* [PATCH] ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()
@ 2021-03-04 4:34 Kai-Heng Feng
2021-03-04 8:10 ` Takashi Iwai
2021-03-04 9:50 ` Joakim Tjernlund
0 siblings, 2 replies; 4+ messages in thread
From: Kai-Heng Feng @ 2021-03-04 4:34 UTC (permalink / raw)
To: tiwai
Cc: Kai-Heng Feng, moderated list:SOUND, Olivia Mackintosh,
Dylan Robinson, Greg Kroah-Hartman, Chris Wulff,
Gustavo A. R. Silva, Joakim Tjernlund, Alexander Tsoy, Mark Brown,
Joe Perches, Dmitry Panchenko, open list
Rear audio on Lenovo ThinkStation P620 stops working after commit
1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo
ThinkStation P620"):
[ 6.013526] usbcore: registered new interface driver snd-usb-audio
[ 6.023064] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
[ 6.023083] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
[ 6.023090] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
[ 6.023098] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
[ 6.023103] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
[ 6.023110] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
[ 6.045846] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
[ 6.045866] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
[ 6.045877] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
[ 6.045886] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
[ 6.045894] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
[ 6.045908] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
I overlooked the issue because when I was working on the said commit,
only the front audio is tested. Apology for that.
Changing supports_autosuspend in driver is too late for disabling
autosuspend, because it was already used by USB probe routine, so it can
break the balance on the following code that depends on
supports_autosuspend.
Fix it by using usb_disable_autosuspend() helper, and balance the
suspend count in disconnect callback.
Fixes: 1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo ThinkStation P620")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
sound/usb/card.c | 5 +++++
sound/usb/quirks.c | 2 +-
sound/usb/usbaudio.h | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 85ed8507e41a..08c794883299 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -830,6 +830,8 @@ static int usb_audio_probe(struct usb_interface *intf,
snd_media_device_create(chip, intf);
}
+ chip->quirk_type = quirk->type;
+
usb_chip[chip->index] = chip;
chip->intf[chip->num_interfaces] = intf;
chip->num_interfaces++;
@@ -912,6 +914,9 @@ static void usb_audio_disconnect(struct usb_interface *intf)
} else {
mutex_unlock(®ister_mutex);
}
+
+ if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND)
+ usb_enable_autosuspend(interface_to_usbdev(intf));
}
/* lock the shutdown (disconnect) task and autoresume */
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 9ba4682ebc48..ef5ee899db26 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -547,7 +547,7 @@ static int setup_disable_autosuspend(struct snd_usb_audio *chip,
struct usb_driver *driver,
const struct snd_usb_audio_quirk *quirk)
{
- driver->supports_autosuspend = 0;
+ usb_disable_autosuspend(interface_to_usbdev(iface));
return 1; /* Continue with creating streams and mixer */
}
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 215c1771dd57..60b9dd7df6bb 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -27,6 +27,7 @@ struct snd_usb_audio {
struct snd_card *card;
struct usb_interface *intf[MAX_CARD_INTERFACES];
u32 usb_id;
+ uint16_t quirk_type;
struct mutex mutex;
unsigned int system_suspend;
atomic_t active;
--
2.30.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()
2021-03-04 4:34 [PATCH] ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend() Kai-Heng Feng
@ 2021-03-04 8:10 ` Takashi Iwai
2021-03-04 9:50 ` Joakim Tjernlund
1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-03-04 8:10 UTC (permalink / raw)
To: Kai-Heng Feng
Cc: moderated list:SOUND, Dmitry Panchenko, Dylan Robinson,
Greg Kroah-Hartman, Chris Wulff, tiwai, Gustavo A. R. Silva,
Joakim Tjernlund, Alexander Tsoy, Mark Brown, Joe Perches,
Olivia Mackintosh, open list
On Thu, 04 Mar 2021 05:34:16 +0100,
Kai-Heng Feng wrote:
>
> Rear audio on Lenovo ThinkStation P620 stops working after commit
> 1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo
> ThinkStation P620"):
> [ 6.013526] usbcore: registered new interface driver snd-usb-audio
> [ 6.023064] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.023083] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.023090] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.023098] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.023103] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.023110] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.045846] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.045866] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.045877] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.045886] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.045894] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.045908] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
>
> I overlooked the issue because when I was working on the said commit,
> only the front audio is tested. Apology for that.
>
> Changing supports_autosuspend in driver is too late for disabling
> autosuspend, because it was already used by USB probe routine, so it can
> break the balance on the following code that depends on
> supports_autosuspend.
>
> Fix it by using usb_disable_autosuspend() helper, and balance the
> suspend count in disconnect callback.
>
> Fixes: 1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo ThinkStation P620")
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()
2021-03-04 4:34 [PATCH] ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend() Kai-Heng Feng
2021-03-04 8:10 ` Takashi Iwai
@ 2021-03-04 9:50 ` Joakim Tjernlund
2021-03-04 10:04 ` Kai-Heng Feng
1 sibling, 1 reply; 4+ messages in thread
From: Joakim Tjernlund @ 2021-03-04 9:50 UTC (permalink / raw)
To: kai.heng.feng@canonical.com, tiwai@suse.com
Cc: alsa-devel@alsa-project.org, livvy@base.nu,
dylan_robinson@motu.com, gregkh@linuxfoundation.org,
crwulff@gmail.com, linux-kernel@vger.kernel.org,
gustavoars@kernel.org, alexander@tsoy.me, broonie@kernel.org,
joe@perches.com, dmitry@d-systems.ee
On Thu, 2021-03-04 at 12:34 +0800, Kai-Heng Feng wrote:
> Rear audio on Lenovo ThinkStation P620 stops working after commit
> 1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo
> ThinkStation P620"):
> [ 6.013526] usbcore: registered new interface driver snd-usb-audio
> [ 6.023064] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.023083] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.023090] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.023098] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.023103] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.023110] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.045846] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.045866] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.045877] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.045886] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> [ 6.045894] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> [ 6.045908] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
>
> I overlooked the issue because when I was working on the said commit,
> only the front audio is tested. Apology for that.
>
> Changing supports_autosuspend in driver is too late for disabling
> autosuspend, because it was already used by USB probe routine, so it can
> break the balance on the following code that depends on
> supports_autosuspend.
>
> Fix it by using usb_disable_autosuspend() helper, and balance the
> suspend count in disconnect callback.
>
> Fixes: 1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo ThinkStation P620")
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
I got an report from a co-worker who has no USB sound from a Lenovo ThinkPad in a Ultra Dock.
USB HS is connected to Dock USB jack.
Could this be the same problem?
Jocke
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()
2021-03-04 9:50 ` Joakim Tjernlund
@ 2021-03-04 10:04 ` Kai-Heng Feng
0 siblings, 0 replies; 4+ messages in thread
From: Kai-Heng Feng @ 2021-03-04 10:04 UTC (permalink / raw)
To: Joakim Tjernlund
Cc: alsa-devel@alsa-project.org, livvy@base.nu,
dylan_robinson@motu.com, gregkh@linuxfoundation.org,
crwulff@gmail.com, tiwai@suse.com, linux-kernel@vger.kernel.org,
alexander@tsoy.me, broonie@kernel.org, gustavoars@kernel.org,
joe@perches.com, dmitry@d-systems.ee
Hi Joakim,
On Thu, Mar 4, 2021 at 5:50 PM Joakim Tjernlund
<Joakim.Tjernlund@infinera.com> wrote:
>
> On Thu, 2021-03-04 at 12:34 +0800, Kai-Heng Feng wrote:
> > Rear audio on Lenovo ThinkStation P620 stops working after commit
> > 1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo
> > ThinkStation P620"):
> > [ 6.013526] usbcore: registered new interface driver snd-usb-audio
> > [ 6.023064] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> > [ 6.023083] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> > [ 6.023090] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> > [ 6.023098] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> > [ 6.023103] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> > [ 6.023110] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> > [ 6.045846] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> > [ 6.045866] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> > [ 6.045877] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> > [ 6.045886] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> > [ 6.045894] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
> > [ 6.045908] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
> >
> > I overlooked the issue because when I was working on the said commit,
> > only the front audio is tested. Apology for that.
> >
> > Changing supports_autosuspend in driver is too late for disabling
> > autosuspend, because it was already used by USB probe routine, so it can
> > break the balance on the following code that depends on
> > supports_autosuspend.
> >
> > Fix it by using usb_disable_autosuspend() helper, and balance the
> > suspend count in disconnect callback.
> >
> > Fixes: 1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo ThinkStation P620")
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>
> I got an report from a co-worker who has no USB sound from a Lenovo ThinkPad in a Ultra Dock.
> USB HS is connected to Dock USB jack.
> Could this be the same problem?
It's a different issue. Please file a separate bug report.
Kai-Heng
>
> Jocke
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-04 10:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-04 4:34 [PATCH] ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend() Kai-Heng Feng
2021-03-04 8:10 ` Takashi Iwai
2021-03-04 9:50 ` Joakim Tjernlund
2021-03-04 10:04 ` Kai-Heng Feng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox