Ubuntu

Poor support for MacBook Pro 5,1: noise, no jack sense, no in-line headset microphones, broken volume control

Reported by Alexey Spiridonov on 2009-11-25
58
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Mactel Support
Undecided
Unassigned
alsa-driver (Ubuntu)
Undecided
Unassigned
linux (Ubuntu)
Low
Chase Douglas
linux-backports-modules-2.6.31 (Ubuntu)
Low
Unassigned

Bug Description

I have carefully read through these bugs:
  https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/337314
  https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/433633
  https://bugs.launchpad.net/alsa-driver/+bug/396563
They conflate a bunch of snd_hda_intel driver issues, and pulseaudio issues across many hardware platforms. However, some of these issues are quite separate between different chipsets. E.g. model=laptop does different things on different chipsets, and doesn't do a thing for my chipset ALC889A. See the full quirks list here:
  http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt

I am reporting this from a x86_64 install, but my sound was broken in exactly the same way when I was running i386.

I have not found a published configuration, which makes the sound on my MacBook Pro 5,1 work completely. I have tried:

1) linux-backports-modules-alsa-generic + snd_hda_linux option "model=mb5" (same as autodetected),
2) default 2.6.31-15-generic + snd_hda_linux option "model=mb5".
In both:
 * (GOOD) Both left and right speakers work (and subwoofer too, I suspect).
 * (BAD) Severe noise issues with headphones -- there is a reasonably quiet white noise floor (though the fact that it's audible is sad). But, on top of that there is a variety of noises, which vary in severity, and every time I unload and reload snd_hda_intel, I get a different result. The noises sometimes sound like radio static -- a crackling that gets quieter and louder with a period of a few seconds. Sometimes, they are tuned, high-pitch tones. The noise pattern varies when I adjust the headphone mixer control. It doesn't get quieter at lower volumes, but changes randomly depending on the slider's position. I tried "position_fix=1" and "=2" as module arguments, to no avail.
 * (BAD) No jack sense: "cat /proc/asound/card*/codec*" is the same regardless of whether headphones are plugged in
 * (BAD) Speakers always on: Volume controls always enable + maximize Front+LFE+Surround outputs (in tandem), never touch headphones (which are muted by default, and labeled "HP" -- which I suspect breaks PulseAudio paths that depend on the string Headphones). The only manual way (i.e. using alsamixer) to silence the speakers is to 0 (but not mute) those three sliders in alsamixer, and then never to touch the PulseAudio volume controls ever again. That's sad.
 * (SLIGHTLY BAD) Headphones should be on by default, not to make users set them up.
 * (BAD) Headset microphones don't work. Apple extensively uses a 3.5 jack standard which combines stereo output and microphone input. This is supported by iPhones & co, and their computers. Apple, and many external vendors manufacture such headsets. The headset works automagically under MacOS, but fails to work under linux, no matter what input settings I choose.

3) linux-backports-modules-alsa-generic + snd_hda_linux option "model=mbp3" (recommended by community page https://help.ubuntu.com/community/MacBook5-1/Karmic),
4) default 2.6.31-15-generic + snd_hda_linux option "model=mbp3".
In both:
 * (GOOD) Tolerable noise floor -- sounds like quiet white noise
 * (BAD) Only the right speaker works, and even that after switching alsamixer from 2 channels to 4 channels.
 * (BAD) No jack sense -- just as above
 * (OKAYISH) The system volume controls affect only the headphone volume. You are free to manually choose the speaker volume via "Surround".
 * (SLIGHTLY BAD) If "4 channel" mode is what it takes to have some semblance of speaker sound, that should be on by default.
 * (BAD) Headset microphones don't work.

5) model=imac24, macpro, and many others -- useless for this machine, no sound, the mixer settings are totally broken, still no jack sense.

The latest karmic backports have no effect on my problems. I have also tried compiling the latest alsa-driver (1.0.21), which didn't solve any of the above problems.

