Bug 71511

Summary: IdeaPad Y410p: Intel HDA Realtek ALC282: loud clicks at startup/shutdown
Product: Drivers Reporter: Guilherme Amadio (guilherme.amadio)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEEDINFO ---    
Severity: normal CC: alan, cmanougian, guilherme.amadio, superquad.vortex2, tiwai
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.13.5-gentoo Subsystem:
Regression: No Bisected commit-id:
Attachments: Verbose ALSA dmesg output
dmesg-grep-ALSA.txt
alsa-info-laptop-amic.txt
Test patch
alsa-info.sh with --no-upload option

Description Guilherme Amadio 2014-03-04 21:00:41 UTC
Created attachment 128021 [details]
Verbose ALSA dmesg output

Hi,

I have an IdeaPad Y410p with an Intel HDA Realtek ALC282, but I have no sound even after I tried all models for alc28x in the documentation (laptop-amic, laptop-dmic, etc). I believe this model may not be properly recognized by the kernel. Here is some data that may help:

$ cat /proc/asound/cards 
 0 [HDMI           ]: HDA-Intel - HDA Intel HDMI
                      HDA Intel HDMI at 0xc2610000 irq 48
 1 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xc2614000 irq 49
$ speaker-test 

speaker-test 1.0.27.2

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib /tmp/portage/media-libs/alsa-lib-1.0.27.2/work/alsa-lib-1.0.27.2/src/pcm/pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
Playback open error: -2,No such file or directory

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: ALC282 Analog [ALC282 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 1: ALC282 Digital [ALC282 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I am also creating an attachment with dmesg output.
Please let me know if you need any more information.

Thank you for your help.

Best,
Guilherme
Comment 1 Raymond 2014-03-05 02:14:53 UTC
[    4.226440] ALSA sound/pci/hda/hda_auto_parser.c:795 hda_codec: ALC282: Apply fix-func for Thinkpad


seem the driver treat your ideapad as thinkpad by this patch


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_realtek.c?id=2793769f4450d9e4845257c953ae278ecdff7d94
Comment 2 Guilherme Amadio 2014-03-05 05:40:02 UTC
Thank you! I had THINKPAD_ACPI=y in my .config, which automatically turned on THINKPAD_ACPI_ALSA_SUPPORT and caused the driver to get confused. After I disabled all options related to ThinkPads, the sound card works. I thought that ThinkPads and IdeaPads had similar hardware, so I didn't give much thought to enabling those options.

However, I now have another problem. At boot and shutdown, I hear very loud pops coming from the speakers. I think this is related to this bug:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1263036

I don't know how to solve it.

I will send new output from dmesg in an attachment. I believe that the lines

[    4.147166] ALSA sound/pci/hda/hda_generic.c:4169 hda-codec: Enable HP auto-muting on NID 0x21
[    4.147170] ALSA sound/pci/hda/hda_generic.c:2993 hda-codec: enabling ADC switching
[    4.147173] ALSA sound/pci/hda/hda_generic.c:4304 hda-codec: Enable auto-mic switch on NID 0x12/0x18/0x0

could be the source of the problem, from what I've seen elsewhere. I will try to investigate that later.

Best regards,
Guilherme
Comment 3 Guilherme Amadio 2014-03-05 05:41:35 UTC
Created attachment 128151 [details]
dmesg-grep-ALSA.txt

New output after sound works, but there are loud pops at boot and shutdown.
Comment 4 Raymond 2014-03-05 06:18:09 UTC
[    4.145613] ALSA sound/pci/hda/hda_auto_parser.c:795 hda_codec: ALC282: Apply fix-func for Thinkpad

have you ask the author whether you need to remove this line since it force all lenovo machine to use thinkpad model ?

- SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Comment 5 Takashi Iwai 2014-03-05 14:38:53 UTC
The false detection of Thinkpad ACPI mixer stuff is rather a bug in thinkpad_acpi driver, if any.  The HD-audio driver merely tries to call the function in thinkpad_acpi driver.

Does the loud click noise appear when you load snd-hda-intel module with model=generic option, too?  With this option, the Realtek-specific code will be skipped, and the boot kernel message should look slightly differently.
Comment 6 Guilherme Amadio 2014-03-05 16:16:59 UTC
By the way, I had THINKPAD_ACPI turned off in the second try, so the fix-func should be a noop, I believe, since I did see an #ifdef switch in the source code in the alsa driver. Just to make sure, though, I commented out the code at hda_auto_parser.c that applied the ThinkPad fix. I still hear the loud click, so I don't think that that is what is causing the problem. I also hear the click with model=generic. The realtek specific code was not skipped when I used this option. I found and 'ideapad' model, but it is under Conexant boards, not Realtek. I tried that anyway and still hear the click.
Comment 7 Takashi Iwai 2014-03-05 16:28:03 UTC
The thinkpad_acpi stuff is definitely irrelevant with the click noise.  I mentioned it just because you failed to get any sounds at the beginning, and if this is still the case, it's a bug in thinkpad_acpi side.

Did you see the difference in kernel messages when you passed model=generic option?  I'm asking this just to make sure whether you performed the test properly.

In anyway, please run alsa-info.sh with --no-upload option, and attach the generated file.  Give the outputs from both model=generic and without model option.

If no Realtek parser is used (with model=generic) but still the click noise is heard, it means that the problem is in the hardware level, and we need some specific workarounds.  It's not possible remotely, and you'll need to figure out at which point it causes the noise by yourself, e.g. by adding some debug print and add extra delay during the device initialization.
Comment 8 Guilherme Amadio 2014-03-05 17:22:21 UTC
Created attachment 128191 [details]
alsa-info-laptop-amic.txt

This is the alsa-info.sh output with snd-hda-intel.model=laptop-amic in the kernel command line. I will upload the output with model=generic later. I do see differences in dmesg, but the click does not go away. I am sure that I am performing the tests correctly.

I don't know if this makes any difference, but I think I should mention that I am using systemd instead of the usual OpenRC init system that Gentoo uses.
Comment 9 Takashi Iwai 2014-03-05 17:25:30 UTC
In your case, you need to pass model=,generic (note the comma) since the first instance is HDMI/DP controller while the second instance is the onboard analog controller.
Comment 10 Guilherme Amadio 2014-03-05 19:40:19 UTC
Ok, now it works and I don't hear any clicks. Thank you very much for your help!

So, just for future reference for people with an IdeaPad Y410p that land here, below are the kernel configuration options and boot parameters that made sound work properly:

Make sure that this is unset, or there will be no sound.

# CONFIG_THINKPAD_ACPI is not set

For the other options, this is what I have:

CONFIG_SND_HDA_INTEL=y
CONFIG_SND_HDA_PREALLOC_SIZE=2048
# CONFIG_SND_HDA_HWDEP is not set
# CONFIG_SND_HDA_INPUT_BEEP is not set
CONFIG_SND_HDA_INPUT_JACK=y
# CONFIG_SND_HDA_PATCH_LOADER is not set
CONFIG_SND_HDA_CODEC_REALTEK=y
# CONFIG_SND_HDA_CODEC_ANALOG is not set
# CONFIG_SND_HDA_CODEC_SIGMATEL is not set
# CONFIG_SND_HDA_CODEC_VIA is not set
CONFIG_SND_HDA_CODEC_HDMI=y
CONFIG_SND_HDA_I915=y
# CONFIG_SND_HDA_CODEC_CIRRUS is not set
# CONFIG_SND_HDA_CODEC_CONEXANT is not set
# CONFIG_SND_HDA_CODEC_CA0110 is not set
# CONFIG_SND_HDA_CODEC_CA0132 is not set
# CONFIG_SND_HDA_CODEC_CMEDIA is not set
# CONFIG_SND_HDA_CODEC_SI3054 is not set
CONFIG_SND_HDA_GENERIC=y
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0

Finally, to hear no loud clicks at startup/shutdown, I passed

snd-hda-intel.model=,generic

to the kernel in the built-in command-line (since I use EFI stub to boot).
Comment 11 Takashi Iwai 2014-03-06 07:25:11 UTC
We still need to fix the Realtek codec driver not to lead to such noises.
Could you try the patch below without model option?
Comment 12 Takashi Iwai 2014-03-06 07:25:58 UTC
Created attachment 128271 [details]
Test patch
Comment 13 Guilherme Amadio 2014-03-07 03:44:25 UTC
Patch tested and it worked. I did not hear any clicks and did not need to pass any options to the module.

Thanks very much for your help!
Comment 14 Chris M 2014-03-09 05:03:49 UTC
Created attachment 128691 [details]
alsa-info.sh with --no-upload option
Comment 15 Chris M 2014-03-09 05:07:59 UTC
Takashi, from this thread: http://comments.gmane.org/gmane.linux.alsa.devel/115772

This is the exact same issue I'm having with this Dell Inspiron 15 7000 Series (Inspiron 15 7537 - or Inspiron 7537 per the alsa-info.txt above).

Passing model=,generic (note the comma) as a test gets rid of the speaker pops on bootup and shutdown.

Card is the same as the IdeaPad410Y:

$ cat /proc/asound/cards
 0 [HDMI           ]: HDA-Intel - HDA Intel HDMI
                      HDA Intel HDMI at 0xe3610000 irq 65
 1 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xe3614000 irq 61

More:

inxi -A
Audio:     Card-1: Intel Lynx Point-LP HD Audio Controller driver: snd_hda_intel Sound: ALSA ver: k3.13-1-amd64
           Card-2: Intel Haswell-ULT HD Audio Controller driver: snd_hda_intel

(Kernel shouldn't matter here)


speaker-test 1.0.27.2

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
Playback open error: -2,No such file or directory


aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: ID 283 Analog [ID 283 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Can you create a patch for this Dell Inspiron 7537 ?
Comment 16 Takashi Iwai 2014-03-10 07:55:01 UTC
Please open another bug report and give alsa-info.sh output in attachment there.
It's a totally different hardware.  Also, make sure that the problem persists with the latest 3.14-rc kernel, too.
Comment 17 Chris M 2014-03-11 05:27:52 UTC
Takashi, it's done at https://bugzilla.kernel.org/show_bug.cgi?id=71861

Thanks
Comment 18 Guilherme Amadio 2015-01-09 12:00:23 UTC
I upgraded my kernel to 3.18.1 and started to hear loud pops at shutdown again, even with the patch in this bug being now part of mainline kernel. The popping doesn't happen during boot. Passing the option snd-hda-intel.model=,generic to the kernel does away with the problem as before. Let me know if you need more information or have a patch that needs testing.

Thanks
Comment 19 Takashi Iwai 2015-01-09 12:46:32 UTC
Then please try to git bisect to figure out the regression commit.