phy: mapphone-mdm6600: Fix runtime disable on probe
PATCH v2 1/3 phy: mapphone-mdm6600: Fix runtime disable on probe
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.
---
Changes since v1:
- Added Sebastian's Reviewed-by
--- drivers/phy/motorola/phy-mapphone-mdm6600.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/phy/motorola/phy-mapphone-mdm6600.c +5 -3
@@ -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; }
Signature · 6 lines
2.42.0 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 2/3 phy: mapphone-mdm6600: Fix runtime PM for remove
Otherwise we will get an underflow on remove.
---
Changes since v1:
- Using pm_runtime_get_noresume() is enough on remove as suggested by Sebastian
--- drivers/phy/motorola/phy-mapphone-mdm6600.c | 1 + 1 file changed, 1 insertion(+)
drivers/phy/motorola/phy-mapphone-mdm6600.c +1 -0
@@ -641,6 +641,7 @@ 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 ]; +pm_runtime_get_noresume (ddata->dev);pm_runtime_dont_use_autosuspend (ddata->dev);pm_runtime_put_sync (ddata->dev);pm_runtime_disable (ddata->dev);
Signature · 6 lines
2.42.0 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v2 2/3] phy: mapphone-mdm6600: Fix runtime PM for remove
Hi,
Quoted 9 lines · Tony Lindgren
Otherwise we will get an underflow on remove.
Cc Ivaylo Dimitrov <[email protected]>Cc Merlijn Wajer <[email protected]>Cc Pavel Machek <[email protected]>Cc Sebastian Reichel <[email protected]>Fixes f7f50b2a7b05 ("phy: mapphone-mdm6600: Add runtime PM support for n_gsm on USB suspend")Signed-off-by Tony Lindgren <[email protected]>---
-- Sebastian
Quoted 23 lines
Changes since v1:
- Using
pm_runtime_get_noresume()is enough on remove as suggested by Sebastian--- drivers/phy/motorola/phy-mapphone-mdm6600.c | 1 + 1 file changed, 1 insertion(+)drivers/phy/motorola/phy-mapphone-mdm6600.c +1
-0@@ -641,6 +641,7 @@ 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 ]; +pm_runtime_get_noresume (ddata->dev);pm_runtime_dont_use_autosuspend (ddata->dev);pm_runtime_put_sync (ddata->dev);pm_runtime_disable (ddata->dev);Signature · 1 line
2.42.0
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v2 3/3 phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
In reply to Tony LindgrenLooks 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.
---
Changes since v1:
- Limit the pinctrl state changes to remove for now based on what Sebastian was wondering about
--- drivers/phy/motorola/phy-mapphone-mdm6600.c | 29 +++++++++------------ 1 file changed, 12 insertions(+), 17 deletions(-)
drivers/phy/motorola/phy-mapphone-mdm6600.c +12 -17
@@ -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;
Signature · 6 lines
2.42.0 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v2 3/3] phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
Hi,
Quoted 19 lines · Tony Lindgren
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()andphy_mdm6600_power_off(), we can use the pinctrl idle state.Cc Ivaylo Dimitrov <[email protected]>Cc Merlijn Wajer <[email protected]>Cc Pavel Machek <[email protected]>Cc Sebastian Reichel <[email protected]>Fixes 2ad2af081622 ("phy: mapphone-mdm6600: Improve phy related runtime PM calls")Signed-off-by Tony Lindgren <[email protected]>
Quoted 8 lines
---
Changes since v1:
- Limit the pinctrl state changes to remove for now based on what Sebastian was wondering about
---
LGTM.
-- Sebastian
Quoted 76 lines
drivers/phy/motorola/phy-mapphone-mdm6600.c | 29 +++++++++------------ 1 file changed, 12 insertions(+), 17 deletions(-)drivers/phy/motorola/phy-mapphone-mdm6600.c +12
-17@@ -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;Signature · 1 line
2.42.0
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy