mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
usb: mtu3: allow system suspend during active gadget connection
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: 427c66422e ("usb: mtu3: support suspend/resume for device mode")
Signed-off-by: Fei Shao <fshao@chromium.org>
Link: https://patch.msgid.link/20260626082218.2750459-2-fshao@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ff14cf71c8
commit
e69027c253
|
|
@ -1037,9 +1037,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);
|
||||
|
||||
|
|
@ -1055,5 +1060,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user