Thinkpad with ALC1318 has a chance of damaging the IC
Hi Takashi,
Thinkpad with ALC1318 has a chance of damaging the IC at S4 resume.
BR,
Kailang
From 14c51609c8c237e35bc7ed31ae28e33a726170f4 Mon Sep 17 00:00:00 2001
From: Kailang Yang <[email protected]>
Date: Wed, 10 Apr 2024 16:57:28 +0800
Subject: [PATCH] ALSA: hda/realtek - Set GPIO3 to default at S4 state for Thinkpad with ALC1318
There is a chance of damaging the IC when S4 resume. Thinkpad with ALC1318 platform need to add this workaround.
Signed-off-by Kailang Yang <[email protected]>
sound/pci/hda/patch_realtek.c +25 -0
@@ -7183,6 +7183,24 @@ static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,alc245_fixup_hp_gpio_led (codec, fix, action); } +static void alc287_s4_power_gpio3_default (struct hda_codec *codec) +{ +if (codec->core.dev.power.power_state ==PMSG_FREEZE ) { +alc_write_coef_idx (codec,0x10 ,0x8806 );/* Change MCLK to GPIO3 */ +alc_write_coefex_idx (codec,0x5a ,0x00 ,0x554f );/* write gpio3 as default value */ + } +} + +static void alc287_fixup_lenovo_thinkpad_with_alc1318 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action !=HDA_FIXUP_ACT_PRE_PROBE ) +return ; + spec->power_hook = alc287_s4_power_gpio3_default; +} +enum {ALC269_FIXUP_GPIO2 ,
@@ -7467,6 +7485,7 @@ enum {ALC285_FIXUP_CS35L56_I2C_2 ,ALC285_FIXUP_CS35L56_I2C_4 ,ALC285_FIXUP_ASUS_GA403U , + ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318, };/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -9690,6 +9709,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_asus_ga403u, }, + [ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc287_fixup_lenovo_thinkpad_with_alc1318, + }, }; static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -10355,6 +10378,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x2318 ,"Thinkpad Z13 Gen2" ,ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD ),SND_PCI_QUIRK (0x17aa ,0x2319 ,"Thinkpad Z16 Gen2" ,ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD ),SND_PCI_QUIRK (0x17aa ,0x231a ,"Thinkpad Z16 Gen2" ,ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD ), +SND_PCI_QUIRK (0x17aa ,0x231e ,"Thinkpad" ,ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318 ), +SND_PCI_QUIRK (0x17aa ,0x231f ,"Thinkpad" ,ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318 ),SND_PCI_QUIRK (0x17aa ,0x30bb ,"ThinkCentre AIO" ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ),SND_PCI_QUIRK (0x17aa ,0x30e2 ,"ThinkCentre AIO" ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ), SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),