Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dell platform adding ucm2 conf with generic mic-mute LEDs feature #105

Closed
GoPerry opened this issue Jun 28, 2021 · 21 comments
Closed

Dell platform adding ucm2 conf with generic mic-mute LEDs feature #105

GoPerry opened this issue Jun 28, 2021 · 21 comments

Comments

@GoPerry
Copy link

GoPerry commented Jun 28, 2021

As the post-patch did, I would need to add one patch for the dell platform which has enabled the generic mic mute feature.
But I did not see the below paths.

/sys/class/sound/ctl-led/speaker
/sys/class/sound/ctl-led/mic

https://www.spinics.net/lists/alsa-devel/msg125821.html

@GoPerry
Copy link
Author

GoPerry commented Jun 28, 2021

root@dell-Latitude-94xx:/sys/module/snd_ctl_led# ll
total 0
drwxr-xr-x 5 root root 0 Jun 28 04:55 ./
drwxr-xr-x 304 root root 0 Jun 23 21:49 ../
-r--r--r-- 1 root root 4096 Jun 28 04:55 coresize
drwxr-xr-x 2 root root 0 Jun 28 04:55 holders/
-r--r--r-- 1 root root 4096 Jun 28 04:57 initsize
-r--r--r-- 1 root root 4096 Jun 28 04:57 initstate
drwxr-xr-x 2 root root 0 Jun 28 04:57 notes/
-r--r--r-- 1 root root 4096 Jun 28 04:55 refcnt
drwxr-xr-x 2 root root 0 Jun 28 04:57 sections/
-r--r--r-- 1 root root 4096 Jun 28 04:57 srcversion
-r--r--r-- 1 root root 4096 Jun 28 04:57 taint
--w------- 1 root root 4096 Jun 28 04:55 uevent

@GoPerry
Copy link
Author

GoPerry commented Jun 28, 2021

snd_ctl_led 24576 0
input_leds 16384 0
ledtrig_audio 16384 4 snd_ctl_led,dell_wmi,snd_sof,dell_laptop

@GoPerry
Copy link
Author

GoPerry commented Jun 28, 2021

@perexg @jwrdegoede

Do I need to add any kernel option to enable the generic mute led ?
Seems like the speaker and mic dirs are not created by default

@jwrdegoede
Copy link
Contributor

You are doing a ll in /sys/module/snd_ctl_led, while you should be doing it in /sys/class/sound/ctl-led.

@GoPerry
Copy link
Author

GoPerry commented Jun 29, 2021

You are doing a ll in /sys/module/snd_ctl_led, while you should be doing it in /sys/class/sound/ctl-led.
Thank you Hans!
correct!
I see the mic and speaker dirs now.

@GoPerry
Copy link
Author

GoPerry commented Jun 30, 2021

root@dell-Latitude-9420:/sys/devices/virtual/sound/ctl-led/mic# echo "follow mute" > mode
root@dell-Latitude-9420:/sys/devices/virtual/sound/ctl-led/mic# ls
brightness card0 mode power uevent
root@dell-Latitude-9420:/sys/devices/virtual/sound/ctl-led/mic# cat mode
follow-mute
root@dell-Latitude-9420:/sys/devices/virtual/sound/ctl-led/mic# cat brightness
1
root@dell-Latitude-9420:/sys/devices/virtual/sound/ctl-led/mic# cat brightness
1
root@dell-Latitude-9420:/sys/devices/virtual/sound/ctl-led/mic# cat brightness
1

did some testing with the ctl-led loaded, the brightsness value is not changed when switching mute/unmute state

@GoPerry
Copy link
Author

GoPerry commented Jun 30, 2021

another problem is that the snd-ctl-led module is not loaded after i add the patch.
Do i need to update alsa-lib ?

@GoPerry
Copy link
Author

GoPerry commented Jun 30, 2021

@jwrdegoede @perexg
Could you help to comment this .

  1. the mic and speaker brightness are not changed when switch mic/spk mute state.
  2. snd-ctl-led is not loaded automatically after the rt715-sdca/init.conf updated to latest

@perexg
Copy link
Member

perexg commented Jun 30, 2021

