Commit d00b4142 authored by Robert Baldyga's avatar Robert Baldyga Committed by Greg Kroah-Hartman

usb: dwc2/gadget: disable clock when it's not needed

When device is stopped or suspended clock is not needed so we
can disable it for this time.
Signed-off-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b203d0a2
...@@ -2893,6 +2893,8 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, ...@@ -2893,6 +2893,8 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
hsotg->gadget.dev.of_node = hsotg->dev->of_node; hsotg->gadget.dev.of_node = hsotg->dev->of_node;
hsotg->gadget.speed = USB_SPEED_UNKNOWN; hsotg->gadget.speed = USB_SPEED_UNKNOWN;
clk_enable(hsotg->clk);
ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
hsotg->supplies); hsotg->supplies);
if (ret) { if (ret) {
...@@ -2941,6 +2943,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, ...@@ -2941,6 +2943,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
clk_disable(hsotg->clk);
return 0; return 0;
} }
...@@ -2972,8 +2976,10 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) ...@@ -2972,8 +2976,10 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on)
spin_lock_irqsave(&hsotg->lock, flags); spin_lock_irqsave(&hsotg->lock, flags);
if (is_on) { if (is_on) {
s3c_hsotg_phy_enable(hsotg); s3c_hsotg_phy_enable(hsotg);
clk_enable(hsotg->clk);
s3c_hsotg_core_init(hsotg); s3c_hsotg_core_init(hsotg);
} else { } else {
clk_disable(hsotg->clk);
s3c_hsotg_phy_disable(hsotg); s3c_hsotg_phy_disable(hsotg);
} }
...@@ -3636,6 +3642,7 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -3636,6 +3642,7 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state)
ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
hsotg->supplies); hsotg->supplies);
clk_disable(hsotg->clk);
} }
return ret; return ret;
...@@ -3650,6 +3657,8 @@ static int s3c_hsotg_resume(struct platform_device *pdev) ...@@ -3650,6 +3657,8 @@ static int s3c_hsotg_resume(struct platform_device *pdev)
if (hsotg->driver) { if (hsotg->driver) {
dev_info(hsotg->dev, "resuming usb gadget %s\n", dev_info(hsotg->dev, "resuming usb gadget %s\n",
hsotg->driver->driver.name); hsotg->driver->driver.name);
clk_enable(hsotg->clk);
ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
hsotg->supplies); hsotg->supplies);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment