mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Niranjan H Y <niranjan.hy@ti.com>
To: <linux-sound@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <broonie@kernel.org>,
	<ckeepax@opensource.cirrus.com>, <lgirdwood@gmail.com>,
	<perex@perex.cz>, <tiwai@suse.com>, <cezary.rojewski@intel.com>,
	<peter.ujfalusi@linux.intel.com>,
	<yung-chuan.liao@linux.intel.com>, <kai.vehmanen@linux.intel.com>,
	<pierre-louis.bossart@linux.dev>, <baojun.xu@ti.com>,
	<shenghao-ding@ti.com>, <sandeepk@ti.com>, <v-hampiholi@ti.com>,
	Niranjan H Y <niranjan.hy@ti.com>
Subject: [PATCH v2 1/5] ASoC: tac5xx2-sdw: add tac5272 support
Date: Thu, 26 Nov 2026 20:20:19 +0900	[thread overview]
Message-ID: <20261126112023.29054-1-niranjan.hy@ti.com> (raw)

Add support for tac5272 which is a UAJ + DMIC
variant with no speaker support.

Refactor tac_component_probe() to dynamically register common
DAPM widgets, routes and controls per part id, removing them from
the static soc_codec_driver_tacdevice. This allows tac5272 to
register common and UAJ widgets only, skipping the speaker path
absent on this variant.

Signed-off-by: Niranjan H Y <niranjan.hy@ti.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
changes since v1:
* Refactored to add the widgets dynamically based on part id
* add DMIC support as part of tac5272
* link to v1: https://lore.kernel.org/linux-sound/20260908032757.389-1-niranjan.hy@ti.com/

 sound/soc/codecs/tac5xx2-sdw.c | 127 +++++++++++++++++++++++++--------
 1 file changed, 99 insertions(+), 28 deletions(-)

diff --git a/sound/soc/codecs/tac5xx2-sdw.c b/sound/soc/codecs/tac5xx2-sdw.c
index 43584bebd..a541f95e4 100644
--- a/sound/soc/codecs/tac5xx2-sdw.c
+++ b/sound/soc/codecs/tac5xx2-sdw.c
@@ -1168,6 +1168,40 @@ static int tac_interrupt_callback(struct sdw_slave *slave,
 	return 0;
 }
 