On the basis of the above, I'm changing the community docs to no longer make a blanket recommendation for model=mbp3. People have to make a choice between two different sets of issues.

In an ideal world:

0) The driver would not produce sporadic noise on the headphones.
1) The driver would support jack sense.
2) The driver would add an extra input for microphones connected through the output 3.5 jack.
3) PulseAudio would automatically mute the speakers on headphones being plugged in.
4) PulseAudio would switch to the headset microphone when that's plugged in.
5) PulseAudio would provide overrides for both of those behaviors.

Alexey Spiridonov (snarkmaster) wrote :

This is on 9.10 Karmic Koala, out-of-the-box (+/- backports-alsa as above) with all updates as of November 24, 2009.

f-bert (f-bert) wrote :

Confirmed, on 9.10 Karmic Koala with all updates until November 27, 2009.

summary: - Poor support for MacBook Pro 5,1: no jack sense, no in-line headset
- microphones, broken volume control
+ Poor support for MacBook Pro 5,1: noise, no jack sense, no in-line
+ headset microphones, broken volume control
Alexey Spiridonov (snarkmaster) wrote :

I updated the description to describe a headphone noise problem with mb5. Truly, there is no acceptable choice. I guess I'll listen to music on headphones from mbp3, and switch to mb5 when I really need the speakers. :'(

description: updated
description: updated
Gambit- (g-launchpad) wrote :

Default install of 9.10 produces no audio support at all for a Macbook 5,2. Updating community help page to reflect that.

Alex Murray (alexmurray) wrote :

I've developed a patch against alsa-driver-1.0.22.1 which should fix this (except for the 3-way headset microphone) - it enables auto muting of the speakers when headphones inserted and makes headphones volume controlled by the master volume), which you can test as follows:

First make sure you don't have any versions of linux-backports-modules-alsa installed:

apt-cache --names-only search linux-backports-modules-alsa | cut -f 1 -d ' ' | xargs sudo apt-get remove --purge

Now download alsa driver source and the patch, and compile and install a patched version of the driver:

cd ~
wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.22.1.tar.bz2
wget http://dl.dropbox.com/u/174251/alsa-driver-1.0.22.1-mb5.patch
tar xjf alsa-driver-1.0.22.1.tar.bz2
patch -p0 < alsa-driver-1.0.22.1-mb5.patch
cd alsa-driver-1.0.22.1
./configure
make
sudo make install

Now you need to reboot your machine. If this works I'll push the patch upstream and hopefully we can get it applied to linux-backports-modules-alsa as well.

I tried the patch in comment #5 and unfortunately it didn't work on my MBP 5,1.

The behavior is exactly the same as with backports-modules-alsa (which I removed before installing ASLA from source, as instructed). No auto muting, and it's impossible to mute the speakers and listen with headphones. Either sound comes through speakers and headphones, or not at all.

Ubuntu 9.10 32bit, all patches until 2010-01-15.

Alex Murray (alexmurray) wrote :

Are you sure you executed the following command:

apt-cache --names-only search linux-backports-modules-alsa | cut -f 1 -d ' ' | xargs sudo apt-get remove --purge

since you may have multiple versions of backports-modules-alsa installed.

You probably also need to make sure there are no alsa 'updates' modules - what is the output from the command:

find /lib/modules/`uname -r`/updates

Are you sure you followed all the instructions in comment #5?

Yes I did:

$ apt-cache --names-only search linux-backports-modules-alsa | cut -f 1 -d ' ' | xargs sudo apt-get remove --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package linux-backports-modules-alsa-2.6.31-14-generic is not installed, so not removed
Package linux-backports-modules-alsa-2.6.31-14-generic-pae is not installed, so not removed
Package linux-backports-modules-alsa-2.6.31-16-generic is not installed, so not removed
Package linux-backports-modules-alsa-2.6.31-16-generic-pae is not installed, so not removed
Package linux-backports-modules-alsa-2.6.31-17-generic is not installed, so not removed
Package linux-backports-modules-alsa-2.6.31-17-generic-pae is not installed, so not removed
Package linux-backports-modules-alsa-2.6.31-15-generic is not installed, so not removed
Package linux-backports-modules-alsa-2.6.31-15-generic-pae is not installed, so not removed
Package linux-backports-modules-alsa-karmic-generic is not installed, so not removed
Package linux-backports-modules-alsa-karmic-generic-pae is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version 1.0.22.1.
Compiled on Jan 15 2010 for kernel 2.6.31-17-generic (SMP).

$ find /lib/modules/`uname -r`/updates
/lib/modules/2.6.31-17-generic/updates
/lib/modules/2.6.31-17-generic/updates/dkms
/lib/modules/2.6.31-17-generic/updates/dkms/nvidia.ko
/lib/modules/2.6.31-17-generic/updates/dkms/mbp_nvidia_bl.ko
/lib/modules/2.6.31-17-generic/updates/dkms/wl.ko
/lib/modules/2.6.31-17-generic/updates/dkms/applesmc.ko
/lib/modules/2.6.31-17-generic/updates/dkms/bcm5974.ko

I'm pretty sure I followed all the instructions in comment #5.

Alex Murray (alexmurray) wrote :

Well to be sure you could simply try copying and pasteing the whole lot of commands into a terminal and that should do it...

Alex Murray (alexmurray) wrote :

If it still doesn't work can you attach the contents of the file: /proc/asound/card0/codec#0

Well that's almost what I did already: pasted the commands into a terminal except the configure, make & make install parts which I executed manually.

Alex Murray (alexmurray) wrote :

Hmm that doesn't look 100% correct... you haven't by chance manually overridden the model parameter in /etc/modprobe.d/alsa-base.conf since it doesn't even have the correct mixer names and the unsol (ie. jack auto sense) is definitely not enabled...

Alex Murray (alexmurray) wrote :

In fact it looks like you've got model=mbp3 I bet specified - make sure you don't manually specify any model and it should work

Here's my alsa-base.conf. It doesn't have "mbp31" specified.

Alex Murray (alexmurray) wrote :

Well even though you definitely have the MBP 5,1 (and the same Subsystem & Vendor IDs - which should automatically match to the mb5 model) it looks to have chosen the mbp3 model instead which would only happen if it was overriden when the module was loaded - can you see what the contents of /sys/module/snd_hda_intel/parameters/model is? Otherwise you could change the last line of alsa-base.conf from:

options snd-hda-intel power_save=10 power_save_controller=N

to

options snd-hda-intel power_save=10 power_save_controller=N model=mb5

and manually specify the model yourself.

Thank you Alex, your comment #15 helped me find out that I had specified model=mbp3 in /etc/modprobe.d/options.conf when trying to debug my sound with a previous ALSA version. Removing that file made it choose the mb5 model - and guess what: automute works now.

Vitali Kulikou (sabotatore) wrote :

On my macbook 5.1 work fine! Thanks!

Luke Symes (allsymes) wrote :

@Alex Murray: Thanks for your patch! I just installed it and it works perfectly! Speakers get muted when headphones are plugged in. "Analog Headphones" now shows as a Connecter in Sound Preferences -> Output.
Please send this upstream; it would be great if this could get into Lucid as well.

Changed in alsa-driver (Ubuntu):
status: New → In Progress
Alex Murray (alexmurray) wrote :

I have already sent it upstream and it has been merged into the 2.6.33 kernel - unfortunately lucid will ship with the already released 2.6.32, but hopefully this will make it to the linux-backports-modules-alsa package for lucid.

Changed in linux (Ubuntu):
assignee: nobody → Chase Douglas (chasedouglas)
status: New → In Progress

Alex, thank you for a great patch! Everything worked as you said.

However, I think the noise problem is still here. I'll check on my reference headphones tomorrow, and post. Moreover, setting model=mbp3 doesn't seem to fix the noise issues any more. Is that possible, or am I just confused?

It would be lovely to have the headset microphone work, too. Can I help fix that in any way? If you provide some pointers, I can try to gather the relevant information under OS X, or to experiment under Linux. I'm pretty happy with C debugging and development, just don't know the ALSA stack. If the only thing that's blocking you is the lack of a headset, I'd be happy to help too.

I noticed one other issue, which is probably not ALSA-triggered. There are volume sliders for "Surround" and "LFE". I have no idea what "Surround" is -- it didn't do anything that I could notice. LFE is the subwoofer (low-frequency emitter) -- btw, it would be nice to have a better mixer name for it, if that's easy to fix :). The problem is this: if I use the GNOME volume control (which goes through pulseaudio), and turn the volume all the way down to 0, then hit mute, then LFE and Surround suddenly get set to 0. The only way to get them to return is to turn the volume up to a nonzero value, and then toggle mute twice (or use a full mixer). Seems pretty mysterious to me. The bad thing is that this results in people unexpectedly losing all their low frequency sounds -- I doubt many people aside from me look at alsamixer.

