From: Dinh Nguyen <dinguyen@xxxxxxxxxx> Move suspend/resume code to common platform code. Signed-off-by: Dinh Nguyen <dinguyen@xxxxxxxxxx> --- drivers/usb/dwc2/gadget.c | 4 ++-- drivers/usb/dwc2/platform.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 8992fe1..7ddf5a4a 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3369,7 +3369,7 @@ void s3c_hsotg_remove(struct dwc2_hsotg *dwc2) clk_disable_unprepare(dwc2->s3c_hsotg->clk); } -static int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2) +int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2) { unsigned long flags; int ret = 0; @@ -3396,7 +3396,7 @@ static int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2) return ret; } -static int s3c_hsotg_resume(struct dwc2_hsotg *dwc2) +int s3c_hsotg_resume(struct dwc2_hsotg *dwc2) { unsigned long flags; int ret = 0; diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 67f95ac..88a70c0 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -207,6 +207,27 @@ static int dwc2_driver_probe(struct platform_device *dev) return retval; } +static int dwc2_suspend(struct platform_device *dev, pm_message_t state) +{ + struct dwc2_hsotg *dwc2 = platform_get_drvdata(dev); + int ret = 0; + + if (dwc2_is_device_mode(dwc2)) + ret = s3c_hsotg_suspend(dwc2); + return ret; +} + +static int dwc2_resume(struct platform_device *dev) +{ + struct dwc2_hsotg *dwc2 = platform_get_drvdata(dev); + int ret = 0; + + if (dwc2_is_device_mode(dwc2)) + ret = s3c_hsotg_resume(dwc2); + + return ret; +} + static struct platform_driver dwc2_platform_driver = { .driver = { .name = dwc2_driver_name, @@ -214,6 +235,8 @@ static struct platform_driver dwc2_platform_driver = { }, .probe = dwc2_driver_probe, .remove = dwc2_driver_remove, + .suspend = dwc2_suspend, + .resume = dwc2_resume, }; module_platform_driver(dwc2_platform_driver); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html