Skip to content

Commit 0112b7c

Browse files
Artur Petrosyangregkh
Artur Petrosyan
authored andcommitted
usb: dwc2: Update dwc2_handle_usb_suspend_intr function.
To avoid working in two modes (partial power down and hibernation) changed conditions for entering partial power down or hibernation. Instead of checking hw_params.power_optimized and hw_params.hibernation now checking power_down param which already set to one of the options (Hibernation or Partial Power Down) based on OTG_EN_PWROPT. Acked-by: Minas Harutyunyan <[email protected]> Signed-off-by: Artur Petrosyan <[email protected]> Signed-off-by: Minas Harutyunyan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a94f018 commit 0112b7c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/usb/dwc2/core_intr.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg)
532532
return;
533533
}
534534
if (dsts & DSTS_SUSPSTS) {
535-
if (hsotg->hw_params.power_optimized) {
535+
switch (hsotg->params.power_down) {
536+
case DWC2_POWER_DOWN_PARAM_PARTIAL:
536537
ret = dwc2_enter_partial_power_down(hsotg);
537538
if (ret) {
538539
if (ret != -ENOTSUPP)
@@ -541,21 +542,22 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg)
541542
__func__);
542543
goto skip_power_saving;
543544
}
544-
545545
udelay(100);
546546

547547
/* Ask phy to be suspended */
548548
if (!IS_ERR_OR_NULL(hsotg->uphy))
549549
usb_phy_set_suspend(hsotg->uphy, true);
550-
} else if (hsotg->hw_params.hibernation) {
550+
break;
551+
case DWC2_POWER_DOWN_PARAM_HIBERNATION:
551552
ret = dwc2_enter_hibernation(hsotg, 0);
552553
if (ret && ret != -ENOTSUPP)
553554
dev_err(hsotg->dev,
554555
"%s: enter hibernation failed\n",
555556
__func__);
556-
} else {
557+
break;
558+
case DWC2_POWER_DOWN_PARAM_NONE:
557559
/*
558-
* If not hibernation nor partial power down are supported,
560+
* If neither hibernation nor partial power down are supported,
559561
* clock gating is used to save power.
560562
*/
561563
dwc2_gadget_enter_clock_gating(hsotg);

0 commit comments

Comments
 (0)