3b4a78d21b0a84c00a44629ca90b5aba66a10f6e
[openwrt/staging/robimarko.git] /
1 From ec43e93b7e36e2baa6685da504b9db3ac7048ceb Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.com>
3 Date: Fri, 16 Apr 2021 11:40:23 +0100
4 Subject: [PATCH] sound/usb: call usb_autopm_get_interface() for
5 devices that should not be suspended
6
7 Webcams with microphones are composite devices, and autosuspend is set
8 at the device level. If uvcvideo is probed after snd-usb-audio, the effect
9 of the quirk applied by snd-usb-audio is undone by uvcvideo's global
10 application of autosuspend.
11
12 Incrementing the interface's PM refcount in such cases prevents runtime PM
13 from happening, thus the device is left active.
14
15 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
16 ---
17 sound/usb/quirks.c | 5 +++++
18 1 file changed, 5 insertions(+)
19
20 --- a/sound/usb/quirks.c
21 +++ b/sound/usb/quirks.c
22 @@ -531,6 +531,11 @@ static int setup_disable_autosuspend(str
23 struct usb_driver *driver,
24 const struct snd_usb_audio_quirk *quirk)
25 {
26 + /*
27 + * Grab the interface, because on a webcam uvcvideo may race
28 + * with snd-usb-audio during probe and re-enable autosuspend.
29 + */
30 + usb_autopm_get_interface(iface);
31 usb_disable_autosuspend(interface_to_usbdev(iface));
32 return 1; /* Continue with creating streams and mixer */
33 }