diff mbox series

[v4,2/2] xhci: Improve the XHCI system resume time

Message ID 20230428140056.1318981-3-Basavaraj.Natikar@amd.com (mailing list archive)
State Accepted
Commit 1c024241d018cf9fc17aa8d95c3fe77d671d7142
Headers show
Series Handle PM events for pci resume | expand

Commit Message

Basavaraj Natikar April 28, 2023, 2 p.m. UTC
Avoid extra 120ms delay during system resume.

The xHC controller may signal wake up to 120ms before showing which usb
device caused the wake on the xHC port registers.

The xhci driver therefore checks for port activity up to 120ms during
resume, making sure that the hub driver can see the port change, and
won't immediately runtime suspend back due to no port activity.

This is however only needed for runtime resume as system resume will
resume all child hubs and other child usb devices anyway.

Fixes: 253f588c70f6 ("xhci: Improve detection of device initiated wake signal.")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mathias Nyman May 2, 2023, 9:26 a.m. UTC | #1
On 28.4.2023 17.00, Basavaraj Natikar wrote:
> Avoid extra 120ms delay during system resume.
> 
> The xHC controller may signal wake up to 120ms before showing which usb
> device caused the wake on the xHC port registers.
> 
> The xhci driver therefore checks for port activity up to 120ms during
> resume, making sure that the hub driver can see the port change, and
> won't immediately runtime suspend back due to no port activity.
> 
> This is however only needed for runtime resume as system resume will
> resume all child hubs and other child usb devices anyway.
> 
> Fixes: 253f588c70f6 ("xhci: Improve detection of device initiated wake signal.")
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
> ---
>   drivers/usb/host/xhci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 11a87b9cbb50..4c0a2b9ca7b2 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -1315,7 +1315,7 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
>   		 * the first wake signalling failed, give it that chance.
>   		 */
>   		pending_portevent = xhci_pending_portevent(xhci);
> -		if (!pending_portevent) {
> +		if (!pending_portevent && msg.event == PM_EVENT_AUTO_RESUME) {
>   			msleep(120);
>   			pending_portevent = xhci_pending_portevent(xhci);
>   		}

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 11a87b9cbb50..4c0a2b9ca7b2 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1315,7 +1315,7 @@  int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
 		 * the first wake signalling failed, give it that chance.
 		 */
 		pending_portevent = xhci_pending_portevent(xhci);
-		if (!pending_portevent) {
+		if (!pending_portevent && msg.event == PM_EVENT_AUTO_RESUME) {
 			msleep(120);
 			pending_portevent = xhci_pending_portevent(xhci);
 		}