All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>, Li Jun <jun.li@nxp.com>,
	stable@vger.kernel.org,
	Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [PATCH 5/5] xhci: Give USB2 ports time to enter U3 in bus suspend
Date: Tue,  8 Dec 2020 11:29:12 +0200	[thread overview]
Message-ID: <20201208092912.1773650-6-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <20201208092912.1773650-1-mathias.nyman@linux.intel.com>

From: Li Jun <jun.li@nxp.com>

If a USB2 device wakeup is not enabled/supported the link state may
still be in U0 in xhci_bus_suspend(), where it's then manually put
to suspended U3 state.

Just as with selective suspend the device needs time to enter U3
suspend before continuing with further suspend operations
(e.g. system suspend), otherwise we may enter system suspend with link
state in U0.

[commit message rewording -Mathias]
Cc: <stable@vger.kernel.org>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-hub.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index c799ca5361d4..74c497fd3476 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1712,6 +1712,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
 	hcd->state = HC_STATE_SUSPENDED;
 	bus_state->next_statechange = jiffies + msecs_to_jiffies(10);
 	spin_unlock_irqrestore(&xhci->lock, flags);
+
+	if (bus_state->bus_suspended)
+		usleep_range(5000, 10000);
+
 	return 0;
 }
 
-- 
2.25.1


      parent reply	other threads:[~2020-12-08  9:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08  9:29 [PATCH 0/5] xhci features for usb-next Mathias Nyman
2020-12-08  9:29 ` [PATCH 1/5] usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK Mathias Nyman
2020-12-08  9:29 ` [PATCH 2/5] usb: xhci: Use temporary buffer to consolidate SG Mathias Nyman
2020-12-08  9:29 ` [PATCH 3/5] xhci-pci: Allow host runtime PM as default for Intel Alpine Ridge LP Mathias Nyman
2020-12-08  9:29 ` [PATCH 4/5] xhci-pci: Allow host runtime PM as default for Intel Maple Ridge xHCI Mathias Nyman
2020-12-08  9:39   ` Greg KH
2020-12-08 11:21     ` Mathias Nyman
2020-12-08  9:29 ` Mathias Nyman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201208092912.1773650-6-mathias.nyman@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.