Message ID | 58dc1c1805b583fa87f9615e9d17e9ff88644718.1618297800.git.Arthur.Petrosyan@synopsys.com (mailing list archive) |
---|---|
State | Accepted |
Commit | cbe1e903e5ab690c34510ab98df749ce6377ad5f |
Headers | show |
Series | [01/12] usb: dwc2: Add device clock gating support functions | expand |
On 13.04.2021 10:16, Artur Petrosyan wrote: > 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. > > Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com> > Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> > --- > drivers/usb/dwc2/core_intr.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c > index 8c0152b514be..ab7fe303c0f9 100644 > --- a/drivers/usb/dwc2/core_intr.c > +++ b/drivers/usb/dwc2/core_intr.c > @@ -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, s/not/neither/? [...] MBR, Sergei
diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 8c0152b514be..ab7fe303c0f9 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -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: /*