Let me know what you think about the outstanding 3 issues. If necessary, I'll create separate bugs for them.

Yep, the noise issue is definitely still there. I can unload and reload the module, and on some loads it's rather less noticeable, but always crackly at least for some volume slider settings (more on that later). On about 50% of the loads, it's a persistently loud crackly hissing noise with a period of a couple of seconds (it gets quieter and louder).

I do consistently get the "better" (not crackly) noise scenario by switching to mbp3. I don't remember any more if mbp3 used to be even better, but probably not. At any rate, the current mbp3 is tolerable but not great.

Regardless of which module I load, or how lucky I get with the random factors mentioned above, the noise level fluctuates depending on the volume slider. On mbp5, with all other sliders maximized, the noise peaks for Master volume are: 8, 17, 27, 36, 45, 55, 64, 73, 83, 92. The noise volume does not substantially depend on the slider setting (i.e. music is acceptable when it's loud, but useless when it's quiet). On mbp3, there is just a faint hint of crackling at those same settings, but the crackling is much much quieter. The white noise background seems to be about the same, maybe slightly quieter on mbp3.

What other information could I get to help debug this?

Chase Douglas (chasedouglas) wrote :

I'm not sure what the difference is, but I've got no noise at all on my macbook. It is currently outputting to a set of speakers. I get a pop every time a sound is played after a period of no sound, which is likely due to the sound driver powering on and off when idle. Other than that, no issues though.

