Skip to content

Commit dfd4b0d

Browse files
Rongronggg9tiwai
authored andcommitted
ALSA: usb-audio: Apply linear volume quirk on MV-SILICON devices
MV-SILICON is a SoC manufacturer producing multifunctional audio SoCs. Many devices built on top of their SDK share a common quirk that the Playback and Capture mixers use linear volume with val = 0/4096/1. The SDK seems to always report "MV-SILICON" for manufacturer string. Hence, match it so that we don't need to define quirk table entries separately for each devices. The "val = 0/4096/1" pattern is also checked against before applying the quirk, in order that the quirk won't accidentally break unseen variants. Quirky device samples: usb 7-1: New USB device found, idVendor=1235, idProduct=0003, bcdDevice= 1.00 usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 7-1: Product: G1 usb 7-1: Manufacturer: MV-SILICON usb 7-1: SerialNumber: 20190808 usb 7-1: New USB device found, idVendor=1235, idProduct=0003, bcdDevice= 1.00 usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 7-1: Product: mvsilicon B1 usb audio usb 7-1: Manufacturer: MV-SILICON usb 7-1: SerialNumber: 20190808 usb 5-1.4: New USB device found, idVendor=8888, idProduct=1719, bcdDevice= 1.00 usb 5-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 5-1.4: Product: HF310 USB Audio usb 5-1.4: Manufacturer: MV-SILICON usb 5-1.4: SerialNumber: 20190808 usb 7-1: New USB device found, idVendor=2717, idProduct=5086, bcdDevice= 1.00 usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 7-1: Product: Redmi 电脑音箱 usb 7-1: Manufacturer: MV-SILICON usb 7-1: SerialNumber: 20190808 usb 2-1.2: New USB device found, idVendor=3142, idProduct=a601, bcdDevice= 1.00 usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 2-1.2: Product: fifine Microphone usb 2-1.2: Manufacturer: MV-SILICON usb 2-1.2: SerialNumber: 20190808 * https://forum.ubuntu-it.org/viewtopic.php?t=659345 Signed-off-by: Rong Zhang <i@rong.moe> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260303194805.266158-9-i@rong.moe
1 parent f510f3b commit dfd4b0d

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

sound/usb/mixer_quirks.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4588,6 +4588,24 @@ static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer,
45884588
}
45894589
}
45904590

4591+
static void snd_usb_mv_silicon_quirks(struct usb_mixer_interface *mixer,
4592+
struct usb_mixer_elem_info *cval,
4593+
struct snd_kcontrol *kctl)
4594+
{
4595+
if (cval->min == 0 && cval->max == 4096 && cval->res == 1) {
4596+
/* The final effects will be printed later. */
4597+
usb_audio_info(mixer->chip, "applying MV-SILICON quirks (0/4096/1 variant)\n");
4598+
4599+
/* Respect MIN_MUTE set by module parameters. */
4600+
if (!(mixer->chip->quirk_flags & QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE))
4601+
mixer->chip->quirk_flags |= QUIRK_FLAG_MIXER_PLAYBACK_LINEAR_VOL;
4602+
if (!(mixer->chip->quirk_flags & QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE))
4603+
mixer->chip->quirk_flags |= QUIRK_FLAG_MIXER_CAPTURE_LINEAR_VOL;
4604+
} else {
4605+
usb_audio_dbg(mixer->chip, "not applying MV-SILICON quirks on unknown variant");
4606+
}
4607+
}
4608+
45914609
/*
45924610
* Some Plantronics headsets have control names that don't meet ALSA naming
45934611
* standards. This function fixes nonstandard source names. By the time
@@ -4664,6 +4682,10 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
46644682
break;
46654683
}
46664684

4685+
if (cval->control == UAC_FU_VOLUME &&
4686+
!strncmp(mixer->chip->card->longname, "MV-SILICON", 10))
4687+
snd_usb_mv_silicon_quirks(mixer, cval, kctl);
4688+
46674689
/* lowest playback value is muted on some devices */
46684690
if (mixer->chip->quirk_flags & QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE)
46694691
if (strstr(kctl->id.name, "Playback")) {

0 commit comments

Comments
 (0)