diff options
| author | Tony Lindgren <tony@atomide.com> | 2014-08-27 19:28:10 -0400 |
|---|---|---|
| committer | Kishon Vijay Abraham I <kishon@ti.com> | 2014-09-24 05:48:33 -0400 |
| commit | 48f48e172c45e66e5323813fccc7dfd34e404bbe (patch) | |
| tree | 8b6800b4d9c8fa0ed3fde2b494651966cd0cd96d /drivers/phy | |
| parent | bad8e33582cb3ea5f3a7a3517ca48e0a03be11a3 (diff) | |
usb: phy: twl4030-usb: Remove asleep and rely on runtime PM
There's no longer need for tracking the phy state in the driver
with asleep, we can now rely on runtime PM.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
| -rw-r--r-- | drivers/phy/phy-twl4030-usb.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index 519cc909b25a..24ff3c6f1499 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c | |||
| @@ -163,7 +163,6 @@ struct twl4030_usb { | |||
| 163 | int irq; | 163 | int irq; |
| 164 | enum omap_musb_vbus_id_status linkstat; | 164 | enum omap_musb_vbus_id_status linkstat; |
| 165 | bool vbus_supplied; | 165 | bool vbus_supplied; |
| 166 | u8 asleep; | ||
| 167 | 166 | ||
| 168 | struct delayed_work id_workaround_work; | 167 | struct delayed_work id_workaround_work; |
| 169 | }; | 168 | }; |
| @@ -388,14 +387,13 @@ static int twl4030_usb_runtime_suspend(struct device *dev) | |||
| 388 | struct twl4030_usb *twl = dev_get_drvdata(dev); | 387 | struct twl4030_usb *twl = dev_get_drvdata(dev); |
| 389 | 388 | ||
| 390 | dev_dbg(twl->dev, "%s\n", __func__); | 389 | dev_dbg(twl->dev, "%s\n", __func__); |
| 391 | if (twl->asleep) | 390 | if (pm_runtime_suspended(dev)) |
| 392 | return 0; | 391 | return 0; |
| 393 | 392 | ||
| 394 | __twl4030_phy_power(twl, 0); | 393 | __twl4030_phy_power(twl, 0); |
| 395 | regulator_disable(twl->usb1v5); | 394 | regulator_disable(twl->usb1v5); |
| 396 | regulator_disable(twl->usb1v8); | 395 | regulator_disable(twl->usb1v8); |
| 397 | regulator_disable(twl->usb3v1); | 396 | regulator_disable(twl->usb3v1); |
| 398 | twl->asleep = 1; | ||
| 399 | 397 | ||
| 400 | return 0; | 398 | return 0; |
| 401 | } | 399 | } |
| @@ -406,7 +404,7 @@ static int twl4030_usb_runtime_resume(struct device *dev) | |||
| 406 | int res; | 404 | int res; |
| 407 | 405 | ||
| 408 | dev_dbg(twl->dev, "%s\n", __func__); | 406 | dev_dbg(twl->dev, "%s\n", __func__); |
| 409 | if (!twl->asleep) | 407 | if (pm_runtime_active(dev)) |
| 410 | return 0; | 408 | return 0; |
| 411 | 409 | ||
| 412 | res = regulator_enable(twl->usb3v1); | 410 | res = regulator_enable(twl->usb3v1); |
| @@ -435,7 +433,6 @@ static int twl4030_usb_runtime_resume(struct device *dev) | |||
| 435 | twl4030_usb_read(twl, PHY_CLK_CTRL) | | 433 | twl4030_usb_read(twl, PHY_CLK_CTRL) | |
| 436 | (PHY_CLK_CTRL_CLOCKGATING_EN | | 434 | (PHY_CLK_CTRL_CLOCKGATING_EN | |
| 437 | PHY_CLK_CTRL_CLK32K_EN)); | 435 | PHY_CLK_CTRL_CLK32K_EN)); |
| 438 | twl->asleep = 0; | ||
| 439 | 436 | ||
| 440 | return 0; | 437 | return 0; |
| 441 | } | 438 | } |
| @@ -560,10 +557,10 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
| 560 | */ | 557 | */ |
| 561 | if ((status == OMAP_MUSB_VBUS_VALID) || | 558 | if ((status == OMAP_MUSB_VBUS_VALID) || |
| 562 | (status == OMAP_MUSB_ID_GROUND)) { | 559 | (status == OMAP_MUSB_ID_GROUND)) { |
| 563 | if (twl->asleep) | 560 | if (pm_runtime_suspended(twl->dev)) |
| 564 | pm_runtime_get_sync(twl->dev); | 561 | pm_runtime_get_sync(twl->dev); |
| 565 | } else { | 562 | } else { |
| 566 | if (!twl->asleep) { | 563 | if (pm_runtime_active(twl->dev)) { |
| 567 | pm_runtime_mark_last_busy(twl->dev); | 564 | pm_runtime_mark_last_busy(twl->dev); |
| 568 | pm_runtime_put_autosuspend(twl->dev); | 565 | pm_runtime_put_autosuspend(twl->dev); |
| 569 | } | 566 | } |
| @@ -572,7 +569,7 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
| 572 | } | 569 | } |
| 573 | 570 | ||
| 574 | /* don't schedule during sleep - irq works right then */ | 571 | /* don't schedule during sleep - irq works right then */ |
| 575 | if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { | 572 | if (status == OMAP_MUSB_ID_GROUND && pm_runtime_active(twl->dev)) { |
| 576 | cancel_delayed_work(&twl->id_workaround_work); | 573 | cancel_delayed_work(&twl->id_workaround_work); |
| 577 | schedule_delayed_work(&twl->id_workaround_work, HZ); | 574 | schedule_delayed_work(&twl->id_workaround_work, HZ); |
| 578 | } | 575 | } |
| @@ -674,7 +671,6 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
| 674 | twl->irq = platform_get_irq(pdev, 0); | 671 | twl->irq = platform_get_irq(pdev, 0); |
| 675 | twl->vbus_supplied = false; | 672 | twl->vbus_supplied = false; |
| 676 | twl->linkstat = -EINVAL; | 673 | twl->linkstat = -EINVAL; |
| 677 | twl->asleep = 1; | ||
| 678 | twl->linkstat = OMAP_MUSB_UNKNOWN; | 674 | twl->linkstat = OMAP_MUSB_UNKNOWN; |
| 679 | 675 | ||
| 680 | twl->phy.dev = twl->dev; | 676 | twl->phy.dev = twl->dev; |
