Commit f8c725c9 authored by Daniel Mack's avatar Daniel Mack Committed by Kelsey Skunberg

ALSA: usb-audio: allow clock source validity interrupts

BugLink: https://bugs.launchpad.net/bugs/1885932

[ Upstream commit 191227d9 ]

miniDSP USBStreamer UAC2 devices send clock validity changes with the
control field set to zero. The current interrupt handler ignores all
packets if the control field does not match the mixer element's, but
it really should only do that in case that field is needed to
distinguish multiple elements with the same ID.

This patch implements a logic that lets notifications packets pass
if the element ID is unique for a given device.
Signed-off-by: default avatarDaniel Mack <daniel@zonque.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKelsey Skunberg <kelsey.skunberg@canonical.com>
parent b311af21
...@@ -2391,6 +2391,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, ...@@ -2391,6 +2391,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
__u8 unitid = (index >> 8) & 0xff; __u8 unitid = (index >> 8) & 0xff;
__u8 control = (value >> 8) & 0xff; __u8 control = (value >> 8) & 0xff;
__u8 channel = value & 0xff; __u8 channel = value & 0xff;
unsigned int count = 0;
if (channel >= MAX_CHANNELS) { if (channel >= MAX_CHANNELS) {
usb_audio_dbg(mixer->chip, usb_audio_dbg(mixer->chip,
...@@ -2399,6 +2400,12 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, ...@@ -2399,6 +2400,12 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
return; return;
} }
for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem)
count++;
if (count == 0)
return;
for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) { for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) {
struct usb_mixer_elem_info *info; struct usb_mixer_elem_info *info;
...@@ -2406,7 +2413,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, ...@@ -2406,7 +2413,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
continue; continue;
info = (struct usb_mixer_elem_info *)list; info = (struct usb_mixer_elem_info *)list;
if (info->control != control) if (count > 1 && info->control != control)
continue; continue;
switch (attribute) { switch (attribute) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment