usb: dwc3: add shutdown function for dwc3 driver
authorJianxin Qin <jianxin.qin@amlogic.com>
Fri, 4 May 2018 03:39:47 +0000 (11:39 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Thu, 14 Jun 2018 07:30:48 +0000 (00:30 -0700)
PD#164611: usb: dwc3: add shutdown function for dwc3 driver

In suspend mode, we will shutdown the USB controller for reducing
more power consumption.

Change-Id: Icfc3182fce4f5455397e5f11fd08693f763757b3
Signed-off-by: Jianxin Qin <jianxin.qin@amlogic.com>
drivers/usb/dwc3/core.c

index 7a8c51c559921645eaddd6b27e951cc7955f58ae..c7c090734f60a5d42811bade2bd5f14e46b37f57 100644 (file)
@@ -1278,6 +1278,17 @@ err0:
        return ret;
 }
 
+#ifdef CONFIG_AMLOGIC_USB
+void dwc3_shutdown(struct platform_device *pdev)
+{
+       struct dwc3 *dwc = platform_get_drvdata(pdev);
+
+       dev_dbg(dwc->dev, "%s\n", __func__);
+       usb_phy_shutdown(dwc->usb2_phy);
+       usb_phy_shutdown(dwc->usb3_phy);
+}
+#endif
+
 static int dwc3_remove(struct platform_device *pdev)
 {
        struct dwc3     *dwc = platform_get_drvdata(pdev);
@@ -1529,6 +1540,9 @@ MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match);
 static struct platform_driver dwc3_driver = {
        .probe          = dwc3_probe,
        .remove         = dwc3_remove,
+#ifdef CONFIG_AMLOGIC_USB
+       .shutdown       = dwc3_shutdown,
+#endif
        .driver         = {
                .name   = "dwc3",
                .of_match_table = of_match_ptr(of_dwc3_match),