aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai2017-08-16 07:18:37 -0500
committerGreg Kroah-Hartman2017-08-24 19:02:35 -0500
commit669c8ab896a2f96a1d49cfa1f5efaaf64c0f6aaa (patch)
tree4f52d11acc0a0ba6532802235fa6ba1b0212ef66
parentf600f9c43346a7f26e9b808b827adfaf5e73958b (diff)
downloadkernel-omap-669c8ab896a2f96a1d49cfa1f5efaaf64c0f6aaa.tar.gz
kernel-omap-669c8ab896a2f96a1d49cfa1f5efaaf64c0f6aaa.tar.xz
kernel-omap-669c8ab896a2f96a1d49cfa1f5efaaf64c0f6aaa.zip
ALSA: usb-audio: Add mute TLV for playback volumes on C-Media devices
commit 0f174b3525a43bd51f9397394763925e0ebe7bc7 upstream. C-Media devices (at least some models) mute the playback stream when volumes are set to the minimum value. But this isn't informed via TLV and the user-space, typically PulseAudio, gets confused as if it's still played in a low volume. This patch adds the new flag, min_mute, to struct usb_mixer_elem_info for indicating that the mixer element is with the minimum-mute volume. This flag is set for known C-Media devices in snd_usb_mixer_fu_apply_quirk() in turn. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196669 Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--sound/usb/mixer.c2
-rw-r--r--sound/usb/mixer.h1
-rw-r--r--sound/usb/mixer_quirks.c6
3 files changed, 9 insertions, 0 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 499b03c8281d..696de5ac69be 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -541,6 +541,8 @@ int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
541 541
542 if (size < sizeof(scale)) 542 if (size < sizeof(scale))
543 return -ENOMEM; 543 return -ENOMEM;
544 if (cval->min_mute)
545 scale[0] = SNDRV_CTL_TLVT_DB_MINMAX_MUTE;
544 scale[2] = cval->dBmin; 546 scale[2] = cval->dBmin;
545 scale[3] = cval->dBmax; 547 scale[3] = cval->dBmax;
546 if (copy_to_user(_tlv, scale, sizeof(scale))) 548 if (copy_to_user(_tlv, scale, sizeof(scale)))
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 3417ef347e40..2b4b067646ab 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -64,6 +64,7 @@ struct usb_mixer_elem_info {
64 int cached; 64 int cached;
65 int cache_val[MAX_CHANNELS]; 65 int cache_val[MAX_CHANNELS];
66 u8 initialized; 66 u8 initialized;
67 u8 min_mute;
67 void *private_data; 68 void *private_data;
68}; 69};
69 70
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 04991b009132..5d2fc5f58bfe 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1873,6 +1873,12 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
1873 if (unitid == 7 && cval->control == UAC_FU_VOLUME) 1873 if (unitid == 7 && cval->control == UAC_FU_VOLUME)
1874 snd_dragonfly_quirk_db_scale(mixer, cval, kctl); 1874 snd_dragonfly_quirk_db_scale(mixer, cval, kctl);
1875 break; 1875 break;
1876 /* lowest playback value is muted on C-Media devices */
1877 case USB_ID(0x0d8c, 0x000c):
1878 case USB_ID(0x0d8c, 0x0014):
1879 if (strstr(kctl->id.name, "Playback"))
1880 cval->min_mute = 1;
1881 break;
1876 } 1882 }
1877} 1883}
1878 1884