Skip to content

Commit 3790a3d

Browse files
pjungkamptiwai
authored andcommitted
ALSA: hda/realtek: Add quirk for Lenovo Yoga9 14IAP7
The Lenovo Yoga 9 14IAP7 is set up similarly to the Thinkpad X1 7th and 8th Gen. It also has the speakers attached to NID 0x14 and the bass speakers to NID 0x17, but here the codec misreports the NID 0x17 as unconnected. The pincfg and hda verbs connect and activate the bass speaker amplifiers, but the generic driver will connect them to NID 0x06 which has no volume control. Set connection list/preferred connections is required to gain volume control. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208555 Signed-off-by: Philipp Jungkamp <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 4a971e8 commit 3790a3d

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6817,6 +6817,43 @@ static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
68176817
}
68186818
}
68196819

6820+
static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
6821+
const struct hda_fixup *fix, int action)
6822+
{
6823+
/*
6824+
* The Pin Complex 0x17 for the bass speakers is wrongly reported as
6825+
* unconnected.
6826+
*/
6827+
static const struct hda_pintbl pincfgs[] = {
6828+
{ 0x17, 0x90170121 },
6829+
{ }
6830+
};
6831+
/*
6832+
* Avoid DAC 0x06 and 0x08, as they have no volume controls.
6833+
* DAC 0x02 and 0x03 would be fine.
6834+
*/
6835+
static const hda_nid_t conn[] = { 0x02, 0x03 };
6836+
/*
6837+
* Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
6838+
* Headphones (0x21) are connected to DAC 0x03.
6839+
*/
6840+
static const hda_nid_t preferred_pairs[] = {
6841+
0x14, 0x02,
6842+
0x17, 0x02,
6843+
0x21, 0x03,
6844+
0
6845+
};
6846+
struct alc_spec *spec = codec->spec;
6847+
6848+
switch (action) {
6849+
case HDA_FIXUP_ACT_PRE_PROBE:
6850+
snd_hda_apply_pincfgs(codec, pincfgs);
6851+
snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6852+
spec->gen.preferred_dacs = preferred_pairs;
6853+
break;
6854+
}
6855+
}
6856+
68206857
enum {
68216858
ALC269_FIXUP_GPIO2,
68226859
ALC269_FIXUP_SONY_VAIO,
@@ -7054,6 +7091,8 @@ enum {
70547091
ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
70557092
ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
70567093
ALC287_FIXUP_LEGION_16ITHG6,
7094+
ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7095+
ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
70577096
};
70587097

70597098
/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -8900,6 +8939,74 @@ static const struct hda_fixup alc269_fixups[] = {
89008939
.type = HDA_FIXUP_FUNC,
89018940
.v.func = alc287_fixup_legion_16ithg6_speakers,
89028941
},
8942+
[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
8943+
.type = HDA_FIXUP_VERBS,
8944+
.v.verbs = (const struct hda_verb[]) {
8945+
// enable left speaker
8946+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8947+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8948+
8949+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8950+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8951+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8952+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8953+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8954+
8955+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8956+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
8957+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8958+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8959+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8960+
8961+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8962+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
8963+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8964+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
8965+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8966+
8967+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8968+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8969+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8970+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8971+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8972+
8973+
// enable right speaker
8974+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8975+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8976+
8977+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8978+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8979+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8980+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8981+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8982+
8983+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8984+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
8985+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8986+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8987+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8988+
8989+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8990+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
8991+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8992+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
8993+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8994+
8995+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8996+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8997+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8998+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8999+
{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9000+
9001+
{ },
9002+
},
9003+
},
9004+
[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9005+
.type = HDA_FIXUP_FUNC,
9006+
.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9007+
.chained = true,
9008+
.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9009+
},
89039010
};
89049011

89059012
static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -9352,6 +9459,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
93529459
SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
93539460
SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
93549461
SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9462+
SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
93559463
SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
93569464
SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
93579465
SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
@@ -9598,6 +9706,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
95989706
{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
95999707
{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
96009708
{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
9709+
{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
96019710
{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
96029711
{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
96039712
{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},

0 commit comments

Comments
 (0)