Chase Douglas (chasedouglas) wrote :

I have submitted the patch upstream for inclusion into a 2.6.32 stable release. When that occurs it should get pulled into the Lucid kernel.

Chase, thanks for submitting the patch. It's a huge improvement. I do see 3 issues outstanding, and am hoping to work through them in this bug, or elsewhere. I would really appreciate your help.

(a) can you post the output of the following command?

$ lspci -v | grep -A7 Audio
00:08.0 Audio device: nVidia Corporation MCP79 High Definition Audio (rev b1)
 Subsystem: nVidia Corporation Device cb79
 Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 21
 Memory at df480000 (32-bit, non-prefetchable) [size=16K]
 Capabilities: <access denied>
 Kernel driver in use: HDA Intel
 Kernel modules: snd-hda-intel

(b) The noise issues are not equally bad on ever module load/reboot. They are also most easily diagnosed in good, sound-isolating headphones. Can you try putting in some good earphones in a quiet place, and slowly scrolling through the Master volume slider in alsamixer?

(c) Can you reproduce the above issue with turning the volume up and down via GNOME Volume Control (or the volume keyboard shortcuts)?

Thanks a lot!

Alexey

Chase Douglas (chasedouglas) wrote :

@Alexey,

(a):
00:08.0 Audio device: nVidia Corporation MCP79 High Definition Audio (rev b1)
 Subsystem: nVidia Corporation Device cb79
 Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 16
 Memory at 93380000 (32-bit, non-prefetchable) [size=16K]
 Capabilities: <access denied>
 Kernel driver in use: HDA Intel
 Kernel modules: snd-hda-intel