+static struct snd_soc_dai_driver tac5272_dai_driver[] = {
+	{
+		.name = "tac5xx2-aif3",
+		.id = TAC5XX2_UAJ,
+		.playback = {
+			.stream_name = "DP4 UAJ Speaker Playback",
+			.channels_min = 1,
+			.channels_max = 2,
+			.rates = TAC5XX2_DEVICE_RATES,
+			.formats = TAC5XX2_DEVICE_FORMATS,
+		},
+		.capture = {
+			.stream_name = "DP7 UAJ Mic Capture",
+			.channels_min = 1,
+			.channels_max = 2,
+			.rates = TAC5XX2_DEVICE_RATES,
+			.formats = TAC5XX2_DEVICE_FORMATS,
+		},
+		.ops = &tac_dai_ops,
+	},
+	{
+		.name = "tac5xx2-aif2",
+		.id = TAC5XX2_DMIC,
+		.capture = {
+			.stream_name = "DP3 Mic Capture",
+			.channels_min = 1,
+			.channels_max = 4,
+			.rates = TAC5XX2_DEVICE_RATES,
+			.formats = TAC5XX2_DEVICE_FORMATS,
+		},
+		.ops = &tac_dai_ops,
+	},
+};
+
 static struct snd_soc_dai_driver tac5572_dai_driver[] = {
 	{
 		.name = "tac5xx2-aif1",
@@ -1353,40 +1387,78 @@ static struct snd_soc_dai_driver tas2883_dai_driver[] = {
 static s32 tac_component_probe(struct snd_soc_component *component)
 {
 	struct tac5xx2_prv *tac_dev = snd_soc_component_get_drvdata(component);
+	u32 part_id = tac_dev->part_id;
 	int ret;
 
 	ret = pm_runtime_resume(component->dev);
 	if (ret < 0 && ret != -EACCES)
 		return ret;
 
-	if (!tac_has_uaj_support(tac_dev))
-		goto done_comp_probe;
+	switch (part_id) {
+	case 0x2883:
+	case 0x5272:
+	case 0x5572:
+	case 0x5672:
+	case 0x5682:
+		ret = snd_soc_dapm_new_controls(snd_soc_component_to_dapm(component),
+						tac5xx2_common_widgets,
+					ARRAY_SIZE(tac5xx2_common_widgets));
+		if (ret) {
+			dev_err(component->dev, "Failed to add common widgets: %d\n", ret);
+			break;
+		}
 
-	ret = snd_soc_dapm_new_controls(snd_soc_component_to_dapm(component),
-					tac_uaj_widgets,
-					ARRAY_SIZE(tac_uaj_widgets));
-	if (ret) {
-		dev_err(component->dev, "Failed to add UAJ widgets: %d\n", ret);
-		return ret;
-	}
+		ret = snd_soc_dapm_add_routes(snd_soc_component_to_dapm(component),
+					      tac5xx2_common_routes,
+					      ARRAY_SIZE(tac5xx2_common_routes));
+		if (ret) {
+			dev_err(component->dev, "Failed to add common routes: %d\n", ret);
+			break;
+		}
 
-	ret = snd_soc_dapm_add_routes(snd_soc_component_to_dapm(component),
-				      tac_uaj_routes, ARRAY_SIZE(tac_uaj_routes));
-	if (ret) {
-		dev_err(component->dev, "Failed to add UAJ routes: %d\n", ret);
-		return ret;
-	}
+		ret = snd_soc_add_component_controls(component, tac5xx2_snd_controls,
+						     ARRAY_SIZE(tac5xx2_snd_controls));
+		if (ret) {
+			dev_err(component->dev, "Failed to add common controls: %d\n", ret);
+			break;
+		}
 
-	ret = snd_soc_add_component_controls(component, tac_uaj_controls,
-					     ARRAY_SIZE(tac_uaj_controls));
-	if (ret) {
-		dev_err(component->dev, "Failed to add UAJ controls: %d\n", ret);
-			return ret;
+		if (part_id == 0x2883)
+			break;
+
+		if (!tac_has_uaj_support(tac_dev)) {
+			if (part_id == 0x5272) {
+				dev_err(component->dev, "tac5272 without UAJ support is invalid\n");
+				ret = -EINVAL;
+			}
+			break;
+		}
+
+		ret = snd_soc_dapm_new_controls(snd_soc_component_to_dapm(component),
+						tac_uaj_widgets,
+						ARRAY_SIZE(tac_uaj_widgets));
+		if (ret) {
+			dev_err(component->dev, "Failed to add UAJ widgets: %d\n", ret);
+			break;
+		}
+
+		ret = snd_soc_dapm_add_routes(snd_soc_component_to_dapm(component),
+					      tac_uaj_routes, ARRAY_SIZE(tac_uaj_routes));
+		if (ret) {
+			dev_err(component->dev, "Failed to add UAJ routes: %d\n", ret);
+			break;
+		}
+
+		ret = snd_soc_add_component_controls(component, tac_uaj_controls,
+						     ARRAY_SIZE(tac_uaj_controls));
+		if (ret)
+			dev_err(component->dev, "Failed to add UAJ controls: %d\n", ret);
+
+		break;
 	}
 
-done_comp_probe:
 	tac_dev->component = component;
-	return 0;
+	return ret;
 }
 
 static void tac_component_remove(struct snd_soc_component *codec)
@@ -1399,12 +1471,6 @@ static void tac_component_remove(struct snd_soc_component *codec)
 static const struct snd_soc_component_driver soc_codec_driver_tacdevice = {
 	.probe = tac_component_probe,
 	.remove = tac_component_remove,
-	.controls = tac5xx2_snd_controls,
-	.num_controls = ARRAY_SIZE(tac5xx2_snd_controls),
-	.dapm_widgets = tac5xx2_common_widgets,
-	.num_dapm_widgets = ARRAY_SIZE(tac5xx2_common_widgets),
-	.dapm_routes = tac5xx2_common_routes,
-	.num_dapm_routes = ARRAY_SIZE(tac5xx2_common_routes),
 	.idle_bias_on = 0,
 	.endianness = 1,
 };
@@ -1419,6 +1485,10 @@ static s32 tac_init(struct tac5xx2_prv *tac_dev)
 	dev_set_drvdata(tac_dev->dev, tac_dev);
 
 	switch (tac_dev->part_id) {
+	case 0x5272:
+		dai_drv = tac5272_dai_driver;
+		num_dais = ARRAY_SIZE(tac5272_dai_driver);
+		break;
 	case 0x5572:
 		dai_drv = tac5572_dai_driver;
 		num_dais = ARRAY_SIZE(tac5572_dai_driver);
@@ -2043,6 +2113,7 @@ static void tac_sdw_remove(struct sdw_slave *peripheral)
 }
 
 static const struct sdw_device_id tac_sdw_id[] = {
+	SDW_SLAVE_ENTRY(0x0102, 0x5272, 0),
 	SDW_SLAVE_ENTRY(0x0102, 0x5572, 0),
 	SDW_SLAVE_ENTRY(0x0102, 0x5672, 0),
 	SDW_SLAVE_ENTRY(0x0102, 0x5682, 0),
-- 
2.34.1


             reply	other threads:[~2026-11-26 11:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 11:20 Niranjan H Y [this message]
2026-11-26 11:20 ` [PATCH v2 2/5] ASoC: sdw_utils: " Niranjan H Y
2026-11-26 11:20 ` [PATCH v2 3/5] ASoC: tac5xx2-sdw: correct default volume registers Niranjan H Y
2026-11-26 11:20 ` [PATCH v2 4/5] ASoC: tac5xx2-sdw: initialize volume registers to 0 dBFS on first probe Niranjan H Y
2026-11-26 11:20 ` [PATCH v2 5/5] ASoC: tac5xx2-sdw: drop DSP algo re-enable from port post-prepare Niranjan H Y

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261126112023.29054-1-niranjan.hy@ti.com \
    --to=niranjan.hy@ti.com \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=sandeepk@ti.com \
    --cc=shenghao-ding@ti.com \
    --cc=tiwai@suse.com \
    --cc=v-hampiholi@ti.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®