b19516319613db4227e93f90f5c2ccf839204221
[openwrt/staging/blocktrron.git] /
1 From cea2dbec1b8e84b95459f4a589c613b84e3d9737 Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.com>
3 Date: Wed, 15 Sep 2021 17:56:45 +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/card.c | 8 +++++++-
18 1 file changed, 7 insertions(+), 1 deletion(-)
19
20 --- a/sound/usb/card.c
21 +++ b/sound/usb/card.c
22 @@ -825,8 +825,14 @@ static int usb_audio_probe(struct usb_in
23 if (ignore_ctl_error)
24 chip->quirk_flags |= QUIRK_FLAG_IGNORE_CTL_ERROR;
25
26 - if (chip->quirk_flags & QUIRK_FLAG_DISABLE_AUTOSUSPEND)
27 + if (chip->quirk_flags & QUIRK_FLAG_DISABLE_AUTOSUSPEND) {
28 + /*
29 + * Grab the interface, because on a webcam uvcvideo may race
30 + * with snd-usb-audio during probe and re-enable autosuspend.
31 + */
32 + usb_autopm_get_interface(intf);
33 usb_disable_autosuspend(interface_to_usbdev(intf));
34 + }
35
36 /*
37 * For devices with more than one control interface, we assume the