From patchwork Mon Sep 11 03:54:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 13378709 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75210EE801F for ; Mon, 11 Sep 2023 03:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9Ak1m5a1B0Fg/I2E1kpLw5VqbBfYO38mQ5f9JBMDVfU=; b=4Uah9GTViBKxfH ngsWA/RyR0rWHOu/pYgkOPcDNUghYyWP4dPGbb390Uirebu2Of+nakdJRpt3LXBQOWQBqVBr6Cj7F u+Fpc6CNTEBPGtTw2sSOpuIGibmyZivF0hX5lAMWcJ7PksNwyMedHBsvV5MxiXBh1Qafe6ySdkO6m oxqH6BmcVBG17g6GlaotFars6T03N50n48MjEUIPvJV1AobaXdqLPW0P99MZhTcazYEWoZDzy6IQT po0TZg1Lu7K35BREwtfnjqR9KDLxhi+wQuS4/h+pkd9vyoFaAx9eKRZ6u7eyzjAlHAxbX7Vh05qs8 SEl1SgNCFTUNr6+dWlng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfY1A-00HBpS-04; Mon, 11 Sep 2023 03:55:20 +0000 Received: from muru.com ([72.249.23.125]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfY17-00HBp4-1T for linux-phy@lists.infradead.org; Mon, 11 Sep 2023 03:55:18 +0000 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id CF74F8027; Mon, 11 Sep 2023 03:55:12 +0000 (UTC) From: Tony Lindgren To: Vinod Koul , Kishon Vijay Abraham I , Miaoqian Lin Cc: Ivaylo Dimitrov , Merlijn Wajer , Pavel Machek , Sebastian Reichel , linux-phy@lists.infradead.org Subject: [PATCH 1/3] phy: mapphone-mdm6600: Fix runtime disable on probe Date: Mon, 11 Sep 2023 06:54:55 +0300 Message-ID: <20230911035501.36706-1-tony@atomide.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230910_205517_560346_EB9E7EAE X-CRM114-Status: UNSURE ( 9.90 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Commit d644e0d79829 ("phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe") caused a regression where we now unconditionally disable runtime PM at the end of the probe while it is only needed on errors. Cc: Ivaylo Dimitrov Cc: Merlijn Wajer Cc: Miaoqian Lin Cc: Pavel Machek Cc: Sebastian Reichel Fixes: d644e0d79829 ("phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe") Signed-off-by: Tony Lindgren Reviewed-by: Sebastian Reichel --- drivers/phy/motorola/phy-mapphone-mdm6600.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c --- a/drivers/phy/motorola/phy-mapphone-mdm6600.c +++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c @@ -627,10 +627,12 @@ static int phy_mdm6600_probe(struct platform_device *pdev) pm_runtime_put_autosuspend(ddata->dev); cleanup: - if (error < 0) + if (error < 0) { phy_mdm6600_device_power_off(ddata); - pm_runtime_disable(ddata->dev); - pm_runtime_dont_use_autosuspend(ddata->dev); + pm_runtime_disable(ddata->dev); + pm_runtime_dont_use_autosuspend(ddata->dev); + } + return error; } From patchwork Mon Sep 11 03:54:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 13378710 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5558EE801F for ; Mon, 11 Sep 2023 03:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SIxo9ArBwqKF+MWK7zd5Z77LLnpGQvUoPgRI5vwb8LI=; b=QGa4OqVjtPspNb QTvGP5iOKJ2AEHQ4mxhFDarud8XymHjFAVZphGDb4U913tYxXP9QGerJsFJgZWbxg/rcm+zL7k7hs 2E87E01UDhJMTYLDH6bFAGwS4kQ+cQi+PDcIhytvvefVozan0s1CIAdhrgkbUDIeuizg1k3ur7sNM 9rsWiHJ7hzzsdmTWlfZlh47NbJgvQ72lVTTt85azSFDUUAGrq1RrXtPVfeN2U0URkPFx65enUuQSI H4Se4/3dWH/yQEWtjoAJ+wX0GZ+rFMBa5t8HUU2iflQqVA1buRA5h+Nmspog5n5BgwJ02D6JWRQoL 5eN3kaq5Y4BBaRttdRAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfY1D-00HBpw-1F; Mon, 11 Sep 2023 03:55:23 +0000 Received: from muru.com ([72.249.23.125]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfY1A-00HBpY-1W for linux-phy@lists.infradead.org; Mon, 11 Sep 2023 03:55:21 +0000 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 8C00E80CC; Mon, 11 Sep 2023 03:55:18 +0000 (UTC) From: Tony Lindgren To: Vinod Koul , Kishon Vijay Abraham I Cc: Ivaylo Dimitrov , Merlijn Wajer , Miaoqian Lin , Pavel Machek , Sebastian Reichel , linux-phy@lists.infradead.org, Kishon Vijay Abraham I Subject: [PATCH 2/3] phy: mapphone-mdm6600: Fix runtime PM for remove Date: Mon, 11 Sep 2023 06:54:56 +0300 Message-ID: <20230911035501.36706-2-tony@atomide.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230911035501.36706-1-tony@atomide.com> References: <20230911035501.36706-1-tony@atomide.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230910_205520_549970_3666D9A8 X-CRM114-Status: UNSURE ( 8.70 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Otherwise we will get an underflow on remove. Cc: Ivaylo Dimitrov Cc: Merlijn Wajer Cc: Pavel Machek Cc: Sebastian Reichel Fixes: f7f50b2a7b05 ("phy: mapphone-mdm6600: Add runtime PM support for n_gsm on USB suspend") Signed-off-by: Tony Lindgren --- drivers/phy/motorola/phy-mapphone-mdm6600.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c --- a/drivers/phy/motorola/phy-mapphone-mdm6600.c +++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c @@ -640,6 +640,11 @@ static void phy_mdm6600_remove(struct platform_device *pdev) { struct phy_mdm6600 *ddata = platform_get_drvdata(pdev); struct gpio_desc *reset_gpio = ddata->ctrl_gpios[PHY_MDM6600_RESET]; + int error; + + error = pm_runtime_resume_and_get(ddata->dev); + if (error) + return; pm_runtime_dont_use_autosuspend(ddata->dev); pm_runtime_put_sync(ddata->dev); From patchwork Mon Sep 11 03:54:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 13378711 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1BB5EC71153 for ; Mon, 11 Sep 2023 03:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ObSXpvUmk35AXem6iWYbUOsuglwiARQwBRIeSValwT0=; b=UQmSYTQoH+fGCA aHPPjb4U0O2WwhgrL5hRDismjavKeXtcr+blQ8BNo6g7X72+8OsAY9rE5t0Liwxvrl5X5v5I6QKdP osmWEGjacJ8r63liT0fXJ5MAsbmC3kbzHAJWFNjGvMTt8xdib84QoP41I1kTbYoApZV+QH3g9Lddj gBCQqHNInRb4uygULLU/hPlOsV+ADXGvOOOPdQFF9y/9B0f3QzrYHZoJ4pCT5xS7vtN7V5yyc3pOX 3YgPTbVkrL8HRCLUBDNF7izus/tE/lXZje6gEm6B3nZEojUcHKa387OzfSqHqCqz3WHj/8WpgHqz9 jwnFK7x2IjzEWumBd8UQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfY1J-00HBr9-2g; Mon, 11 Sep 2023 03:55:29 +0000 Received: from muru.com ([72.249.23.125]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfY1H-00HBqk-1r for linux-phy@lists.infradead.org; Mon, 11 Sep 2023 03:55:28 +0000 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 999D48027; Mon, 11 Sep 2023 03:55:25 +0000 (UTC) From: Tony Lindgren To: Vinod Koul , Kishon Vijay Abraham I Cc: Ivaylo Dimitrov , Merlijn Wajer , Miaoqian Lin , Pavel Machek , Sebastian Reichel , linux-phy@lists.infradead.org, Kishon Vijay Abraham I Subject: [PATCH 3/3] phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins Date: Mon, 11 Sep 2023 06:54:57 +0300 Message-ID: <20230911035501.36706-3-tony@atomide.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230911035501.36706-1-tony@atomide.com> References: <20230911035501.36706-1-tony@atomide.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230910_205527_659252_6F34A6F1 X-CRM114-Status: GOOD ( 13.17 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Looks like the driver sleep pins configuration is unusable. Adding the sleep pins causes the usb phy to not respond. We need to use the default pins in probe, and only set sleep pins at phy_mdm6600_device_power_off(). The sleep pins are needed as otherwise the modem hardware can wake up even with the phy driver unloaded as the reset gpio pin can glitch during the deeper SoC idle states. Cc: Ivaylo Dimitrov Cc: Merlijn Wajer Cc: Pavel Machek Cc: Sebastian Reichel Fixes: 2ad2af081622 ("phy: mapphone-mdm6600: Improve phy related runtime PM calls") Signed-off-by: Tony Lindgren Reviewed-by: Sebastian Reichel --- drivers/phy/motorola/phy-mapphone-mdm6600.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c --- a/drivers/phy/motorola/phy-mapphone-mdm6600.c +++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c @@ -456,6 +456,7 @@ static void phy_mdm6600_device_power_off(struct phy_mdm6600 *ddata) { struct gpio_desc *reset_gpio = ddata->ctrl_gpios[PHY_MDM6600_RESET]; + int error; ddata->enabled = false; phy_mdm6600_cmd(ddata, PHY_MDM6600_CMD_BP_SHUTDOWN_REQ); @@ -471,6 +472,11 @@ static void phy_mdm6600_device_power_off(struct phy_mdm6600 *ddata) } else { dev_err(ddata->dev, "Timed out powering down\n"); } + + error = pinctrl_pm_select_sleep_state(ddata->dev); + if (error) + dev_warn(ddata->dev, "%s: error with sleep_state: %i\n", + __func__, error); } static void phy_mdm6600_deferred_power_on(struct work_struct *work) @@ -571,12 +577,6 @@ static int phy_mdm6600_probe(struct platform_device *pdev) ddata->dev = &pdev->dev; platform_set_drvdata(pdev, ddata); - /* Active state selected in phy_mdm6600_power_on() */ - error = pinctrl_pm_select_sleep_state(ddata->dev); - if (error) - dev_warn(ddata->dev, "%s: error with sleep_state: %i\n", - __func__, error); - error = phy_mdm6600_init_lines(ddata); if (error) return error;