]> Git Repo - linux.git/commitdiff
usb: dwc2: Allow entering clock gating from USB_SUSPEND interrupt
authorArtur Petrosyan <[email protected]>
Tue, 13 Apr 2021 07:36:22 +0000 (11:36 +0400)
committerGreg Kroah-Hartman <[email protected]>
Tue, 13 Apr 2021 10:25:11 +0000 (12:25 +0200)
If core doesn't support hibernation or partial power
down power saving options, power can still be saved
using clock gating on all the clocks.

- Added entering clock gating state from USB_SUSPEND
  interrupt.

Acked-by: Minas Harutyunyan <[email protected]>
Signed-off-by: Artur Petrosyan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/usb/dwc2/core_intr.c

index 8c0152b514beef7fd558ef3ece2bb05c413fd4dd..ab7fe303c0f998ffb32f56e211308a1db1ca4da4 100644 (file)
@@ -529,14 +529,18 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg)
                                /* Ask phy to be suspended */
                                if (!IS_ERR_OR_NULL(hsotg->uphy))
                                        usb_phy_set_suspend(hsotg->uphy, true);
-                       }
-
-                       if (hsotg->hw_params.hibernation) {
+                       } else if (hsotg->hw_params.hibernation) {
                                ret = dwc2_enter_hibernation(hsotg, 0);
                                if (ret && ret != -ENOTSUPP)
                                        dev_err(hsotg->dev,
                                                "%s: enter hibernation failed\n",
                                                __func__);
+                       } else {
+                               /*
+                                * If not hibernation nor partial power down are supported,
+                                * clock gating is used to save power.
+                                */
+                               dwc2_gadget_enter_clock_gating(hsotg);
                        }
 skip_power_saving:
                        /*
This page took 0.074613 seconds and 4 git commands to generate.