| From 0ebcef61d4cb7ca384802e1085ca0e39da7d560a Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Fri, 8 Apr 2016 19:52:02 +0200 |
| Subject: ALSA: usb-audio: allow clock source validity interrupts |
| |
| From: Daniel Mack <daniel@zonque.org> |
| |
| [ Upstream commit 191227d99a281333b50aaf82ab4152fbfa249c19 ] |
| |
| 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: Daniel Mack <daniel@zonque.org> |
| Signed-off-by: Takashi Iwai <tiwai@suse.de> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| sound/usb/mixer.c | 9 ++++++++- |
| 1 file changed, 8 insertions(+), 1 deletion(-) |
| |
| diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
| index a2a9712bd6fa7..eb98e60e57335 100644 |
| --- a/sound/usb/mixer.c |
| +++ b/sound/usb/mixer.c |
| @@ -2391,6 +2391,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, |
| __u8 unitid = (index >> 8) & 0xff; |
| __u8 control = (value >> 8) & 0xff; |
| __u8 channel = value & 0xff; |
| + unsigned int count = 0; |
| |
| if (channel >= MAX_CHANNELS) { |
| usb_audio_dbg(mixer->chip, |
| @@ -2399,6 +2400,12 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, |
| 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) { |
| struct usb_mixer_elem_info *info; |
| |
| @@ -2406,7 +2413,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, |
| continue; |
| |
| info = (struct usb_mixer_elem_info *)list; |
| - if (info->control != control) |
| + if (count > 1 && info->control != control) |
| continue; |
| |
| switch (attribute) { |
| -- |
| 2.25.1 |
| |