From nobody Mon Sep 15 09:27:27 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1727EC54EBD for ; Fri, 13 Jan 2023 00:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240365AbjAMAye (ORCPT ); Thu, 12 Jan 2023 19:54:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbjAMAyK (ORCPT ); Thu, 12 Jan 2023 19:54:10 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1390D120A8 for ; Thu, 12 Jan 2023 16:54:10 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id p24so21882571plw.11 for ; Thu, 12 Jan 2023 16:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PobSF2/MDkJrX0shmq4Y9cOMyGXHMWsuX8BGemf4VBw=; b=Osh1B7zp7tQhU+9MxWPY/yAEEmUj1gtkg7jmpWJk9NgmbGtaRDmTSetrchIDDB96H+ p/qRxiUkZPIgdLp122//Q4wMQJBff8z5Wllf5G5VRmLI1m4fSX5EcrMKZqaReT11PdfM P6fr4Mh9AH5OB+SOA9myUKG6PNEbejlcVIpio= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PobSF2/MDkJrX0shmq4Y9cOMyGXHMWsuX8BGemf4VBw=; b=X8xUhYwdAuxn8UKguKWb7NxDIeXj+CbSa9A7P8fC0h5ro7HWpyp7yXR453gA+d+PWZ dgEGjVNqiBnS7pJyNaeP9arOhKbBVZ9rUAr3QEroIAy2Z8EtszUGDI9VUqkw0e/8kqLu jnZP4HI59mv8gl4OJcsI7Qsblv9Qv201VnExgVEPAv8Dhzig4TWNFhOuGq0Mdv0mTjFs mea4hcXqX2aL9tTwwPNdewhJZZEBOxcP3ovq6Ao8dkrpfjEYznNnn4CECwQ9i5nXzuuN KHf420QP/QJETFVgdPuaToS1y6iZw1becFQYgMo+5S4XJ5q/d1j+leTtzytEcGOuJR0E vDfQ== X-Gm-Message-State: AFqh2kr05k/q6M67xNp7eUVU0P2c4+I6Q8aKr5hHZEMdafpI11MMVjy0 nvvsU3eieDJcJAVRMPwJXAUr2Q== X-Google-Smtp-Source: AMrXdXsvI3zs4GuDkNa8TpijaRhFnlRVYdPGEVTOzyqt4I2mkh0WJTBPXLb075HpeSi0t5xXkCE3Ug== X-Received: by 2002:a05:6a20:9588:b0:b2:549c:b0eb with SMTP id iu8-20020a056a20958800b000b2549cb0ebmr99249330pzb.36.1673571249545; Thu, 12 Jan 2023 16:54:09 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:11a:201:4652:3752:b9b7:29f9]) by smtp.gmail.com with ESMTPSA id u11-20020a6540cb000000b0046ff3634a78sm10676614pgp.71.2023.01.12.16.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 16:54:08 -0800 (PST) From: Stephen Boyd To: stable@vger.kernel.org Cc: Johan Hovold , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Dmitry Baryshkov , Vinod Koul Subject: [PATCH 5.15.y 1/4] phy: qcom-qmp-combo: disable runtime PM on unbind Date: Thu, 12 Jan 2023 16:54:02 -0800 Message-Id: <20230113005405.3992011-2-swboyd@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230113005405.3992011-1-swboyd@chromium.org> References: <20230113005405.3992011-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 4382d518d1887e62234560ea08a0203d11d28cc1 upstream. Make sure to disable runtime PM also on driver unbind. Fixes: ac0d239936bd ("phy: qcom-qmp: Add support for runtime PM"). Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20220907110728.19092-2-johan+linaro@kernel.= org Signed-off-by: Vinod Koul Signed-off-by: Stephen Boyd --- drivers/phy/qualcomm/phy-qcom-qmp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy= -qcom-qmp.c index a9687e040960..7b7557c35af6 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -5740,7 +5740,9 @@ static int qcom_qmp_phy_probe(struct platform_device = *pdev) return -ENOMEM; =20 pm_runtime_set_active(dev); - pm_runtime_enable(dev); + ret =3D devm_pm_runtime_enable(dev); + if (ret) + return ret; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. @@ -5790,13 +5792,10 @@ static int qcom_qmp_phy_probe(struct platform_devic= e *pdev) phy_provider =3D devm_of_phy_provider_register(dev, of_phy_simple_xlate); if (!IS_ERR(phy_provider)) dev_info(dev, "Registered Qcom-QMP phy\n"); - else - pm_runtime_disable(dev); =20 return PTR_ERR_OR_ZERO(phy_provider); =20 err_node_put: - pm_runtime_disable(dev); of_node_put(child); return ret; } --=20 https://chromeos.dev From nobody Mon Sep 15 09:27:27 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3BCAC54EBE for ; Fri, 13 Jan 2023 00:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240167AbjAMAyk (ORCPT ); Thu, 12 Jan 2023 19:54:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239204AbjAMAyM (ORCPT ); Thu, 12 Jan 2023 19:54:12 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DBE613D25 for ; Thu, 12 Jan 2023 16:54:11 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id jl4so21898725plb.8 for ; Thu, 12 Jan 2023 16:54:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3EKfzPUpjx2o77cFgSD1szOPFx9p7F1YloFu6dux5jE=; b=E1FYs3giqJVQqe4m9EiI/42Aeraq7nSFJAh76CzhEmZ8N3OiAbqSjVPL+sEjUMnKj7 kfRLIW03elctYlzBsoKaFi5rtWxbg/aGGqPhU0L0BX3xAi4wkRbe+NWyKw8aBSfOIOwm +zboYH6FFwuvhu5msLAZcc8u82gIq4GamG8/0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3EKfzPUpjx2o77cFgSD1szOPFx9p7F1YloFu6dux5jE=; b=pG8cGIzOQ74IrLgNT6M0r1swHy8WFInyfHfaw7DbS5qR00ehtVs57C9QrgNx/KkEhQ UttzIfmdSTF5S1EmpyFbkObewxSgqVgJdYFI66mQ5vD42v5ZEz0VLmLA2HFT3Qgdfjo3 LdXHWcGrTbxTUbAVmPDKluFZAdcMQ3xygp734QdgneIGJfloGBjRO5moaQhiE+DTU6Ik DLGia7BdRYAcIv4UW0McitQ7h7cXSNd9l53Yt4qTNXOxGg7SHo1GanXAgT3AvVa1pdt3 zjsi8ZR+mAiyx8CLwnCJcvZsd72IH6j570ZN/wNPXPsfaLVU66kE90aXE6T7GXAM2umN Fhvg== X-Gm-Message-State: AFqh2koF4wyztu+pWNO0Mz7h5qETSXcKiWnmGvLzDNufnuhPnm/fbfcq Tm2//D1IbpcsTC/fWSVlnOSeWkERlhFUr+Kd X-Google-Smtp-Source: AMrXdXtvOcYZ8tDiCxG/3HKLbMslNeVV3YlgqxwU0xsD4pLMminvtrZ0hxxgiuj52Rwr7c538iaqjQ== X-Received: by 2002:a05:6a20:6724:b0:b6:55e:caa0 with SMTP id q36-20020a056a20672400b000b6055ecaa0mr9167697pzh.17.1673571250950; Thu, 12 Jan 2023 16:54:10 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:11a:201:4652:3752:b9b7:29f9]) by smtp.gmail.com with ESMTPSA id u11-20020a6540cb000000b0046ff3634a78sm10676614pgp.71.2023.01.12.16.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 16:54:10 -0800 (PST) From: Stephen Boyd To: stable@vger.kernel.org Cc: Johan Hovold , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Vinod Koul Subject: [PATCH 5.15.y 2/4] phy: qcom-qmp-combo: fix memleak on probe deferral Date: Thu, 12 Jan 2023 16:54:03 -0800 Message-Id: <20230113005405.3992011-3-swboyd@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230113005405.3992011-1-swboyd@chromium.org> References: <20230113005405.3992011-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 2de8a325b1084330ae500380cc27edc39f488c30 upstream. Switch to using the device-managed of_iomap helper to avoid leaking memory on probe deferral and driver unbind. Note that this helper checks for already reserved regions and may fail if there are multiple devices claiming the same memory. Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220916102340.11520-5-johan+linaro@kernel.= org Signed-off-by: Vinod Koul Signed-off-by: Stephen Boyd --- drivers/phy/qualcomm/phy-qcom-qmp.c | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy= -qcom-qmp.c index 7b7557c35af6..c6f860ce3d99 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -5410,17 +5410,17 @@ int qcom_qmp_phy_create(struct device *dev, struct = device_node *np, int id, * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. */ - qphy->tx =3D of_iomap(np, 0); - if (!qphy->tx) - return -ENOMEM; + qphy->tx =3D devm_of_iomap(dev, np, 0, NULL); + if (IS_ERR(qphy->tx)) + return PTR_ERR(qphy->tx); =20 - qphy->rx =3D of_iomap(np, 1); - if (!qphy->rx) - return -ENOMEM; + qphy->rx =3D devm_of_iomap(dev, np, 1, NULL); + if (IS_ERR(qphy->rx)) + return PTR_ERR(qphy->rx); =20 - qphy->pcs =3D of_iomap(np, 2); - if (!qphy->pcs) - return -ENOMEM; + qphy->pcs =3D devm_of_iomap(dev, np, 2, NULL); + if (IS_ERR(qphy->pcs)) + return PTR_ERR(qphy->pcs); =20 /* * If this is a dual-lane PHY, then there should be registers for the @@ -5429,9 +5429,9 @@ int qcom_qmp_phy_create(struct device *dev, struct de= vice_node *np, int id, * offset from the first lane. */ if (cfg->is_dual_lane_phy) { - qphy->tx2 =3D of_iomap(np, 3); - qphy->rx2 =3D of_iomap(np, 4); - if (!qphy->tx2 || !qphy->rx2) { + qphy->tx2 =3D devm_of_iomap(dev, np, 3, NULL); + qphy->rx2 =3D devm_of_iomap(dev, np, 4, NULL); + if (IS_ERR(qphy->tx2) || IS_ERR(qphy->rx2)) { dev_warn(dev, "Underspecified device tree, falling back to legacy register regions\= n"); =20 @@ -5441,15 +5441,17 @@ int qcom_qmp_phy_create(struct device *dev, struct = device_node *np, int id, qphy->rx2 =3D qphy->rx + QMP_PHY_LEGACY_LANE_STRIDE; =20 } else { - qphy->pcs_misc =3D of_iomap(np, 5); + qphy->pcs_misc =3D devm_of_iomap(dev, np, 5, NULL); } =20 } else { - qphy->pcs_misc =3D of_iomap(np, 3); + qphy->pcs_misc =3D devm_of_iomap(dev, np, 3, NULL); } =20 - if (!qphy->pcs_misc) + if (IS_ERR(qphy->pcs_misc)) { dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); + qphy->pcs_misc =3D NULL; + } =20 /* * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3 --=20 https://chromeos.dev From nobody Mon Sep 15 09:27:27 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD9B0C54EBD for ; Fri, 13 Jan 2023 00:54:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbjAMAyo (ORCPT ); Thu, 12 Jan 2023 19:54:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232713AbjAMAyN (ORCPT ); Thu, 12 Jan 2023 19:54:13 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7FE713DCA for ; Thu, 12 Jan 2023 16:54:12 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id s13-20020a17090a6e4d00b0022900843652so3862234pjm.1 for ; Thu, 12 Jan 2023 16:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mYLtqXctG0w1LDFrtR6bI6BtOkIAb//0EdxGpdC0Co8=; b=W8yTfno6MmIJHmnAjTFoN9Fq6mR6U4UbfNzG0fYw4g8/AfMBbpxuOPPe6tULefgZtL BIuXTKSFvb4r6hQ5qH3XVuQyMfXLZ4I4LqZCLCyT8tXePbX8IVSPEjX8lgnnAOYnuJ9A muFX8SBY9q4Q9MzxBg41WOtgwhODwuzLRpJYo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mYLtqXctG0w1LDFrtR6bI6BtOkIAb//0EdxGpdC0Co8=; b=kmt1NssD/RTwuKT4nhjbQUWpHjZBj0eISPMv9YBmL6xfoZWsPf/fPd69CVyRvyYd4y +07COHgsG00aVkND1QSa9Db7BCUTPkXGV5yI3pgpMynqXFlv/p618Vb3p3Nc3kuY8fpy 5LyaeEyWDxvfE0GxT3Snrb8h0I9SdDsphtv7lg2oJ8BVUatyGPG9nV/pJq9bDwyGEjO1 yqeqZrHqep8iA7zDkBC+0gDnnAWprYuzzG6+8kff+BjH1l/MnwSXMWwjuBV4Xfur7mAr SbiJQemsufKUdsOx435KpeIz6ud79be3a3yDMAbjhVEWN+VG0BbLrWwzb5DJNNVC2KWA JQ6A== X-Gm-Message-State: AFqh2kr9lCwOgA4re8LpIFFK+d6TEfJIjsDmOQvw9jiNe6RvCFDLmOCy auF5wzwz37UU61DmAB5ZyVDfDQ== X-Google-Smtp-Source: AMrXdXusxrqyCQz9+WG1sdtE6YE5LRkp8kO3M+C8igKjPuLrVn0x7V/jWbyAkpfXAfWLSevWkB3hOA== X-Received: by 2002:a05:6a20:8362:b0:ac:7a44:db55 with SMTP id z34-20020a056a20836200b000ac7a44db55mr77255609pzc.39.1673571252275; Thu, 12 Jan 2023 16:54:12 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:11a:201:4652:3752:b9b7:29f9]) by smtp.gmail.com with ESMTPSA id u11-20020a6540cb000000b0046ff3634a78sm10676614pgp.71.2023.01.12.16.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 16:54:11 -0800 (PST) From: Stephen Boyd To: stable@vger.kernel.org Cc: Johan Hovold , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Dmitry Baryshkov , Vinod Koul Subject: [PATCH 5.15.y 3/4] phy: qcom-qmp-combo: fix broken power on Date: Thu, 12 Jan 2023 16:54:04 -0800 Message-Id: <20230113005405.3992011-4-swboyd@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230113005405.3992011-1-swboyd@chromium.org> References: <20230113005405.3992011-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 7a7d86d14d073dfa3429c550667a8e78b99edbd4 upstream. The PHY is powered on during phy-init by setting the SW_PWRDN bit in the COM_POWER_DOWN_CTRL register and then setting the same bit in the in the PCS_POWER_DOWN_CONTROL register that belongs to the USB part of the PHY. Currently, whether power on succeeds depends on probe order and having the USB part of the PHY be initialised first. In case the DP part of the PHY is instead initialised first, the intended power on of the USB block results in a corrupted DP_PHY register (e.g. DP_PHY_AUX_CFG8). Add a pointer to the USB part of the PHY to the driver data and use that to power on the PHY also if the DP part of the PHY is initialised first. Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo ph= y") Cc: stable@vger.kernel.org # 5.10 Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20221114081346.5116-5-johan+linaro@kernel.o= rg Signed-off-by: Vinod Koul [swboyd@chromium.org: Backport to pre-split driver] Signed-off-by: Stephen Boyd --- drivers/phy/qualcomm/phy-qcom-qmp.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy= -qcom-qmp.c index c6f860ce3d99..9fda6d283f20 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -2919,6 +2919,7 @@ struct qcom_qmp { struct regulator_bulk_data *vregs; =20 struct qmp_phy **phys; + struct qmp_phy *usb_phy; =20 struct mutex phy_mutex; int init_count; @@ -4554,7 +4555,7 @@ static int qcom_qmp_phy_com_init(struct qmp_phy *qphy) struct qcom_qmp *qmp =3D qphy->qmp; const struct qmp_phy_cfg *cfg =3D qphy->cfg; void __iomem *serdes =3D qphy->serdes; - void __iomem *pcs =3D qphy->pcs; + struct qmp_phy *usb_phy =3D qmp->usb_phy; void __iomem *dp_com =3D qmp->dp_com; int ret, i; =20 @@ -4620,13 +4621,13 @@ static int qcom_qmp_phy_com_init(struct qmp_phy *qp= hy) qphy_setbits(serdes, cfg->regs[QPHY_COM_POWER_DOWN_CONTROL], SW_PWRDN); } else { - if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) - qphy_setbits(pcs, - cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], - cfg->pwrdn_ctrl); + if (usb_phy->cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) + qphy_setbits(usb_phy->pcs, + usb_phy->cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], + usb_phy->cfg->pwrdn_ctrl); else - qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL, - cfg->pwrdn_ctrl); + qphy_setbits(usb_phy->pcs, QPHY_POWER_DOWN_CONTROL, + usb_phy->cfg->pwrdn_ctrl); } =20 mutex_unlock(&qmp->phy_mutex); @@ -5769,6 +5770,9 @@ static int qcom_qmp_phy_probe(struct platform_device = *pdev) goto err_node_put; } =20 + if (cfg->type =3D=3D PHY_TYPE_USB3) + qmp->usb_phy =3D qmp->phys[id]; + /* * Register the pipe clock provided by phy. * See function description to see details of this pipe clock. @@ -5791,6 +5795,9 @@ static int qcom_qmp_phy_probe(struct platform_device = *pdev) id++; } =20 + if (!qmp->usb_phy) + return -EINVAL; + phy_provider =3D devm_of_phy_provider_register(dev, of_phy_simple_xlate); if (!IS_ERR(phy_provider)) dev_info(dev, "Registered Qcom-QMP phy\n"); --=20 https://chromeos.dev From nobody Mon Sep 15 09:27:27 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DAACC54EBE for ; Fri, 13 Jan 2023 00:54:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240441AbjAMAyr (ORCPT ); Thu, 12 Jan 2023 19:54:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239596AbjAMAyP (ORCPT ); Thu, 12 Jan 2023 19:54:15 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A483E2A for ; Thu, 12 Jan 2023 16:54:14 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id m7-20020a17090a730700b00225ebb9cd01so25385188pjk.3 for ; Thu, 12 Jan 2023 16:54:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6wTahgPOn0LySuA1i9bASDFyi3Ueigx8xRo8Xbilw4I=; b=U+sQqif0/Muwdc6NYnuRVJ/j6zAussnLylJFzP3+XGWl1klHVC4kb2atu717aEslzA NqVodkM/ROdq5D0SYpKOyR74tTv0KKYlk+jtzkRmuOtN353d1p2bmajYiizRUFMhI13H JeyHme9Xr/xYbipOCXs3Fmvj0rBMaCC5vHuhA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6wTahgPOn0LySuA1i9bASDFyi3Ueigx8xRo8Xbilw4I=; b=4Cieok60aHkChPA9gn4w+lBxISblwUxswCcJS43WD6LyEhQFVHO/scNXDEp57evTPt ta1lMYCrwiEX6hiavKJSYh3MD0ATUpFH0tkW4PhyjxcmCJ+wRDQXLYyxL+F8G1dqejuu G7ZqcHOAmxl98RCSSCCSNRatH6oMlt9dOFa9CsGoF0K1Pk9naMS1ZRcvaEh2buunRGzu z+q+HARbXbde9I3/XeN0o5mfEn/Q5lkM8J1eFVYYUR/f5Eoc2U+8I4YQ1xT5AIW2VvQW HveNjNoXEV1e9frbDjpLaEHThrxSaH7UNakIBv/kFD/I7bZ51vr5GErjmEEL6AY3Tc2T N26w== X-Gm-Message-State: AFqh2kq8Y6KOzwM3bRMPrzykP7nC3NQWnhdksYHIPZBkfyMt/kJRj9uw s9Dyv6RYlzErqzN8eplEw548fw== X-Google-Smtp-Source: AMrXdXuFP3bnEy2rZYHKu3/UtPStVpANsmmC7JzX1z4v5Zlv4YYFYFbBwTG8gZF1b7urQ8yQc5GpUw== X-Received: by 2002:a05:6a20:548e:b0:9d:efd3:66ca with SMTP id i14-20020a056a20548e00b0009defd366camr110139183pzk.17.1673571253651; Thu, 12 Jan 2023 16:54:13 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:11a:201:4652:3752:b9b7:29f9]) by smtp.gmail.com with ESMTPSA id u11-20020a6540cb000000b0046ff3634a78sm10676614pgp.71.2023.01.12.16.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 16:54:13 -0800 (PST) From: Stephen Boyd To: stable@vger.kernel.org Cc: Johan Hovold , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Dmitry Baryshkov , Vinod Koul Subject: [PATCH 5.15.y 4/4] phy: qcom-qmp-combo: fix runtime suspend Date: Thu, 12 Jan 2023 16:54:05 -0800 Message-Id: <20230113005405.3992011-5-swboyd@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230113005405.3992011-1-swboyd@chromium.org> References: <20230113005405.3992011-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit c7b98de745cffdceefc077ad5cf9cda032ef8959 upstream. Drop the confused runtime-suspend type check which effectively broke runtime PM if the DP child node happens to be parsed before the USB child node during probe (e.g. due to order of child nodes in the devicetree). Instead use the new driver data USB PHY pointer to access the USB configuration and resources. Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo ph= y") Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20221114081346.5116-6-johan+linaro@kernel.o= rg Signed-off-by: Vinod Koul [swboyd@chromium.org: Backport to pre-split driver] Signed-off-by: Stephen Boyd --- drivers/phy/qualcomm/phy-qcom-qmp.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy= -qcom-qmp.c index 9fda6d283f20..d928afe2ebba 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -4985,15 +4985,11 @@ static void qcom_qmp_phy_disable_autonomous_mode(st= ruct qmp_phy *qphy) static int __maybe_unused qcom_qmp_phy_runtime_suspend(struct device *dev) { struct qcom_qmp *qmp =3D dev_get_drvdata(dev); - struct qmp_phy *qphy =3D qmp->phys[0]; + struct qmp_phy *qphy =3D qmp->usb_phy; const struct qmp_phy_cfg *cfg =3D qphy->cfg; =20 dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qphy->mode); =20 - /* Supported only for USB3 PHY and luckily USB3 is the first phy */ - if (cfg->type !=3D PHY_TYPE_USB3) - return 0; - if (!qmp->init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; @@ -5010,16 +5006,12 @@ static int __maybe_unused qcom_qmp_phy_runtime_susp= end(struct device *dev) static int __maybe_unused qcom_qmp_phy_runtime_resume(struct device *dev) { struct qcom_qmp *qmp =3D dev_get_drvdata(dev); - struct qmp_phy *qphy =3D qmp->phys[0]; + struct qmp_phy *qphy =3D qmp->usb_phy; const struct qmp_phy_cfg *cfg =3D qphy->cfg; int ret =3D 0; =20 dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qphy->mode); =20 - /* Supported only for USB3 PHY and luckily USB3 is the first phy */ - if (cfg->type !=3D PHY_TYPE_USB3) - return 0; - if (!qmp->init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; --=20 https://chromeos.dev