Skip to content

Commit 3b384cc

Browse files
tmlindvinodkoul
authored andcommitted
phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
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 <[email protected]> Cc: Merlijn Wajer <[email protected]> Cc: Pavel Machek <[email protected]> Cc: Sebastian Reichel <[email protected]> Fixes: 2ad2af0 ("phy: mapphone-mdm6600: Improve phy related runtime PM calls") Signed-off-by: Tony Lindgren <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent b99e0ba commit 3b384cc

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

drivers/phy/motorola/phy-mapphone-mdm6600.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,10 @@ static int phy_mdm6600_power_on(struct phy *x)
122122
{
123123
struct phy_mdm6600 *ddata = phy_get_drvdata(x);
124124
struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE];
125-
int error;
126125

127126
if (!ddata->enabled)
128127
return -ENODEV;
129128

130-
error = pinctrl_pm_select_default_state(ddata->dev);
131-
if (error)
132-
dev_warn(ddata->dev, "%s: error with default_state: %i\n",
133-
__func__, error);
134-
135129
gpiod_set_value_cansleep(enable_gpio, 1);
136130

137131
/* 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)
160154

161155
gpiod_set_value_cansleep(enable_gpio, 0);
162156

163-
error = pinctrl_pm_select_sleep_state(ddata->dev);
164-
if (error)
165-
dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
166-
__func__, error);
167-
168157
return 0;
169158
}
170159

@@ -456,6 +445,7 @@ static void phy_mdm6600_device_power_off(struct phy_mdm6600 *ddata)
456445
{
457446
struct gpio_desc *reset_gpio =
458447
ddata->ctrl_gpios[PHY_MDM6600_RESET];
448+
int error;
459449

460450
ddata->enabled = false;
461451
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)
471461
} else {
472462
dev_err(ddata->dev, "Timed out powering down\n");
473463
}
464+
465+
/*
466+
* Keep reset gpio high with padconf internal pull-up resistor to
467+
* prevent modem from waking up during deeper SoC idle states. The
468+
* gpio bank lines can have glitches if not in the always-on wkup
469+
* domain.
470+
*/
471+
error = pinctrl_pm_select_sleep_state(ddata->dev);
472+
if (error)
473+
dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
474+
__func__, error);
474475
}
475476

476477
static void phy_mdm6600_deferred_power_on(struct work_struct *work)
@@ -571,12 +572,6 @@ static int phy_mdm6600_probe(struct platform_device *pdev)
571572
ddata->dev = &pdev->dev;
572573
platform_set_drvdata(pdev, ddata);
573574

574-
/* Active state selected in phy_mdm6600_power_on() */
575-
error = pinctrl_pm_select_sleep_state(ddata->dev);
576-
if (error)
577-
dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
578-
__func__, error);
579-
580575
error = phy_mdm6600_init_lines(ddata);
581576
if (error)
582577
return error;

0 commit comments

Comments
 (0)