Bug 50781
Summary: | internal mic not working properly | ||
---|---|---|---|
Product: | Drivers | Reporter: | kite (kitelau) |
Component: | Sound(ALSA) | Assignee: | Takashi Iwai (tiwai) |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | alan, florian, tiwai |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 3.2.29 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
alsa-info.txt
patch1 patch2 patch3 linux kernel 3.7.0-rc6, without hda-verb tweaks, without your above patches linux kernel 3.7.0-rc6, with hda-verb tweaks, without your above patches |
Description
kite
2012-11-20 13:54:19 UTC
Created attachment 86691 [details]
alsa-info.txt
Try the latest 3.7-rc6. Some bugs regarding Cirrus codec have been fixed. Thanks for your comment. I compiled 3.7-rc6, no help at all. Do I need to do anything else? Then it's possibly a hardware feature. Some devices are known to send a phase-inverted signal in one channel (likely for the noise cancellation). What does it show with the command sequence below? hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 2 hda-verb /dev/snd/hwC0D0 0x11 GET_PROC_COEF 0 (Install hda-verb described in Documentation/sound/alsa/HD-Audio.txt.) Which channel is working and which channel doesn't work? I suppose only the right channel is working? If it's the right channel, try to run the following via hda-verb program (as root) after loading the driver: hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 2 hda-verb /dev/snd/hwC0D0 0x11 SET_PROC_COEF 0x100a The left channel is not working here. bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 2 nid = 0x11, verb = 0x500, param = 0x2 value = 0x0 bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 GET_PROC_COEF 0 nid = 0x11, verb = 0xc00, param = 0x0 value = 0xa ============= bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 2 nid = 0x11, verb = 0x500, param = 0x2 value = 0x0 bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 SET_PROC_COEF 0x100a nid = 0x11, verb = 0x400, param = 0x100a value = 0x0 You said it is a feature, but when I boot into MacOS, both channels are working there. I think something is wrong under linux. (In reply to comment #5) > The left channel is not working here. > > bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 2 > nid = 0x11, verb = 0x500, param = 0x2 > value = 0x0 > bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 GET_PROC_COEF 0 > nid = 0x11, verb = 0xc00, param = 0x0 > value = 0xa OK, it's the expected value. Also give the outputs of other values between 0 and 4 for SET_COEF_INDEX? e.g. SET_COEF_INDEX 1 GET_PROC_COEF 0 > bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 2 > nid = 0x11, verb = 0x500, param = 0x2 > value = 0x0 > bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 SET_PROC_COEF 0x100a > nid = 0x11, verb = 0x400, param = 0x100a > value = 0x0 And no behavior change in the mic recording? If this doesn't change, make sure that the coef value is properly set by reading it again via SET_COEF_INDEX 2 / GET_PROC_COEF 0. If 0x100a doesn't help, try 0x40a. Bit 11:12 and 9:10 should control the channel mapping of ADC2 and ADC1, respectively. You can play with these bits. If these still don't change anything, you can play to turn on bit 4 and 5. These control ADC1 and ADC2 PGA modes. > You said it is a feature, but when I boot into MacOS, both channels are > working > there. Check whether the internal mic gives really a stereo input, i.e. the different signals for both left and right channels. > I think something is wrong under linux. We had a similar bug for other Macs but it was fixed recently on 3.7. It was due to the wrong COEF stuff. This is a vendor-specific setup, thus the generic driver can't work without special handling. ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 0 nid = 0x11, verb = 0x500, param = 0x0 value = 0x0 ./hda-verb /dev/snd/hwC0D0 0x11 GET_PROC_COEF 0 nid = 0x11, verb = 0xc00, param = 0x0 value = 0x1e ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 1 nid = 0x11, verb = 0x500, param = 0x1 value = 0x0 ./hda-verb /dev/snd/hwC0D0 0x11 GET_PROC_COEF 0 nid = 0x11, verb = 0xc00, param = 0x0 value = 0xa ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 2 nid = 0x11, verb = 0x500, param = 0x2 value = 0x0 ./hda-verb /dev/snd/hwC0D0 0x11 GET_PROC_COEF 0 nid = 0x11, verb = 0xc00, param = 0x0 value = 0xa ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 3 nid = 0x11, verb = 0x500, param = 0x3 value = 0x0 ./hda-verb /dev/snd/hwC0D0 0x11 GET_PROC_COEF 0 nid = 0x11, verb = 0xc00, param = 0x0 value = 0x146a ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 4 nid = 0x11, verb = 0x500, param = 0x4 value = 0x0 ./hda-verb /dev/snd/hwC0D0 0x11 GET_PROC_COEF 0 nid = 0x11, verb = 0xc00, param = 0x0 value = 0x7 =========== After the following setting, mic recording within audacity is working in 2 channels! Also mic is working within Skype now! But with heavy background noise. Not clear enough for general use. bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 2 nid = 0x11, verb = 0x500, param = 0x2 value = 0x0 bash-4.2# ./hda-verb /dev/snd/hwC0D0 0x11 SET_PROC_COEF 0x100a nid = 0x11, verb = 0x400, param = 0x100a value = 0x0 Try 0x102a or 0x2a instead of 0x100a, then. 0x102a is a little better than 0x100a, more natural sound; 0x2a return to the previous status (left static noise, right ok). OK. To be sure, could you try model=mbp101 option instead? If this doesn't work, try without model option, and let me know what doesn't work exactly in this state. (e.g. no sound from speaker, etc.) I'm asking it because I saw you set model=mbp55. It might be wrong for yours. Actually model=mbp55 was not there (deleted) when I did the above test following your previous steps. After setting model=mbp101, with or without hda-verb tweaks, the mic is silent (audacity test, the signal wave is a vertical line). Horizontal line. Sorry OK, that's good to know. Could you upload alsa-info.sh output again with the latest kernel? Anyway, I cooked up patches for testing now. It became more than I expected, not only adding a new fixup, in the end. Apply three patches attached below, and you'll have the COEF 2 0x102a automagically for your device. Give it a try. Created attachment 87081 [details]
patch1
Created attachment 87091 [details]
patch2
Created attachment 87101 [details]
patch3
With kernel 3.7.0-rc6 without your patches above: Created attachment 87121 [details]
linux kernel 3.7.0-rc6, without hda-verb tweaks, without your above patches
Created attachment 87131 [details]
linux kernel 3.7.0-rc6, with hda-verb tweaks, without your above patches
linux kernel 3.7.0-rc6, with hda-verb tweaks, without your above patches
I applied your patches 1,2,3. Both channels are working quite good now. Thanks a lot for your brilliant work! I just checked dmesg, and found the following log, is this harmless? [ 6984.464519] hda-intel: Unstable LPIB (131000 >= 8192); disabling LPIB delay counting (In reply to comment #20) > I applied your patches 1,2,3. Both channels are working quite good now. > Thanks > a lot for your brilliant work! Good to hear. The patch is queued for 3.8 kernel (where the merge window will be opened sooner or later in one or two weeks). (In reply to comment #21) > I just checked dmesg, and found the following log, is this harmless? > > [ 6984.464519] hda-intel: Unstable LPIB (131000 >= 8192); disabling LPIB > delay > counting Yes, this is no big thing to worry. Your hardware doesn't give a stable LPIB register read, so the driver disabled the extra delay calculation, but using only position buffer. It's still good enough for normal use. A patch referencing this bug report has been merged in Linux v3.8-rc1: commit ffe4d12b151018e831f0ca2e05fe78a55238c517 Author: Takashi Iwai <tiwai@suse.de> Date: Fri Nov 23 08:34:13 2012 +0100 ALSA: hda - Add a fixup for internal mic on MacBook Pro 8,1 |