You are not logged in.

#51 2024-01-27 00:17:10

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

Sir_Potato wrote:

Perfect. I have created a patch file, so we can test whether it works or not.

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 308ec7034cc9..e8a836596bfb 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4623,6 +4623,21 @@ static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
 	}
 }
 
+static void alc236_fixup_hp_mute_led_coefbit2(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 = 0x07;
+		spec->mute_led_coef.mask = 1;
+		spec->mute_led_coef.on = 1;
+		spec->mute_led_coef.off = 0;
+		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
+	}
+}
+
 /* turn on/off mic-mute LED per capture hook by coef bit */
 static int coef_micmute_led_set(struct led_classdev *led_cdev,
 				enum led_brightness brightness)
@@ -7133,6 +7148,7 @@ enum {
 	ALC285_FIXUP_HP_GPIO_LED,
 	ALC285_FIXUP_HP_MUTE_LED,
 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
+	ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
 	ALC236_FIXUP_HP_GPIO_LED,
 	ALC236_FIXUP_HP_MUTE_LED,
 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
@@ -8556,6 +8572,10 @@ static const struct hda_fixup alc269_fixups[] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
 	},
+	[ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
+	    .type = HDA_FIXUP_FUNC,
+	    .v.func = alc236_fixup_hp_mute_led_coefbit2,
+	},
 	[ALC236_FIXUP_HP_GPIO_LED] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc236_fixup_hp_gpio_led,
@@ -9440,6 +9460,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
+	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
-- 
2.41.0

To test this you will have to compile a custom kernel for your system and boot using it. If I'm not mistaken you run Fedora 38.
https://docs.fedoraproject.org/en-US/qu … om-kernel/

The Fedora Docs provide you with the necessary info to compile the kernel.
Don't forget to apply my patch file prior to compiling the kernel, otherwise the changes won't be made.

Hay so,

# On
card=/dev/snd/hwC1D0
sudo hda-verb $card 0x20 0x500 0x7
sudo hda-verb $card 0x20 0x400 0x1

# Off
card=/dev/snd/hwC1D0
sudo hda-verb $card 0x20 0x500 0x7
sudo hda-verb $card 0x20 0x400 0x0

works for me on my HP Laptop, Product Name: HP Laptop 14-fq0xxx, Model : 14-fq0013dx, ProdID: 192T6UA#ABA, SN#: 5CD0418BC9
https://alsa-project.org/db/?f=56793e10 … 1449ec3160

Last edited by Rustmilian (2024-01-27 07:11:01)

Offline

#52 2024-01-27 10:36:54

Sir_Potato
Member
Registered: 2023-01-12
Posts: 30

Re: Enabling Mute Fn Key LED on HP Laptop

Hey there,
in that case the kernel patch for you would be

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index f6f16622f9cc..0d2fbb8b24b3 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -9852,6 +9852,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
+	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
-- 
2.43.0

can you compile it into the kernel and test in on your system?

Offline

#53 2024-01-27 10:53:11

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

I actually created my own patch and modified the official Arch Linux "linux" PKGBUILD and started compiling it a good 1-2 hours ago. It's going to take a while longer as this hardware is pretty terrible.

Glad to see that our patches match up though, that took me longer than I care for to figure out.

My_patch :

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 04a3dffcb..4577ef16b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -9862,6 +9862,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
+	SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
 	SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
 	SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),

Offline

#54 2024-01-27 11:03:47

Sir_Potato
Member
Registered: 2023-01-12
Posts: 30

Re: Enabling Mute Fn Key LED on HP Laptop

Very nice,
when you are done and verified that it is working, report back and I'll send the patch to the maintainers.

Offline

#55 2024-01-27 12:59:40

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

My stupid terminal crashed during compilation sad
Trying again in tty mode.

Last edited by Rustmilian (2024-01-27 13:00:56)

Offline

#56 2024-01-27 23:42:56

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

I tried both my & your patch (separately ofc). unfortunately neither worked, mute LED still doesn't function. sad

Actually for a brief moment during boot, the LED does flash on.

Last edited by Rustmilian (2024-01-27 23:51:41)

Offline

#57 2024-01-28 00:17:51

Sir_Potato
Member
Registered: 2023-01-12
Posts: 30

Re: Enabling Mute Fn Key LED on HP Laptop

Do you by any chance have a model enabled for your Soundcard?
Check /etc/modprobe.d/
maybe you have a file there, which contains some kind of manual override for snd_hda_Intel.

An override would explain, why it flashes for a brief moment during boot, but stops working the moment the override takes control.

Also, are you fully sure, that the patch gets actually applied prior to compilation.
Go into the source directory of your kernel package and check the file.
I had a similar Problem, where due to some syntax error the patch would not be applied by the build tools.

Offline

