[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230817093305.212821-1-kai.heng.feng@canonical.com>
Date: Thu, 17 Aug 2023 17:33:05 +0800
From: Kai-Heng Feng <kai.heng.feng@...onical.com>
To: mathias.nyman@...el.com
Cc: Kai-Heng Feng <kai.heng.feng@...onical.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] xhci: Disable connect, disconnect and over-current wakeup on system suspend
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@...onical.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
Powered by blists - more mailing lists