Bug 42740

Summary: No sound with kernel 3.2.*
Product: Drivers Reporter: Ansa89 (ansalonistefano)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: florian, tiwai
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.2.5 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: Alsa-info for kernel 3.1.10
Alsa-info for kernel 3.2.5
Aplay on kernel 3.2.5
Alsa-info for kernel 3.2.5 with 3.5mm jack headphone plugged in
Kernel compile log
A test patch to suppress multi-io creations for Realtek
Patch to fix the routing on Acer Aspire 5935 (for 3.2 kernel)
Additional fix patch
Additional fix patch (correct one)

Description Ansa89 2012-02-07 11:29:35 UTC
Starting with kernel 3.2 series, I can't get any sound from my notebook.
With kernel 3.0.20 and 3.1.10 all works as expected.

Hardware:
- Acer Aspire 5935g
- HDA Intel - Realtek ALC 889


If you need other info, ask me.
Comment 1 Ansa89 2012-02-07 11:52:11 UTC
Forgot one thing: with kernel 3.2.* I can still change the volume of channels and all related things with "alsamixer".
Comment 2 Takashi Iwai 2012-02-08 08:57:01 UTC
Please give alsa-info.sh outputs (run with --no-upload option) on both working (3.0.x or 3.1.x) and non-working (3.2.x) kernels.
Comment 3 Ansa89 2012-02-08 09:45:16 UTC
Created attachment 72317 [details]
Alsa-info for kernel 3.1.10
Comment 4 Ansa89 2012-02-08 09:45:54 UTC
Created attachment 72318 [details]
Alsa-info for kernel 3.2.5
Comment 5 Ansa89 2012-02-08 09:50:14 UTC
Since I hadn't "alsa-info.sh", I get it with:
wget -O alsa-info.sh http://www.alsa-project.org/alsa-info.sh

Hope this is the correct way.
Comment 6 Takashi Iwai 2012-02-08 09:56:18 UTC
Thanks, that's correct.

Did you test both speaker(s) and the headphone outputs?
Comment 7 Takashi Iwai 2012-02-08 10:03:25 UTC
As a quick look, I see anything wrong in the setup.
How did you test?  Could you check via aplay like

    % aplay -Dplughw -vv somefile.wav

