From: Takashi Iwai <tiwai@suse.de>
Subject: Revive usb-audio Keep Interface mixer
Patch-mainline: Never, only for compatibility
References: bsc#1181014
It seems that the lack of the old mixer element "Keep Interface"
confuses alsactl and others. Revive the dummy mixer element again
just for compatibility.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/usb/mixer.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -3508,6 +3508,40 @@ static int snd_usb_mixer_status_create(s
return 0;
}
+/* Dummy mixer ctl just for compatibility */
+static int keep_iface_ctl_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ return 0;
+}
+
+static int keep_iface_ctl_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ return 0;
+}
+
+static const struct snd_kcontrol_new keep_iface_ctl = {
+ .iface = SNDRV_CTL_ELEM_IFACE_CARD,
+ .name = "Keep Interface",
+ .info = snd_ctl_boolean_mono_info,
+ .get = keep_iface_ctl_get,
+ .put = keep_iface_ctl_put,
+};
+
+static int create_keep_iface_ctl(struct usb_mixer_interface *mixer)
+{
+ struct snd_kcontrol *kctl = snd_ctl_new1(&keep_iface_ctl, mixer);
+
+ /* need only one control per card */
+ if (snd_ctl_find_id(mixer->chip->card, &kctl->id)) {
+ snd_ctl_free_one(kctl);
+ return 0;
+ }
+
+ return snd_ctl_add(mixer->chip->card, kctl);
+}
+
int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif)
{
static const struct snd_device_ops dev_ops = {
@@ -3559,6 +3593,10 @@ int snd_usb_create_mixer(struct snd_usb_
if (err < 0)
goto _error;
+ err = create_keep_iface_ctl(mixer);
+ if (err < 0)
+ goto _error;
+
err = snd_usb_mixer_apply_create_quirk(mixer);
if (err < 0)
goto _error;