Bug 64401

Summary: Add MacBook Pro 11,1 to cs4208_fixup_tbl
Product: Drivers Reporter: Alex Fiestas (afiestas)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: normal CC: baronmog, bugzilla.kernel, davidesousa, johnf, lordmocha, mike, tiwai, zamasu110
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.12 Subsystem:
Regression: No Bisected commit-id:
Attachments: one liner patch to add macbook pro 11,1
Patch without space removal
alsa info
Patch with signed-off
Patch to apply GPIO0 fixup for MacBooks as default
alsa-info without patch
spdif, alsa-info, NOT muted
spdif, alsa-info, muted
Patch to fix regression for MBA6
Patch to add pin control for SPDIF
Combined patches for complete fix against linux 3.12

Description Alex Fiestas 2013-11-04 22:23:54 UTC
Created attachment 113341 [details]
one liner patch to add macbook pro 11,1

MacBook Pro 11,1 uses the same codec chip as MBA so we can reuse everything.

If the attached patch is not correct (or commit message) discard it but please, add the Subsystem Id :p
Comment 1 Alex Fiestas 2013-11-04 22:27:40 UTC
Created attachment 113351 [details]
Patch without space removal
Comment 2 Takashi Iwai 2013-11-05 06:52:41 UTC
Thanks for the patch.
Could you give alsa-info.sh output (run it with --no-upload option), too?
Comment 3 Takashi Iwai 2013-11-05 06:56:08 UTC
Also, for including into the upstream, we need your sign-off.
See Documentation/SubmittingPatches section 12 for details.
Comment 4 Alex Fiestas 2013-11-05 08:19:44 UTC
Created attachment 113421 [details]
alsa info
Comment 5 Alex Fiestas 2013-11-05 08:24:24 UTC
Created attachment 113431 [details]
Patch with signed-off
Comment 6 Harry Rod 2013-11-05 08:29:54 UTC
this also effects Macbook Pro 11,2 (and probably 11,3)
Comment 7 Takashi Iwai 2013-11-05 08:55:54 UTC
Thanks.  Looking at alsa-info.sh output, the pin configs appear sane.
Do you really need to override the pin configs with mba6?
That is, isn't it enough to set up GPIO (i.e. using CS4208_GPIO0 instead of CS4208_MBA6)?
Comment 8 Takashi Iwai 2013-11-05 09:33:08 UTC
In other words, does the patch below work instead of yours?
Comment 9 Takashi Iwai 2013-11-05 09:33:52 UTC
Created attachment 113441 [details]
Patch to apply GPIO0 fixup for MacBooks as default
Comment 10 Alex Fiestas 2013-11-05 10:12:06 UTC
Created attachment 113451 [details]
alsa-info without patch

Ignore the rc5 kernel name, it contains the patch for MBA.
Comment 11 Alex Fiestas 2013-11-05 10:30:23 UTC
It works with GPI00 patch !
Comment 12 Takashi Iwai 2013-11-05 10:35:58 UTC
OK, then also check whether all components work properly.
The machine seems to have a bass speaker, and whether the corresponding mixer control really changes its volume.  Also BIOS shows that there is a digital output, independent from HDMI.
Comment 13 David De Sousa 2013-11-05 18:58:48 UTC
Hello, I have a macbook 11,3, applied the patch, now the speakers work, but not the bass speaker, anything I can do to help?
Comment 15 Takashi Iwai 2013-11-05 20:09:12 UTC
Try to pass model=mba6 option to snd-hda-intel module.  Then the pin configuration for MBA6 will be used instead of BIOS setup.
Comment 16 David De Sousa 2013-11-06 01:28:29 UTC
nope, now the bass speaker control in alsamixer disappeared and it's worst than before.

I should have mentioned that without the model=mba6 option, the bass speaker controls did something, although I don't know if it's activating the subwoofer, if I lower it down to 0, the bass goes away, but cranking it up to 100% it just doesn't sound the same as in OSX, very little bass output.
Comment 17 Harry Rod 2013-11-06 02:03:43 UTC
Takashi Iwai: "Also BIOS shows that there is a digital output, independent from HDMI."

