Created attachment 114701 [details] alsa-info output on Linux 3.12 (KO) After switching from Linux 3.11 to 3.12, I encounter several sound regressions on Lenovo 3000 N100: 1) I can hear no sound from the speakers. 2) On the headphones, the output volume is low and when I increase it, it quickly becomes saturated. It looks like it's no longer amplified. On alsamixer, there is now an "Auto-Mute" control (boolean). When I enable it, the saturation disappears but the volume is still quite low (much more than with Linux <= 3.11). I'm on Ubuntu 13.10. All was working fine with Linux 3.11. Those issues have appeared since Linux 3.12-rc1. I've seen there has been some changes around the AD1986A quirks for Linux 3.12, maybe is it related?
Created attachment 114711 [details] alsa-info output on Linux 3.11 (OK)
The EAPD seems controlling both outputs on this machine. Try two patches attached below. (These were already merged in the upstream tree for the upcoming 3.13-rc1 pull request.) If this still doesn't work, please give alsa-info.sh outputs with the headphone plugged and unplugged.
Created attachment 114721 [details] Patch #1
Created attachment 114731 [details] Patch #2
I didn't tried the patches on 3.12 but directly tried the kernel 3.13-rc1 instead (since they should be included in this version). It was easier for me to wait for a .deb from Ubuntu, but if needed I'll take some time to rebuild the sound driver with patches for testing. The situation is worse than before: there is no sound at all neither from speakers, nor headphones. I can just hear some background noise from headphones, and changing the volume doesn't seem to change the noise level.
Created attachment 115671 [details] alsa-info output on Linux 3.13-rc1 (no headphones)
Created attachment 115681 [details] alsa-info output on Linux 3.13-rc1 (headphones)
Hrm, interesting, someone must have muted the amp of the NID 0x1b, which is the speaker output, and toggled EAPD wrongly. It doesn't happen with the emulator, so something really hardware-specific behavior. Looking at the alsa-info.sh output, you're using PulseAudio. Could you stop PA and try the raw playback via "aplay -Dplughw -vv foo.wav"? At least, it makes debugging easier. The next thing to test is to boot in runlevel 3, login there, and get the alsa-info.sh output. (I assume that there is no pulseaudio daemon running at this point.) This will be close to the bare state. In alsa-info.sh output, check whether node 0x1b is muted (the amp 0x80 bit), and whether the EAPD value is 0x00 or 0x02. The driver should have unmuted and clears EAPD. If the node 0x1b is in a wrong state, we need a clean initialized driver state. For that, unload snd-hda-intel module manually. Then remove /var/lib/alsa/asound.state or /etc/asound.state file (depending on distro and version). Then reboot the machine and again login in runlevel 3, and take alsa-info.sh. At this time, the mixer should be uninitialized, that is, muted states as default, so you'd need to unmute and adjust Master volume manually.
Ok, without PulseAudio I can get some sound working, but correct amplification (I think), but there's still some issues. 1) First, I booted with PulseAudio disabled and no headphones. No sound from speakers (with the given aplay command). 2) Headphones plugged: I have sound from the right headphone only, on the left only background noise. 3) Headphones unplugged: I have sound from the speakers (right and left). 4) Headphones re-plugged: I have sound from both headphones and speakers. Still no sound from left headphone. 5) While playing some music with rhythmbox, I changed the PMC volume via alsamixer. As soon as I touched this parameter, sound disapeared and I could never get the sound back (until reboot). I don't know if this issue is related, though. I'll attach an alsa-info.txt for each of those steps. Then, I did unload snd-hda-intel and remove /var/lib/alsa/asound.state, rebooted (runlevel 3) without headphones, and took alsa-info.txt. But I experienced exactly the same behaviour than before (steps 1-5). As soon as I started PulseAudio, I couldn't get any sound from speakers/headphones.
Created attachment 115691 [details] alsa-info output on Linux 3.13-rc1 (no PulseAudio #1: no headphones)
Created attachment 115701 [details] alsa-info output on Linux 3.13-rc1 (no PulseAudio #2: headphones)
Created attachment 115711 [details] alsa-info output on Linux 3.13-rc1 (no PulseAudio #3: no headphones)
Created attachment 115721 [details] alsa-info output on Linux 3.13-rc1 (no PulseAudio #4: headphones)
Created attachment 115731 [details] alsa-info output on Linux 3.13-rc1 (no PulseAudio #5: broken after alsamixer)
Created attachment 115741 [details] alsa-info output on Linux 3.13-rc1 (no PulseAudio, asound.state removed, fresh boot)
About step #5 where I broke sound with alsamixer, I just wanted to add that changing PCM volume with it while not running rhythmbox doesn't break anything.
For step #1, If I disable auto-mute before plugging headphones, I can get sound from speakers. But all other steps remain valid.
the headphone and speaker are connected to same DAC in previous version -static const struct hda_verb ad1986a_init_verbs[] = { - /* HP, Line-Out, Surround, CLFE selectors */ - {0x0a, AC_VERB_SET_CONNECT_SEL, 0x0}, - {0x0b, AC_VERB_SET_CONNECT_SEL, 0x0}, https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=53eb1b85402f108d5151338cff4430f30fd9727f [ALSA] hda-codec - Fix AD1986A Lenovo auto-mute The jack detection bit on AD1986A Lenovo N100 seems inverse from the standard definition. Now fixed the detection properly.
My bad, the wrong EAPD was due to another patch in 3.13-rc1. The two patches with 3.12 should have worked. In anyway, try the patch below. I guess AD1986A has a substantial problem with the pin control on/off, so we'd need to use the amp instead.
Created attachment 115871 [details] Fix patch for 3.13-rc1
I tested the patch on 3.13-rc2, but it doesn't seem to change anything. I still have the same behaviour. I'll attach alsa-info outputs. Also, I can hear sound from left headphone (I previously said than I could'nt hear anything from it) but at a volume level very low. It's possible that I did not hear it before because I hadn't adjusted master to 100%.
Created attachment 116911 [details] alsa-info output on Linux 3.13-rc2+patch (headphones)
Created attachment 116921 [details] alsa-info output on Linux 3.13-rc2+patch (no headphones)
In your alsa-info.sh output, "Speaker Playback Switch" is turned off. Try to turn it on: amixer -c0 set Speaker unmute
I got the speakers working again. Nevertheless, there is still some issues: 1) The output volume is lower than in 3.11. In 3.13 I must set PCM volume to 100% to get something similar to what I have in 3.11 with a PCM volume of ~50%. 2) The left headphone volume is always very very low, whatever the volume I set. I also tried changing invidivually left/right volume. 3) When PulseAudio is running, I can hear no sound.
Thanks, at least, a little step forward now :) About 1) it's because the old PCM volume provided the overloaded amp (+12dB) at 100%. So, with 100%, you actually played in 150% volume without knowing. So, the current behavior is actually a bug fix. 2 and 3 are real problems. Now let's check with hda-verb. With the patched 3.13 kernel, play without PulseAudio through the speaker (hp unplugged). While playback, try the following: hda-verb /dev/snd/hwC0D0 0x0b SET_CONN 0 Do you get also lower volume now? Or is it still same? hda-verb /dev/snd/hwC0D0 0x0b SET_CONN 1 should return to the original state. Then, test with the headphone. Play through a headphone, and while playback, hda-verb /dev/snd/hwC0D0 0x0a SET_CONN 1 Does this change the volume? hda-verb /dev/snd/hwC0D0 0x0a SET_CONN 0 should return to the original state.
Yet, another simpler test. Try to turn on "Loopback Mixing" mixer switch via alsamixer -c0, and check whether the speaker output gets lower.
Ok, here are the results (I'm sorry for the long delay, I've been quite busy during the week). 1) hda-verb /dev/snd/hwC0D0 0x0b SET_CONN 0 Only speakers, no headphones: I don't see any difference. 2) hda-verb /dev/snd/hwC0D0 0x0a SET_CONN 1 With headphones plugged: Now I have correct sound volume on the left headphone! 3) Loopback Mixing turned on (off by default) Only speakers, no headphones: I lost sound from the left speaker (or maybe it's very very low, it's hard to tell). With headphones plugged (0x0a SET_CONN 0): No difference (left headphone still very very low) With headphones plugged (0x0a SET_CONN 1): No sound at all. When I run hda-verb commands during playback, it seems that the change is not applied. I have to stop playback, re-run hda-verb, and then restart playback to see a change. Also, when I change volume other than PCM (master, headphones or speakers) during playback, or when I plug/unplug headphones, sound stops playing immediately and I have to unload and reload snd_hda_intel and snd_hda_codec_analog modules in order to get some sound again.
OK, thanks for testing. It seems that AD1986A behaves in a really weird way and has many hidden restrictions (no wonder, it's one of the oldest HD-audio codec chip). Could you try two patches below on top of 3.13-rc3?
Created attachment 117971 [details] Fix patch #1 on 3.13-rc3
Created attachment 117981 [details] Fix patch #2 on 3.13-rc3
Good news today, with the patched 3.13-rc3, everything seems to be working as expected! (I just have to increase a bit the sound volume but you explained above that it's a bugfix.)
FEATURES Supports both AC ’97 and HD audio interfaces so it just work like ac97 if headphone can only shared with front , spec->indep_hp should be zero static hda_nid_t preferred_pairs[] = { 0x1a, 0x03, 0x1b, 0x03, 0x1c, 0x04, 0x1d, 0x05, 0x1e, 0x03, 0 };
spec->indep_hp doesn't matter in this case since the generic parser is smart enough and creates the instance only when it's really available. The patch is now merged to upstream, so let's close the bug. Thanks for your patient testing!
do the internal mic and external mic work as expected ? seem only one mic pin at node 0x1f (Mic1/Mic2) pin do [Both] mean this situation since phanton jack is created even when Misc bit is clear and pincap support Detect ? Node 0x1f [Pin Complex] wcaps 0x400081: Stereo Control: name="Mic Phantom Jack", index=0, device=0 Pincap 0x00001727: IN Detect Trigger ImpSense Vref caps: HIZ 50 GRD 80 Pin Default 0xc2a190f0: [Both] Mic at Ext Front Conn = 1/8, Color = Pink DefAssociation = 0xf, Sequence = 0x0 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=00, enabled=0
The internal mic seems to be working as expected. For external mic, I can't test right now (because I don't have one), but I'll try during the next week.
Ok, I found an external mic for testing. It seems to be working as before. However, I noticed a little change: - in 3.11 I had two "mic" entries, but only one was working (I had to use the same entry for both internal and external mic). - Now with 3.13rc5 I only have one mic entry. It's cleaner this way.
how did you test ? Did you recording in stereo or mono ? do the left channel for internal mic and right channel for external mic jack ? or Do the mic1 and mic2 (internal mic and external mic) are mixed together ? https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=8ab78c7424588c6b1600dcfd70418617a09326b8 the driver previously used LineInAmp at node 0x17 and MicMixAmp at node 0x13 for the Internal Mic playback volume and Mic Playback Volume + HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
I tried both recording in stereo and mono (with audacity), and I coulnd't get any difference between left and right channels, therefore I assume that mic1 and mic2 are mixed together.
try hda_jack_sense_test.py when you plugged the external mic jack is node 0x1f or not https://bugzilla.kernel.org/show_bug.cgi?id=66621 this require hda_codec.py of alsa-tools/hda-analyzer do your n100 really use CD ? control.12 { iface MIXER name 'Capture Source' value Mic comment { access 'read write' type ENUMERATED count 1 item.0 Mic item.1 CD } } Figure 3. Microphone Selection/Mixing Block Diagram MMIX 2CMIC MS MSWP2 MSWP1 MSWP0 Right Left 0 0 0 MIC 1 MIC 1 0 0 1 MIC 2 MIC 2 0 1 0 MIC 2 MIC 1 0 1 1 MIC 1 MIC 2 1 x x MIC 1+2 MIC 1+2 Table 45. MIC_1/2 Swap NID Name Description 0x11 MIC_1/2 Swap Swaps the left/right association of MIC_1/2 on the input pins only. Allows up mix, spreading one microphone to both left and right output channels. Node 0x11 [Audio Selector] wcaps 0x300941: Stereo R/L Connection: 2 0x0f* 0x2b Processing caps: benign=1, ncoeff=0
Here are hda_jack_sense_test.py results. When no mic plugged: Pin 0x1f [Both] Mic Ext at Front (Pink) [] : PD=0 Imp=1400 When external mic is plugged: Pin 0x1f [Both] Mic Ext at Front (Pink) [] : PD=0 Imp=1700 ...but sometimes: Pin 0x1f [Both] Mic Ext at Front (Pink) [] : PD=0 Imp=1800 Is it what you wanted?
About the CD, what is it exactly? is it the CD-Rom line in? How am I supposed to use it? If I try to record from it, I get nothing. hda_jack_sense_test.py gives: Pin 0x22 [Fixed] CD Int at N/A (Unknown) [] :
Table 46. ADI Specific Verb Support Processing State Get 0xF03 N/A (0) Processing State Controls the up-mix function of the MIC_1/2 swap widget. Up-Mix will spread the selected left channel (see the left/right swap feature of the enable EAPD/BTL verb description) to both the left and right channel outputs of this stereo widget. Value Processing State Up-Mix Spreading 0x00 Off Off 0x01 Benign On 0x02 Benign On Set 0x703 Processing State 8 N/A (0) Note that the AD1986 considers both on and benign states as benign. If the on state is set, the AD1986 will set and return the benign state
PD should be 1 when you plug the mic or headphone and 0 when unpluuged is it rare to connect CD to the analog mixer of the codec in laptop ? you can use hda-analyzer to swap the left and right channel of node 0x11 and use hda_verb to turn on/off the up-mixing by ADI specific verb