]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.15
authorSasha Levin <sashal@kernel.org>
Sun, 22 Oct 2023 23:09:41 +0000 (19:09 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 22 Oct 2023 23:09:41 +0000 (19:09 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.15/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch [new file with mode: 0644]
queue-5.15/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch [new file with mode: 0644]
queue-5.15/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch [new file with mode: 0644]
queue-5.15/series

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 (file)
index 0000000..e33558f
--- /dev/null
@@ -0,0 +1,111 @@
+From a3dec81cd8c8a91c3ba047bf8c21b839d46ce51e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Sep 2023 09:04:29 +0300
+Subject: phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ 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 <ivo.g.dimitrov.75@gmail.com>
+Cc: Merlijn Wajer <merlijn@wizzup.org>
+Cc: Pavel Machek <pavel@ucw.cz>
+Cc: Sebastian Reichel <sre@kernel.org>
+Fixes: 2ad2af081622 ("phy: mapphone-mdm6600: Improve phy related runtime PM calls")
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Link: https://lore.kernel.org/r/20230913060433.48373-3-tony@atomide.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 (file)
index 0000000..5e59a39
--- /dev/null
@@ -0,0 +1,51 @@
+From fb108e36fbcd4d946d6f5836a2f2f52ac2eff800 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Sep 2023 09:04:27 +0300
+Subject: phy: mapphone-mdm6600: Fix runtime disable on probe
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ 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 <ivo.g.dimitrov.75@gmail.com>
+Cc: Merlijn Wajer <merlijn@wizzup.org>
+Cc: Miaoqian Lin <linmq006@gmail.com>
+Cc: Pavel Machek <pavel@ucw.cz>
+Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Fixes: d644e0d79829 ("phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe")
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Link: https://lore.kernel.org/r/20230913060433.48373-1-tony@atomide.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 (file)
index 0000000..122a824
--- /dev/null
@@ -0,0 +1,40 @@
+From 87fae972e0e136c2e6ee49f4eb7be9077467b993 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Sep 2023 09:04:28 +0300
+Subject: phy: mapphone-mdm6600: Fix runtime PM for remove
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ Upstream commit b99e0ba9633af51638e5ee1668da2e33620c134f ]
+
+Otherwise we will get an underflow on remove.
+
+Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
+Cc: Merlijn Wajer <merlijn@wizzup.org>
+Cc: Pavel Machek <pavel@ucw.cz>
+Cc: Sebastian Reichel <sre@kernel.org>
+Fixes: f7f50b2a7b05 ("phy: mapphone-mdm6600: Add runtime PM support for n_gsm on USB suspend")
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Link: https://lore.kernel.org/r/20230913060433.48373-2-tony@atomide.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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
+
index 2bbe597552e8f6ed2bb5fb399652071a6d27ad87..932864540f00cb967d3f52d358537f0d5bdd24b1 100644 (file)
@@ -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