From a0fe0415e0b2a1d87b54db1a0451e05f59675f0c Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Mon, 31 Oct 2016 10:18:20 +0800 Subject: usb: phy: phy-generic: add the implementation of .set_suspend 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 Signed-off-by: Felipe Balbi --- drivers/usb/phy/phy-generic.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/usb/phy') diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index 8311ba2968cd..89d6e7a5fdb7 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -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; } -- cgit v1.2.3-59-g8ed1b