Skip to content

Commit a43c1c4

Browse files
committed
ALSA: usb-audio: Add static mapping table for ALC1220-VB-based mobos
TRX40 mobos from MSI and others with ALC1220-VB USB-audio device need yet more quirks for the proper control names. This patch provides the mapping table for those boards, correcting the FU names for volume and mute controls as well as the terminal names for jack controls. It also improves build_connector_control() not to add the directional suffix blindly if the string is given from the mapping table. With this patch applied, the new UCM profiles will be effective. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206873 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent a8cf44f commit a43c1c4

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

sound/usb/mixer.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,8 +1776,10 @@ static void build_connector_control(struct usb_mixer_interface *mixer,
17761776
{
17771777
struct snd_kcontrol *kctl;
17781778
struct usb_mixer_elem_info *cval;
1779+
const struct usbmix_name_map *map;
17791780

1780-
if (check_ignored_ctl(find_map(imap, term->id, 0)))
1781+
map = find_map(imap, term->id, 0);
1782+
if (check_ignored_ctl(map))
17811783
return;
17821784

17831785
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
@@ -1809,8 +1811,12 @@ static void build_connector_control(struct usb_mixer_interface *mixer,
18091811
usb_mixer_elem_info_free(cval);
18101812
return;
18111813
}
1812-
get_connector_control_name(mixer, term, is_input, kctl->id.name,
1813-
sizeof(kctl->id.name));
1814+
1815+
if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name)))
1816+
strlcat(kctl->id.name, " Jack", sizeof(kctl->id.name));
1817+
else
1818+
get_connector_control_name(mixer, term, is_input, kctl->id.name,
1819+
sizeof(kctl->id.name));
18141820
kctl->private_free = snd_usb_mixer_elem_free;
18151821
snd_usb_mixer_add_control(&cval->head, kctl);
18161822
}

sound/usb/mixer_maps.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,24 @@ static const struct usbmix_name_map asus_rog_map[] = {
369369
{}
370370
};
371371

372+
/* TRX40 mobos with Realtek ALC1220-VB */
373+
static const struct usbmix_name_map trx40_mobo_map[] = {
374+
{ 18, NULL }, /* OT, IEC958 - broken response, disabled */
375+
{ 19, NULL, 12 }, /* FU, Input Gain Pad - broken response, disabled */
376+
{ 16, "Speaker" }, /* OT */
377+
{ 22, "Speaker Playback" }, /* FU */
378+
{ 7, "Line" }, /* IT */
379+
{ 19, "Line Capture" }, /* FU */
380+
{ 17, "Front Headphone" }, /* OT */
381+
{ 23, "Front Headphone Playback" }, /* FU */
382+
{ 8, "Mic" }, /* IT */
383+
{ 20, "Mic Capture" }, /* FU */
384+
{ 9, "Front Mic" }, /* IT */
385+
{ 21, "Front Mic Capture" }, /* FU */
386+
{ 24, "IEC958 Playback" }, /* FU */
387+
{}
388+
};
389+
372390
/*
373391
* Control map entries
374392
*/
@@ -500,7 +518,7 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
500518
},
501519
{ /* Gigabyte TRX40 Aorus Pro WiFi */
502520
.id = USB_ID(0x0414, 0xa002),
503-
.map = asus_rog_map,
521+
.map = trx40_mobo_map,
504522
},
505523
{ /* ASUS ROG Zenith II */
506524
.id = USB_ID(0x0b05, 0x1916),
@@ -512,11 +530,11 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
512530
},
513531
{ /* MSI TRX40 Creator */
514532
.id = USB_ID(0x0db0, 0x0d64),
515-
.map = asus_rog_map,
533+
.map = trx40_mobo_map,
516534
},
517535
{ /* MSI TRX40 */
518536
.id = USB_ID(0x0db0, 0x543d),
519-
.map = asus_rog_map,
537+
.map = trx40_mobo_map,
520538
},
521539
{ 0 } /* terminator */
522540
};

sound/usb/quirks-table.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3635,4 +3635,18 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
36353635
}
36363636
},
36373637

3638+
#define ALC1220_VB_DESKTOP(vend, prod) { \
3639+
USB_DEVICE(vend, prod), \
3640+
.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { \
3641+
.vendor_name = "Realtek", \
3642+
.product_name = "ALC1220-VB-DT", \
3643+
.profile_name = "Realtek-ALC1220-VB-Desktop", \
3644+
.ifnum = QUIRK_NO_INTERFACE \
3645+
} \
3646+
}
3647+
ALC1220_VB_DESKTOP(0x0414, 0xa002), /* Gigabyte TRX40 Aorus Pro WiFi */
3648+
ALC1220_VB_DESKTOP(0x0db0, 0x0d64), /* MSI TRX40 Creator */
3649+
ALC1220_VB_DESKTOP(0x0db0, 0x543d), /* MSI TRX40 */
3650+
#undef ALC1220_VB_DESKTOP
3651+
36383652
#undef USB_DEVICE_VENDOR_SPEC

0 commit comments

Comments
 (0)