From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: mathias.nyman@intel.com
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] xhci: Disable connect, disconnect and over-current wakeup on system suspend
Date: Thu, 17 Aug 2023 17:33:05 +0800 [thread overview]
Message-ID: <20230817093305.212821-1-kai.heng.feng@canonical.com> (raw)
HP ProOne 440 G10 AIO sometimes cannot suspend as xHCI wakes up the
system:
[ 445.814574] hub 2-0:1.0: hub_suspend
[ 445.814652] usb usb2: bus suspend, wakeup 0
[ 445.824629] xhci_hcd 0000:00:14.0: Port change event, 1-11, id 11, portsc: 0x202a0
[ 445.824639] xhci_hcd 0000:00:14.0: resume root hub
[ 445.824651] xhci_hcd 0000:00:14.0: handle_port_status: starting usb1 port polling.
[ 445.844039] xhci_hcd 0000:00:14.0: PM: pci_pm_suspend(): hcd_pci_suspend+0x0/0x20 returns -16
[ 445.844058] xhci_hcd 0000:00:14.0: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x1c0 returns -16
[ 445.844072] xhci_hcd 0000:00:14.0: PM: failed to suspend async: error -16
[ 446.276101] PM: Some devices failed to suspend, or early wake event detected
The system is designed to let display and touchpanel share the same
power source, so when the display becomes off, the USB touchpanel also
lost its power and disconnect itself from USB bus. That doesn't play
well when most Desktop Environment lock and turnoff the display right
before entering system suspend.
So for system-wide suspend, also disable connect, disconnect and
over-current wakeup to prevent spurious wakeup.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
drivers/usb/host/xhci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index fae994f679d4..dc499100efa6 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -16,6 +16,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
+#include <linux/suspend.h>
#include <linux/dmi.h>
#include <linux/dma-mapping.h>
@@ -789,7 +790,7 @@ static void xhci_disable_hub_port_wake(struct xhci_hcd *xhci,
t2 = t1;
/* clear wake bits if do_wake is not set */
- if (!do_wakeup)
+ if (!do_wakeup || pm_suspend_target_state != PM_SUSPEND_ON)
t2 &= ~PORT_WAKE_BITS;
/* Don't touch csc bit if connected or connect change is set */
--
2.34.1
next reply other threads:[~2023-08-17 9:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 9:33 Kai-Heng Feng [this message]
2023-08-17 11:18 ` [PATCH] xhci: Disable connect, disconnect and over-current wakeup on system suspend Oliver Neukum
2023-08-17 12:53 ` Mathias Nyman
2023-08-17 13:13 ` Kai-Heng Feng
2023-08-17 14:03 ` Alan Stern
2023-08-17 23:49 ` Kai-Heng Feng
2023-08-17 14:07 ` Alan Stern
2023-08-17 14:22 ` Alan Stern
2023-08-18 0:01 ` Kai-Heng Feng
2023-08-18 3:08 ` Alan Stern
2023-08-18 14:12 ` Kai-Heng Feng
2023-08-18 15:02 ` Alan Stern
2023-08-18 0:00 ` Kai-Heng Feng
2023-08-18 3:19 ` Alan Stern
2023-08-18 14:19 ` Kai-Heng Feng
2023-08-18 15:20 ` Alan Stern
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=20230817093305.212821-1-kai.heng.feng@canonical.com \
--to=kai.heng.feng@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox