Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp97482pxj; Fri, 7 May 2021 04:42:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSYilT+OajGO/yVAQewgV1Cx669J+TrUrvgaQNpqGWltVXwWS7wf7b/0QQNQ0ccfRcXuVE X-Received: by 2002:a17:906:170f:: with SMTP id c15mr9453363eje.358.1620387732585; Fri, 07 May 2021 04:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620387732; cv=none; d=google.com; s=arc-20160816; b=FyLzKsWU9cTRsQOx8gPn0ZC7atAUm/BkpbJmyMkYjINxH5gqPf7G/PuJ+5uIo31tUr WLk2fr0isZ1kRwbasZ+usPKSmK1fqtEvCjnIRLRD+WgHdFxB/UxBFMAYGdfZJDK3H7H4 yVCBnWgPnHZt56b1FT5YOIYKWKsYsKaLmi+82IBtoJI7r8OwqlzDJUNYy0r9EysqslMc TX5yR0BsA/8lkliUsJn307dRC7FuTJ670YiTC4sjxqrbWgNqWg66pHdGCjd4oED53N7S lTlv3Pgu/e1W/8Rp6+8Oya+BhzIo14+v71PIur1c+wHsHEr1SKu0p48b6SNaFWDIdLxD G0BQ== 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=pLvWd1FpU22rh1oLRHW5mE8F6VZ+fszY7q0GrBEPSD0=; b=PPO68JPsew5/aGfomG16DNbjsocoFdiV7jqlW2ktJq40Qinu0X4CdlIIPOLxxioXRg V4w/5K0Ln+Z/I8YBkfIEDONvtqgoJrGSEicpzTwGrjUuSWeihlDJ5zdpfpcNvD0ae7v4 jmGN1oX6jMjbSrfRVNSODleT4/Yo4gnyUVwDsQz9pxM2W/frn+zprggsWJWBhy2t77v2 ME4Od3E0JE7TZaJEJmEy/er/FMdpf/pzYW89llF9WBfmMqE4XtrVtPmHqK/kxFiR46Tq A27zhKQWHbSYFJJLs7Xwl1WqfiF87A5vtFyjnVZbX6Gk+I1EJgkJWjcBENBkio/qrM16 TF7g== 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 ca14si4918146edb.164.2021.05.07.04.41.48; Fri, 07 May 2021 04:42:12 -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 S234693AbhEGI33 (ORCPT + 99 others); Fri, 7 May 2021 04:29:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:52702 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234706AbhEGI32 (ORCPT ); Fri, 7 May 2021 04:29:28 -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 D5DD8AEFE; Fri, 7 May 2021 08:28:27 +0000 (UTC) Date: Fri, 07 May 2021 10:28:27 +0200 Message-ID: From: Takashi Iwai To: Daniel Cordova A Cc: tiwai@suse.com, perex@perex.cz, kailang@realtek.com, jhp@endlessos.org, kai.heng.feng@canonical.com, hui.wang@canonical.com, chenhuacai@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: hda: fixup headset for ASUS GU502 laptop In-Reply-To: <20210506212105.1532-1-danesc87@gmail.com> References: <20210506212105.1532-1-danesc87@gmail.com> 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 Thu, 06 May 2021 23:21:05 +0200, Daniel Cordova A wrote: > > The GU502 requires a few steps to make headset i/o works properly: > pincfg, verbs to unmute headphone out and callback to toggle output > between speakers and headphone using jack. > > Signed-off-by: Daniel Cordova A. Just a minor nitpick: could you put the quirk entry in the PCI SSID order? thanks, Takashi > --- > sound/pci/hda/patch_realtek.c | 62 +++++++++++++++++++++++++++++++++++ > 1 file changed, 62 insertions(+) > > diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c > index bd7bfd7c9ee7..d91ab7521496 100644 > --- a/sound/pci/hda/patch_realtek.c > +++ b/sound/pci/hda/patch_realtek.c > @@ -6210,6 +6210,35 @@ static void alc294_fixup_gx502_hp(struct hda_codec *codec, > } > } > > +static void alc294_gu502_toggle_output(struct hda_codec *codec, > + struct hda_jack_callback *cb) > +{ > + /* Windows sets 0x10 to 0x8420 for Node 0x20 which is > + * responsible from changes between speakers and headphones > + */ > + if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) > + alc_write_coef_idx(codec, 0x10, 0x8420); > + else > + alc_write_coef_idx(codec, 0x10, 0x0a20); > +} > + > +static void alc294_fixup_gu502_hp(struct hda_codec *codec, > + const struct hda_fixup *fix, int action) > +{ > + if (!is_jack_detectable(codec, 0x21)) > + return; > + > + switch (action) { > + case HDA_FIXUP_ACT_PRE_PROBE: > + snd_hda_jack_detect_enable_callback(codec, 0x21, > + alc294_gu502_toggle_output); > + break; > + case HDA_FIXUP_ACT_INIT: > + alc294_gu502_toggle_output(codec, NULL); > + break; > + } > +} > + > static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, > const struct hda_fixup *fix, int action) > { > @@ -6427,6 +6456,9 @@ enum { > ALC294_FIXUP_ASUS_GX502_HP, > ALC294_FIXUP_ASUS_GX502_PINS, > ALC294_FIXUP_ASUS_GX502_VERBS, > + ALC294_FIXUP_ASUS_GU502_HP, > + ALC294_FIXUP_ASUS_GU502_PINS, > + ALC294_FIXUP_ASUS_GU502_VERBS, > ALC285_FIXUP_HP_GPIO_LED, > ALC285_FIXUP_HP_MUTE_LED, > ALC236_FIXUP_HP_GPIO_LED, > @@ -7665,6 +7697,35 @@ static const struct hda_fixup alc269_fixups[] = { > .type = HDA_FIXUP_FUNC, > .v.func = alc294_fixup_gx502_hp, > }, > + [ALC294_FIXUP_ASUS_GU502_PINS] = { > + .type = HDA_FIXUP_PINS, > + .v.pins = (const struct hda_pintbl[]) { > + { 0x19, 0x01a11050 }, /* rear HP mic */ > + { 0x1a, 0x01a11830 }, /* rear external mic */ > + { 0x21, 0x012110f0 }, /* rear HP out */ > + { } > + }, > + .chained = true, > + .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS > + }, > + [ALC294_FIXUP_ASUS_GU502_VERBS] = { > + .type = HDA_FIXUP_VERBS, > + .v.verbs = (const struct hda_verb[]) { > + /* set 0x15 to HP-OUT ctrl */ > + { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, > + /* unmute the 0x15 amp */ > + { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 }, > + /* set 0x1b to HP-OUT */ > + { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, > + { } > + }, > + .chained = true, > + .chain_id = ALC294_FIXUP_ASUS_GU502_HP > + }, > + [ALC294_FIXUP_ASUS_GU502_HP] = { > + .type = HDA_FIXUP_FUNC, > + .v.func = alc294_fixup_gu502_hp, > + }, > [ALC294_FIXUP_ASUS_COEF_1B] = { > .type = HDA_FIXUP_VERBS, > .v.verbs = (const struct hda_verb[]) { > @@ -8163,6 +8224,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { > SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), > SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), > SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), > + SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), > SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), > SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), > SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE), > -- > 2.31.1 >