Bug 14078

Summary: Headphone jack gives no sound (macbook pro 4.1)
Product: Drivers Reporter: sveina
Component: Sound(ALSA)Assignee: Takashi Iwai (tiwai)
Status: RESOLVED CODE_FIX    
Severity: normal CC: sveina, tiwai
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.30-rc2-00106-ga9fd4f3 Subsystem:
Regression: No Bisected commit-id:
Attachments: alsa-info output on speakers
alsa-info output on headphones
Alsa-info output for last working version (on speakers)
Alsa-info output for last working version (on headphones)
alsa-info output, post hda-verb, with headphones plugged before running hda-verb
alsa-info output for model=auto, triple hda-verb invocation
Fix / improve ALC889A mbp3 quirk

Description sveina 2009-08-28 08:04:28 UTC
As of commit a9fd4f3fcdc7e5757424f7e5888f660cf34bb1a9 (git-bisected), on a macbook pro 4.1, when headphones are plugged in the speakers mute yet the headphones produce no sound whatsoever. It's possible to manually unmute the speakers while headphones are plugged in; no combination of settings gives sound on the headphones.

Prior to this, alsa correctly switched between headphone and speaker output.
Comment 1 sveina 2009-08-28 08:05:25 UTC
Note, git-bisection was completed using only patches that touch sound/pci/hda, and so may theoretically be inaccurate.
Comment 2 Takashi Iwai 2009-08-28 08:21:45 UTC
Does this still happen with 2.6.31-rc8 kernel?
If yes, please give alsa-info.sh output (run with --no-upload option).
Comment 3 sveina 2009-08-28 18:29:26 UTC
Created attachment 22890 [details]
alsa-info output on speakers

Output on 2.6.31-rc8; headphones still not working
Comment 4 sveina 2009-08-28 18:30:08 UTC
Created attachment 22891 [details]
alsa-info output on headphones
Comment 5 Takashi Iwai 2009-08-28 21:56:04 UTC
So, if I understand correctly, the speaker is correctly muted automatically via the headphone plugging (and I suppose unmute after unplugging).  But, the no sound comes from the headphone.  Right?

What happens if you raise "Line-Out Playback Volume"?  For example,
    % amixer -c0 set "Line-Out" 0dB
Comment 6 sveina 2009-08-28 21:59:57 UTC
You understand correctly.

The line-out control does nothing, on its own or in combination, nor do any others; I've tried unmuting and raising the volume using every control in alsamixer (including the input ones).
Comment 7 Takashi Iwai 2009-08-28 22:04:32 UTC
OK, then try to get hda-verb program from:
    http://ftp.kernel.org/pub/linux/kernel/people/tiwai/misc/hda-verb/

and run like below (as root):
    # hda-verb /dev/snd/hwC0D0 0x15 SET_PIN_WID 0xc0

(Note that this requires the hd-audio drivers built with CONFIG_SND_HDA_HWDEP=y.)

Does it give any change?
Comment 8 Takashi Iwai 2009-08-28 22:07:48 UTC
Also, try to load snd-hda-intel module with model=auto option, and adjust mixer again.  Does it work better?
Comment 9 sveina 2009-08-28 23:10:41 UTC
hda-verb did nothing, before or after reloading with model=auto.

Loading snd-hda-intel with model=auto caused alsamixer to show a number of new channels, including one for headphones; it looked quite promising. Unfortunately, it caused no sound to be emitted, period, in either headphone or speaker mode.
Comment 10 Takashi Iwai 2009-08-29 06:23:11 UTC
If this doesn't work, please give alsa-info.sh output at this state.
(In reply to comment #9)
> hda-verb did nothing, before or after reloading with model=auto.
 
That hda-verb command is for without model option.
Do load the driver without model=auto option, run hda-verb command, and give alsa-info.sh output again.

> Loading snd-hda-intel with model=auto caused alsamixer to show a number of
> new
> channels, including one for headphones; it looked quite promising.
> Unfortunately, it caused no sound to be emitted, period, in either headphone
> or
> speaker mode.

MacBookPro requires GPIO1 setup with model=auto.  Run the following sequence:
    # hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x01
    # hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR 0x01
    # hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x01

Then try again.  If this doesn't work, give alsa-info.sh at this state, too.
Comment 11 Takashi Iwai 2009-08-29 08:17:24 UTC
Also, if you can have the old working version, please give alsa-info.sh output on that.  In that way, we can compare the difference what was actually changed.
Comment 12 sveina 2009-08-29 10:20:37 UTC
Created attachment 22894 [details]
Alsa-info output for last working version (on speakers)
Comment 13 sveina 2009-08-29 10:20:59 UTC
Created attachment 22895 [details]
Alsa-info output for last working version (on headphones)
Comment 14 sveina 2009-08-29 10:26:00 UTC
Created attachment 22896 [details]
alsa-info output, post hda-verb, with headphones plugged before running hda-verb
Comment 15 sveina 2009-08-29 10:30:24 UTC
Created attachment 22897 [details]
alsa-info output for model=auto, triple hda-verb invocation

Indeed, this didn't work either. No output, with speakers or without.
Comment 16 Takashi Iwai 2009-08-30 10:07:59 UTC
Could you try the patch below (without model option)?
This will add the individual Headphone and Speaker volumes, too.

Also, the Line-Out volume is renamed as Surround volume since it's the optional surround volume for 4ch mode.
Comment 17 Takashi Iwai 2009-08-30 10:09:13 UTC
Created attachment 22910 [details]
Fix / improve ALC889A mbp3 quirk
Comment 18 sveina 2009-08-30 10:50:06 UTC
That worked perfectly; thank you very much. Not only do the headphones work, but I can now control the headphone and speaker volume separately, the way I could in OS X back when I used it. I vote to apply it. ;)

One cosmetic flaw: The speaker volume shows up at the far right of alsamixer, instead of next to the headphone controls like they ought to. That is, it goes "master - headphones - pcm - (...lots of extra controls...) - speaker", while it ought to go "master - headphones - speaker - pcm".

I don't know if you have any control over the order they show up there, but if it's an easy fix, I'd appreciate fixing that.
Comment 19 Takashi Iwai 2009-08-31 10:50:40 UTC
Thanks for checking.  The patch is now in sound git tree and also submitted to Linus.

Regarding the speaker volume position; this has nothing to do with the kernel but an issue of alsa-lib.  I'm going to fix this later.