diff mbox series

[v2,10/12] usb: dwc2: Add clock gating entering flow by system suspend

Message ID 20210413073716.30C13A0094@mailhost.synopsys.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Artur Petrosyan April 13, 2021, 7:37 a.m. UTC
If not hibernation nor partial power down are supported,
clock gating is used to save power.

Adds a new flow of entering clock gating when PC is
suspended.

Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
---
 Changes in v2:
 - None

 drivers/usb/dwc2/hcd.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Sergey Shtylyov April 13, 2021, 9:29 a.m. UTC | #1
On 13.04.2021 10:37, Artur Petrosyan wrote:

> If not hibernation nor partial power down are supported,

    s/not/neither/?

> clock gating is used to save power.
> 
> Adds a new flow of entering clock gating when PC is
> suspended.
> 
> Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
> ---
>   Changes in v2:
>   - None
> 
>   drivers/usb/dwc2/hcd.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
> index 31d6a1b87228..09dcd37b9ef8 100644
> --- a/drivers/usb/dwc2/hcd.c
> +++ b/drivers/usb/dwc2/hcd.c
> @@ -4372,6 +4372,15 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
>   		break;
>   	case DWC2_POWER_DOWN_PARAM_HIBERNATION:
>   	case DWC2_POWER_DOWN_PARAM_NONE:
> +		/*
> +		 * If not hibernation nor partial power down are supported,

    s/not/neither/?

> +		 * clock gating is used to save power.
> +		 */
> +		dwc2_host_enter_clock_gating(hsotg);
> +
> +		/* After entering suspend, hardware is not accessible */
> +		clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
> +		break;
>   	default:
>   		goto skip_power_saving;
>   	}
MBR, Sergei
diff mbox series

Patch

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 31d6a1b87228..09dcd37b9ef8 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -4372,6 +4372,15 @@  static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
 		break;
 	case DWC2_POWER_DOWN_PARAM_HIBERNATION:
 	case DWC2_POWER_DOWN_PARAM_NONE:
+		/*
+		 * If not hibernation nor partial power down are supported,
+		 * clock gating is used to save power.
+		 */
+		dwc2_host_enter_clock_gating(hsotg);
+
+		/* After entering suspend, hardware is not accessible */
+		clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+		break;
 	default:
 		goto skip_power_saving;
 	}