(b), (c):
I put on some headphones and started to hear exactly what you are referring to. When I increase the volume I hear static come in, and its volume varied as I increased and decreased the volume (i.e. it didn't just get louder when I increased the volume as expected, it actually randomly increases and decreases as you increase the volume). This occurred both by using alsamixer and the gnome volume control.

Alex Murray (alexmurray) wrote :

@Alexey - indeed I can reproduce both the headphone noise plus the weird muting of LFE and Surround - this sounds like a bug in pulseaudio (since it is muting them in the first place and then not muting them) so I'd file a separate bug about that.

Will have a look at trying to trackdown the static / noise in headphones...

Also LFE is the standard name for subwoofer in ALSA and will likely break lots of things if changed - ie. this is represented by the simple fact that before my patch, the headphones were labelled 'HP' which pulseaudio didnt understand, but simply renaming it to 'Headphone' in my patch makes them controlled with the master volume - so names matter and in this case LFE should definitely not be changed as its basically a standard.

Chase Douglas (chasedouglas) wrote :

The patch to enabled correct headphone port handling has been accepted into the -stable kernel tree for 2.6.32. It should get incorporated into the Lucid kernel from the -stable tree.

I am currently working on incorporating the patch into the linux-backports-modules for karmic.

tags: added: patch
Diderik From (diderik-from) wrote :

I'm afraid this doesn't work for me on my MacBook 5,1/Karmic with the latest upgrades. Compiling/making/installing the driver 1.0.22 (with or without the patch) breaks sound altogether, and the only way I can make it work again is to go:
sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils
sudo apt-get install linux-sound-base alsa-base alsa-utils

I'd be happy to provide more info, just let me know what you might need.

Chase Douglas (chasedouglas) wrote :

@Diderik:

The headphone jack sensing issue is in the alsa driver. None of the packages you mentioned include the alsa drivers; the drivers are included in the linux-image and linux-backports-modules packages. That is why I am working on incorporating the patch into linux-backports-modules which provides backported alsa drivers.

John Dong (jdong) wrote :

Alex's patch works perfectly here on my 17" Macbook Pro unibody!

Stefan Bader (smb) on 2010-02-17
Changed in linux-backports-modules-2.6.31 (Ubuntu):
importance: Undecided → Low
status: New → In Progress
Changed in linux-backports-modules-2.6.31 (Ubuntu):
status: In Progress → Fix Committed
Changed in linux (Ubuntu):
importance: Undecided → Low
Changed in alsa-driver (Ubuntu):
status: In Progress → New
Diderik From (diderik-from) wrote :

Success!

The problem was that the command
apt-cache --names-only search linux-backports-modules-alsa | cut -f 1 -d ' ' | xargs sudo apt-get remove --purge
did not execute properly. It listed the modules to be removed, then asked for confirmation but for some reason automatically aborted. When I realized this, I just manually removed the listed components, and reinstalled the patch.

Thanks.

Luke Symes (allsymes) wrote :

Hey Chase, I see you marked this as Fix Committed for linux-backports-modules-2.6.31, whereabouts has the fix been committed to? I looked at the Ubuntu branches but couldn't see anything.

Chase Douglas (chasedouglas) wrote :

@Luke Symes:

The fix has been committed to the ubuntu-karmic-lbm git tree. It should be released shortly to the karmic-proposed archive. I've pinged the stable release maintainer to determine when it will get released.

Chase Douglas (chasedouglas) wrote :

The hold up is due to a current kernel in -proposed. By policy, a kernel package must have been in -proposed for one full week for testing purposes before it can be pushed to -updates. The stable release maintainer is working to get the current one out to -updates, but if the new kernel with this fix is moved to -proposed it will overwrite the current package there, resetting the timer.

Essentially, the fix will get out there for karmic eventually, but as a side effect of our duty to ensure that a stable release is not destabilized by updates the fix may take a bit longer. If you are anxious, you can find the fix in the kernel team's pre-prososed ppa:

https://launchpad.net/~kernel-ppa/+archive/pre-proposed/

Chase Douglas (chasedouglas) wrote :

The headphone jack fix has been included in the latest lucid kernel release (2.6.32-15). There's nothing new on the sound quality issue. In order to help keep the bugs manageable, I suggest that the sound quality issue be opened as a new bug so that this bug can be used for tracking the headphone jack sensing issue.

Changed in linux (Ubuntu):
status: In Progress → Fix Released
W. Michael Petullo (mike-flyn) wrote :

Has this patch been pushed upstream?

Yes - it is already in the latest 2.6.32 stable kernel and will be in
Ubuntu Lucid which will be released in April

On 6 March 2010 12:53, W. Michael Petullo <email address hidden> wrote:
> Has this patch been pushed upstream?
>
> --
> Poor support for MacBook Pro 5,1: noise, no jack sense, no in-line headset microphones, broken volume control
> https://bugs.launchpad.net/bugs/488103
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Accepted linux-backports-modules-2.6.31 into karmic-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed

Folks, I don't like to say that (after so much work you have done) but I experience for the very first time a strange noise, kind of systematically repeated sound.

I've upgraded today (on MBP5,1 late2008) my Karmic box to use kernel 2.6.31-21-generic, 64-bit and test/use since a few days KDE4.4.1. The patch for the jack sense works, music plays ok and all kind of sounds but there is this _very_ strange noise.

Anyone else the same?

Nikos

Bahh... after a reboot it went away. So false alarm. I really don't know what that was... (?)

Brad Figg (brad-figg) on 2010-03-28
tags: added: kj-triage needs-required-logs no-sound-mic sound-macbook volume-control
Martin Pitt (pitti) on 2010-04-06
tags: added: verification-done
removed: verification-needed
Ben (benmctee) wrote :

Followed #5 exactly as written and it worked perfectly. Thanks for the patch.
Ubuntu 9.10 - Karmic Koala
Macbook 5,1

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-backports-modules-2.6.31 - 2.6.31-21.23

---------------
linux-backports-modules-2.6.31 (2.6.31-21.23) karmic-proposed; urgency=low

  [ Chase Douglas ]

  * ALSA: hda - Improved MacBook (Pro) 5,1 / 5,2 support
    - LP: #488103
  * compat-wireless: update to 2.6.32.8
    - LP: #522824
 -- Stefan Bader <email address hidden> Wed, 17 Mar 2010 23:20:35 +0100

Changed in linux-backports-modules-2.6.31 (Ubuntu):
status: Fix Committed → Fix Released
Changed in linux-backports-modules-2.6.31 (Ubuntu):
assignee: nobody → David Ward (david-ward87)
assignee: David Ward (david-ward87) → nobody
Jérôme Pouiller (jezz) wrote :

As far as I understand, problem with microphone is not solved with this patch, isn't?

I have MacBookPro5,5 and I cannot get internal or external microphone works (at least in a usual way).

Nevertheless, if I do "arecord -c 2", I can get internal microphone works. In this case, it seems to only capture left channel.

If I can help for anything, I will do it.

Alex Murray (alexmurray) wrote :

@Jerome: This patch (and bug report) is for MacBook (Pro) models 5,1 / 5,2 only - if it has some effect for your MacBookPro5,5 then that's great. but it is not intended to - if you are having problems with your MacBook Pro5,5 please file a separate bug.

Changed in alsa-driver (Ubuntu):
status: New → Fix Released
Changed in mactel-support:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers