From: Sasha Levin Date: Sun, 22 Oct 2023 23:09:41 +0000 (-0400) Subject: Fixes for 5.15 X-Git-Tag: v4.14.328~27 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=62186d0722521c552bc5e5df6a2eb3f44e074789;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.15 Signed-off-by: Sasha Levin --- diff --git a/queue-5.15/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch b/queue-5.15/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch new file mode 100644 index 00000000000..e33558f90cc --- /dev/null +++ b/queue-5.15/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch @@ -0,0 +1,111 @@ +From a3dec81cd8c8a91c3ba047bf8c21b839d46ce51e 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 c3e2ab6a2a717..67802f9e40ba0 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; + } + +@@ -456,6 +445,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 +461,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) +@@ -571,12 +572,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.15/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch b/queue-5.15/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch new file mode 100644 index 00000000000..5e59a397c8a --- /dev/null +++ b/queue-5.15/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch @@ -0,0 +1,51 @@ +From fb108e36fbcd4d946d6f5836a2f2f52ac2eff800 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 3cd4d51c247c3..436b5ab6dc6d5 100644 +--- 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; + } + +-- +2.42.0 + diff --git a/queue-5.15/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch b/queue-5.15/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch new file mode 100644 index 00000000000..122a82402ba --- /dev/null +++ b/queue-5.15/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch @@ -0,0 +1,40 @@ +From 87fae972e0e136c2e6ee49f4eb7be9077467b993 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 436b5ab6dc6d5..c3e2ab6a2a717 100644 +--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c ++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c +@@ -641,6 +641,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.15/series b/queue-5.15/series index 2bbe597552e..932864540f0 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -134,3 +134,6 @@ asoc-pxa-fix-a-memory-leak-in-probe.patch serial-8250-omap-move-uart_write-inside-pm-section.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