]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: musb: Update to use PM runtime autosuspend
authorTony Lindgren <tony@atomide.com>
Tue, 31 May 2016 15:05:11 +0000 (10:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Jun 2016 21:58:59 +0000 (14:58 -0700)
Let's make the PM runtime use the standard autosuspend calls.
Commit 5de85b9d57ab ("PM / runtime: Re-init runtime PM states at probe
error and driver unbind") means we must pair use_autosuspend with
dont_use_autosuspend and then use put_sync to properly idle the
device.

Note that we'll be removing the PM runtime calls from the glue
layer to the MUSB core in the next patch. And we can also remove
the pointless FIXME comment now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_gadget.c
drivers/usb/musb/omap2430.c

index c370ed59ef7b1416a49b9a520c6faa10f0b9cb03..89c270a995497e45dd0b9863a5feef5c81d86b6a 100644 (file)
@@ -2220,7 +2220,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
        if (status)
                goto fail5;
 
-       pm_runtime_put(musb->controller);
+       pm_runtime_mark_last_busy(musb->controller);
+       pm_runtime_put_autosuspend(musb->controller);
 
        /*
         * For why this is currently needed, see commit 3e43a0725637
@@ -2248,6 +2249,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
        usb_phy_shutdown(musb->xceiv);
 
 err_usb_phy_init:
+       pm_runtime_dont_use_autosuspend(musb->controller);
        pm_runtime_put_sync(musb->controller);
 
 fail2:
@@ -2313,8 +2315,6 @@ static int musb_remove(struct platform_device *pdev)
        spin_unlock_irqrestore(&musb->lock, flags);
        musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
        musb_platform_exit(musb);
-       pm_runtime_put(musb->controller);
-       /* FIXME power down */
 
        musb_phy_callback = NULL;
 
@@ -2326,6 +2326,9 @@ static int musb_remove(struct platform_device *pdev)
        cancel_work_sync(&musb->irq_work);
        cancel_delayed_work_sync(&musb->finish_resume_work);
        cancel_delayed_work_sync(&musb->deassert_reset_work);
+       pm_runtime_dont_use_autosuspend(musb->controller);
+       pm_runtime_put_sync(musb->controller);
+       pm_runtime_disable(musb->controller);
        musb_free(musb);
        device_init_wakeup(dev, 0);
        return 0;
index 152865b3652295caf52340ca86397d5494f34c84..fff5a8a283e3ca27ecada3f621619071f8a2444b 100644 (file)
@@ -1963,7 +1963,8 @@ static int musb_gadget_stop(struct usb_gadget *g)
         * that currently misbehaves.
         */
 
-       pm_runtime_put(musb->controller);
+       pm_runtime_mark_last_busy(musb->controller);
+       pm_runtime_put_autosuspend(musb->controller);
 
        return 0;
 }
index c84e0322c108710607abca65245ca4f368ba2da9..07363d28fbc146b8c5793fa400b62e5ec5821b6e 100644 (file)
@@ -435,8 +435,9 @@ static int omap2430_musb_init(struct musb *musb)
        phy_init(musb->phy);
        phy_power_on(musb->phy);
 
-       pm_runtime_put_noidle(musb->controller);
-       pm_runtime_put_noidle(glue->dev);
+       pm_runtime_mark_last_busy(musb->controller);
+       pm_runtime_put_autosuspend(musb->controller);
+       pm_runtime_put(glue->dev);
        return 0;
 
 err1: