Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: musb: da8xx: Remove try_idle implementation from host-only mode

The idle_state is not meant for host-only mode. When the device acts as a
host, it fails to exit the idle state once entered. This prevents new
USB gadgets from being detected once plugged in.

Commit 032ec49f5351 ("usb: musb: drop useless board_mode usage") removed
a is_otg_enabled() check in the try_idle() that prevented from entering
idle_state. This was removed because at that time it was not possible to
select host-only mode with CONFIG_USB_MUSB_HOST so dual role was always
set.

Add #ifndef CONFIG_USB_MUSB_HOST around try_idle() callback to prevent
from entering idle_state when host-only mode has been selected.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Link: https://lore.kernel.org/r/20240528102026.40136-4-bastien.curutchet@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Bastien Curutchet and committed by
Greg Kroah-Hartman
608662dd 6ecd7749

+4 -1
+4 -1
drivers/usb/musb/da8xx.c
··· 191 191 spin_unlock_irqrestore(&musb->lock, flags); 192 192 } 193 193 194 - static void da8xx_musb_try_idle(struct musb *musb, unsigned long timeout) 194 + static void __maybe_unused da8xx_musb_try_idle(struct musb *musb, unsigned long timeout) 195 195 { 196 196 static unsigned long last_timer; 197 197 ··· 476 476 .disable = da8xx_musb_disable, 477 477 478 478 .set_mode = da8xx_musb_set_mode, 479 + 480 + #ifndef CONFIG_USB_MUSB_HOST 479 481 .try_idle = da8xx_musb_try_idle, 482 + #endif 480 483 481 484 .set_vbus = da8xx_musb_set_vbus, 482 485 };