@GoPerry : You should add configuration like https://www.spinics.net/lists/alsa-devel/msg125821.html to the UCM card. It loads the kernel module and attaches the selected ALSA controls for the LED trigger.

EDIT: The shell commands which are identical to the mentioned UCM config:

  • /sbin/modprobe snd_ctl_led
  • echo -n "DAC1 Playback Switch" > /sys/class/sound/ctl-led/speaker/card0/attach
  • echo -n "ADC Capture Switch" > /sys/class/sound/ctl-led/mic/card0/attach

EDIT2: Changed echo to echo -n.

@GoPerry
Copy link
Author

GoPerry commented Jul 1, 2021

root@dell-Latitude-xx0:/sys/class/sound/ctl-led/mic/card0# echo "ADC Capture Switch" > attach
bash: echo: write error: No such file or directory

root@dell-Latitude-xx0:/sys/class/sound/ctl-led/mic/card0# ls
attach card detach list power reset uevent

It is weird that the attach file cannot be written by this command.

@perexg
Copy link
Member

perexg commented Jul 1, 2021

Try echo -n "ADC Capture Switch" > attach .

@perexg
Copy link
Member

perexg commented Jul 1, 2021

Also, the control should exists. Use amixer -c 0 controls to get list of controls. Perhaps, you want to attach another one.

@GoPerry
Copy link
Author

GoPerry commented Jul 1, 2021

root@dell-Latitude-9420:/sys/class/sound/ctl-led/mic# ls
brightness card0 mode power uevent
root@dell-Latitude-9420:/sys/class/sound/ctl-led/mic# cat brightness
0
root@dell-Latitude-9420:/sys/class/sound/ctl-led/mic# cat brightness
1
root@dell-Latitude-9420:/sys/class/sound/ctl-led/mic# cat brightness
0
root@dell-Latitude-9420:/sys/class/sound/ctl-led/mic# cat brightness
1

It works for me now with right kcontrol.

@GoPerry
Copy link
Author

GoPerry commented Jul 1, 2021

then the only prolem need to resolve is the ucm2 loading snd_ctl_led.

FixedBootSequence [
exec "-/sbin/modprobe snd_ctl_led"
sysw "-/class/sound/chctl-led/mic/card${CardNumber}/attach:rt714 FU02 Capture Switch"
]

I would like to check where the alsa code will call the FixedBootSequence ?

@GoPerry
Copy link
Author

GoPerry commented Jul 1, 2021

Is it the alsa-lib will trigger the FixedBootSequence ?

@GoPerry
Copy link
Author

GoPerry commented Jul 1, 2021

if alsa-lib trigger the FixedBootSequence, then i would need to upgrade the alsa-lib

@perexg
Copy link
Member

perexg commented Jul 1, 2021

You need 1.2.5 alsa-lib and alsa-utils packages. The fixed boot sequence is called from the alsactl utility (invoked via systemd/udev rules).

@perexg
Copy link
Member

perexg commented Jul 1, 2021

sysw "-/class/sound/chctl-led/mic/card${CardNumber}/attach:rt714 FU02 Capture Switch"

Typo? It should be class/sound/ctl-led/....

@jwrdegoede
Copy link
Contributor

Note there also is an selinux issue where selinux is blocking alsactl from doing the modprobe:

https://bugzilla.redhat.com/show_bug.cgi?id=1958210

Try setting enforcing=0 on the kernel commandline as a workaround for now.

@GoPerry
Copy link
Author

GoPerry commented Jul 1, 2021

Note there also is an selinux issue where selinux is blocking alsactl from doing the modprobe:

https://bugzilla.redhat.com/show_bug.cgi?id=1958210

Try setting enforcing=0 on the kernel commandline as a workaround for now.

Thank you Hans, let me try disable the selinux

@GoPerry
Copy link
Author

GoPerry commented Jul 1, 2021

sysw "-/class/sound/chctl-led/mic/card${CardNumber}/attach:rt714 FU02 Capture Switch"

Typo? It should be class/sound/ctl-led/....

yeah, typo, the touchpad corrupting the input method.

@GoPerry GoPerry closed this as completed Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants