From patchwork Thu Mar 12 10:38:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 5992641 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AC115BF90F for ; Thu, 12 Mar 2015 10:38:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB4F420480 for ; Thu, 12 Mar 2015 10:38:58 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CEC4420437 for ; Thu, 12 Mar 2015 10:38:56 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 58ACF26068B; Thu, 12 Mar 2015 11:38:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 541B826068B; Thu, 12 Mar 2015 11:38:47 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7B45826573C; Thu, 12 Mar 2015 11:38:45 +0100 (CET) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id C652C260646 for ; Thu, 12 Mar 2015 11:38:39 +0100 (CET) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8F48CAE27; Thu, 12 Mar 2015 10:38:39 +0000 (UTC) Date: Thu, 12 Mar 2015 11:38:39 +0100 Message-ID: From: Takashi Iwai To: Vasil Zlatanov In-Reply-To: <20150311222600.GA2927@airon> References: <20150311222600.GA2927@airon> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.4 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] Microphone Not Working after Suspend on Apple MacBookAir5, 2 Cirrus Logic CS4206 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP At Wed, 11 Mar 2015 23:26:00 +0100, Vasil Zlatanov wrote: > > Issue as seen on reddit thread: > https://www.reddit.com/r/linux/comments/1kccbk/alsa_bug_driving_me_crazy_please_help/ > > A common problem for Apple Macbook Air 5.2 users where microphone does > not work after system resume. As users have noted microphone starts > working ones again when the volume is changed in alsa-mixer. > > alsa-info dumps are attached showing before and after being adjusted > (where before causes microphone not to work while in after it does) > > IRC user 'debianuser' kindly helped out and found that using the two > following commands fix the issue: > > amixer -cPCH set "Capture" 0% nocap > amixer -cPCH set "Capture" 100% cap > > In my experience both are required and they seem to have the same effect > as manually changing the volume level in alsamixer, and as such resolve > the issue (until another suspend when they have to be run again). This might be due to the single ADC amp. The ADC widgets have multiple inputs and usually they have individual amp volumes. But some codecs give only a single volume for all inputs. There is a flag in the driver to change the control for that. The patch below enables it. Alternatively, you can pass "single_adc_smp = true" hint in the firmware patch passed via patch option. See Documentation/sound/alsa/HD-Audio.txt for details. > As of now I'm resolving this issue by creating a service that is to run > after resume from susspend with the given amixer commands to renable the > microphone. > > The second issue, which is also in the reddit thread, is that the > microphine is mono and when recording only right channel audio is seen. > For me this broke programs such as mumble and skype. > > A alsa-info output with coefficients is attached. > > 'debianuser' managed to find a solution to this issue well, resolving it > by running the following two commands: > > hda-verb /dev/snd/hwC0D0 0x11 SET_COEF_INDEX 2 > hda-verb /dev/snd/hwC0D0 0x11 SET_PROC_COEF 0x102a > > After one runs them a single time after boot, the channels collectly > show and programs issues are resolved. 'debianuser' mentions that the > sources for the commands are available in the kernel and applied to the > macbook 8.1 model, but not to mine. Yes, it's the very same workaround for MBP8,1. You can pass model=mbp81 option. If it works, you can just add a sline to cs420x_fixup_tbl[] something like @@ -393,6 +393,7 @@ static const struct snd_pci_quirk cs420x_fixup_tbl[] = { SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81), SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), + SND_PCI_QUIRK(0x106b, 0x5600, "MacBookAir 5,2", CS420X_MBP81), SND_PCI_QUIRK(0x106b, 0x5b00, "MacBookAir 4,2", CS420X_MBA42), SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), {} /* terminator */ Takashi diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 1589c9bcce3e..dd2b3d92071f 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -584,6 +584,7 @@ static int patch_cs420x(struct hda_codec *codec) return -ENOMEM; spec->gen.automute_hook = cs_automute; + codec->single_adc_amp = 1; snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, cs420x_fixups);