alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@zonque.org>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, orm.finnendahl@selma.hfmdk-frankfurt.de,
	clemens@ladisch.de, jan.baumgart@selma.hfmdk-frankfurt.de,
	Daniel Mack <daniel@zonque.org>
Subject: [PATCH 2/2] sound: usb: allow clock source validity interrupts
Date: Fri,  8 Apr 2016 19:52:02 +0200	[thread overview]
Message-ID: <1460137922-8993-2-git-send-email-daniel@zonque.org> (raw)
In-Reply-To: <1460137922-8993-1-git-send-email-daniel@zonque.org>

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>
---
 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 973274b..aa6f16e 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2371,6 +2371,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,
@@ -2379,6 +2380,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;
 
@@ -2386,7 +2393,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.4.3

  reply	other threads:[~2016-04-08 17:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08 17:52 [PATCH 1/2] sound: usb: add UAC2 clock sources as mixer controls Daniel Mack
2016-04-08 17:52 ` Daniel Mack [this message]
2016-04-09  8:52   ` [PATCH 2/2] sound: usb: allow clock source validity interrupts Takashi Iwai
2016-04-09  9:16     ` Daniel Mack
2016-04-09  9:51       ` Takashi Iwai
2016-04-09 14:37         ` Daniel Mack
2016-04-09 15:25           ` Takashi Iwai
2016-04-09  8:43 ` [PATCH 1/2] sound: usb: add UAC2 clock sources as mixer controls Takashi Iwai
2016-04-09  9:09   ` Daniel Mack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460137922-8993-2-git-send-email-daniel@zonque.org \
    --to=daniel@zonque.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=jan.baumgart@selma.hfmdk-frankfurt.de \
    --cc=orm.finnendahl@selma.hfmdk-frankfurt.de \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).