From: Sasha Levin Date: Sun, 22 Oct 2023 23:09:43 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v4.14.328~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc8fd9e02367748c00daf801e8459c945a85fe4c;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch b/queue-5.4/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch new file mode 100644 index 00000000000..9e0e8370836 --- /dev/null +++ b/queue-5.4/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch @@ -0,0 +1,111 @@ +From 8bad7a18fb21026b64d28b503a678de4647a4399 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Sep 2023 09:04:29 +0300 +Subject: phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins + +From: Tony Lindgren + +[ Upstream commit 3b384cc74b00b5ac21d18e4c1efc3c1da5300971 ] + +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(). + +As the modem can also be booted to a serial port mode for firmware +flashing, let's make the pin changes limited to probe and remove. For +probe, we get the default pins automatically. We only need to set the +sleep pins in phy_mdm6600_device_power_off() to prevent the modem from +waking up because the gpio line glitches. + +If it turns out that we need a separate state for phy_mdm6600_power_on() +and phy_mdm6600_power_off(), we can use the pinctrl idle state. + +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 +Link: https://lore.kernel.org/r/20230913060433.48373-3-tony@atomide.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/motorola/phy-mapphone-mdm6600.c | 29 +++++++++------------ + 1 file changed, 12 insertions(+), 17 deletions(-) + +diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c +index 50a7f2a1ea16a..a79d6cf202209 100644 +--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c ++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c +@@ -122,16 +122,10 @@ static int phy_mdm6600_power_on(struct phy *x) + { + struct phy_mdm6600 *ddata = phy_get_drvdata(x); + struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE]; +- int error; + + if (!ddata->enabled) + return -ENODEV; + +- error = pinctrl_pm_select_default_state(ddata->dev); +- if (error) +- dev_warn(ddata->dev, "%s: error with default_state: %i\n", +- __func__, error); +- + gpiod_set_value_cansleep(enable_gpio, 1); + + /* Allow aggressive PM for USB, it's only needed for n_gsm port */ +@@ -160,11 +154,6 @@ static int phy_mdm6600_power_off(struct phy *x) + + gpiod_set_value_cansleep(enable_gpio, 0); + +- error = pinctrl_pm_select_sleep_state(ddata->dev); +- if (error) +- dev_warn(ddata->dev, "%s: error with sleep_state: %i\n", +- __func__, error); +- + return 0; + } + +@@ -455,6 +444,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); +@@ -470,6 +460,17 @@ static void phy_mdm6600_device_power_off(struct phy_mdm6600 *ddata) + } else { + dev_err(ddata->dev, "Timed out powering down\n"); + } ++ ++ /* ++ * Keep reset gpio high with padconf internal pull-up resistor to ++ * prevent modem from waking up during deeper SoC idle states. The ++ * gpio bank lines can have glitches if not in the always-on wkup ++ * domain. ++ */ ++ 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) +@@ -570,12 +571,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; +-- +2.42.0 + diff --git a/queue-5.4/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch b/queue-5.4/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch new file mode 100644 index 00000000000..b0f07b290ac --- /dev/null +++ b/queue-5.4/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch @@ -0,0 +1,51 @@ +From c8e167d2a20fc5705e88fbc527f7d09b113c1d7c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Sep 2023 09:04:27 +0300 +Subject: phy: mapphone-mdm6600: Fix runtime disable on probe + +From: Tony Lindgren + +[ Upstream commit 719606154c7033c068a5d4c1dc5f9163b814b3c8 ] + +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 +Reviewed-by: Sebastian Reichel +Fixes: d644e0d79829 ("phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe") +Signed-off-by: Tony Lindgren +Link: https://lore.kernel.org/r/20230913060433.48373-1-tony@atomide.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + 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 +index 39d13f7e4cf33..042927f8ac4f3 100644 +--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c ++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c +@@ -626,10 +626,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; + } + +-- +2.42.0 + diff --git a/queue-5.4/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch b/queue-5.4/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch new file mode 100644 index 00000000000..4ed6630b695 --- /dev/null +++ b/queue-5.4/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch @@ -0,0 +1,40 @@ +From 26614f39c81a0d4e27bd3743b739826f6384c0ba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Sep 2023 09:04:28 +0300 +Subject: phy: mapphone-mdm6600: Fix runtime PM for remove + +From: Tony Lindgren + +[ Upstream commit b99e0ba9633af51638e5ee1668da2e33620c134f ] + +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 +Reviewed-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20230913060433.48373-2-tony@atomide.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/motorola/phy-mapphone-mdm6600.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c +index 042927f8ac4f3..50a7f2a1ea16a 100644 +--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c ++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c +@@ -640,6 +640,7 @@ static int 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]; + ++ pm_runtime_get_noresume(ddata->dev); + pm_runtime_dont_use_autosuspend(ddata->dev); + pm_runtime_put_sync(ddata->dev); + pm_runtime_disable(ddata->dev); +-- +2.42.0 + diff --git a/queue-5.4/series b/queue-5.4/series index 45a81cbc92f..961ec343b6a 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -116,3 +116,6 @@ gpio-vf610-set-value-before-the-direction-to-avoid-a-glitch.patch asoc-pxa-fix-a-memory-leak-in-probe.patch gpio-vf610-make-irq_chip-immutable.patch gpio-vf610-mask-the-gpio-irq-in-system-suspend-and-s.patch +phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch +phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch +phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch