the result from alsa script is http://www.alsa-project.org/db/?f=bc96743cc602b4f03ef3c304e56ad3fe80047564 the microphones (external and internal) are not working under ubuntu, while they used to work under osX.
Created attachment 107299 [details] alsa-info from 3.2 kernel
Created attachment 107300 [details] alsa-info from 3.11 kernel
there is no mic jack and int mic strange that the driver created headphone mic at node 0x15 Node 0x15 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Control: name="Headphone Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Headphone Mic Boost Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Control: name="Headphone Mic Jack", index=0, device=0 Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0000373c: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01214030: [Jack] HP Out at Ext Rear Conn = 1/8, Color = Green DefAssociation = 0x3, Sequence = 0x0 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=01, enabled=1 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 can the headphone jack be retasked as mic jack ? [ 25.367757] ALSA sound/pci/hda/hda_auto_parser.c:795 hda_codec: ALC889A: Apply fix-func for MacBookAir 1,1 [ 25.367763] hda_codec: ALC889A: SKU not ready 0x400000f0 [ 25.367907] ALSA sound/pci/hda/hda_auto_parser.c:393 autoconfig: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker [ 25.367911] ALSA sound/pci/hda/hda_auto_parser.c:397 speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 25.367915] ALSA sound/pci/hda/hda_auto_parser.c:401 hp_outs=1 (0x15/0x0/0x0/0x0/0x0) [ 25.367918] ALSA sound/pci/hda/hda_auto_parser.c:402 mono: mono_out=0x0 [ 25.367920] ALSA sound/pci/hda/hda_auto_parser.c:406 inputs: [ 25.367924] ALSA sound/pci/hda/patch_realtek.c:490 realtek: No valid SSID, checking pincfg 0x400000f0 for NID 0x1d [ 25.367926] ALSA sound/pci/hda/patch_realtek.c:573 realtek: Enable default setup for auto mode as fallback [ 25.369144] ALSA sound/pci/hda/hda_generic.c:1765 ==> lo_type=2, wired=1, mio=1, badness=0x0 [ 25.369149] ALSA sound/pci/hda/hda_generic.c:1681 multi_outs = 15/0/0/0 : 2/0/0/0 (type HP) [ 25.369154] ALSA sound/pci/hda/hda_generic.c:358 out path: depth=3 :02:0c:15 [ 25.369157] ALSA sound/pci/hda/hda_generic.c:1709 spk_outs = 14/0/0/0 : 3/0/0/0 [ 25.369161] ALSA sound/pci/hda/hda_generic.c:358 spk path: depth=3 :03:0d:14 [ 25.369164] ALSA sound/pci/hda/hda_generic.c:1821 ==> Best config: lo_type=2, wired=1, mio=1 [ 25.369168] ALSA sound/pci/hda/hda_generic.c:1681 multi_outs = 15/0/0/0 : 2/0/0/0 (type HP) [ 25.369172] ALSA sound/pci/hda/hda_generic.c:358 out path: depth=3 :02:0c:15 [ 25.369176] ALSA sound/pci/hda/hda_generic.c:1709 spk_outs = 14/0/0/0 : 3/0/0/0 [ 25.369180] ALSA sound/pci/hda/hda_generic.c:358 spk path: depth=3 :03:0d:14 [ 25.369190] ALSA sound/pci/hda/hda_generic.c:2381 hda-codec: Enable shared I/O jack on NID 0x15
Using hda-jack-retask to retask 0x15 from hp to mic I don't get any sound. Note that the mba has only one external jack for both ext mic (not working) and hp (working), plus an additional built-in int mic (not working). My current setting has options snd-hda-intel model=mba21, but I don't think this has some influence on the test. Moreover, I tested using speaker-test, arecord -d 5 test-mic.wav and aplay test-mic.wav on 3.2.0-53-generic-pae
do you mean that the headphone is similar to this patch http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=5780b627e24113323427c102175296ae43dfb9d7 try retask node to fixed Mic at int for the remaining nodes [N/A] one at a time !!----------- /sys/class/sound/hwC0D0/init_pin_configs: 0x14 0x90100120 0x15 0x01214030 0x16 0x400000f0 0x17 0x400000f0 0x18 0x400000f0 0x19 0x400000f0 0x1a 0x400000f0 0x1b 0x400000f0
i don't know if my hardware matches the above: what i have is a single jack where i used to connect apple headphones (which had a mic alltogether) under os x; then i have internal front mic. the guy who wrote the patch that gives me audio at all, found the pin for speakers and hp, but not mics. i've tried retasking the single unused pins, both under the runningn kernel and under a more recent one, as suggested also by takashi iwai, but without success: besides compiling the kernel, what i do is just run hda-jack-retask and override them one at a time
do you mean the Mac book air support headset with TRRS connector (similar to those moblie phone) Control: name="Headphone Mic Jack", index=0, device=0 - hp_mic_detect (bool): enable/disable the hp/mic shared input for a single built-in mic case; default true seem that this feature be disabled by using hint hp_mic_detect = false http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=967303dabc22335e83c6ee4a9e0684a7c05da976 you need to ask the author why the driver create this control ? http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/Documentation/sound/alsa/HD-Audio.txt
I think you're right, it is the same as I use for iphone, and looking in wikipedia it seems like it is a trrs. A (perhaps) separate problem is the internal front mic. More info, in particular I put a link to the original patch, you can find in this post http://unix.stackexchange.com/questions/73044/kernel-patch-for-microphones-on-apple-macbook-air-1-1-early-2008 but why at the end of the day i'm not able to see any pin other than speaker and hp?
http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=a385d97b826df72cce06939dda4a4d41bc97c8a8 can the pin cfg of mics be found in OSX or windows driver inf?
i see; if you look at the above link, the guy who originally wrote the patch took a look at OS X kext files (there's a link to the forum where he was asking around), but this wasn't useful in the process
The driver doesn't give any mic control just because the BIOS doesn't set any pin configuration for either internal or external mic pin. Usually the mic is assigned to NID 0x18 and else. Did you already try it? See Documentation/sound/alsa/HD-audio.txt for how to set up the pin configuration via a firmware "patch" file.
Should I write a text file like [codec] 0x10ec0885 0x106b3400 0 [model] auto [pincfg] 0x18 ?? [verb] ?? [hint] ?? then put it in /lib/firmware/ and call it A.fw and add a line in /etc/modprobe.d/alsa-base.conf where I say options snd-hda-intel patch=A aftern having compiled a kernel with CONFIG_SND_HDA_PATCH_LOADER=y set? So, what should I put in ?? exactly?
You don't have need verbs and hints, so just skip these sections. Also, you need no model section, too. For the pin config of a built-in mic, try to pass 0x90a60100, for example. Also, you need to pass a file name including the extension, i.e. "patch=A.fw". And yes, you need to build the kernel with CONFIG_SND_HDA_PATCH_LOADER=y.
ok, tried with options patch=mic.fw on my current 3.2.0-56-generic-pae, which has the above kernel config enabled. upon reboot, no luck with 0x18 0x90a60100 Now trying with 0x19 0x90a60100
neither the second one worked. i'm testing with mic and int mic volume up and boosted in alsamixer, and capture selected for both, trying to use the front mic, and arecord aplay. I thought that using refit as opposed to bios compatibility could help, but Reimundo H. told me he already tried that. Moreover, I found a guy running Arch Linux whose codec dump showed Node 0x18 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0000373c: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01a19820: [Jack] Mic at Ext Rear Conn = 1/8, Color = Pink DefAssociation = 0x2, Sequence = 0x0 Pin-ctls: 0x20: IN VREF_HIZ Unsolicited: tag=00, enabled=0 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 but Reimundo H. still told me it was more similar to a HP than a Mic, so I also discarded the hypothesis of installing Arch any other number combination I could try to pass?
moreover, it is unlikely that pulseaudio is somehow interfering with the mics being recognized, isn't it?
You need to test the all pins from 0x14 to 0x1f, one by one. Better not to change two. Try even the HP or the speaker pin to replace as a mic. Test both the built-in mic and the external mic jack for each pin. At each time, check the mixer setup ("Capture Switch" is unmuted, "Capture Volume" is raised, etc). Also, make sure that the pin control of the corresponding pin is set property to input (at least bit 0x20 is set). You can fiddle with different VREF values of the pin on the fly via hda-verb, too. For primary testing, better to avoid PulseAudio although it shouldn't interfere too much in this case. Test always a stereo stream, not a mono. % arecord -Dhw -fdat -vv foo.wav % aplay -Dhw -vv foo.wav Also, another interesting test would be to check the pin-detection for the external mic. It might not have a dedicated jack detection since it's a TRRS. But still worth to try. For each pin test, test like % hda-verb /dev/snd/hwC0D0 XXX SET_PIN_SENSE 0 % hda-verb /dev/snd/hwC0D0 XXX GET_PIN_SENSE 0 where XXX is the pin NID (e.g. 0x18) to test. The call with GET_PIN_SENSE would return the bit 0x80000000 if the jack is detected. Another item to test is the GPIO pins. The GPIO 0 seems already used for the speaker (and/or HP) amp. You can confirm it by changing it dynamically. The GPIO 1 isn't currently used, so this might hit something interesting. If any of the above hits nothing, there must be vendor-specific verbs like COEF setup. If so, I have no idea. This is never published and kept secret. You have to figure it out by digging some Mac OSX stuff.
I will, but I suspect Reimundo H. has already tried most of these (on an mba2,1, which is more or less the same). Do you think this is peculiar to Realtek ALC885 codec in general (so that if someone else happens to have the same codec on another board e.g. on Windows still can be helpful), or related to how Apple has bunched things together, e.g. setting the mics to some particular pins of their choice, and then controlling it perhaps at EFI level?
Everything is possible. In the past, Apple has tweaks in the driver level (mostly provided from external file) in addition to the basic setup in EFI level.
Does this piece of plist from OS tell us something useful? [code=auto:0] <dict> <key>MicAttributes</key> <integer>28</integer> <key>MicInfo</key> <string>Sampled on rising edge</string> <key>NodeID</key> <integer>39</integer> <key>PinConfigDefault</key> <integer>2426405136</integer> </dict>[code=auto:0]
Hm, NodeID 39 means 0x27, which isn't present in the codec. Maybe it's a invisible node the codec doesn't advertise. You can try to fiddle with that, for example, hda-verb /dev/snd/hwC0D0 0x27 GET_CONFIG_DEFAULT should show some meaningful bits (like 0x400000f0) if the node is real. If it's a fake (e.g. a node virtually implemented in the driver), it'd return a value like 0xffffffff or 0 (or you see some errors in the kernel message).
issuing sudo hda-verb /dev/snd/hwC0D0 0x27 GET_CONFIG_DEFAULT NODE_COUNT i get nid = 0x27, verb = 0xf1c, param = 0x4 value = 0x0 does it mean it's indeed a fake?
i was also thinking, how did people solve this issue for, e.g., other mb or mba from 3,1 onwards? i guess they'll have different chips than alc885, but apple is likely to try this same business, isn't it?
The new machines have different codecs and setups, so I guess this is specific to MBA 1,1 and 2,1. BTW, I found a couple of bugs in the recent code regarding these machines without the mic. The driver didn't set up the headphone pin correctly. The two patches below should fix it.
Created attachment 116141 [details] hp pin fix patch #1
Created attachment 116151 [details] hp pin fix patch #2
The speakers still don't work with Linux 3.13.0-rc2 (which includes your patches) and all channels unmuted (in alsamixer). I hope I'm posting in the right thread: I have a MBA 1,1. Please tell me if I should create a new thread.
i modified to high, since this is supposed to be a thin and portable machine, and mics are important. also, to verified-documented, since i think we all know what and where the problem is up to now, i don't get any hint from mac forums on coeff and verbs i think it's fine to post here any other sound issues than mics for mba1,1
do you know any particular coeff verbs one can try to play with, in order to get an idea of how the missing part of the codec works?
Created attachment 117801 [details] alsa script from 3.2.0-57-generic-pae
There is no known COEFs, unfortunately. COEF stuff is always vendor-specific and its spec hasn't been released. Another thing you can test easily is to check whether any VREF bits of each pin may influence on some inputs. Apple's hardware tend to abuse VREF bit for controlling some different purpose. For example, VREF bits on NID 0x18 is used for controlling outputs on MBA 2,1. So, it'd be natural if any other VREF bits are used for controlling inputs... For that, you'd need to assume some pin as input at first. Set it up preliminary. Then adjust VREF bits on this and other pins dynamically while you're recording a PCM stream.
I don't know much about VREF and COEF so I didn't try experimenting that. However, I noticed that the sound is correctly output in the jack plug (for earphones) on Linux 3.13-rc2 on MacBook Air 1,1. That's good news! :) The sound in the embedded speakers still doesn't work, even with 3.13-rc3. alsa-info on 3.13-rc3: http://www.alsa-project.org/db/?f=d052fb0b64e615ca7b11ff25a24ba61903bcd8e2
I found in the same plist file these other lines <key>MicInfo</key> <string>WM8800 External Microphone Virtual Pin Complex</string> <key>NodeID</key> <integer>24</integer> <key>PinConfigDefault</key> <integer>28020848</integer> does it say anything meaningful?
It indicates that NID 0x18 is a rear mic jack pin with pincfg 0x01ab9070. So this looks like a pin that can be used for the mic. But the word "virtual" makes me wonder whether it's really a hardware implementation or not...
suppose i want to change Node 0x18 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Control: name="Mic Boost Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x03 0x03] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0000373c: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 0x400000f0: [N/A] Line Out at Ext N/A Conn = Unknown, Color = Unknown DefAssociation = 0xf, Sequence = 0x0 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=00, enabled=0 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 to something like Node 0x18 [Pin Complex] wcaps 0x40018f: Stereo Amp-In Amp-Out Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x08373c: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 0x01a19c40: [Jack] Mic at Ext Rear Conn = 1/8, Color = Pink DefAssociation = 0x4, Sequence = 0x0 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=00, enabled=0 Connection: 5 0x0c* 0x0d 0x0e 0x0f 0x26 what should I do?
You already did it via patch option...
right. is there a way to do it without having to reboot every time?
another stupid question: are Vendor Id, Subsystem Id and Revision Id fixed or one can change them?
Moreover, does the lines you suggested for arecord automatically pick any input device marked as capture in alsamixer, even if they're more than one and pulseaudio is playing around?
Am I correct in saying that this !!Advanced information - PCI Vendor/Device/Subsystem ID's !!------------------------------------------------------- 00:1b.0 0403: 8086:284b (rev 03) Subsystem: 106b:00a2 cannot be changed, and thus identifies (completely) the audio hardware, while this !!HDA-Intel Codec information !!--------------------------- --startcollapse-- Codec: Realtek ALC889A Address: 0 AFG Function Id: 0x1 (unsol 1) Vendor Id: 0x10ec0885 Subsystem Id: 0x106b3400 Revision Id: 0x100103 can be changed via a patch?
Speaking with some people in the Apple community, their opinion is the pin for mics are 0x18 and 0x19, and they provided a codec dump I'd like to reproduce exactly. In particular, they seem also worried that the mic input be connected to the right 'mixer', 0x12 most likely: can all this be achieved via a patch like the ones above? Node 24 [Pin Complex] wcaps 4194703: Stereo Amp-In Amp-Out Amp-In caps: ofs=0, nsteps=3, stepsize=39, mute=0 Amp-In vals: [0 0] Amp-Out caps: ofs=0, nsteps=0, stepsize=0, mute=1 Amp-Out vals: [128 128] Pincap 14140: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 27367456: [Jack] Mic at Ext Rear Conn = 1/8, Color = Pink DefAssociation = 2, Sequence = 0 Pin-ctls: 32: IN VREF_HIZ Unsolicited: tag=00, enabled=0 Connection: 5 12* 13 14 15 38 Node 25 [Pin Complex] wcaps 4194703: Stereo Amp-In Amp-Out Amp-In caps: ofs=0, nsteps=3, stepsize=39, mute=0 Amp-In vals: [0 0] Amp-Out caps: ofs=0, nsteps=0, stepsize=0, mute=1 Amp-Out vals: [128 128] Pincap 14140: IN OUT HP Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 44144704: [Jack] Mic at Ext Front Conn = 1/8, Color = Pink DefAssociation = 4, Sequence = 0 Pin-ctls: 32: IN VREF_HIZ Unsolicited: tag=00, enabled=0 Connection: 5 12* 13 14 15 38
I notice that now under 3.2.0-60-generic-pae the automute function for speakers when HP is plugged in doesn't work anymore
I'm running Windows 7 (ultimate SP1 32 bit) on the MBA (1,1 Early 2008) with working microphones and sound (via Boot Camp 4 drivers) (regedit confims the codec is realtek ALC 885) Below is a PinConfig taken from regedit (in case more data are needed, I can attach the original file or provide further info) Can someone help me put together a patch for alsa and check if it solves the mic problem? 0x00 0x201c4701 0x01 0x011d4701 0x02 0x101e4701 0x03 0x901f4701 0x04 0x301c5701 0x05 0x401d5701 0x06 0x211e5701 0x07 0x011f5701 0x08 0xf01c6701 0x09 0x001d6701 0x0a 0x001e6701 0x0b 0x401f6701 0x0c 0xf01c7701 0x0d 0x001d7701 0x0e 0x001e7701 0x0f 0x401f7701 0x10 0xf01c8701 0x11 0x001d8701 0x12 0x001e8701 0x13 0x401f8701 0x14 0xf01c9701 0x15 0x001d9701 0x16 0x001e9701 0x17 0x401f9701 0x18 0xf01ca701 0x19 0x001da701 0x1a 0x001ea701 0x1b 0x401fa701 0x1c 0xf01cb701 0x1d 0x001db701 0x1e 0x001eb701 0x1f 0x401fb701 0x20 0xf01cc701 0x21 0x001dc701 0x22 0x001ec701 0x23 0x401fc701 0x24 0xf01cd701 0x25 0x001dd701 0x26 0x001ed701 0x27 0x401fd701 0x28 0xf01ce701 0x29 0x001de701 0x2a 0x001ee701 0x2b 0x401fe701 0x2c 0xf01cf701 0x2d 0x001df701 0x2e 0x001ef701 0x2f 0x401ff701
I realised there's actually no external (TRRS) mic, only internal built in one. Moreover, we tried to guess pins from linux running as virtual machine in os x, with no success; I also asked some apple guys, and their reply was apple does not provide pin configurations.. I'm not sure how many people still possess a working mba1,1; anyway, is there something else we could try? also, I'm surprised that only for this mba model there's this specific problem, while most of later ones have mic working fine (did someone have to solve a similar problem for other models?)
Created attachment 166561 [details] alsa script
I just realised the internal microphone is connected to logic board and not to audio card. Does this make any difference? Since this is both the only audio part not working and the only one connected to logic board instad of audio card, I suspect we have to instruct alsa how to use this device Do we need to modify the ALC 885(889A) codec part, which is in the sound card, or look for a different device/codec? Are the following relevant? PP3V3_S3_MIC_F MIN_LINE_WIDTH=0.20MM MIN_NECK_WIDTH=0.20MM VOLTAGE=3.3V Pin 2 and pin 3 NC not connected Pin 4 AUD_MIC_DATA_F Pin 5 AUD_MIC_CLK_F Pin 6 GND_MIC_F
Created attachment 167011 [details] pinouts from connectors on logic board picture
pin 1 PP3V3_S3_MIC_F MIN_LINE_WIDTH=0.20MM MIN_NECK_WIDTH=0.20MM VOLTAGE=3.3V pin 2 and pin 3 NC not connected pin 4 AUD_MIC_DATA_F pin 5 AUD_MIC_CLK_F pin 6 GND_MIC_F
can anyone help?
(In reply to Nicolo' from comment #46) > I just realised the internal microphone is connected to logic board and not > to audio card. Does this make any difference? > this mean that you need to write driver for that logic board and hda codec will not create any analog capture device
thanks, can you help doing that, given the data I provided?
Created attachment 188561 [details] pdf with full schematics contains mic and audio schematics
I uploaded a PDF file with full schematics for the laptop, including microphone and audio connections. Given that, could anyone help producing a patch so that we can have working microphone in Linux for the Macbook Air? notice that the remaining audio stuff works fine, and the microphone is connected to logic board first, and then from here to the (separate) audio card. Codec is Realtek ALC 885. Of course I'm willing to test any suggested patch or change
you have to trace the connection from external mic to hda controller/codec refer to page 20, audio connector seem not connected to hda codec , those pin name seem to be hda controller SDIN0
as can be seen from pages 60, 37 and 23 the mic goes to audio connector and then the hda-sdin0 goes from audio connector to hda on the south bridge it is not clear to me where the alc885 codec is located: is it the picture on page 37?
Table 142. High Definition Audio Codec Pinout do any name match with those 48 pins of HDA codecs ? seem none of those PORTs
do those name match with Table 55. High Definition Audio Link Signal Descriptions ?
so is some information still missing?
I just realized there are many versions of the file I sent, namely EVT, DVT, PVT,...; it appears in mine there is no information about the audio codec (ALC885) pin assingments; I guess we should look for the appropriate version that contains those data
I guess the audio connector is used to connect HDA codec and mic since it have those signal pins of HDA link but there is no output pins for headphone and speaker HDA controller seem use GPIO33
I agree, but I think it is not possible to understand the audio codec pin assingments from the version I posted; unfortunately, it seems the only available one