Could this be the digital audio output (optical SPDIF) that is combined into the headphone port? (the light for mine is actually stuck on 'amixer set IEC958 off' doesn't turn it off for me like it did on previous models)
Comment 18 Noah Romer 2013-11-06 04:38:28 UTC
The most recent patch does enable the speakers on Macbook Pro 11,2 (the Oct 2013 version). However, the mute button doesn't work.
Comment 19 Takashi Iwai 2013-11-06 07:28:09 UTC
If bass speaker produces any output, it's likely working as expected.  Just check whether the amp is set to full on the corresponding pin.  So I applied the patch in comment 9 now to sound git tree.

The soft bass output is probably the software issue, not the hardware (device driver) issue.  MacOS may be modifying the PCM stream to enhance the bass.

Regarding the digital output: yes, this can be an SPDIF, if it exists.  There are multiple IEC958 controls (HDMI outputs have the same named controls, too), so a simple "amixer set IEC958 off" might not work.  You'd need to specify the exact index, device, etc.

About the mute button: this isn't what the sound driver serves.  Usually the mute key is handled as a normal input key event, and your desktop system should react to it and change the mixer appropriately.  For that, usually you'd just need to adjust the keymap in udev (or systemd) to assign the corresponding key code to AudioMute key symbol.
Comment 20 Alex Fiestas 2013-11-06 09:35:23 UTC
Bass speaker seems to work (even though PulseAudio doesn't seem to do anything with it automatically).

Still trying to figure out how to power off the optical output (SPDIF?)
Comment 21 Takashi Iwai 2013-11-06 11:08:58 UTC
Try to turn on/off "IEC958 Playback Switch" via alsamixer.  Run "alsamixer -c0" (or -c1, depending on the PCI slot).

If this doesn't help, please give alsa-info.sh outputs with both IEC958 on/off states.  (Better to run alsa-info.sh with --no-upload option and attach the outputs to this bugzilla.)
Comment 22 Harry Rod 2013-11-07 04:39:19 UTC
muting all spdif in alsamixer -c0 and alsamixer -c1 does not turn the optical audio off
Comment 23 Harry Rod 2013-11-07 04:39:55 UTC
Created attachment 113691 [details]
spdif, alsa-info, NOT muted
Comment 24 Harry Rod 2013-11-07 04:40:09 UTC
Created attachment 113701 [details]
spdif, alsa-info, muted
Comment 25 Takashi Iwai 2013-11-07 06:56:33 UTC
Looks like your kernel isn't fully patched.  The codec name appears "Cirrus ID 4208".  With the fully patched kernel, it must be "CS4208".

But the SPDIF issue might be independent from that, judging from the alsa-info.sh outputs.  The mixer switch actually turns off IEC958 status enable bit, so it works as expected.  But it doesn't seem to influence on the SPDIF light.

I guess the SPDIF red light is always on even if you pass model=mba6 option, right?  (I know it breaks other things, just to check about the SPDIF.)

If so, the only possible control, except for secret vendor-specific verbs, is to power down the converter.  Try like:
    hda-verb /dev/snd/hwC1D0 0x0e SET_POWER_STATE 0x03

Does it turn off?  If yes, does the following recover?
    hda-verb /dev/snd/hwC1D0 0x0e SET_POWER_STATE 0x00
Comment 26 Harry Rod 2013-11-07 22:30:57 UTC
hi, model=mba6 did not seem to turn the light off.
however, those two hda-verb commands both worked.
Comment 27 Takashi Iwai 2013-11-08 06:49:33 UTC
OK, what about this?  For light off,
    hda-verb /dev/snd/hwC1D0 0x21 SET_PIN_WID 0x00
and for light on,
    hda-verb /dev/snd/hwC1D0 0x21 SET_PIN_WID 0x40
Comment 28 Harry Rod 2013-11-08 08:28:22 UTC
yes, those two both worked
Comment 29 Takashi Iwai 2013-11-08 15:35:53 UTC
The patch in comment 9 turned out to break the existing MBA6 fixup.
The additional patch is attached below, in order to make MBA6 working again.

Also, judging from the information in comment 28, the SPDIF light can be controlled via the pin control value.  The patch to add the support is attached below, too.

Give them a try.
Comment 30 Takashi Iwai 2013-11-08 15:36:52 UTC
Created attachment 113881 [details]
Patch to fix regression for MBA6
Comment 31 Takashi Iwai 2013-11-08 15:38:49 UTC
Created attachment 113891 [details]
Patch to add pin control for SPDIF
Comment 32 Joseph Coffland 2013-11-10 14:12:49 UTC
Success.  Sound is working and I can turn the SPDIF light off and on with the IEC958 switch.
Comment 33 Joseph Coffland 2013-11-10 14:18:52 UTC
Created attachment 114081 [details]
Combined patches for complete fix against linux 3.12
Comment 34 John Ferlito 2013-11-10 21:08:26 UTC
Could the following line also be added for Macbook Pro 11,3

SND_PCI_QUIRK(0x106b, 0x5e00, "MacBookPro 11,3", CS4208_MBA6),
Comment 35 John Ferlito 2013-11-10 21:09:54 UTC
(In reply to John Ferlito from comment #34)
> Could the following line also be added for Macbook Pro 11,3
> 
> SND_PCI_QUIRK(0x106b, 0x5e00, "MacBookPro 11,3", CS4208_MBA6),

Agh ignore that just realised IDs are the same. Maybe the 3 should be dropped or a comment added that it covers all of them?
Comment 36 Michael Marineau 2013-11-10 22:56:33 UTC
I can also confirm that the patches from #30 and #31 fix MacBookPro11,3
Comment 37 Takashi Iwai 2013-11-13 16:18:44 UTC
The patches have been merged and will be included later to Linus tree.  It should be in 3.13-rc1.
Comment 38 Kazumichi Aoki 2013-12-10 22:03:32 UTC
Dear all,
I want to need your builded fruitful patch, but I don't know patch destination.
I need sound output MBP13 for ubuntu. If you can any advice to me, I am so happy.
I am so sorry, please let me know patch method.
Sincerely regards,
Kazumichi Aoki,
Comment 39 Kazumichi Aoki 2013-12-13 15:11:29 UTC
Dear all,
I miss understanding this problem. I have fix that.
Thank you so much.
Sincerely regards,