??
Comment 8 Ansa89 2012-02-08 10:09:58 UTC
(In reply to comment #6)
> Thanks, that's correct.
> 
> Did you test both speaker(s) and the headphone outputs?
Sorry, I don't understand.
Do you mean if I tried to plug headphone/external speaker through a 3.5mm jack?
If so, then no, I don't.

The only external peripheral is a microphone plugged into the "microphone-in"
port.



(In reply to comment #7)
> As a quick look, I see anything wrong in the setup.
> How did you test?  Could you check via aplay like
> 
>     % aplay -Dplughw -vv somefile.wav
> 
> ??
Tested with "mplayer file.mp3" and it doesn't show off any error/warning related to sound.

Now I will reboot, try aplay and post the output.
Comment 9 Ansa89 2012-02-08 10:42:10 UTC
Created attachment 72319 [details]
Aplay on kernel 3.2.5

The output is the same (according to "diff") on kernel 3.1.10.
Comment 10 Ansa89 2012-02-08 10:50:27 UTC
I tried to plug the headphone and (surprise!) I can hear sound (from the headphone).
What is the source of this strange behavior?
Comment 11 Takashi Iwai 2012-02-08 11:00:47 UTC
(In reply to comment #8)
> (In reply to comment #6)
> > Thanks, that's correct.
> > 
> > Did you test both speaker(s) and the headphone outputs?
> Sorry, I don't understand.
> Do you mean if I tried to plug headphone/external speaker through a 3.5mm
> jack?
> If so, then no, I don't.

Well, I thought the machine has a built-in speaker.
What output did you test exactly?  Only from the headphone jack?
Or from any other outputs?

> Tested with "mplayer file.mp3" and it doesn't show off any error/warning
> related to sound.

There should be no "error" in this bug.  In the user-space side, everything looks OK.  It's just some missing piece in the driver.
Comment 12 Takashi Iwai 2012-02-08 11:03:48 UTC
(In reply to comment #10)
> I tried to plug the headphone and (surprise!) I can hear sound (from the
> headphone).
> What is the source of this strange behavior?

So, do you mean that the headphone output didn't work unless you re-plug the headphone?

In anyway, please give alsa-info.sh outputs before and after working.
Comment 13 Ansa89 2012-02-08 11:18:02 UTC
(In reply to comment #11)
> Well, I thought the machine has a built-in speaker.
> What output did you test exactly?  Only from the headphone jack?
> Or from any other outputs?
The machine is a laptop with integrated speakers and a port where plug the headphone.
The problem is with integrated speakers (normally I use them to hear sounds).
If I plug the 3.5mm jack headphone, then I can hear sounds from headphone (still no sound from integrated speakers) and when unplug it we come back to initial situation.

Again I will reboot, catch output and post it.
Comment 14 Ansa89 2012-02-08 11:41:13 UTC
Created attachment 72320 [details]
Alsa-info for kernel 3.2.5 with 3.5mm jack headphone plugged in

The difference from attachment 72318 [details] should be:
@@ -279,7 +279,7 @@
     Conn = ATAPI, Color = Unknown
     DefAssociation = 0x1, Sequence = 0x0
     Misc = NO_PRESENCE
-  Pin-ctls: 0x40: OUT
+  Pin-ctls: 0x00:
   Unsolicited: tag=00, enabled=0
   Connection: 5
      0x0c 0x0d 0x0e 0x0f* 0x26
Comment 15 Takashi Iwai 2012-02-10 13:18:27 UTC
The difference is just because the speaker is turned off by the auto-mute feature of the headphone.

Just to be sure, try to unmute "Surround", "Center" and "LFE" mixer switches.  And turn off "Auto-Mute Mode".  Does this change anything?

Other than that, I run out of idea.  There is no difference in the init sequence between 3.0/3.1 and 3.2.  The only difference is that the assignment of DAC, but this must work.
Comment 16 Ansa89 2012-02-10 14:01:27 UTC
(In reply to comment #15)
> Just to be sure, try to unmute "Surround", "Center" and "LFE" mixer switches. 
> And turn off "Auto-Mute Mode".  Does this change anything?
Tried, but no luck, I can't hear nothing from integrated speakers.
Comment 17 Takashi Iwai 2012-02-10 14:21:43 UTC
OK, could you double-check that the speaker output works with 3.1.10 kernel?

If it's confirmed to work, copy sound/pci/hda/patch_realtek.c from 3.2 kernel, and build again and test.  Does it still work?

If the speaker is still working with the new patch_realtek.c, try to copy sound/pci/hda/hda_intel.c.  Edit the file like below:

--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2160,7 +2160,7 @@ static void azx_clear_irq_pending(struct azx *chip)
        spin_unlock_irq(&chip->reg_lock);
 }
 
-#ifdef CONFIG_X86
+#if 0
 static int azx_pcm_mmap(struct snd_pcm_substream *substream,
                        struct vm_area_struct *area)
 {

and rebuild and retest.  If the speaker is still working with this change, try to copy the whole files in sound/pci/hda.
Comment 18 Ansa89 2012-02-10 15:03:14 UTC
Created attachment 72353 [details]
Kernel compile log

(In reply to comment #17)
> OK, could you double-check that the speaker output works with 3.1.10 kernel?

Yes, it works.

> If it's confirmed to work, copy sound/pci/hda/patch_realtek.c from 3.2
> kernel,
> and build again and test.  Does it still work?

When I try to compile (with modified sources), it returns me an error (see attachment 72321 [details]).
Comment 19 Ansa89 2012-02-10 15:05:45 UTC
(In reply to comment #18)
> When I try to compile (with modified sources), it returns me an error (see
> attachment 72321 [details]).

Whoops! I mean attachment 72353 [details].
Comment 20 Takashi Iwai 2012-02-10 15:17:49 UTC
I guess you are copying from 3.3-rc?  Let's try from 3.2 kernel.
Comment 21 Ansa89 2012-02-10 15:42:44 UTC
I copied "sound/pci/hda/patch_realtek.c" to 3.1.10 kernel from 3.2.5 kernel.
Comment 22 Takashi Iwai 2012-02-10 16:32:53 UTC
OK, I seem to have tested wrongly then.

Instead, start from hda_intel.c (with patch).  If it still works, copy all files in sound/pci/hda/*.  And touch include/linux/export.h.  Then you should be able to build, at least.
Comment 23 Ansa89 2012-02-10 18:20:18 UTC
(In reply to comment #22)
> Instead, start from hda_intel.c (with patch).

It works.


> copy all files in sound/pci/hda/*.  And touch include/linux/export.h.
> Then you should be able to build, at least.

I can't build:
sound/pci/hda/hda_codec.c: In function ‘get_jack_default_name’:
sound/pci/hda/hda_codec.c:5275: error: ‘SND_JACK_LINEIN’ undeclared (first use in this function)
sound/pci/hda/hda_codec.c:5275: error: (Each undeclared identifier is reported only once
sound/pci/hda/hda_codec.c:5275: error: for each function it appears in.)
make[3]: *** [sound/pci/hda/hda_codec.o] Error 1
make[2]: *** [sound/pci/hda] Error 2
make[1]: *** [sound/pci] Error 2
make: *** [sound] Error 2
Comment 24 Takashi Iwai 2012-02-11 07:56:19 UTC
Just disable CONFIG_SND_HDA_INPUT_JACK kconfig.
Comment 25 Ansa89 2012-02-11 12:43:54 UTC
(In reply to comment #22)
> If it still works, copy all files in sound/pci/hda/*.
> And touch include/linux/export.h. Then you should be
> able to build, at least.

Disabling CONFIG_SND_HDA_INPUT_JACK, it compiles, but the internal speakers doesn't work.
Comment 26 Takashi Iwai 2012-02-13 11:50:40 UTC
Thanks, so something got broken in patch_realtek.c, as it seems.

Please go back to the clean 3.2.x, and try to apply the patch below.  It just disables the multi-io creation so that the speaker is assigned to DAC 0x03 like in 3.1.x kernel.
Comment 27 Takashi Iwai 2012-02-13 11:51:47 UTC
Created attachment 72361 [details]
A test patch to suppress multi-io creations for Realtek
Comment 28 Ansa89 2012-02-13 12:19:12 UTC
Good news: with the patch to suppress multi-io creations, it works.
However the "surround", "center" and "lfe" controls disappeared from alsamixer (I think this is the normal behavior).

Personal conclusion: since I don't need "surround", "center" and "lfe" controls, then the bug is fixed for me.
Moreover I don't know if the patch break support for other sound devices.
Comment 29 Takashi Iwai 2012-02-13 12:50:01 UTC
OK, then I'll work on the "right" patch.  The patch in comment 27 will be never applied.  It's just a test to identify the problem.
Comment 30 Ansa89 2012-02-13 13:07:26 UTC
(In reply to comment #29)
> The patch in comment 27 will be never applied.
> It's just a test to identify the problem.

Yes, that was obvious.

So can we mark this bug as "RESOLVED"?
Comment 31 Takashi Iwai 2012-02-13 13:16:55 UTC
Try the patch below instead (for 3.2 kernel).  It should fix the routing of Aspire 5935 to be as in 3.1 kernel.
Comment 32 Takashi Iwai 2012-02-13 13:17:35 UTC
Created attachment 72362 [details]
Patch to fix the routing on Acer Aspire 5935 (for 3.2 kernel)
Comment 33 Ansa89 2012-02-13 14:17:46 UTC
(In reply to comment #31)
> Try the patch below instead (for 3.2 kernel).  It should fix the routing of
> Aspire 5935 to be as in 3.1 kernel.

Reverted previous change, then applied attachment 72362 [details] .
It works and alsamixer shows again "surround", "center" and "lfe" controls.
Comment 34 Takashi Iwai 2012-02-13 14:41:27 UTC
Thanks.  Now the patch is merged to the sound git tree.
It'll be merged back to 3.2.y tree once when reached to the upstream Linus tree.

We can close this bug now :)
Comment 35 Ansa89 2012-02-13 14:55:14 UTC
(In reply to comment #34)
> It'll be merged back to 3.2.y tree

Also to 3.3 tree?
Comment 36 Takashi Iwai 2012-02-13 15:00:37 UTC
Sure.  Linus tree is 3.3 tree for now.
Comment 37 Ansa89 2012-02-13 15:07:12 UTC
Ok, thanks for your patience and all your work.
Comment 38 Takashi Iwai 2012-02-17 09:26:13 UTC
I found another problem with my previous patch.  It wrongly sets the connections for surround and CLFE outputs.  The additional patch below fixes the problem.

I'll queue it up for 3.3 and 3.2-stable.
Comment 39 Takashi Iwai 2012-02-17 09:27:05 UTC
Created attachment 72423 [details]
Additional fix patch
Comment 40 Takashi Iwai 2012-02-17 09:30:36 UTC
Created attachment 72424 [details]
Additional fix patch (correct one)

Sorry, a wrong patch was attached in the previous comment...
Comment 41 Ansa89 2012-02-19 09:57:35 UTC
In 3.3-rc4 changelog I see
"ALSA: hda - Fix silent speaker output on Acer Aspire 6935"
but should be
"ALSA: hda - Fix silent speaker output on Acer Aspire 5935"
or I'm wrong?

BTW the important thing is that your patch was merged into mainline.
Comment 42 Florian Mickler 2012-02-19 10:56:22 UTC
A patch referencing this bug report has been merged in Linux v3.3-rc4:

commit 02a237b24d57e2e2d5402c92549e9e792aa24359
Author: Takashi Iwai <tiwai@suse.de>
Date:   Mon Feb 13 15:25:07 2012 +0100

    ALSA: hda - Fix silent speaker output on Acer Aspire 6935
Comment 43 Florian Mickler 2012-02-27 22:27:32 UTC
A patch referencing this bug report has been merged in Linux v3.3-rc5:

commit ef8d60fb79614a86a82720dc2402631dbcafb315
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Feb 17 10:12:38 2012 +0100

    ALSA: hda/realtek - Fix surround output regression on Acer Aspire 5935