@@ -920,6 +920,8 @@ static void alc_pre_init(struct hda_codec *codec)
920
920
((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
921
921
#define is_s4_resume (codec ) \
922
922
((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
923
+ #define is_s4_suspend (codec ) \
924
+ ((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
923
925
924
926
static int alc_init (struct hda_codec * codec )
925
927
{
@@ -7183,6 +7185,44 @@ static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
7183
7185
alc245_fixup_hp_gpio_led (codec , fix , action );
7184
7186
}
7185
7187
7188
+ /*
7189
+ * ALC287 PCM hooks
7190
+ */
7191
+ static void alc287_alc1318_playback_pcm_hook (struct hda_pcm_stream * hinfo ,
7192
+ struct hda_codec * codec ,
7193
+ struct snd_pcm_substream * substream ,
7194
+ int action )
7195
+ {
7196
+ alc_write_coef_idx (codec , 0x10 , 0x8806 ); /* Change MLK to GPIO3 */
7197
+ switch (action ) {
7198
+ case HDA_GEN_PCM_ACT_OPEN :
7199
+ alc_write_coefex_idx (codec , 0x5a , 0x00 , 0x954f ); /* write gpio3 to high */
7200
+ break ;
7201
+ case HDA_GEN_PCM_ACT_CLOSE :
7202
+ alc_write_coefex_idx (codec , 0x5a , 0x00 , 0x554f ); /* write gpio3 as default value */
7203
+ break ;
7204
+ }
7205
+ }
7206
+
7207
+ static void alc287_s4_power_gpio3_default (struct hda_codec * codec )
7208
+ {
7209
+ if (is_s4_suspend (codec )) {
7210
+ alc_write_coef_idx (codec , 0x10 , 0x8806 ); /* Change MLK to GPIO3 */
7211
+ alc_write_coefex_idx (codec , 0x5a , 0x00 , 0x554f ); /* write gpio3 as default value */
7212
+ }
7213
+ }
7214
+
7215
+ static void alc287_fixup_lenovo_thinkpad_with_alc1318 (struct hda_codec * codec ,
7216
+ const struct hda_fixup * fix , int action )
7217
+ {
7218
+ struct alc_spec * spec = codec -> spec ;
7219
+
7220
+ if (action != HDA_FIXUP_ACT_PRE_PROBE )
7221
+ return ;
7222
+ spec -> power_hook = alc287_s4_power_gpio3_default ;
7223
+ spec -> gen .pcm_playback_hook = alc287_alc1318_playback_pcm_hook ;
7224
+ }
7225
+
7186
7226
7187
7227
enum {
7188
7228
ALC269_FIXUP_GPIO2 ,
@@ -7470,7 +7510,8 @@ enum {
7470
7510
ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC ,
7471
7511
ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1 ,
7472
7512
ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC ,
7473
- ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1
7513
+ ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1 ,
7514
+ ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318 ,
7474
7515
};
7475
7516
7476
7517
/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -9726,6 +9767,12 @@ static const struct hda_fixup alc269_fixups[] = {
9726
9767
.chained = true,
9727
9768
.chain_id = ALC285_FIXUP_ASUS_GA403U ,
9728
9769
},
9770
+ [ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318 ] = {
9771
+ .type = HDA_FIXUP_FUNC ,
9772
+ .v .func = alc287_fixup_lenovo_thinkpad_with_alc1318 ,
9773
+ .chained = true,
9774
+ .chain_id = ALC269_FIXUP_THINKPAD_ACPI
9775
+ },
9729
9776
};
9730
9777
9731
9778
static const struct snd_pci_quirk alc269_fixup_tbl [] = {
@@ -10394,6 +10441,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
10394
10441
SND_PCI_QUIRK (0x17aa , 0x2318 , "Thinkpad Z13 Gen2" , ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD ),
10395
10442
SND_PCI_QUIRK (0x17aa , 0x2319 , "Thinkpad Z16 Gen2" , ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD ),
10396
10443
SND_PCI_QUIRK (0x17aa , 0x231a , "Thinkpad Z16 Gen2" , ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD ),
10444
+ SND_PCI_QUIRK (0x17aa , 0x231e , "Thinkpad" , ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318 ),
10445
+ SND_PCI_QUIRK (0x17aa , 0x231f , "Thinkpad" , ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318 ),
10397
10446
SND_PCI_QUIRK (0x17aa , 0x30bb , "ThinkCentre AIO" , ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ),
10398
10447
SND_PCI_QUIRK (0x17aa , 0x30e2 , "ThinkCentre AIO" , ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ),
10399
10448
SND_PCI_QUIRK (0x17aa , 0x310c , "ThinkCentre Station" , ALC294_FIXUP_LENOVO_MIC_LOCATION ),
0 commit comments