From patchwork Sun Sep 3 14:37:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenghao Ding X-Patchwork-Id: 13373251 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 008A6C83F2D for ; Sun, 3 Sep 2023 14:39:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C292F74C; Sun, 3 Sep 2023 16:38:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C292F74C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1693751976; bh=XnJ+rBd204cD0RhuvzREtSVPd6pW1pZ5s9jN9JZC2E4=; h=From:To:CC:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=nqBMnlEhsk2he7Nz2mxj4cyi4babcxjJUzg1MbmM02uPQmUlA9IwymXR+Q2+djJhV vdSdL8gesFC7lj00qM7X7TdEQ6ocTLhQjbu+7hFthMPCmpSD17jK6L1zqzDykrL3pI 8SWsDJ13T1VNIssmlhKjB4GqadQ39sxQq7zgtdd8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E53B8F80494; Sun, 3 Sep 2023 16:38:36 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3B776F8047D; Sun, 3 Sep 2023 16:38:36 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9957FF80494; Sun, 3 Sep 2023 16:38:32 +0200 (CEST) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (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 D163EF800F5 for ; Sun, 3 Sep 2023 16:38:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D163EF800F5 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=hQwhUfAD Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 383EcHLk094173; Sun, 3 Sep 2023 09:38:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1693751897; bh=VPP3534bL1twBj+oAPOmEti95elGY30cahr0lXxhNOw=; h=From:To:CC:Subject:Date; b=hQwhUfADdrfaT2P1ZjStTaj/kYzbWzl9sOtuSrpX1Kpz8sAHmN6J+6yEWJOp51BAs cEJwusx6wXT72yrqHFS7hZ5t4Tpxn3RsGdtigfuVFvvbJ2kTZn2DRBBlyjWe4/fu4m 8L8wox2NgJhrGvJVEJFgSlfuRMaz+jShPrJi5CMk= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 383EcHjC038931 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 3 Sep 2023 09:38:17 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Sun, 3 Sep 2023 09:38:15 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Sun, 3 Sep 2023 09:38:16 -0500 Received: from LT5CG31242FY.dhcp.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 383Ec9Ev064460; Sun, 3 Sep 2023 09:38:10 -0500 From: Shenghao Ding To: CC: , , , , , , <13916275206@139.com>, , , , , , , , , , , Shenghao Ding Subject: [PATCH v1 1/2] ALSA: hda/tas2781: Update tas2781 HDA driver Date: Sun, 3 Sep 2023 22:37:57 +0800 Message-ID: <20230903143759.92-1-shenghao-ding@ti.com> X-Mailer: git-send-email 2.33.0.windows.2 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Message-ID-Hash: PFDGITJWYF5G2NWQTQLC4NEXFPSRNVE7 X-Message-ID-Hash: PFDGITJWYF5G2NWQTQLC4NEXFPSRNVE7 X-MailFrom: shenghao-ding@ti.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Support ACPI_ID both TXNW2781 and TIAS2781, and revert structure cs35l41_dev_name. Signed-off-by: Shenghao Ding --- Changes in v1: - Redefine tas2781_generic_fixup, remove hid param - TIAS2781 has been used by our customers, see following dstd.dsl. We have discussed this with them, they requested TIAS2781 must be supported for the laptops already released to market, their new laptops will switch to TXNW2781 Name (_HID, "TIAS2781") // _HID: Hardware ID Name (_UID, Zero) // _UID: Unique ID Method (_SUB, 0, NotSerialized) // _SUB: Subsystem ID { If ((SPID == Zero)) { Return ("17AA3886") } If ((SPID == One)) { Return ("17AA3884") } } - Add TXNW2781 support in comp_match_tas2781_dev_name - revert from scodec_dev_name back to cs35l41_dev_name --- sound/pci/hda/patch_realtek.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a07df6f929..1dc50fdbdf 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6745,7 +6745,7 @@ static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_ } } -struct scodec_dev_name { +struct cs35l41_dev_name { const char *bus; const char *hid; int index; @@ -6754,7 +6754,7 @@ struct scodec_dev_name { /* match the device name in a slightly relaxed manner */ static int comp_match_cs35l41_dev_name(struct device *dev, void *data) { - struct scodec_dev_name *p = data; + struct cs35l41_dev_name *p = data; const char *d = dev_name(dev); int n = strlen(p->bus); char tmp[32]; @@ -6773,19 +6773,27 @@ static int comp_match_cs35l41_dev_name(struct device *dev, void *data) static int comp_match_tas2781_dev_name(struct device *dev, void *data) { - struct scodec_dev_name *p = data; + const char *bus = data; const char *d = dev_name(dev); - int n = strlen(p->bus); + int n = strlen(bus); char tmp[32]; /* check the bus name */ - if (strncmp(d, p->bus, n)) + if (strncmp(d, bus, n)) return 0; /* skip the bus number */ if (isdigit(d[n])) n++; + + /* exactly match either TXNW2781 or TIAS2781 */ + /* the rest must be exact matching */ + snprintf(tmp, sizeof(tmp), "-%s:00", "TXNW2781"); + + if (!strcmp(d + n, tmp)) + return 1; + /* the rest must be exact matching */ - snprintf(tmp, sizeof(tmp), "-%s:00", p->hid); + snprintf(tmp, sizeof(tmp), "-%s:00", "TIAS2781"); return !strcmp(d + n, tmp); } @@ -6795,7 +6803,7 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char { struct device *dev = hda_codec_dev(cdc); struct alc_spec *spec = cdc->spec; - struct scodec_dev_name *rec; + struct cs35l41_dev_name *rec; int ret, i; switch (action) { @@ -6824,24 +6832,17 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char } static void tas2781_generic_fixup(struct hda_codec *cdc, int action, - const char *bus, const char *hid) + const char *bus) { struct device *dev = hda_codec_dev(cdc); struct alc_spec *spec = cdc->spec; - struct scodec_dev_name *rec; int ret; switch (action) { case HDA_FIXUP_ACT_PRE_PROBE: - rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL); - if (!rec) - return; - rec->bus = bus; - rec->hid = hid; - rec->index = 0; spec->comps[0].codec = cdc; component_match_add(dev, &spec->match, - comp_match_tas2781_dev_name, rec); + comp_match_tas2781_dev_name, (void *)bus); ret = component_master_add_with_match(dev, &comp_master_ops, spec->match); if (ret) @@ -6888,7 +6889,7 @@ static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const st static void tas2781_fixup_i2c(struct hda_codec *cdc, const struct hda_fixup *fix, int action) { - tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781"); + tas2781_generic_fixup(cdc, action, "i2c"); } /* for alc295_fixup_hp_top_speakers */ From patchwork Sun Sep 3 14:37:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenghao Ding X-Patchwork-Id: 13373252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 53655C71153 for ; Sun, 3 Sep 2023 14:40:20 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 01778741; Sun, 3 Sep 2023 16:39:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 01778741 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1693752018; bh=enV+SqyecbOfVcUbHoqUCBK6vvS9LXOU9qkKPFqeik8=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=OefMlXpTV0MaVRK216dWwG4vynfwWZo2bDRyuJeV0GzNj7ynZN0F1schT8yk7kugf FPZLCebqNFEw4yEcESVu3tEAqt8mpIpEtWUocSSOd1uAIZxW7qJGyAyOjalK4EVdZU iAhfjtn6oJxat0NKVXpNYwAUi8LshqAiCz05N+7s= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B9E04F80564; Sun, 3 Sep 2023 16:38:39 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id F0619F80552; Sun, 3 Sep 2023 16:38:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6B97FF8047D; Sun, 3 Sep 2023 16:38:34 +0200 (CEST) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 3815AF80141 for ; Sun, 3 Sep 2023 16:38:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3815AF80141 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=WIb4ofuC Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 383EcN98003267; Sun, 3 Sep 2023 09:38:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1693751903; bh=v6pe/Dt8AerprFgjS5Gcdn7rSGlsyB+4xsmT0PdVs2A=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=WIb4ofuCndyGlZVpvm3YB2Gvnl2n3dUBMiN0aIEEcz4ZyjY7HehtxwUHRSJnm8rR+ FAP9GM/D3DL/ZV+mXIfkFD2cBr9yHvQWknORkbSBQOsQaikGLRVnbPkXGjAKV3meoU tz2KdjwxFMcjHlSE31sh5F5ukiPzoUnCyoVRt1lo= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 383EcNWo018035 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 3 Sep 2023 09:38:23 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Sun, 3 Sep 2023 09:38:22 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Sun, 3 Sep 2023 09:38:22 -0500 Received: from LT5CG31242FY.dhcp.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 383Ec9Ew064460; Sun, 3 Sep 2023 09:38:17 -0500 From: Shenghao Ding To: CC: , , , , , , <13916275206@139.com>, , , , , , , , , , , Shenghao Ding Subject: [PATCH v1 2/2] ALSA: hda/tas2781: Update tas2781 HDA driver Date: Sun, 3 Sep 2023 22:37:58 +0800 Message-ID: <20230903143759.92-2-shenghao-ding@ti.com> X-Mailer: git-send-email 2.33.0.windows.2 In-Reply-To: <20230903143759.92-1-shenghao-ding@ti.com> References: <20230903143759.92-1-shenghao-ding@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Message-ID-Hash: IBTQEBRNLSIDVXRXGL4H2HIZWDVRFUPM X-Message-ID-Hash: IBTQEBRNLSIDVXRXGL4H2HIZWDVRFUPM X-MailFrom: shenghao-ding@ti.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Support ACPI_ID both TXNW2781 and TIAS2781, update dsp/bypass mode switching in tasdevice_program_put. Signed-off-by: Shenghao Ding --- Changes in v1: - Add comment on dsp/bypass mode in tasdevice_program_put and tasdevice_info_programs - TIAS2781 has been used by our customers, see following dstd.dsl. We have discussed this with them, they requested TIAS2781 must be supported for the laptops already released to market, their new laptop can switch to TXNW2781 Name (_HID, "TIAS2781") // _HID: Hardware ID Name (_UID, Zero) // _UID: Unique ID Method (_SUB, 0, NotSerialized) // _SUB: Subsystem ID { If ((SPID == Zero)) { Return ("17AA3886") } If ((SPID == One)) { Return ("17AA3884") } } --- sound/pci/hda/tas2781_hda_i2c.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c index fb80280293..5250d300a2 100644 --- a/sound/pci/hda/tas2781_hda_i2c.c +++ b/sound/pci/hda/tas2781_hda_i2c.c @@ -199,8 +199,11 @@ static int tasdevice_info_programs(struct snd_kcontrol *kcontrol, uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; + /* 0: dsp mode + * non-zero: bypass mode + */ uinfo->value.integer.min = 0; - uinfo->value.integer.max = tas_fw->nr_programs - 1; + uinfo->value.integer.max = tas_fw->nr_programs; return 0; } @@ -238,7 +241,10 @@ static int tasdevice_program_put(struct snd_kcontrol *kcontrol, int max = tas_fw->nr_programs - 1; int val, ret = 0; - val = clamp(nr_program, 0, max); + /* 0: dsp mode + * non-zero: bypass mode + */ + val = (nr_program) ? max : 0; if (tas_priv->cur_prog != val) { tas_priv->cur_prog = val; @@ -647,7 +653,9 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt) const char *device_name; int ret; - if (strstr(dev_name(&clt->dev), "TIAS2781")) + if (strstr(dev_name(&clt->dev), "TXNW2781")) + device_name = "TXNW2781"; + else if (strstr(dev_name(&clt->dev), "TIAS2781")) device_name = "TIAS2781"; else return -ENODEV; @@ -824,6 +832,7 @@ static const struct i2c_device_id tas2781_hda_i2c_id[] = { static const struct acpi_device_id tas2781_acpi_hda_match[] = { {"TIAS2781", 0 }, + {"TXNW2781", 1 }, {} }; MODULE_DEVICE_TABLE(acpi, tas2781_acpi_hda_match);