Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3537911pxj; Mon, 24 May 2021 08:56:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeQSJp5Ihd2+iuVfuLmoHk+kbN1GQPgOyTac9bkb80qjqE3UQ37MHVhYeAIfCBVJjBsbVm X-Received: by 2002:a5d:9d16:: with SMTP id j22mr14849819ioj.92.1621871794804; Mon, 24 May 2021 08:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621871794; cv=none; d=google.com; s=arc-20160816; b=Zkr+6acnSGFU4F1IcyCPbOcppeLhJKYKx1tVy/+L7tW6fHmHBqWaatz7UjPSZOCuOp Bdhu5l4KZQSBFKdYtGNGsLS8k2x8xT6Iw6/bkXbsCZg0AHNhytAVhBjBvj6AxBbg2ocP kSxqS49HrVmXTO90aKSrKdqSLO9B3faVKQIHynzjLtMy/x4PFnaZ+FOytc9c7BDjMQbU y/fnKfk1CE+l+Ueaa0wKB7GtAn7DKUriDxJq27CqBcDj+/nrHG/3WicdT+KpwpVtGI7G Fm9urdpwalLXPMGoWiWjtraEZjaf9HT1XxJQtBujZpcyj1gNTUlEowavmmnduo3j0qsA cyaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YEEH+5BYtey68GHFFr7sh/PXQMyh/O9x8OQnSmfJpsA=; b=kTEJxDvhS4pi4Lnyb0s1tcrPeahhGBuihaFp8gJHXadIfVkNgiulcCeR2lRSVO/BYV laVL0GwJMtYqjnxJNmzXK9UGupIPbVGiv0xpD5eQKF91mYM+9Wm4lTafyJirLlhVPc7Q Hko/R08xG+iEmQZJLpESK9Uc2K1oOkKrt0QNFh+6G9R33IpjRxyYJkOAbtLE9Ysmw4Ar 0W9ClmArseDczNZ+UbKwqEEQI2QOt8UXdPPCi0tbTjCGEBI2PZ8cWU/Ydwvp0UK0RtvU s7WYjlZfmL/P2QeMdXqfC2mDCUmsFrclnJahx6VmxqgW9MK0QVnBe+sfrGcDfJmGHaw+ nvqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SjhKwFOV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k64si14352424iof.43.2021.05.24.08.56.21; Mon, 24 May 2021 08:56:34 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SjhKwFOV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234591AbhEXP44 (ORCPT + 99 others); Mon, 24 May 2021 11:56:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:38584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234789AbhEXPtu (ORCPT ); Mon, 24 May 2021 11:49:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F7F661584; Mon, 24 May 2021 15:37:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870679; bh=r7k6GJg9G3wZjlx+z1jxZXHJDXc4TMUpHOUdmR6D5A0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SjhKwFOVfUMu91DgHq+efuDPe/M9luTh6fPlqIlMHUp+FY+dYbZNzxIyUXAEc7BJW yhyGsdA9G7al69ff9xMiAOpDq3cytqqXDIv9KeRG0RDl0lZZg6RmyvVedu4e4TXJsx 0mieZqG4MfAwGkl/g0udUdSJoQyZNjP3XKT/eK1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Cordova A , Takashi Iwai Subject: [PATCH 5.4 25/71] ALSA: hda: fixup headset for ASUS GU502 laptop Date: Mon, 24 May 2021 17:25:31 +0200 Message-Id: <20210524152327.279082842@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152326.447759938@linuxfoundation.org> References: <20210524152326.447759938@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Cordova A commit c1b55029493879f5bd585ff79f326e71f0bc05e3 upstream. 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 Cc: Link: https://lore.kernel.org/r/20210507173116.12043-1-danesc87@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 62 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6120,6 +6120,35 @@ static void alc294_fixup_gx502_hp(struct } } +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) { @@ -6316,6 +6345,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_MUTE_LED, @@ -7540,6 +7572,35 @@ static const struct hda_fixup alc269_fix .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[]) { @@ -7971,6 +8032,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), + SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),