MLK-10086-3 usb: phy-nop: add the implementation of .set_suspend
authorLi Jun <b47624@freescale.com>
Tue, 20 Jan 2015 08:03:38 +0000 (16:03 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:01 +0000 (14:47 -0500)
Add clock enable/disable at .set_suspend if the PHY has
suspend requirement, it can be benefit of power saving for
phy and the whole system (parent clock may also be disabled).

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 6c2f853799899c37ee2f733cafd58f1b2dc1f37f)

drivers/usb/phy/phy-generic.c

index 8311ba2..cdc6f86 100644 (file)
@@ -59,6 +59,16 @@ EXPORT_SYMBOL_GPL(usb_phy_generic_unregister);
 
 static int nop_set_suspend(struct usb_phy *x, int suspend)
 {
+       struct usb_phy_generic *nop = dev_get_drvdata(x->dev);
+
+       if (IS_ERR(nop->clk))
+               return 0;
+
+       if (suspend)
+               clk_disable_unprepare(nop->clk);
+       else
+               clk_prepare_enable(nop->clk);
+
        return 0;
 }