ALSA: hda/realtek: Add inverted LED quirk for HP ZBook 8 G2a
PATCH 1/1 ALSA: hda/realtek: Add inverted LED quirk for HP ZBook 8 G2a
HP ZBook 8 G2a 14 and 16 (SSIDs 0x103c:0x8f94 and 0x103c:0x8f95) require special handling for the speaker mute LED with inverted behavior compared to the existing ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED.
Add a new dedicated quirk ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED to address the inverted speaker mute led issue. This ensures the LED behaves correctly on the new HP ZBook models.
--- sound/hda/codecs/realtek/alc269.c | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
sound/hda/codecs/realtek/alc269.c +44 -0
@@ -3776,6 +3776,15 @@ static void alc245_hp_spk_mute_led_update(void *private_data, int enabled)alc_update_coef_idx (codec,0x0b ,0x0c , val); } +static void alc245_hp_spk_mute_led_update_inverted (void *private_data,int enabled) +{ +struct hda_codec *codec = private_data; +unsigned int val; + + val = enabled ?0x04 :0x08 ;/* inverted: 0x04 led off, 0x08 led on */ +alc_update_coef_idx (codec,0x0b ,0x0c , val); +} +/* JD2: mute led GPIO3: micmute led */ static void alc245_tas2781_i2c_hp_fixup_muteled (struct hda_codec *codec,const struct hda_fixup *fix,int action)
@@ -3804,6 +3813,34 @@ static void alc245_tas2781_i2c_hp_fixup_muteled(struct hda_codec *codec,alc245_fixup_hp_mute_led_coefbit (codec, fix, action);alc285_fixup_hp_coef_micmute_led (codec, fix, action); } + +static void alc245_tas2781_i2c_hp_fixup_muteled_inverted (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; +hda_nid_t hp_pin =alc_get_hp_pin (spec); +static const hda_nid_t conn[] = {0x02 }; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +if (!hp_pin) { + spec->gen.vmaster_mute.hook = alc245_hp_spk_mute_led_update_inverted; + spec->gen.vmaster_mute_led =1 ; + } + spec->gen.auto_mute_via_amp =1 ; +snd_hda_override_conn_list (codec,0x17 ,ARRAY_SIZE (conn), conn); +break ; +case HDA_FIXUP_ACT_INIT : +if (!hp_pin) +alc245_hp_spk_mute_led_update_inverted (codec, !spec->gen.master_mute); +break ; + } + +tas2781_fixup_txnw_i2c (codec, fix, action); +if (hp_pin) +alc245_fixup_hp_mute_led_coefbit (codec, fix, action); +alc285_fixup_hp_coef_micmute_led (codec, fix, action); +}/* * Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly * at PM resume
@@ -4164,6 +4201,7 @@ enum {ALC256_FIXUP_VAIO_RPL_MIC_NO_PRESENCE ,ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED ,ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED , +ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED ,ALC288_FIXUP_SURFACE_SWAP_DACS ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO , ALC233_FIXUP_LENOVO_GPIO2_MIC_HOTKEY,
@@ -6134,6 +6172,10 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK, }, + [ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc245_tas2781_i2c_hp_fixup_muteled_inverted, + }, [ALC287_FIXUP_LENOVO_YOGA_PRO7] = { .type = HDA_FIXUP_FUNC,/* Reuse the DAC routing selected for ThinkPad X1 Gen7 */
@@ -7361,6 +7403,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8f42 ,"HP ZBook 8 G2a 14W" ,ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x8f57 ,"HP Trekker G7JC" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8f62 ,"HP ZBook 8 G2a 16W" ,ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED ), +SND_PCI_QUIRK (0x103c ,0x8f94 ,"HP ZBook 8 G2a 14" ,ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED ), +SND_PCI_QUIRK (0x103c ,0x8f95 ,"HP ZBook 8 G2a 16" ,ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED ),SND_PCI_QUIRK (0x1043 ,0x1024 ,"ASUS Zephyrus G14 2025" ,ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x1032 ,"ASUS VivoBook X513EA" ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1043, 0x1034, "ASUS GU605C", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
Signature · 1 line
2.43.0
Quoted 42 lines · Chris Chiu
HP ZBook 8 G2a 14 and 16 (SSIDs 0x103c:0x8f94 and 0x103c:0x8f95) require special handling for the speaker mute LED with inverted behavior compared to the existing
ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED.Add a new dedicated quirk
ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTEDto address the inverted speaker mute led issue. This ensures the LED behaves correctly on the new HP ZBook models.Signed-off-by Chris Chiu <[email protected]>--- sound/hda/codecs/realtek/alc269.c | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)sound/hda/codecs/realtek/alc269.c +13
-0@@ -3776,6 +3776,15 @@ static void alc245_hp_spk_mute_led_update(void *private_data, int enabled)alc_update_coef_idx (codec,0x0b ,0x0c , val); } +static void alc245_hp_spk_mute_led_update_inverted (void *private_data,int enabled) +{ +struct hda_codec *codec = private_data; +unsigned int val; + + val = enabled ?0x04 :0x08 ;/* inverted: 0x04 led off, 0x08 led on */ +alc_update_coef_idx (codec,0x0b ,0x0c , val); +} +/* JD2: mute led GPIO3: micmute led */ static void alc245_tas2781_i2c_hp_fixup_muteled (struct hda_codec *codec,const struct hda_fixup *fix,int action)@@ -3804,6 +3813,34 @@ static void alc245_tas2781_i2c_hp_fixup_muteled(struct hda_codec *codec,alc245_fixup_hp_mute_led_coefbit (codec, fix, action);alc285_fixup_hp_coef_micmute_led (codec, fix, action); } + +static void alc245_tas2781_i2c_hp_fixup_muteled_inverted (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{
sound/hda/codecs/realtek/alc269.c static void alc245_tas2781_i2c_hp_fixup_muteled(struct hda_codec *codec, · line 3829
Quoted 10 lines
sound/hda/codecs/realtek/alc269.c +10
-0+struct alc_spec *spec = codec->spec; +hda_nid_t hp_pin =alc_get_hp_pin (spec); +static const hda_nid_t conn[] = {0x02 }; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +if (!hp_pin) { + spec->gen.vmaster_mute.hook = alc245_hp_spk_mute_led_update_inverted; + spec->gen.vmaster_mute_led =1 ; + }
Is there a case without HP pin at all? Those are laptops, right?
sound/hda/codecs/realtek/alc269.c static void alc245_tas2781_i2c_hp_fixup_muteled(struct hda_codec *codec, · line 3842
Quoted 13 lines
sound/hda/codecs/realtek/alc269.c +13
-0+ spec->gen.auto_mute_via_amp =1 ; +snd_hda_override_conn_list (codec,0x17 ,ARRAY_SIZE (conn), conn); +break ; +case HDA_FIXUP_ACT_INIT : +if (!hp_pin) +alc245_hp_spk_mute_led_update_inverted (codec, !spec->gen.master_mute); +break ; + } + +tas2781_fixup_txnw_i2c (codec, fix, action); +if (hp_pin) +alc245_fixup_hp_mute_led_coefbit (codec, fix, action); +alc285_fixup_hp_coef_micmute_led (codec, fix, action);
Hmm, the code flow depends on hp_pin, and it isn't explained why you have to do it in that way. Please give either more comment or description to understand better your changes.
thanks,
Takashi