usb: dwc3: core: Allow platform glue driver to handle PM

DWC3 platform glue driver on some targets is responsible for
dealing with power management. They might even implement
runtime suspend for DWC3 and want to keep devices in suspend
during system PM state transitions. DWC3 core doesn't aware
of glue driver based PM functionality. This driver carries
out hardware read write operations assuming it is never put
in LPM and clocks would always be ON.

Hence, for platforms which implement aggressive power management
of DWC3 from its glue driver, make core's PM ops as NO-OP and
just notify them of the core PM states using callback.

Change-Id: If82913ebe753236682e31ab351c991c3f855b2f1
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index ee06d07..8c52a13 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1547,6 +1547,10 @@
 	struct dwc3	*dwc = dev_get_drvdata(dev);
 	int		ret;
 
+	/* Check if platform glue driver handling PM, if not then handle here */
+	if (!dwc3_notify_event(dwc, DWC3_CORE_PM_SUSPEND_EVENT))
+		return 0;
+
 	ret = dwc3_suspend_common(dwc);
 	if (ret)
 		return ret;
@@ -1561,6 +1565,10 @@
 	struct dwc3	*dwc = dev_get_drvdata(dev);
 	int		ret;
 
+	/* Check if platform glue driver handling PM, if not then handle here */
+	if (!dwc3_notify_event(dwc, DWC3_CORE_PM_RESUME_EVENT))
+		return 0;
+
 	pinctrl_pm_select_default_state(dev);
 
 	ret = dwc3_resume_common(dwc);