From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796354565; b=WDZPA4LGQ22Hjm/CErWrHhxHnhzY185zrEjl7Oa5vp7WcvjcudNa5e9U3R1ej5qVn1/o XiR2sosZ+hwyjcT02ZTi+6D8nOMew+wQvfIOfEyJ5KjLYUfSxQDw5SvdaxJIeMYzPi8KT gGJ/FgDpCCVgraajDKYBJRXkx9xrtYgImI62aQH0cPY84vly5D/W1U5fm5NMOK+wNLnBL idlpC8LoXzyRZnPko9Qy4rEOef64vVANk+Ce9Dyg0PW+Lf3++g91+wrlx7AtNm+2X8dsn zE1cGLdersSt33fEZlDv1YsJhJ5SpuPVlCUm7ji1zUgfZGLZ9wz9bsF6QLPxAQu9ARQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796354565; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=uN6l3Jt63vAUzfwUbHybOJdBPY9kUf85O0fVcR8Tifk=; b=S/Js/fKdF9UktWMDeispw8rr7H/t9T0gs26wdyzVGRiktU/K9+vpTbE5mNEDaon2Vzem pisvptsTW3NUphV8tjmZmfKpbMRtYMyMdx8bbVHDCE2S9Qfm7O7cJiLXf0XBEsOM4oIsV HwW6isj/bkbnOyJn2UtdRLHOKbn7VSHj6vKrdiBOxL8PrPQIk7PZAsbBVZYbc+t2eDysn 6gl6LGUgMBnk+yPQNYWkYrqFmSnrutVZgSBg6ugcJ4PamWp/L0F2SUvrzHknwKg6yiEMP L92+/hFAUE7lxlTodHJMc5QNUjtSRKFuNJIK6lUKZip6r2iuPcVhhlNtQAcW9YFusmQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=XGSbjxPA; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B1CB606A322; Fri, 4 Dec 2026 03:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=XGSbjxPA Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2B651F000CE; Fri, 4 Dec 2026 03:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796354564; bh=uN6l3Jt63vAUzfwUbHybOJdBPY9kUf85O0fVcR8Tifk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=XGSbjxPAQ0XMQcJJqBOodtUic0M4RkZJFt8CHz0wU+eMnNxAGEapSndgBuQ0UK3c9 tkojQaGsuCSkWS3Oib0moGGxIUFE1CdUmrxwX35aGtok7ibpACZctS0F6ZriV7D1rv /tgYBDWRqOeuhvMGcgbO1T4SUCK9y/2POhM+Jj4o= Date: Thu, 3 Dec 2026 18:31:10 +0100 From: Greg Kroah-Hartman To: admin@or1k.net Cc: Jonathan Corbet , Shuah Khan , Randy Dunlap , Alan Stern , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH 1/2] USB: core: Add USB_QUIRK_DISCONNECT_PARENT_SUSPEND Message-ID: <2026120358-dedicator-concise-9d9b@gregkh> References: <20261120-quadcast-s-suspend-v1-0-add8ccf12c8f@or1k.net> <20261120-quadcast-s-suspend-v1-1-add8ccf12c8f@or1k.net> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261120-quadcast-s-suspend-v1-1-add8ccf12c8f@or1k.net> On Fri, Nov 20, 2026 at 12:22:25AM +0200, Oleh Kurudz via B4 Relay wrote: > From: Oleh Kurudz > > Some USB products are several functions behind a small hub inside the > same enclosure. On the HyperX QuadCast S microphone one of these > functions drops off the bus while the system is suspending, and the > built-in hub then reports the connect change upstream and wakes the > system, even though remote wakeup is disabled for the hub and for > everything behind it. On s2idle systems the suspend bounces back within > about a second. > > USB_QUIRK_DISCONNECT_SUSPEND does not help here. Set on the function > that drops off, it disables that function's port on the built-in hub, > but the hub itself still signals the wakeup. Set on the hub, it would > affect every product that uses the same generic hub chip (a Huasheng > 214b:7250 in this case), including ones with a keyboard behind it that > is expected to wake the system. > > Add USB_QUIRK_DISCONNECT_PARENT_SUSPEND. When a hub has a child with > this quirk, usb_suspend() disables the hub's upstream port after > suspending it, just as USB_QUIRK_DISCONNECT_SUSPEND would for the hub > itself. The children are checked at suspend time instead of copying the > flag to the hub at enumeration, because a reset-resume of the hub re-runs > usb_detect_quirks() and would drop a copied flag. > > Like USB_QUIRK_DISCONNECT_SUSPEND, this only affects system sleep; > runtime suspend does not go through usb_suspend(). The quirk can also be > set with the usbcore.quirks parameter, using the letter 's'. > > This patch and its changelog were written with the help of an AI > coding assistant (Claude, claude-opus-5-5). I reviewed the result and > tested it on my hardware, see the next patch. > > Signed-off-by: Oleh Kurudz > --- > Documentation/admin-guide/kernel-parameters.txt | 5 +++++ > drivers/usb/core/driver.c | 20 +++++++++++++++++++- > drivers/usb/core/quirks.c | 3 +++ > include/linux/usb/quirks.h | 7 +++++++ > 4 files changed, 34 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 176648941..7751c373a 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -8235,6 +8235,11 @@ Kernel parameters > 9-bytes configuration descriptor request. > Ask for 255-bytes request instead to mirror > Windows' behavior); > + s = USB_QUIRK_DISCONNECT_PARENT_SUSPEND > + (Device sits behind a hub that signals > + a spurious wakeup when the device drops > + off the bus during suspend; disconnect > + the hub before suspend); > Example: quirks=0781:5580:bk,0a5c:5834:gij > > usbhid.mousepoll= > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > index d3a61ebc6..a40d9595b 100644 > --- a/drivers/usb/core/driver.c > +++ b/drivers/usb/core/driver.c > @@ -1620,6 +1620,23 @@ static void choose_wakeup(struct usb_device *udev, pm_message_t msg) > udev->do_remote_wakeup = w; > } > > +/* > + * Check whether a child of @hdev wants @hdev disconnected during system > + * suspend. The caller must hold @hdev's device lock, which keeps the set of > + * children stable. > + */ > +static bool usb_child_wants_parent_disconnect(struct usb_device *hdev) Why "hdev" and not just "udev"? So you "know" this is a hub? Are you sure? And can you use __must_hold() here? > +{ > + struct usb_device *child; > + int port1; > + > + usb_hub_for_each_child(hdev, port1, child) { > + if (child->quirks & USB_QUIRK_DISCONNECT_PARENT_SUSPEND) > + return true; > + } > + return false; > +} > + > /* The device lock is held by the PM core */ > int usb_suspend(struct device *dev, pm_message_t msg) > { > @@ -1637,7 +1654,8 @@ int usb_suspend(struct device *dev, pm_message_t msg) > if (r) > return r; > > - if (udev->quirks & USB_QUIRK_DISCONNECT_SUSPEND) > + if ((udev->quirks & USB_QUIRK_DISCONNECT_SUSPEND) || > + (udev->parent && usb_child_wants_parent_disconnect(udev))) > usb_port_disable(udev); > > return 0; > diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c > index a4bcbe9c9..3933cf9c0 100644 > --- a/drivers/usb/core/quirks.c > +++ b/drivers/usb/core/quirks.c > @@ -146,6 +146,9 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp) > case 'r': > flags |= USB_QUIRK_WINDOWS_CONFIG_REQ_SIZE; > break; > + case 's': > + flags |= USB_QUIRK_DISCONNECT_PARENT_SUSPEND; > + break; > /* Ignore unrecognized flag characters */ > } > } > diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h > index a4043b33c..101dd1ca4 100644 > --- a/include/linux/usb/quirks.h > +++ b/include/linux/usb/quirks.h > @@ -84,4 +84,11 @@ > /* Use a 255 bytes config descriptor request mirroring windows behavior */ > #define USB_QUIRK_WINDOWS_CONFIG_REQ_SIZE BIT(19) > > +/* > + * Device sits behind a hub that signals a spurious wakeup when the device > + * drops off the bus during system suspend; the hub needs to be disconnected > + * before suspend. So you want to disconnect the parent before the child? That feels wrong and really broken. How does Windows handle this? Surely it doesn't have a quirk list like this? How did this device pass usb.org testing? thanks, greg k-h