@@ -86,6 +86,14 @@ struct alc_spec {
86
86
87
87
unsigned int gpio_mute_led_mask ;
88
88
unsigned int gpio_mic_led_mask ;
89
+ unsigned int mute_led_coef_idx ;
90
+ unsigned int mute_led_coefbit_mask ;
91
+ unsigned int mute_led_coefbit_on ;
92
+ unsigned int mute_led_coefbit_off ;
93
+ unsigned int mic_led_coef_idx ;
94
+ unsigned int mic_led_coefbit_mask ;
95
+ unsigned int mic_led_coefbit_on ;
96
+ unsigned int mic_led_coefbit_off ;
89
97
90
98
hda_nid_t headset_mic_pin ;
91
99
hda_nid_t headphone_mic_pin ;
@@ -4178,6 +4186,73 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4178
4186
}
4179
4187
}
4180
4188
4189
+ /* update mute-LED according to the speaker mute state via COEF bit */
4190
+ static void alc_fixup_mute_led_coefbit_hook (void * private_data , int enabled )
4191
+ {
4192
+ struct hda_codec * codec = private_data ;
4193
+ struct alc_spec * spec = codec -> spec ;
4194
+
4195
+ if (spec -> mute_led_polarity )
4196
+ enabled = !enabled ;
4197
+
4198
+ /* temporarily power up/down for setting COEF bit */
4199
+ enabled ? alc_update_coef_idx (codec , spec -> mute_led_coef_idx ,
4200
+ spec -> mute_led_coefbit_mask , spec -> mute_led_coefbit_off ) :
4201
+ alc_update_coef_idx (codec , spec -> mute_led_coef_idx ,
4202
+ spec -> mute_led_coefbit_mask , spec -> mute_led_coefbit_on );
4203
+ }
4204
+
4205
+ static void alc285_fixup_hp_mute_led_coefbit (struct hda_codec * codec ,
4206
+ const struct hda_fixup * fix ,
4207
+ int action )
4208
+ {
4209
+ struct alc_spec * spec = codec -> spec ;
4210
+
4211
+ if (action == HDA_FIXUP_ACT_PRE_PROBE ) {
4212
+ spec -> mute_led_polarity = 0 ;
4213
+ spec -> mute_led_coef_idx = 0x0b ;
4214
+ spec -> mute_led_coefbit_mask = 1 <<3 ;
4215
+ spec -> mute_led_coefbit_on = 1 <<3 ;
4216
+ spec -> mute_led_coefbit_off = 0 ;
4217
+ spec -> gen .vmaster_mute .hook = alc_fixup_mute_led_coefbit_hook ;
4218
+ spec -> gen .vmaster_mute_enum = 1 ;
4219
+ }
4220
+ }
4221
+
4222
+ /* turn on/off mic-mute LED per capture hook by coef bit */
4223
+ static void alc_hp_cap_micmute_update (struct hda_codec * codec )
4224
+ {
4225
+ struct alc_spec * spec = codec -> spec ;
4226
+
4227
+ if (spec -> gen .micmute_led .led_value )
4228
+ alc_update_coef_idx (codec , spec -> mic_led_coef_idx ,
4229
+ spec -> mic_led_coefbit_mask , spec -> mic_led_coefbit_on );
4230
+ else
4231
+ alc_update_coef_idx (codec , spec -> mic_led_coef_idx ,
4232
+ spec -> mic_led_coefbit_mask , spec -> mic_led_coefbit_off );
4233
+ }
4234
+
4235
+ static void alc285_fixup_hp_coef_micmute_led (struct hda_codec * codec ,
4236
+ const struct hda_fixup * fix , int action )
4237
+ {
4238
+ struct alc_spec * spec = codec -> spec ;
4239
+
4240
+ if (action == HDA_FIXUP_ACT_PRE_PROBE ) {
4241
+ spec -> mic_led_coef_idx = 0x19 ;
4242
+ spec -> mic_led_coefbit_mask = 1 <<13 ;
4243
+ spec -> mic_led_coefbit_on = 1 <<13 ;
4244
+ spec -> mic_led_coefbit_off = 0 ;
4245
+ snd_hda_gen_add_micmute_led (codec , alc_hp_cap_micmute_update );
4246
+ }
4247
+ }
4248
+
4249
+ static void alc285_fixup_hp_mute_led (struct hda_codec * codec ,
4250
+ const struct hda_fixup * fix , int action )
4251
+ {
4252
+ alc285_fixup_hp_mute_led_coefbit (codec , fix , action );
4253
+ alc285_fixup_hp_coef_micmute_led (codec , fix , action );
4254
+ }
4255
+
4181
4256
#if IS_REACHABLE (CONFIG_INPUT )
4182
4257
static void gpio2_mic_hotkey_event (struct hda_codec * codec ,
4183
4258
struct hda_jack_callback * event )
@@ -5964,6 +6039,7 @@ enum {
5964
6039
ALC285_FIXUP_THINKPAD_HEADSET_JACK ,
5965
6040
ALC294_FIXUP_ASUS_HPE ,
5966
6041
ALC285_FIXUP_HP_GPIO_LED ,
6042
+ ALC285_FIXUP_HP_MUTE_LED ,
5967
6043
};
5968
6044
5969
6045
static const struct hda_fixup alc269_fixups [] = {
@@ -7089,6 +7165,10 @@ static const struct hda_fixup alc269_fixups[] = {
7089
7165
.type = HDA_FIXUP_FUNC ,
7090
7166
.v .func = alc285_fixup_hp_gpio_led ,
7091
7167
},
7168
+ [ALC285_FIXUP_HP_MUTE_LED ] = {
7169
+ .type = HDA_FIXUP_FUNC ,
7170
+ .v .func = alc285_fixup_hp_mute_led ,
7171
+ },
7092
7172
};
7093
7173
7094
7174
static const struct snd_pci_quirk alc269_fixup_tbl [] = {
@@ -7234,6 +7314,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7234
7314
SND_PCI_QUIRK (0x103c , 0x8497 , "HP Envy x360" , ALC269_FIXUP_HP_MUTE_LED_MIC3 ),
7235
7315
SND_PCI_QUIRK (0x103c , 0x84e7 , "HP Pavilion 15" , ALC269_FIXUP_HP_MUTE_LED_MIC3 ),
7236
7316
SND_PCI_QUIRK (0x103c , 0x8736 , "HP" , ALC285_FIXUP_HP_GPIO_LED ),
7317
+ SND_PCI_QUIRK (0x103c , 0x877a , "HP" , ALC285_FIXUP_HP_MUTE_LED ),
7237
7318
SND_PCI_QUIRK (0x1043 , 0x103e , "ASUS X540SA" , ALC256_FIXUP_ASUS_MIC ),
7238
7319
SND_PCI_QUIRK (0x1043 , 0x103f , "ASUS TX300" , ALC282_FIXUP_ASUS_TX300 ),
7239
7320
SND_PCI_QUIRK (0x1043 , 0x106d , "Asus K53BE" , ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),
0 commit comments