Skip to content

Commit f8c11eb

Browse files
khfengtiwai
authored andcommitted
ALSA: usb-audio: Add support for Lenovo ThinkStation P620
Lenovo ThinkStation P620 is like other TRX40 boards, is equipped with two USB audio cards. USB device (17aa:104d) provides functionality for Internal Speaker and Front Headset. It's UAC v2, so it supports insertion control (jack detection). However, when trying to get the connector status of the speaker, an error occurs: [ 5.787405] usb 3-1: cannot get connectors status: req = 0x81, wValue = 0x200, wIndex = 0x1000, type = 0 Since the insertion control works perfectly for the headset, the error for speaker is probably casued by connecting internally. So let's relax the error for a bit if it's a speaker, and always reports it's connected. USB device (17aa:1046) is for rear Line-in, Line-out and Microphone. The insertion control works for all three jacks. However, there's an Function Unit that doesn't work: [ 5.905415] usb 3-6: cannot get ctl value: req = 0x83, wValue = 0xc00, wIndex = 0x1300, type = 4 [ 5.905418] usb 3-6: 19:0: cannot get min/max values for control 12 (id 19) So turn off the FU to avoid the error. Also, add specific card name for both devices, so userspace can easily indentify both cards. Signed-off-by: Kai-Heng Feng <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 103f528 commit f8c11eb

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

sound/usb/mixer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,10 @@ static int mixer_ctl_connector_get(struct snd_kcontrol *kcontrol,
14631463
snd_usb_unlock_shutdown(chip);
14641464

14651465
if (ret < 0) {
1466+
if (strstr(kcontrol->id.name, "Speaker")) {
1467+
ucontrol->value.integer.value[0] = 1;
1468+
return 0;
1469+
}
14661470
error:
14671471
usb_audio_err(chip,
14681472
"cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",

sound/usb/mixer_maps.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,11 @@ static const struct usbmix_name_map asus_rog_map[] = {
370370
{}
371371
};
372372

373+
static const struct usbmix_name_map lenovo_p620_rear_map[] = {
374+
{ 19, NULL, 12 }, /* FU, Input Gain Pad */
375+
{}
376+
};
377+
373378
/* TRX40 mobos with Realtek ALC1220-VB */
374379
static const struct usbmix_name_map trx40_mobo_map[] = {
375380
{ 18, NULL }, /* OT, IEC958 - broken response, disabled */
@@ -573,6 +578,10 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
573578
.map = trx40_mobo_map,
574579
.connector_map = trx40_mobo_connector_map,
575580
},
581+
{ /* Lenovo ThinkStation P620 Rear */
582+
.id = USB_ID(0x17aa, 0x1046),
583+
.map = lenovo_p620_rear_map,
584+
},
576585
{ 0 } /* terminator */
577586
};
578587

sound/usb/quirks-table.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,6 +2794,19 @@ YAMAHA_DEVICE(0x7010, "UB99"),
27942794
QUIRK_RENAME_DEVICE("Rane", "SL-1")
27952795
},
27962796

2797+
/* Lenovo ThinkStation P620 Rear Line-in, Line-out and Microphone */
2798+
{
2799+
USB_DEVICE(0x17aa, 0x1046),
2800+
QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Rear",
2801+
"Lenovo-ThinkStation-P620-Rear"),
2802+
},
2803+
/* Lenovo ThinkStation P620 Internal Speaker + Front Headset */
2804+
{
2805+
USB_DEVICE(0x17aa, 0x104d),
2806+
QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Main",
2807+
"Lenovo-ThinkStation-P620-Main"),
2808+
},
2809+
27972810
/* Native Instruments MK2 series */
27982811
{
27992812
/* Komplete Audio 6 */

0 commit comments

Comments
 (0)