From patchwork Thu Jul 8 00:16:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cameron Berkenpas X-Patchwork-Id: 12364209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 653DFC07E95 for ; Thu, 8 Jul 2021 00:44:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BE56A61CCA for ; Thu, 8 Jul 2021 00:44:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE56A61CCA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=neo-zeon.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 85F3F82C; Thu, 8 Jul 2021 02:43:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 85F3F82C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1625705074; bh=al3VcySOcwb/a7wdnVD1VkrqKxkAmoQ/R22iWbOe3aQ=; h=To:From:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=cgW+V1lTDngabekALN+fWy3Drjow2//kmwcT25P5Cem4pHFr8ArpRlxI15ViSkx/h HkVbccMHD0MwddzsBzJbq2Q/p23wDACoxNiTS5YWsKKiYdzteoSTBprdfrTTEBlQui f6PvzQeAm7gGLGukVvSWdO+oUQtZ/1bgSgRych08= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0FA26F8016C; Thu, 8 Jul 2021 02:43:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1C51AF80224; Thu, 8 Jul 2021 02:43:42 +0200 (CEST) Received: from neo-zeon.de (neo-zeon.de [70.229.12.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 258A3F8012F for ; Thu, 8 Jul 2021 02:43:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 258A3F8012F Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=neo-zeon.de header.i=@neo-zeon.de header.b="lLPQaZzm" Received: from neo-zeon.de (localhost [127.0.0.1]) by neo-zeon.de (OpenSMTPD) with ESMTP id d656f739 for ; Wed, 7 Jul 2021 17:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=neo-zeon.de; h=to:from :subject:message-id:date:mime-version:content-type; s=1; bh=qDIi /NkXmi/rFUGP9c7C3jzyywc=; b=lLPQaZzm9D2w5z3bScxB6rO0YAKVi0UJY047 DXK16n8ub6eU4xig9JMlLoPkRaLngBlC7ymiqS3fxD0EE2hGIJcMs/+NT5xOVbGa PmhNZB+EQMkkOeX601IBqilBUIaeYV9R58WV8uP4v9B/yEfzOj6YEkuuEpXx2Ao1 kYikuoE= Received: by neo-zeon.de (OpenSMTPD) with ESMTPSA id fa743d35 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Wed, 7 Jul 2021 17:16:49 -0700 (PDT) To: "alsa-devel@alsa-project.org" From: Cameron Berkenpas Subject: Patch For Lenovo Legion 7 15IMHg05 & Yoga 7 14ITL5 Message-ID: Date: Wed, 7 Jul 2021 17:16:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 Content-Language: en-US X-Content-Filtered-By: Mailman/MimeDel 2.1.15 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Hello, I have a patch against 5.12.x that results in working speaker audio for the Lenovo Legion 7 15IMHg05 and the Lenovo Yoga 7 14ITL5. How should I go about getting this merged? Should this be against the latest torvalds git? Is this the right place to present this particular patch? There are no issues checking my changes against checkpatch.pl. Thanks! diff --git a/sound/pci/hda/legion_15imhg05_helper.c b/sound/pci/hda/legion_15imhg05_helper.c new file mode 100644 index 000000000000..6ead999ec3c9 --- /dev/null +++ b/sound/pci/hda/legion_15imhg05_helper.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Fixes for Lenovo Legion 15IMHg05 speaker output. */ + +static const struct hda_verb legion_15imhg05_coefs[] = { +{0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x41 }, +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x2 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, 0x4b0, 0x20 }, + +// Set right speaker for Legion 7i. +{0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x42 }, + +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, +{0x20, AC_VERB_SET_PROC_COEF, 0xc }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x2a }, +{0x20, 0x4b0, 0x20 }, +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x2 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, 0x4b0, 0x20 }, +{} +}; + +static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, + const struct hda_fixup *fix, + int action) +{ + struct alc_spec *spec = codec->spec; + + switch (action) { + case HDA_FIXUP_ACT_INIT: + spec->gen.automute_speaker = 0; + break; + } +} diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e46e43dac6bf..28a4955cf2c2 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6352,6 +6352,12 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, /* for alc285_fixup_ideapad_s740_coef() */ #include "ideapad_s740_helper.c" +/* For alc287_fixup_legion_15imhg05_speakers() */ +#include "legion_15imhg05_helper.c" + +/* For yoga7_14itl5_coefs */ +#include "yoga7_14itl5_coefs.c" + enum { ALC269_FIXUP_GPIO2, ALC269_FIXUP_SONY_VAIO, @@ -6561,6 +6567,9 @@ enum { ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, ALC623_FIXUP_LENOVO_THINKSTATION_P340, ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, + ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS, + ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, + ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, }; static const struct hda_fixup alc269_fixups[] = { @@ -8088,6 +8097,24 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC269_FIXUP_THINKPAD_ACPI, }, + [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = legion_15imhg05_coefs, + .chained = true, + .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, + }, + [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc287_fixup_legion_15imhg05_speakers, + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE, + }, + [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = yoga7_14itl5_coefs, + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE, + }, [ALC295_FIXUP_ASUS_DACS] = { .type = HDA_FIXUP_FUNC, .v.func = alc295_fixup_asus_dacs, @@ -8520,6 +8547,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME), SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP), + SND_PCI_QUIRK(0x17aa, 0x3813, "Lenovo Legion 7", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS), + SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI), diff --git a/sound/pci/hda/yoga7_14itl5_coefs.c b/sound/pci/hda/yoga7_14itl5_coefs.c new file mode 100644 index 000000000000..a437fe042a1d --- /dev/null +++ b/sound/pci/hda/yoga7_14itl5_coefs.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Fixes for Lenovo Yoga 7 14ITL5 speaker output. */ + +static const struct hda_verb yoga7_14itl5_coefs[] = { +{0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x41 }, +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x2 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, 0x4b0, 0x20 }, + +// set right speaker Yoga 7i. +{0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x46 }, + +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, +{0x20, AC_VERB_SET_PROC_COEF, 0xc }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x2a }, +{0x20, 0x4b0, 0x20 }, +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x2 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +{0x20, 0x4b0, 0x20 }, +{} +}; +