New HP mute led feature
Hi Takashi,
HP had new mute led feature.
Attach two patches will enable it.
BR,
Kailang
From aa194afcde387b536a66e84dfe994bd558e260bb Mon Sep 17 00:00:00 2001
From: Kailang Yang <[email protected]>
Date: Thu, 19 Mar 2020 16:02:57 +0800
Subject: [PATCH] ALSA: hda/realtek - Add HP new mute led supported
HP new platform has new mute led feature.
sound/pci/hda/patch_realtek.c +60 -0
@@ -4062,6 +4062,60 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, } } +/* update mute-LED according to the speaker mute state via COEF bit */ +static void alc236_fixup_mute_led_coefbit_hook (void *private_data,int enabled) +{ +struct hda_codec *codec = private_data; +struct alc_spec *spec = codec->spec; + +if (spec->mute_led_polarity) + enabled = !enabled; + + enabled ?alc_update_coef_idx (codec,0x34 ,0 ,1 <<5 ) : +alc_update_coef_idx (codec,0x34 ,1 <<5 ,0 ); +} + +static void alc236_fixup_hp_mute_led_coefbit (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mute_led_polarity =0 ; + spec->gen.vmaster_mute.hook = alc236_fixup_mute_led_coefbit_hook; + spec->gen.vmaster_mute_enum =1 ; + } +} + +/* turn on/off mic-mute LED per capture hook */ +static void alc236_hp_cap_micmute_update (struct hda_codec *codec) +{ +struct alc_spec *spec = codec->spec; + +if (spec->gen.micmute_led.led_value) +alc_update_coef_idx (codec,0x35 ,3 <<2 ,2 <<2 ); +else +alc_update_coef_idx (codec,0x35 ,3 <<2 ,1 <<2 ); +} + +static void alc236_fixup_hp_coef_micmute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { +snd_hda_gen_add_micmute_led (codec, alc236_hp_cap_micmute_update); + } +} + +static void alc236_fixup_hp_mute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +alc236_fixup_hp_mute_led_coefbit (codec, fix, action); +alc236_fixup_hp_coef_micmute_led (codec, fix, action); +} +#if IS_REACHABLE (CONFIG_INPUT )static void gpio2_mic_hotkey_event (struct hda_codec *codec,struct hda_jack_callback *event)
@@ -5923,6 +5977,7 @@ enum {ALC294_FIXUP_ASUS_DUAL_SPK ,ALC285_FIXUP_THINKPAD_HEADSET_JACK ,ALC294_FIXUP_ASUS_HPE , + ALC236_FIXUP_HP_MUTE_LED, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7061,6 +7116,10 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC294_FIXUP_ASUS_HEADSET_MIC }, + [ALC236_FIXUP_HP_MUTE_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc236_fixup_hp_mute_led, + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7208,6 +7267,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x83b9 ,"HP Spectre x360" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8497 ,"HP Envy x360" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ), +SND_PCI_QUIRK (0x103c ,0x877d ,"HP" ,ALC236_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
From 21fa892bcd66a7eecdb0721097036f3a55b08a13 Mon Sep 17 00:00:00 2001
From: Kailang Yang <[email protected]>
Date: Wed, 1 Apr 2020 13:25:22 +0800
Subject: [PATCH] ALSA: hda/realtek - Add supported new mute Led for HP
HP Thin Client Note Book supported mute Led.
Hardware PIN was not enough to meet old LED rule.
JD2 to control playback mute led.
GPO3 to control capture mute led.(ALC285 didn't control GPO3 via verb command) This two PIN just could control by COEF register.
sound/pci/hda/patch_realtek.c +61 -0
85 lines not on this page · raw message
Quoted 5 lines · Kailang
Hi Takashi,
HP had new mute led feature.
Attach two patches will enable it.
They don't seem applied cleanly.
Could you rebase to the latest git tree?
Also, it might be worth unifying the handling. Both patches introduce very similar functions, and the values to mask and set can be referred, e.g. spec->coefbit_mask, etc. But such a cleanup can be done in a separate patch later, too.
thanks,
Takashi
Hi Takashi,
I modified as attaches.
BR,
Kailang
Quoted 24 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, April 1, 2020 2:18 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: New HP mute led featureQuoted 5 lines · Kailang
Hi Takashi,
HP had new mute led feature.
Attach two patches will enable it.They don't seem applied cleanly.
Could you rebase to the latest git tree?Also, it might be worth unifying the handling. Both patches introduce very similar functions, and the values to mask and set can be referred, e.g.
spec->coefbit_mask, etc. But such a cleanup can be done in a separate patch later, too.
Quoted 5 lines
thanks,
Takashi
------Please consider the environment before printing this e-mail.
From 93bea1f322358a4bbd1b5d7a054cd2960c0ac91c Mon Sep 17 00:00:00 2001
From: Kailang Yang <[email protected]>
Date: Tue, 7 Apr 2020 14:40:20 +0800
Subject: [PATCH] ALSA: hda/realtek - Add supported new mute Led for HP
HP Note Book supported new mute Led.
Hardware PIN was not enough to meet old LED rule.
JD2 to control playback mute led.
GPO3 to control capture mute led.(ALC285 didn't control GPO3 via verb command) This two PIN just could control by COEF registers.
sound/pci/hda/patch_realtek.c +81 -0
@@ -86,6 +86,14 @@ struct alc_spec {unsigned int gpio_mute_led_mask;unsigned int gpio_mic_led_mask; +unsigned int mute_led_coef_idx; +unsigned int mute_led_coefbit_mask; +unsigned int mute_led_coefbit_on; +unsigned int mute_led_coefbit_off; +unsigned int mic_led_coef_idx; +unsigned int mic_led_coefbit_mask; +unsigned int mic_led_coefbit_on; +unsigned int mic_led_coefbit_off;hda_nid_t headset_mic_pin;hda_nid_t headphone_mic_pin;
@@ -4178,6 +4186,73 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, } } +/* update mute-LED according to the speaker mute state via COEF bit */ +static void alc_fixup_mute_led_coefbit_hook (void *private_data,int enabled) +{ +struct hda_codec *codec = private_data; +struct alc_spec *spec = codec->spec; + +if (spec->mute_led_polarity) + enabled = !enabled; + +/* temporarily power up/down for setting COEF bit */ + enabled ?alc_update_coef_idx (codec, spec->mute_led_coef_idx, + spec->mute_led_coefbit_mask, spec->spec->mute_led_coefbit_off) : +alc_update_coef_idx (codec, spec->mute_led_coef_idx, + spec->mute_led_coefbit_mask, spec->spec->mute_led_coefbit_on); +} + +static void alc285_fixup_hp_mute_led_coefbit (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mute_led_polarity =0 ; + spec->mute_led_coef_idx =0x0b ; + spec->mute_led_coefbit_mask =1 <<3 ; + spec->spec->mute_led_coefbit_on =1 <<3 ; + spec->spec->mute_led_coefbit_off =0 ; + spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook; + spec->gen.vmaster_mute_enum =1 ; + } +} + +/* turn on/off mic-mute LED per capture hook by coef bit */ +static void alc_hp_cap_micmute_update (struct hda_codec *codec) +{ +struct alc_spec *spec = codec->spec; + +if (spec->gen.micmute_led.led_value) +alc_update_coef_idx (codec, spec->mic_led_coef_idx, + spec->mic_led_coefbit_mask, spec->mic_led_coefbit_on); +else +alc_update_coef_idx (codec, spec->mic_led_coef_idx, + spec->mic_led_coefbit_mask, spec->mic_led_coefbit_off); +} + +static void alc285_fixup_hp_coef_micmute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mic_led_coef_idx =0x19 ; + spec->mic_led_coefbit_mask =1 <<13 ; + spec->mic_led_coefbit_on =1 <<13 ; + spec->mic_led_coefbit_off =0 ; +snd_hda_gen_add_micmute_led (codec, alc_hp_cap_micmute_update); + } +} + +static void alc285_fixup_hp_mute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +alc285_fixup_hp_mute_led_coefbit (codec, fix, action); +alc285_fixup_hp_coef_micmute_led (codec, fix, action); +} +#if IS_REACHABLE (CONFIG_INPUT )static void gpio2_mic_hotkey_event (struct hda_codec *codec,struct hda_jack_callback *event)
@@ -5964,6 +6039,7 @@ enum {ALC285_FIXUP_THINKPAD_HEADSET_JACK ,ALC294_FIXUP_ASUS_HPE ,ALC285_FIXUP_HP_GPIO_LED , + ALC285_FIXUP_HP_MUTE_LED, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7089,6 +7165,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_gpio_led, }, + [ALC285_FIXUP_HP_MUTE_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_mute_led, + }, }; static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7234,6 +7314,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8497 ,"HP Envy x360" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8736 ,"HP" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x877a ,"HP" ,ALC285_FIXUP_MUTE_LED ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
From 9e6a6131937ba32c7ef1bcef09e2ed12f8715cba Mon Sep 17 00:00:00 2001
From: Kailang Yang <[email protected]>
Date: Tue, 7 Apr 2020 14:52:42 +0800
Subject: [PATCH] ALSA: hda/realtek - Add HP new mute led supported for ALC236
HP new platform has new mute led feature.
COEF index 0x34 bit 5 to control playback mute led. COEF index 0x35 bit 2 and bit 3 to control Mic mute led.
sound/pci/hda/patch_realtek.c +44 -0
80 lines not on this page · raw message
Quoted 4 lines · Kailang
Hi Takashi,
I modified as attaches.
Thanks. They had, however, a few typos that didn't compile, so I applied them with corrections.
Please check the commits in sound git tree later.
Takashi
Quoted 37 lines
BR,
KailangQuoted 24 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, April 1, 2020 2:18 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: New HP mute led featureQuoted 5 lines · Kailang
Hi Takashi,
HP had new mute led feature.
Attach two patches will enable it.They don't seem applied cleanly.
Could you rebase to the latest git tree?Also, it might be worth unifying the handling. Both patches introduce very similar functions, and the values to mask and set can be referred, e.g.
spec->coefbit_mask, etc. But such a cleanup can be done in a separate patch later, too.Quoted 5 lines
thanks,
Takashi
------Please consider the environment before printing this e-mail.
[2 0001-hp-thinclient-0x877a-mute-led.patch <application/octet-stream (base64)>]
[3 0002-hp-thinclient-0x877d-mute-led.patch <application/octet-stream (base64)>]
Quoted 12 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Tuesday, April 7, 2020 3:51 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: New HP mute led featureQuoted 1 line · Kailang
Quoted 7 lines
Quoted 3 lines
Hi Takashi,
I modified as attaches.
Thanks. They had, however, a few typos that didn't compile, so I applied them with corrections.
Please check the commits in sound git tree later.
Thanks a lot. ^^
Quoted 45 lines
Takashi
Quoted 24 lines
BR,
KailangQuoted 20 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, April 1, 2020 2:18 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>
Subject: Re: New HP mute led featureQuoted 5 lines · Kailang
Hi Takashi,
HP had new mute led feature.
Attach two patches will enable it.They don't seem applied cleanly.
Could you rebase to the latest git tree?Also, it might be worth unifying the handling. Both patches introduce very similar functions, and the values to mask and set can be
referred, e.g.
Quoted 16 lines
Quoted 10 lines
spec->coefbit_mask, etc. But such a cleanup can be done in aspec->separatepatch
later, too.thanks,
Takashi
------Please consider the environment before printing this e-mail.
[2 0001-hp-thinclient-0x877a-mute-led.patch <application/octet-stream (base64)>]
[3 0002-hp-thinclient-0x877d-mute-led.patch <application/octet-stream (base64)>]