mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
usb: dwc2: add pm runtime support
Adds pm_runtime support for dwc2, so that power domain is enabled only when there is a transaction going on to help save power. Change-Id: I318552774d20eeaed521ff179f99b2551ee24183 Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
@@ -472,6 +472,9 @@ static int dwc2_driver_remove(struct platform_device *dev)
|
||||
if (hsotg->gadget_enabled)
|
||||
dwc2_hsotg_remove(hsotg);
|
||||
|
||||
pm_runtime_put_sync(hsotg->dev);
|
||||
pm_runtime_disable(hsotg->dev);
|
||||
|
||||
if (hsotg->ll_hw_enabled)
|
||||
dwc2_lowlevel_hw_disable(hsotg);
|
||||
|
||||
@@ -604,6 +607,11 @@ static int dwc2_driver_probe(struct platform_device *dev)
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
pm_runtime_enable(hsotg->dev);
|
||||
retval = pm_runtime_get_sync(hsotg->dev);
|
||||
if (retval < 0)
|
||||
goto error;
|
||||
|
||||
retval = dwc2_get_dr_mode(hsotg);
|
||||
if (retval)
|
||||
goto error;
|
||||
@@ -670,6 +678,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
|
||||
return 0;
|
||||
|
||||
error:
|
||||
pm_runtime_put_sync(hsotg->dev);
|
||||
pm_runtime_disable(hsotg->dev);
|
||||
dwc2_lowlevel_hw_disable(hsotg);
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user