aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@iki.fi>2016-09-22 23:43:47 -0400
committerTakashi Iwai <tiwai@suse.de>2016-09-23 02:32:18 -0400
commiteb1a74b7bea17eea31915c4f76385cefe69d9795 (patch)
tree0fa235c5e35c02b8ab34e8dc6ef631764aa8a15b /sound/usb
parentdb68577966abc1aeae4ec597b3dcfa0d56e92041 (diff)
ALSA: usb-audio: Extend DragonFly dB scale quirk to cover other variants
The DragonFly quirk added in 42e3121d90f4 ("ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly") applies a custom dB map on the volume control when its range is reported as 0..50 (0 .. 0.2dB). However, there exists at least one other variant (hw v1.0c, as opposed to the tested v1.2) which reports a different non-sensical volume range (0..53) and the custom map is therefore not applied for that device. This results in all of the volume change appearing close to 100% on mixer UIs that utilize the dB TLV information. Add a fallback case where no dB TLV is reported at all if the control range is not 0..50 but still 0..N where N <= 1000 (3.9 dB). Also restrict the quirk to only apply to the volume control as there is also a mute control which would match the check otherwise. Fixes: 42e3121d90f4 ("ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly") Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi> Reported-by: David W <regulars@d-dub.org.uk> Tested-by: David W <regulars@d-dub.org.uk> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer_quirks.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index f6c3bf79af9a..04991b009132 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1831,6 +1831,7 @@ void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer,
1831} 1831}
1832 1832
1833static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer, 1833static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer,
1834 struct usb_mixer_elem_info *cval,
1834 struct snd_kcontrol *kctl) 1835 struct snd_kcontrol *kctl)
1835{ 1836{
1836 /* Approximation using 10 ranges based on output measurement on hw v1.2. 1837 /* Approximation using 10 ranges based on output measurement on hw v1.2.
@@ -1848,10 +1849,19 @@ static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer,
1848 41, 50, TLV_DB_MINMAX_ITEM(-441, 0), 1849 41, 50, TLV_DB_MINMAX_ITEM(-441, 0),
1849 ); 1850 );
1850 1851
1851 usb_audio_info(mixer->chip, "applying DragonFly dB scale quirk\n"); 1852 if (cval->min == 0 && cval->max == 50) {
1852 kctl->tlv.p = scale; 1853 usb_audio_info(mixer->chip, "applying DragonFly dB scale quirk (0-50 variant)\n");
1853 kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; 1854 kctl->tlv.p = scale;
1854 kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; 1855 kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
1856 kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
1857
1858 } else if (cval->min == 0 && cval->max <= 1000) {
1859 /* Some other clearly broken DragonFly variant.
1860 * At least a 0..53 variant (hw v1.0) exists.
1861 */
1862 usb_audio_info(mixer->chip, "ignoring too narrow dB range on a DragonFly device");
1863 kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
1864 }
1855} 1865}
1856 1866
1857void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer, 1867void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
@@ -1860,8 +1870,8 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
1860{ 1870{
1861 switch (mixer->chip->usb_id) { 1871 switch (mixer->chip->usb_id) {
1862 case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */ 1872 case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */
1863 if (unitid == 7 && cval->min == 0 && cval->max == 50) 1873 if (unitid == 7 && cval->control == UAC_FU_VOLUME)
1864 snd_dragonfly_quirk_db_scale(mixer, kctl); 1874 snd_dragonfly_quirk_db_scale(mixer, cval, kctl);
1865 break; 1875 break;
1866 } 1876 }
1867} 1877}