]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: phy: phy-generic: add the implementation of .set_suspend
authorPeter Chen <peter.chen@nxp.com>
Mon, 31 Oct 2016 02:18:20 +0000 (10:18 +0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 18 Nov 2016 11:54:42 +0000 (13:54 +0200)
Add clock operation 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@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/phy/phy-generic.c

index 8311ba2968cd1e14f21b6c497b463d4ec4cf9abe..89d6e7a5fdb7ab35548a9622a5d266e47b4e9355 100644 (file)
@@ -59,6 +59,15 @@ 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)) {
+               if (suspend)
+                       clk_disable_unprepare(nop->clk);
+               else
+                       clk_prepare_enable(nop->clk);
+       }
+
        return 0;
 }