Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3546199pxj; Mon, 24 May 2021 09:05:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJws36cdF7uyHHcSKNBbGkl/fRc2FLTuFDl93tmA28i+olIamnJSoE/qiTSgtqjCXvBU6Lb7 X-Received: by 2002:a05:6e02:1a63:: with SMTP id w3mr13346253ilv.113.1621872336696; Mon, 24 May 2021 09:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872336; cv=none; d=google.com; s=arc-20160816; b=tVn3SdtVUdZ11qz2xTzTWsKchTMD/9f4LxszhmeqV1E43P35biZlnhSGjtSTXFgEyS Dyh9XBKtw1njds77xGYhpG2COLqN+t0NR2YPhCdjMOUIKAK2gp2tME5X2aXsdwlWeblG srlC6pefgHaLjBo8cQx1ovd25nA8muddtSA5I6nub9SA9k7fJdxMY6xXtX4EjFF7jmV6 ExPa8TuTPYrfb6Q1YdatYE64+BAZTd7zGGrbDBhBGcXz96ZJKDrzE1OUd3/TcbeOY8SG XIMz3X1yP+rHZjx9BufTEN5OhwMLwy+VTM1uhw75eIlk+FHBcHQFo6H+n6ZEMMBuB1kP Pg3Q== 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=gEZWMPIE9tVMgwlE2zXNrbV6bJNq+YWu80uZM6XlmxA=; b=AUOCn6Nq2Nw5vR9GmqkXI38PPVc4DlwaOZaKBCJ9jGPMSSQDanIJ+luY8ESku7/KMM la+J+atAciDYQkTn/6H0YUjgDxbXmtSm3FYivBCIpG3X6gg9rwMohBtyl94YnLjGq9im 0RJIl4QDyECEIPohUfAWB+9jABlFUUstkturwFJOCSAWsI1bC/TF++olMov7OMvLMHg2 VmMj7aW8yAHOSiRMvHlypvRXMFKvKYX7+geZlcSFceYmy2R6B/+vY0LnLPOsejlCqBMW VkD9lOXT32aorv2Zf47h72bi3hn+iNMX5v1R2qcYRWmo6VtOSwVW/Ajkav8rAszT7iV0 0JZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TQBbJfkD; 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 x9si14005229ilo.119.2021.05.24.09.05.18; Mon, 24 May 2021 09:05:36 -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=TQBbJfkD; 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 S237367AbhEXQFU (ORCPT + 99 others); Mon, 24 May 2021 12:05:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:40492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235413AbhEXP6t (ORCPT ); Mon, 24 May 2021 11:58:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F8126196E; Mon, 24 May 2021 15:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871076; bh=/ZMCnfVgzjPi3wZ+cuTJLw8G9D5HUinA54l12UnUAtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TQBbJfkDvu2erEPEM6vku0ZTjQi7O2OAcfhKNmWZ8TN8ef7fQs2wSh3mmDGpAC1Am Ha/EccYTRYqQtkTvLmhFRULGOb8kNqZF4vrGU86WwqsWKyW/kt3la7GgePlYMeQ0EQ bC+mau+qIVRbaVYMTEFFbDt2nnYHNVBDuS9tVinw= 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.12 050/127] ALSA: hda: fixup headset for ASUS GU502 laptop Date: Mon, 24 May 2021 17:26:07 +0200 Message-Id: <20210524152336.538860064@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@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 @@ -6232,6 +6232,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) { @@ -6449,6 +6478,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, @@ -7687,6 +7719,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[]) { @@ -8198,6 +8259,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),