Bug 213851
Summary: | Microphone LED is always on in the Thinkpad X220, T420 and W520 | ||
---|---|---|---|
Product: | Drivers | Reporter: | Peter Weber (peter.weber) |
Component: | Sound(ALSA) | Assignee: | Jaroslav Kysela (perex) |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | iam, perex |
Priority: | P1 | ||
Hardware: | x86-64 | ||
OS: | Linux | ||
See Also: | https://bugzilla.kernel.org/show_bug.cgi?id=214641 | ||
Kernel Version: | 5.13.x | Subsystem: | |
Regression: | Yes | Bisected commit-id: | |
Attachments: |
amixer -c0 contents
Sound LED debug patch Sound LED debug patch v2 Fix 'Capture Switch' change notifications |
Description
Peter Weber
2021-07-25 16:55:12 UTC
When the ThinkPad is docked into a docking-station (with USB-Microphone attached to it) the LED remains always off. Vice versa. This is a regression introduced by new alsa LED control. Please edit the bug, set component: sound(alsa) and assignee perex@perex.cz (I'm not sure if you have privilege to assign) Which controls are bound to the Mic LED ? cat /sys/devices/virtual/sound/ctl-led/mic/card0/list and 'amixer -c 0 controls' Replace 0 with the HDA card number, if different. On 5.13.1 $ cat /sys/devices/virtual/sound/ctl-led/mic/card0/list 7 $ amixer -c 0 controls numid=18,iface=CARD,name='Dock Headphone Jack' numid=16,iface=CARD,name='Dock Mic Jack' numid=22,iface=CARD,name='HDMI/DP,pcm=3 Jack' numid=28,iface=CARD,name='HDMI/DP,pcm=7 Jack' numid=34,iface=CARD,name='HDMI/DP,pcm=8 Jack' numid=19,iface=CARD,name='Headphone Jack' numid=14,iface=CARD,name='Internal Mic Phantom Jack' numid=15,iface=CARD,name='Mic Jack' numid=17,iface=CARD,name='Speaker Phantom Jack' numid=13,iface=MIXER,name='Master Playback Switch' numid=12,iface=MIXER,name='Master Playback Volume' numid=4,iface=MIXER,name='Headphone Playback Switch' numid=3,iface=MIXER,name='Headphone Playback Volume' numid=43,iface=MIXER,name='PCM Playback Volume' numid=9,iface=MIXER,name='Mic Boost Volume' numid=7,iface=MIXER,name='Capture Switch' numid=6,iface=MIXER,name='Capture Volume' numid=23,iface=MIXER,name='IEC958 Playback Con Mask' numid=29,iface=MIXER,name='IEC958 Playback Con Mask',index=1 numid=35,iface=MIXER,name='IEC958 Playback Con Mask',index=2 numid=24,iface=MIXER,name='IEC958 Playback Pro Mask' numid=30,iface=MIXER,name='IEC958 Playback Pro Mask',index=1 numid=36,iface=MIXER,name='IEC958 Playback Pro Mask',index=2 numid=25,iface=MIXER,name='IEC958 Playback Default' numid=31,iface=MIXER,name='IEC958 Playback Default',index=1 numid=37,iface=MIXER,name='IEC958 Playback Default',index=2 numid=26,iface=MIXER,name='IEC958 Playback Switch' numid=32,iface=MIXER,name='IEC958 Playback Switch',index=1 numid=38,iface=MIXER,name='IEC958 Playback Switch',index=2 numid=5,iface=MIXER,name='Auto-Mute Mode' numid=11,iface=MIXER,name='Beep Playback Switch' numid=10,iface=MIXER,name='Beep Playback Volume' numid=44,iface=MIXER,name='Digital Capture Volume' numid=8,iface=MIXER,name='Internal Mic Boost Volume' numid=2,iface=MIXER,name='Speaker Playback Switch' numid=1,iface=MIXER,name='Speaker Playback Volume' numid=21,iface=PCM,name='Capture Channel Map' numid=20,iface=PCM,name='Playback Channel Map' numid=27,iface=PCM,name='ELD',device=3 numid=40,iface=PCM,name='Playback Channel Map',device=3 numid=33,iface=PCM,name='ELD',device=7 numid=41,iface=PCM,name='Playback Channel Map',device=7 numid=39,iface=PCM,name='ELD',device=8 numid=42,iface=PCM,name='Playback Channel Map',device=8 On 5.12 $ amixer -c 0 controls numid=20,iface=CARD,name='Dock Headphone Jack' numid=18,iface=CARD,name='Dock Mic Jack' numid=24,iface=CARD,name='HDMI/DP,pcm=3 Jack' numid=30,iface=CARD,name='HDMI/DP,pcm=7 Jack' numid=36,iface=CARD,name='HDMI/DP,pcm=8 Jack' numid=21,iface=CARD,name='Headphone Jack' numid=16,iface=CARD,name='Internal Mic Phantom Jack' numid=17,iface=CARD,name='Mic Jack' numid=19,iface=CARD,name='Speaker Phantom Jack' numid=14,iface=MIXER,name='Master Playback Switch' numid=13,iface=MIXER,name='Master Playback Volume' numid=4,iface=MIXER,name='Headphone Playback Switch' numid=3,iface=MIXER,name='Headphone Playback Volume' numid=45,iface=MIXER,name='PCM Playback Volume' numid=9,iface=MIXER,name='Mic Boost Volume' numid=12,iface=MIXER,name='Mic Mute-LED Mode' numid=7,iface=MIXER,name='Capture Switch' numid=6,iface=MIXER,name='Capture Volume' numid=25,iface=MIXER,name='IEC958 Playback Con Mask' numid=31,iface=MIXER,name='IEC958 Playback Con Mask',index=1 numid=37,iface=MIXER,name='IEC958 Playback Con Mask',index=2 numid=26,iface=MIXER,name='IEC958 Playback Pro Mask' numid=32,iface=MIXER,name='IEC958 Playback Pro Mask',index=1 numid=38,iface=MIXER,name='IEC958 Playback Pro Mask',index=2 numid=27,iface=MIXER,name='IEC958 Playback Default' numid=33,iface=MIXER,name='IEC958 Playback Default',index=1 numid=39,iface=MIXER,name='IEC958 Playback Default',index=2 numid=28,iface=MIXER,name='IEC958 Playback Switch' numid=34,iface=MIXER,name='IEC958 Playback Switch',index=1 numid=40,iface=MIXER,name='IEC958 Playback Switch',index=2 numid=5,iface=MIXER,name='Auto-Mute Mode' numid=11,iface=MIXER,name='Beep Playback Switch' numid=10,iface=MIXER,name='Beep Playback Volume' numid=46,iface=MIXER,name='Digital Capture Volume' numid=8,iface=MIXER,name='Internal Mic Boost Volume' numid=15,iface=MIXER,name='Mute-LED Mode' numid=2,iface=MIXER,name='Speaker Playback Switch' numid=1,iface=MIXER,name='Speaker Playback Volume' numid=23,iface=PCM,name='Capture Channel Map' numid=22,iface=PCM,name='Playback Channel Map' numid=29,iface=PCM,name='ELD',device=3 numid=42,iface=PCM,name='Playback Channel Map',device=3 numid=35,iface=PCM,name='ELD',device=7 numid=43,iface=PCM,name='Playback Channel Map',device=7 numid=41,iface=PCM,name='ELD',device=8 numid=44,iface=PCM,name='Playback Channel Map',device=8 Note that on 5.13 there's no 'Mute-LED Mode' and 'Mic Mute-LED Mode' The ALSA mixer controls for the LED mode were removed, only the sysfs interface is available to set the LED mode now. numid=7,iface=MIXER,name='Capture Switch' The Mic LED mute should follow this switch. Could you try to control this mixer element using 'alsamixer' or 'amixer' ? This element is not visible in alsamixer. When I press mute button physically, the state changes correctly. Checked with amixer -c0 cget numid=7,iface=MIXER,name='Capture Switch' $ amixer -c0 cget numid=7,iface=MIXER,name='Capture Switch' numid=7,iface=MIXER,name='Capture Switch' ; type=BOOLEAN,access=rw------,values=2 : values=on,on $ amixer cset numid=7,iface=MIXER,name='Capture Switch' on,on numid=2,iface=MIXER,name='Capture Switch' ; type=BOOLEAN,access=rw------,values=1 : values=on Note that the numid's are different (2 vs 7) and only a single value. Is this the issue? Sorry, nevermind, forget to add "-c0". $ amixer -c0 cset numid=7,iface=MIXER,name='Capture Switch' on numid=7,iface=MIXER,name='Capture Switch' ; type=BOOLEAN,access=rw------,values=2 : values=on,on on/off does not make led change, it always on. In alsamixer, you need to switch to the capture view (F4). I don't see a problem in the control_led.c code (the ledtrig_audio_set() call seems straight and should follow the attached element). You may attach also a different element for the check. If you set the Mic LED mute mode to 'off', the function is correct? (In reply to Jaroslav Kysela from comment #9) > In alsamixer, you need to switch to the capture view (F4). I know, but there's no such switch. https://files.catbox.moe/o8if48.png Capture bar doesn't have mute capability either. > I don't see a problem in the control_led.c code (the ledtrig_audio_set() > call seems straight and should follow the attached element). You may attach > also a different element for the check. When I attach 13 (speaker mute) to mic led, it works. This element has only one value (on or off), while element 7 (mic mute) has two values: on,on or off,off. Could this be the cause of ths issue? > > If you set the Mic LED mute mode to 'off', the function is correct? When I set Mic LED mute mode to 'off' on 5.12, it works correctly. Created attachment 298145 [details]
amixer -c0 contents
The microphone is stereo by the way.
I've set it to Sound(ALSA). Jaroslav (perex) is already here :) (In reply to ValdikSS from comment #10) > (In reply to Jaroslav Kysela from comment #9) > > In alsamixer, you need to switch to the capture view (F4). > > I know, but there's no such switch. > https://files.catbox.moe/o8if48.png > Capture bar doesn't have mute capability either. The red 'CAPTURE' state means that the capture path is active (unmuted). The space key controls this in the F4 view. > > I don't see a problem in the control_led.c code (the ledtrig_audio_set() > > call seems straight and should follow the attached element). You may attach > > also a different element for the check. > > When I attach 13 (speaker mute) to mic led, it works. This element has only > one value (on or off), while element 7 (mic mute) has two values: on,on or > off,off. > Could this be the cause of ths issue? The Mic LED should be active when both values for 'Capture Switch' are off. The new code evaluates all values. Could you apply the attached patch (led-debug) and show me the 'CTL LED' lines from dmesg when you toggle the 'Capture Switch' on and off ? Created attachment 298169 [details]
Sound LED debug patch
0x4000000 is mic led, 0x2000000 is speaker led. Mic led lights up on boot and does not switch after switching capture or pressing the physical button. No new records are printed on switching. Pressing speaker mute button adds prints. [ 19.665980] CTL LED GET: access=0x4000000 value[0]=0 [ 19.665983] CTL LED GET: access=0x4000000 value[1]=0 [ 19.665984] CTL LED STATE: access=0x4000000 route=0 [ 19.665988] CTL LED GET: access=0x2000000 value[0]=0 [ 19.665989] CTL LED STATE: access=0x2000000 route=0 [ 19.665992] CTL LED GET: access=0x2000000 value[0]=0 [ 19.665994] CTL LED STATE: access=0x2000000 route=0 [ 19.665996] CTL LED GET: access=0x4000000 value[0]=0 [ 19.665997] CTL LED GET: access=0x4000000 value[1]=0 [ 19.665998] CTL LED STATE: access=0x4000000 route=0 [ 46.178143] CTL LED GET: access=0x2000000 value[0]=1 [ 46.178149] CTL LED STATE: access=0x2000000 route=1 [ 245.647248] CTL LED GET: access=0x2000000 value[0]=0 [ 245.647254] CTL LED STATE: access=0x2000000 route=0 [ 246.467618] CTL LED GET: access=0x2000000 value[0]=1 [ 246.467624] CTL LED STATE: access=0x2000000 route=1 [ 247.087296] CTL LED GET: access=0x2000000 value[0]=0 [ 247.087320] CTL LED STATE: access=0x2000000 route=0 [ 247.876807] CTL LED GET: access=0x2000000 value[0]=1 [ 247.876813] CTL LED STATE: access=0x2000000 route=1 Created attachment 298179 [details]
Sound LED debug patch v2
Please, provide new output from the updated debug patch. [авг 3 15:48] CTL LED ADD/VALUE: access=0x4000003/0x4000000 [ +0,000008] CTL LED GET: access=0x4000000 value[0]=1 [ +0,000002] CTL LED STATE: access=0x4000000 route=1 [ +0,000013] CTL LED GET: access=0x2000000 value[0]=1 [ +0,000001] CTL LED STATE: access=0x2000000 route=1 [ +0,000007] CTL LED GET: access=0x2000000 value[0]=1 [ +0,000001] CTL LED STATE: access=0x2000000 route=1 [ +0,000004] CTL LED GET: access=0x4000000 value[0]=1 [ +0,000001] CTL LED STATE: access=0x4000000 route=1 No new records upon switching. Do you see element change events using the 'amixer -c 0 events' for the 'Capture Switch'? Replace zero with your HDA card number. No, there's no events for CAPTURE switch. There are for speaker though. ... Ready to listen... Poll ok: 1 event value: numid=2,iface=MIXER,name='Speaker Playback Switch' event value: numid=2,iface=MIXER,name='Speaker Playback Switch' event value: numid=13,iface=MIXER,name='Master Playback Switch' event value: numid=2,iface=MIXER,name='Speaker Playback Switch' event value: numid=13,iface=MIXER,name='Master Playback Switch' event value: numid=13,iface=MIXER,name='Master Playback Switch' So the problem does not seem to be related to the LED code. Takashi, do you have any idea why 'Capture Switch' does not generate change notifications? 'Capture Switch' does not generate change notifications on older kernels as well (tested with 5.10.56). Created attachment 298287 [details]
Fix 'Capture Switch' change notifications
Please, test this patch.
(In reply to Jaroslav Kysela from comment #23) > Created attachment 298287 [details] > Fix 'Capture Switch' change notifications > > Please, test this patch. It works. LED works correctly with the patch, `amixer -c0 events` shows the event. Queued to upstream. Thank you for your co-operation with the debugging and testing. Should be fixed in 5.14. As well as 5.13.13. |