[v2,12/15] usb: dwc2: Add hibernation exiting flow by system resume
diff mbox series

Message ID 20210416124819.A3B26A005C@mailhost.synopsys.com
State New
Headers show
Series
  • Untitled series #495535
Related show

Commit Message

Artur Petrosyan April 16, 2021, 12:48 p.m. UTC
Adds a new flow of exiting hibernation when PC is resumed
from suspend state.

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

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

Comments

Minas Harutyunyan April 19, 2021, 7:31 a.m. UTC | #1
On 4/16/2021 4:48 PM, Artur Petrosyan wrote:
> Adds a new flow of exiting hibernation when PC is resumed
> from suspend state.
> 
> Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>

Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>

> ---
>   Changes in v2:
>   - None
> 
>   drivers/usb/dwc2/hcd.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
> index 92848629cc61..035d4911a3c3 100644
> --- a/drivers/usb/dwc2/hcd.c
> +++ b/drivers/usb/dwc2/hcd.c
> @@ -4470,6 +4470,16 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd)
>   		set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
>   		break;
>   	case DWC2_POWER_DOWN_PARAM_HIBERNATION:
> +		ret = dwc2_exit_hibernation(hsotg, 0, 0, 1);
> +		if (ret)
> +			dev_err(hsotg->dev, "exit hibernation failed.\n");
> +
> +		/*
> +		 * Set HW accessible bit before powering on the controller
> +		 * since an interrupt may rise.
> +		 */
> +		set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
> +		break;
>   	case DWC2_POWER_DOWN_PARAM_NONE:
>   		/*
>   		 * If not hibernation nor partial power down are supported,
>

Patch
diff mbox series

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 92848629cc61..035d4911a3c3 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -4470,6 +4470,16 @@  static int _dwc2_hcd_resume(struct usb_hcd *hcd)
 		set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 		break;
 	case DWC2_POWER_DOWN_PARAM_HIBERNATION:
+		ret = dwc2_exit_hibernation(hsotg, 0, 0, 1);
+		if (ret)
+			dev_err(hsotg->dev, "exit hibernation failed.\n");
+
+		/*
+		 * Set HW accessible bit before powering on the controller
+		 * since an interrupt may rise.
+		 */
+		set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+		break;
 	case DWC2_POWER_DOWN_PARAM_NONE:
 		/*
 		 * If not hibernation nor partial power down are supported,