#58 2024-01-28 00:22:54

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

/etc/modprobe.d/ is empty.
The patch gets applied properly, yes.

on a un-patched kernel the LED doesn't flash at all.

Last edited by Rustmilian (2024-01-28 00:32:36)

Offline

#59 2024-01-28 00:30:43

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

I recently wrote up an Arch Wiki page for my hardware, IDK if you'll find this useful but just in case.

Offline

#60 2024-01-28 12:46:44

Sir_Potato
Member
Registered: 2023-01-12
Posts: 30

Re: Enabling Mute Fn Key LED on HP Laptop

Check if pressing the Mute Hotkey actually mutes the Speakers/Headphone jack. The LED only gets bound to the state of one specific sound device.

What I mean by that is, for example, when I enable sound output over HDMI or my Docking Station the LED stops working.
It only reflects the state of my built-in speakers and headphone jack., because only they are handled by snd_hda_intel.

So go into your system settings and select your speakers as the output, then try to mute them (via Hotkey and via software in the control panel)

If that also doesn't work, then we might need to change the LED binding in software. To do this, first check what the LED is bound to

cat /sys/class/leds/hda::mute/trigger
cat /sys/class/sound/ctl-led/speaker/mode

This will show us what the LED is listening to. If these files do not exist, then something is not right.

The first command should return a block of keywords. Look for

[audio-mute]

what is important here, is that the square brackets are around audio-mute. If not, overwrite it using

sudo sh -c 'echo audio-mute > /sys/class/leds/hda::mute/trigger'

The second command sould return

follow-mute

If not, overwrite with

sudo sh -c 'echo follow-mute > /sys/class/sound/ctl-led/speaker/mode'

and test if it starts working (you might have to restart first).

Last edited by Sir_Potato (2024-01-28 12:53:55)

Offline

#61 2024-01-28 14:03:36

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

The Mute Key actually mutes both Speakers/Headphone jack & HDMI device, both are handled by snd_hda_intel.

The square brackets are around [audio-mute]
cat /sys/class/leds/hda::mute/trigger :

none usb-gadget usb-host rc-feedback kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock ACAD-online disk-activity disk-read disk-write mtd nand-disk cpu cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 cpu6 cpu7 panic BAT0-charging-or-full BAT0-charging BAT0-full BAT0-charging-blink-full-solid rfkill-any rfkill-none bluetooth-power hci0-power rfkill0 [audio-mute] audio-micmute phy0rx phy0tx phy0assoc phy0radio rfkill1

cat /sys/class/sound/ctl-led/speaker/mode :

follow-mute

Offline

#62 2024-01-28 14:09:44

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

Wait, It works. I was using the "Pro Audio" profile which fails to trigger LED.
Is it possible to get the Pro Audio profile to trigger it?

Last edited by Rustmilian (2024-01-28 14:12:10)

Offline

#63 2024-01-28 14:23:00

Sir_Potato
Member
Registered: 2023-01-12
Posts: 30

Re: Enabling Mute Fn Key LED on HP Laptop

Great!
No, at least I don't know a way.
In my case I use the "Play HiFi quality Music" profile. Testing with Pro Audio also doesn't work for me.
Actually Pro Audio breaks my speaker output completely.

Offline

#64 2024-01-28 14:27:02

Sir_Potato
Member
Registered: 2023-01-12
Posts: 30

Re: Enabling Mute Fn Key LED on HP Laptop

https://bbs.archlinux.org/viewtopic.php?id=284592

It seems like it might be possible by writing a script, which would change the LED state whenever pulseaudio events happen.
But if you want the kernel handling your LED then you are stuck with this.

Offline

#65 2024-01-28 15:30:41

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

I don't think the script would work without the kernel component anyway in this case.
I've tried similar scripts in the past that didn't work.

Last edited by Rustmilian (2024-01-28 15:32:42)

Offline

#66 2024-01-28 15:37:26

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

Anyway, thanks for your help. If possible can you link me the patch when you send it to the mailing list? Just so I can keep an eye on it.

Last edited by Rustmilian (2024-01-28 15:59:35)

Offline

#67 2024-01-28 16:02:13

Sir_Potato
Member
Registered: 2023-01-12
Posts: 30

Re: Enabling Mute Fn Key LED on HP Laptop

I have send the patch:
https://patchwork.kernel.org/project/al … ko@web.de/

Will probably take some time before it gets integrated.

Offline

#68 2024-01-28 23:10:49

LongcatOwO
Member
Registered: 2024-01-28
Posts: 2

Re: Enabling Mute Fn Key LED on HP Laptop

Hi, I've been trying this script on my laptop.

Sir_Potato wrote:

Alright, I've come up with a (frankly not very elegant) brute-force solution:

#!/bin/bash

