From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 680103ACEFB; Sat, 12 Sep 2026 18:44:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789238664; cv=none; b=cy35Smnn9Cq9dpMB9kb8maFGJGk/CEsvOEU2gcDsLC6fePMV5zDoGQ5Z94fTQ8amud7yA5TbRjmsBeQz0omkMvhhKY7Az3iJaCsd/35LJaoPKdJbM49pmn+aqza90631eQWzvRC+oWa/H1vyBHcWQweJeJOYfIWxwkmcOI+dJeM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789238664; c=relaxed/simple; bh=dllTVOeh9UEXo35389tO0IxPexP5rrbJ+uLwelGIBys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WvGlxdZ/78DW+rKUWkxzJ91E5gtjkKkcD151qnz+lIHVSzN4a3c4QtgwPMCo4KKqpm9SCeAGKWUuDTTBPwvkoAgHPmJkiR0PPNo4v7Er2AD7hzHaCt1EGsXrkLfCWR1eExwVx2XARNJgE5vpouaezk/sxxmEVV7YcqT/dis9LIE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rVd+fHiS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rVd+fHiS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D4331F000FF; Sat, 12 Sep 2026 18:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789238663; bh=+LbuinYzoAwTKXeL1SIWE/2VDFDVbAVbMFPQEO73Rv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rVd+fHiSpg0zG3uVrDoSbiQ7plsqcriMZIap7ditomusZQc270WQFw+nJYHFLAdnx gvYFOYfOWzN5cytrbPLjvC9Go9I33dAwTKxzU+Lx/lcuCZE7+DZgezpPr6EjJsN8v6 cBlKLeHNOmhnqD6Vj2RUVov2HpXOm/UTZfPOiITk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Fei Shao , Sasha Levin Subject: [PATCH 5.15 491/935] usb: mtu3: allow system suspend during active gadget connection Date: Sat, 12 Sep 2026 08:58:41 +0200 Message-ID: <20260912065538.079582245@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Fei Shao [ Upstream commit e69027c25361b6044c7928715667586cc5469063 ] When operating in gadget mode connected to a USB host, system suspend fails with -EBUSY because active peripheral connections block suspend entry. Fix this by restricting the -EBUSY check to runtime autosuspend (PMSG_IS_AUTO). For system suspend (!PMSG_IS_AUTO), perform soft disconnect to disconnect from the bus and allow MAC sleep. Fixes: 427c66422e14 ("usb: mtu3: support suspend/resume for device mode") Signed-off-by: Fei Shao Link: https://patch.msgid.link/20260626082218.2750459-2-fshao@chromium.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/mtu3/mtu3_core.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index 3ea5145a842b1..9cc031057b5cf 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -1030,9 +1030,14 @@ int ssusb_gadget_suspend(struct ssusb_mtk *ssusb, pm_message_t msg) if (!mtu->gadget_driver) return 0; - if (mtu->connected) + /* Prevent runtime suspend when active connection exists */ + if (mtu->connected && PMSG_IS_AUTO(msg)) return -EBUSY; + /* Perform soft disconnect for system suspend */ + if (mtu->softconnect && !PMSG_IS_AUTO(msg)) + mtu3_dev_on_off(mtu, 0); + mtu3_dev_suspend(mtu); synchronize_irq(mtu->irq); @@ -1048,5 +1053,9 @@ int ssusb_gadget_resume(struct ssusb_mtk *ssusb, pm_message_t msg) mtu3_dev_resume(mtu); + /* Restore soft connect for system resume */ + if (mtu->softconnect && !PMSG_IS_AUTO(msg)) + mtu3_dev_on_off(mtu, 1); + return 0; } -- 2.53.0