Skip to contentSkip to conversation

usb: dwc2: Prevent core suspend when port connection flag is 0

PATCH Minas Harutyunyan 2 participants 2 messages Mar 18, 2021 – Mar 23, 2021 1 message not in the archive USB

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Minas Harutyunyan

author Acked-by
#1 lore raw
Quoted 8 lines · Artur Petrosyan

In host mode port connection status flag is "0" when loading the driver. After loading the driver system asserts suspend which is handled by "_dwc2_hcd_suspend()" function. Before the system suspend the port connection status is "0". As result need to check the "port_connect_status" if it is "0", then skipping entering to suspend.

Quoted 19 lines
---
  drivers/usb/dwc2/hcd.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc2/hcd.c +2 -1
index 40e5655921bf..1a9789ec5847 100644
@@ -4322,7 +4322,8 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
  	if (hsotg->op_state == OTG_STATE_B_PERIPHERAL)
  		goto unlock;
 
-	if (hsotg->params.power_down > DWC2_POWER_DOWN_PARAM_PARTIAL)
+	if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL ||
+	    hsotg->flags.b.port_connect_status == 0)
  		goto skip_power_saving;
 
  	/*
#2 lore raw
In reply to a message not in the archive
Quoted 6 lines · Artur Petrosyan

In host mode port connection status flag is "0" when loading the driver. After loading the driver system asserts suspend which is handled by "_dwc2_hcd_suspend()" function. Before the system suspend the port connection status is "0". As result need to check the "port_connect_status" if it is "0", then skipping entering to suspend.

As before, is this a bugfix and needs to go to stable kernels? If so, what commit does this fix?

thanks,

greg k-h