[alsa-devel] [RFC] ALSA: Add a static keep_iface quirk for two known devices

news at aboehler.at news at aboehler.at
Thu Aug 30 21:57:17 CEST 2018


From: Andreas Böhler <news at aboehler.at>

Hi,

I own a Phonic Helix Board 12 Universal USB sound mixer that I couldn't 
get to work properly on my box. After some debugging, it turned out that 
the playback stream is muted when the capture interface is brought down.

Since I was on 4.14, I implemented a quirk there and wanted to port it 
to 4.18 before submitting it - just to find out that the keep_iface 
control is very much the same approach.

This patch adds a mixer quirk for known devices such as the Phonic Helix 
Board 12 Universal and the Behringer FCA610 (tested and reported by 
Takashi Sakamoto). For these devices, the control is not created and 
keep_iface is simply set to true.

Signed-off-by: Andreas Böhler <dev at aboehler.at>

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index c63c84b54969..f11208fb4e58 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -3474,9 +3474,15 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
 	if (err < 0)
 		goto _error;
 
-	err = create_keep_iface_ctl(mixer);
-	if (err < 0)
-		goto _error;
+	/* For known cards, make the keep_iface quirk static
+	 * otherwiese, add a mixer control */
+	if(snd_usb_mixer_keep_iface_static_quirk(mixer)) {
+		mixer->chip->keep_iface = true;
+	} else {
+		err = create_keep_iface_ctl(mixer);
+		if (err < 0)
+			goto _error;
+	}
 
 	snd_usb_mixer_apply_create_quirk(mixer);
 
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index cbfb48bdea51..414aa1f3a170 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -2000,3 +2000,13 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
 	}
 }
 
+bool snd_usb_mixer_keep_iface_static_quirk(struct usb_mixer_interface *mixer)
+{
+	switch (mixer->chip->usb_id) {
+	case USB_ID(0x170b, 0x0015): /* Phonic Helix Board 12 Universal */
+	case USB_ID(0x1397, 0x0003): /* Behringer FCA 610 */
+		return true;
+	}
+
+	return false;
+}
diff --git a/sound/usb/mixer_quirks.h b/sound/usb/mixer_quirks.h
index 52be26db558f..5853e86adffd 100644
--- a/sound/usb/mixer_quirks.h
+++ b/sound/usb/mixer_quirks.h
@@ -14,6 +14,8 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
 				  struct usb_mixer_elem_info *cval, int unitid,
 				  struct snd_kcontrol *kctl);
 
+bool snd_usb_mixer_keep_iface_static_quirk(struct usb_mixer_interface *mixer);
+
 #ifdef CONFIG_PM
 void snd_usb_mixer_resume_quirk(struct usb_mixer_interface *mixer);
 #endif
-- 
2.18.0



More information about the Alsa-devel mailing list