read -p "What's your sound card? Form /dev/snd/hwCxDx": card

echo "Testing GPIO pins, polarity 0"
for i in 0x01 0x02 0x04 0x08 0x10 0x20 0x40;
do
  sudo hda-verb $card 0x01 0x716 $i
  sudo hda-verb $card 0x01 0x717 $i
  sudo hda-verb $card 0x01 0x715 $i
  sleep 0.2
done
echo "Testing GPIO pins, polarity 1"
for i in 0x01 0x02 0x04 0x08 0x10 0x20 0x40;
do
  sudo hda-verb $card 0x01 0x716 $i 
  sudo hda-verb $card 0x01 0x717 $i
  sudo hda-verb $card 0x01 0x715 0x00
  sleep 0.2
done
echo "Testing COEF and INDEX"
start=0x1
end=0xff
for (( i=$start; i <=$end; ++i)); 
do
  for j in 0x1 0x2 0x4 0x8 0x10 0x20 0x40 0x80 0x100 0x200 0x400 0x800 0x1000 0x2000 0x4000 0x8000;
  do
    sudo hda-verb $card 0x20 0x500 $i
    sudo hda-verb $card 0x20 0x400 $j
    sleep 0.2
  done
done

This bash script will test all possible inputs (at least all the ones I think are possible).
You can basically put this in a bash file and run it.
While the script is running, you have to be ready to stop it the moment your LED turns on. So you start the script and wait with your fingers over Ctrl-C.
Each combination will be tested for 0.2 seconds, so you have to be quick about it. There are a lot of possible combinations.
14 GPIO and 4096 COEF commands to be exact. Depending in your case, it could take up to 14 minutes.
If you want, you can change the sleep value to decrease the time, but it will make reacting harder.

Then, when you found the combination that works to turn on your LED we can determine the one which turns it back off.

One important thing: This script will temporarily change basically your entire soundcard configuration. There will be crackling and plopping sounds coming from your speakers. But don't worry, after a system restart everything should go back to normal.

If you are unsure what command turned your LED on, post the console output generated when your LED turned on.

The card I used for the script was /dev/snd/hwC0D0 which if I remember correctly was Realtek ALC236. While I was running the script, I noticed that the output from the hda-verb commands seems to be displayed  at a rate slower (around 1s/command)  than the rate it should have been (0.2s/command), so I stopped the running script using Ctrl-C. But even after pressing it once, the command still seem to be running, so I press Ctrl-C multiple times until it stops. The next time I reboot, /dev/snd/hwC0D0 is gone. I cannot seem to find it anywhere.

sudo alsa-info.sh --upload

cat: '/sys/module/snd_soc_skl_hda_dsp/parameters/*': No such file or directory
Uploading information to www.alsa-project.org ... Done!

Your ALSA information is located at http://alsa-project.org/db/?f=aca54f21eb3d6bd7c53d016561ec880e4a58578d
Please inform the person helping you.

http://alsa-project.org/db/?f=aca54f21e … 0e4a58578d

I suspect this to be a hardware problem since I reinstalled everything from scratch and the sound card still did not appear.

Could you please help me? Thank you in advance.

Last edited by LongcatOwO (2024-01-28 23:13:21)

Offline

#69 2024-01-29 03:09:48

LongcatOwO
Member
Registered: 2024-01-28
Posts: 2

Re: Enabling Mute Fn Key LED on HP Laptop

I finally managed to get it to appear again. Turns out I haven't tried doing a cold restart all these times smile, so the pins on the sound card never got reset. For mute LEDs, I still have none of them working, both audio and microphone.

Offline

#70 2024-01-29 17:52:51

Sir_Potato
Member
Registered: 2023-01-12
Posts: 30

Re: Enabling Mute Fn Key LED on HP Laptop

Happy to hear that it worked out for you. I was worried that I might have to remove the script, if it risks breaking hardware.

First try the commands which worked for other people in this forum. Especially the ones which also use ALC236. It seems like many of those cards use the same controls for their LEDs.

I am very occupied with upcoming university exams, so I won't be able to assist you in the upcoming weeks.
In case you find the necessary commands, post them here and I will create a patch when I have the time.

Offline

#71 2024-01-29 18:34:17

Rustmilian
Member
Registered: 2022-12-25
Posts: 11

Re: Enabling Mute Fn Key LED on HP Laptop

Sir_Potato, I'm a bit sad to hear that you'll be swamped with university exams; hope you do well on them though.
I had emailed you about this previously. I have the green light on making a Arch Wiki page detailing how to solve this issue located here for the time being and I wanted to know if you'd be interested in helping write it. It's currently extremely incomplete but it's coming along.

If anyone else on page is interested in helping you're welcome too.

Use This Talk Page

Offline

Board footer

Powered by FluxBB