Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp238677pxu; Tue, 6 Oct 2020 05:26:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqeJccqscJbVq88s+jyWdm66ueBn2PKZrjQmYaQlqiP/KFPAN40VQInTAnCl5HpO2Eb9dB X-Received: by 2002:a05:6402:b0e:: with SMTP id bm14mr5392120edb.259.1601987207129; Tue, 06 Oct 2020 05:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601987207; cv=none; d=google.com; s=arc-20160816; b=bonMM3rpR06U/ZyEIXuLHIp/9VyfmIin6K8/t/z4nxC3RaJpgPoZKmWyZoAcePDUmB wps5sT0+LxeQK6Vhf8xhiTvIe7X50Eisnqb9rzqw55GYiqgLBSRo+dU5Blq/goVUrPlP BM0a2j6tOxvyeorvSopalc+v49dqayWiHKCMDNzOK3IZrRQja3pyrC3ncBPbILN0U0j4 qxeUrRomKqC+usgtnr8c3aARXDCGrXGcYtzbY3mLfAOQNsYCl2UQlM01ITBILv+LsomQ aUL1qeAbEex1rN304Lc1IGrlkPulqY+kLTm3VH7FKbQWkR5oNmekE6hmw5tz8JpEjAWN baJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=/Cl/ZTtamc8ZOlCvMktQvVbwJOM+KJYM/OdovUh0djg=; b=I6w75R3Is6bFtaeNRxEKr9RNUd6giVD+MEG3tsvo8S9cy35/R1FsTggnN0cGdNn5xv 2JEhSGU5n7cllP/uzeY73R/uIpzCQoloKiOwjxqxwbzb9mCAHFiN1lqe5aPcObmaAKQc v1g/zXM3KZ0dULHT5PVdqsqostXrGXl3BbcLS5iwSuQWeH05r9CeWVL6eLbK2ojbX0Rz mW3YMjrV3Q6C2Mi2W/V5kKXNvg+2tef61AzzNFaa1SdBZNRoCIummScPlocQao1gYnsO +xhovc0zBJ3TabxmctIhwOjFv35uv0G1XW64M5MqX79oHO1NTZN+i6rOoF5/p69P5LQG wIlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pv2si1784232ejb.681.2020.10.06.05.26.23; Tue, 06 Oct 2020 05:26:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726267AbgJFMYn (ORCPT + 99 others); Tue, 6 Oct 2020 08:24:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:42050 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726133AbgJFMYn (ORCPT ); Tue, 6 Oct 2020 08:24:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DEB49B03B; Tue, 6 Oct 2020 12:24:41 +0000 (UTC) Date: Tue, 06 Oct 2020 14:24:41 +0200 Message-ID: From: Takashi Iwai To: Jian-Hong Pan Cc: Takashi Iwai , Kailang Yang , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux@endlessm.com Subject: Re: [PATCH] ALSA: hda/realtek: Enable audio jacks of ASUS D700SA with ALC887 In-Reply-To: <20201006075334.92933-1-jhp@endlessos.org> References: <20201006075334.92933-1-jhp@endlessos.org> 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/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 06 Oct 2020 09:53:35 +0200, Jian-Hong Pan wrote: > > The ASUS D700SA desktop's audio (1043:2390) with ALC887 cannot detect > the headset microphone and another headphone jack until > ALC887_FIXUP_ASUS_HMIC and ALC887_FIXUP_ASUS_AUDIO quirks are applied. > The NID 0x15 maps as the headset microphone and NID 0x19 maps as another > headphone jack. Also need the function like alc887_fixup_asus_jack to > enable the audio jacks. > > Signed-off-by: Jian-Hong Pan > Signed-off-by: Kailang Yang > --- > sound/pci/hda/patch_realtek.c | 41 +++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c > index d4f17b465892..8d0928bdc9ff 100644 > --- a/sound/pci/hda/patch_realtek.c > +++ b/sound/pci/hda/patch_realtek.c > @@ -1929,6 +1929,8 @@ enum { > ALC1220_FIXUP_CLEVO_P950, > ALC1220_FIXUP_CLEVO_PB51ED, > ALC1220_FIXUP_CLEVO_PB51ED_PINS, > + ALC887_FIXUP_ASUS_AUDIO, > + ALC887_FIXUP_ASUS_HMIC, > }; > > static void alc889_fixup_coef(struct hda_codec *codec, > @@ -2141,6 +2143,30 @@ static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, > alc_fixup_headset_mode_no_hp_mic(codec, fix, action); > } > > +static void alc887_asus_hp_automute_hook(struct hda_codec *codec, > + struct hda_jack_callback *jack) > +{ > + struct alc_spec *spec = codec->spec; > + int vref; > + > + snd_hda_gen_hp_automute(codec, jack); > + > + vref = spec->gen.hp_jack_present ? 0xc4 : 0xc0; Use the AC_PINCTL_* instead of the raw numbers. Some values are shortened form in hda_local.h, too (e.g. 0xc0 = PIN_HP). > + snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, > + vref); Better to use snd_hda_set_pin_ctl(). > +} > + > +static void alc887_fixup_asus_jack(struct hda_codec *codec, > + const struct hda_fixup *fix, int action) > +{ > + struct alc_spec *spec = codec->spec; > + if (action != HDA_FIXUP_ACT_PROBE) > + return; > + snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, > + 0xc0); This one would be snd_hda_set_pin_ctl_cached(), so that it'll be restored at resume. thanks, Takashi