Skip to content

Commit c3cdf18

Browse files
flukejonestiwai
authored andcommitted
ALSA: hda: fixup headset for ASUS GX502 laptop
The GX502 requires a few steps to enable the headset i/o: pincfg, verbs to enable and unmute the amp used for headpone out, and a jacksense callback to toggle output via internal or jack using a verb. Signed-off-by: Luke D Jones <[email protected]> Cc: <[email protected]> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208005 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 6a6660d commit c3cdf18

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

sound/pci/hda/patch_realtek.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5993,6 +5993,40 @@ static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
59935993
snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
59945994
}
59955995

5996+
5997+
static void alc294_gx502_toggle_output(struct hda_codec *codec,
5998+
struct hda_jack_callback *cb)
5999+
{
6000+
/* The Windows driver sets the codec up in a very different way where
6001+
* it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6002+
*/
6003+
if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6004+
alc_write_coef_idx(codec, 0x10, 0x8a20);
6005+
else
6006+
alc_write_coef_idx(codec, 0x10, 0x0a20);
6007+
}
6008+
6009+
static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6010+
const struct hda_fixup *fix, int action)
6011+
{
6012+
/* Pin 0x21: headphones/headset mic */
6013+
if (!is_jack_detectable(codec, 0x21))
6014+
return;
6015+
6016+
switch (action) {
6017+
case HDA_FIXUP_ACT_PRE_PROBE:
6018+
snd_hda_jack_detect_enable_callback(codec, 0x21,
6019+
alc294_gx502_toggle_output);
6020+
break;
6021+
case HDA_FIXUP_ACT_INIT:
6022+
/* Make sure to start in a correct state, i.e. if
6023+
* headphones have been plugged in before powering up the system
6024+
*/
6025+
alc294_gx502_toggle_output(codec, NULL);
6026+
break;
6027+
}
6028+
}
6029+
59966030
static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
59976031
const struct hda_fixup *fix, int action)
59986032
{
@@ -6173,6 +6207,9 @@ enum {
61736207
ALC285_FIXUP_THINKPAD_HEADSET_JACK,
61746208
ALC294_FIXUP_ASUS_HPE,
61756209
ALC294_FIXUP_ASUS_COEF_1B,
6210+
ALC294_FIXUP_ASUS_GX502_HP,
6211+
ALC294_FIXUP_ASUS_GX502_PINS,
6212+
ALC294_FIXUP_ASUS_GX502_VERBS,
61766213
ALC285_FIXUP_HP_GPIO_LED,
61776214
ALC285_FIXUP_HP_MUTE_LED,
61786215
ALC236_FIXUP_HP_MUTE_LED,
@@ -7338,6 +7375,33 @@ static const struct hda_fixup alc269_fixups[] = {
73387375
.chained = true,
73397376
.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
73407377
},
7378+
[ALC294_FIXUP_ASUS_GX502_PINS] = {
7379+
.type = HDA_FIXUP_PINS,
7380+
.v.pins = (const struct hda_pintbl[]) {
7381+
{ 0x19, 0x03a11050 }, /* front HP mic */
7382+
{ 0x1a, 0x01a11830 }, /* rear external mic */
7383+
{ 0x21, 0x03211020 }, /* front HP out */
7384+
{ }
7385+
},
7386+
.chained = true,
7387+
.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7388+
},
7389+
[ALC294_FIXUP_ASUS_GX502_VERBS] = {
7390+
.type = HDA_FIXUP_VERBS,
7391+
.v.verbs = (const struct hda_verb[]) {
7392+
/* set 0x15 to HP-OUT ctrl */
7393+
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7394+
/* unmute the 0x15 amp */
7395+
{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7396+
{ }
7397+
},
7398+
.chained = true,
7399+
.chain_id = ALC294_FIXUP_ASUS_GX502_HP
7400+
},
7401+
[ALC294_FIXUP_ASUS_GX502_HP] = {
7402+
.type = HDA_FIXUP_FUNC,
7403+
.v.func = alc294_fixup_gx502_hp,
7404+
},
73417405
[ALC294_FIXUP_ASUS_COEF_1B] = {
73427406
.type = HDA_FIXUP_VERBS,
73437407
.v.verbs = (const struct hda_verb[]) {
@@ -7711,6 +7775,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
77117775
SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
77127776
SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
77137777
SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
7778+
SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
77147779
SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
77157780
SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
77167781
SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),

0 commit comments

Comments
 (0)