Skip to contentSkip to conversation

ASoC: tac5xx2-sdw: add tac5272 support

PATCH New Niranjan H Y 2 participants 8 messages Nov 26

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 ASoC: tac5xx2-sdw: add tac5272 support

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.

---
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/[email protected]/

 sound/soc/codecs/tac5xx2-sdw.c | 127 +++++++++++++++++++++++++--------
 1 file changed, 99 insertions(+), 28 deletions(-)
sound/soc/codecs/tac5xx2-sdw.c +99 -28
index 43584bebd..a541f95e4 100644
@@ -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),
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/5 ASoC: sdw_utils: add tac5272 support

Update soundwire utils to support tac5272 which is
UAJ + DMIC variant with no speaker support.

---
changes since v1:
* Added DMIC support to tac5272 machine driver entry
* link to v1: https://lore.kernel.org/linux-sound/[email protected]/

 sound/soc/sdw_utils/soc_sdw_utils.c | 30 +++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
sound/soc/sdw_utils/soc_sdw_utils.c +30 -0
index b6acf7616..617ea88b3 100644
@@ -81,6 +81,36 @@ static const struct snd_kcontrol_new rt700_controls[] = {
 };
 
 struct asoc_sdw_codec_info codec_info_list[] = {
+	{
+		.vendor_id = 0x0102,
+		.part_id = 0x5272,
+		.name_prefix = "tac5272",
+		.dais = {
+			{
+				/* UAJ */
+				.direction = {true, true},
+				.dai_name = "tac5xx2-aif3",
+				.component_name = "tac5272",
+				.dai_type = SOC_SDW_DAI_TYPE_JACK,
+				.dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_JACK_IN_DAI_ID},
+				.controls = generic_jack_controls,
+				.num_controls = ARRAY_SIZE(generic_jack_controls),
+				.widgets = generic_jack_widgets,
+				.num_widgets = ARRAY_SIZE(generic_jack_widgets),
+				.rtd_init = asoc_sdw_ti_sdca_jack_rtd_init,
+			},
+			{
+				/* mic (DMIC) */
+				.direction = {false, true},
+				.dai_name = "tac5xx2-aif2",
+				.component_name = "tac5272",
+				.dai_type = SOC_SDW_DAI_TYPE_MIC,
+				.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
+				.rtd_init = asoc_sdw_ti_dmic_rtd_init,
+			},
+		},
+		.dai_num = 2,
+	},
 	{
 		.vendor_id = 0x0102,
 		.part_id = 0x5572,
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 2/5] ASoC: sdw_utils: add tac5272 support

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] ASoC: sdw_utils: missing UAJ DAPM routes in asoc_sdw_ti_sdca_jack_rtd_init() --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] ASoC: sdw_utils: missing UAJ DAPM routes in asoc_sdw_ti_sdca_jack_rtd_init()
--

commit ab1ea32241446e1fd526f967dff86ea035e556af
Author: Niranjan H Y <[email protected]>

ASoC: sdw_utils: add tac5272 support

This commit adds a codec_info_list entry for the TI tac5272 SoundWire codec with UAJ and DMIC DAI definitions.

Quoted 15 lines
sound/soc/sdw_utils/soc_sdw_utils.c +7 -0
index b6acf7616d147..617ea88b30649 100644
@@ -81,6 +81,36 @@ static const struct snd_kcontrol_new rt700_controls[] = {
 };
 
 struct asoc_sdw_codec_info codec_info_list[] = {
+	{
+		.vendor_id = 0x0102,
+		.part_id = 0x5272,
+		.name_prefix = "tac5272",
+		.dais = {
+			{
+				/* UAJ */

sound/soc/sdw_utils/soc_sdw_utils.c static const struct snd_kcontrol_new rt700_controls[] = { · line 100

Quoted 10 lines
sound/soc/sdw_utils/soc_sdw_utils.c +10 -0
+				.direction = {true, true},
+				.dai_name = "tac5xx2-aif3",
+				.component_name = "tac5272",
+				.dai_type = SOC_SDW_DAI_TYPE_JACK,
+				.dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_JACK_IN_DAI_ID},
+				.controls = generic_jack_controls,
+				.num_controls = ARRAY_SIZE(generic_jack_controls),
+				.widgets = generic_jack_widgets,
+				.num_widgets = ARRAY_SIZE(generic_jack_widgets),
+				.rtd_init = asoc_sdw_ti_sdca_jack_rtd_init,

[Severity: High]
Does asoc_sdw_ti_sdca_jack_rtd_init() leave the card's "Headphone" and "Headset Mic" widgets (from generic_jack_widgets) disconnected from the codec's UAJ widgets?

Unlike asoc_sdw_ti_tac5xx2_spk_rtd_init(), which adds DAPM routes from "<prefix> SPK_L" and "<prefix> SPK_R" to the card speaker widgets, asoc_sdw_ti_sdca_jack_rtd_init() binds ti_sdca_jack_pins to "Headphone" and "Headset Mic" without calling snd_soc_dapm_add_routes() to connect them to "tac5272 HP_L", "tac5272 HP_R", and "tac5272 UAJ_MIC" defined in sound/soc/codecs/tac5xx2-sdw.c:tac_uaj_widgets[]. As a result, jack pin state updates and the Headphone/Headset Mic pin switches do not gate or power the codec's UAJ DAPM paths.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#3 lore raw

PATCH v2 3/5 ASoC: tac5xx2-sdw: correct default volume registers

In reply to Niranjan H Y

The volume doesn't get correctly updated when the
volume in the mixer controls are updated to their default values as the regmap cache will not do HW write leading to unexpected behaviour. So correct them with the hardware defaults.

---
changes since v1:
* newly added patch

 sound/soc/codecs/tac5xx2-sdw.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/codecs/tac5xx2-sdw.c +5 -3
index a541f95e4..1cea864a2 100644
@@ -401,6 +401,8 @@ static const struct reg_default tac_reg_default[] = {
 	{TAC_USAGE_REG(SM, OT113), 0x0},
 	{TAC_MUTE_REG(SM, FU113, LEFT), 0x1},
 	{TAC_MUTE_REG(SM, FU113, RIGHT), 0x1},
+	{TAC_VOLUME_REG(SM, FU113, LEFT), 0x9c00},
+	{TAC_VOLUME_REG(SM, FU113, RIGHT), 0x9c00},
 	{TAC_GAIN_REG(SM, FU113, LEFT), 0x0},
 	{TAC_GAIN_REG(SM, FU113, RIGHT), 0x0},
 	{TAC_MUTE_REG(SM, FU11,  LEFT), 0x1},
@@ -417,11 +419,11 @@ static const struct reg_default tac_reg_default[] = {
 	{TAC_USAGE_REG(UAJ, OT45), 0x0},
 	{TAC_MUTE_REG(UAJ, FU41, LEFT), 0x1},
 	{TAC_MUTE_REG(UAJ, FU41, RIGHT), 0x1},
-	{TAC_VOLUME_REG(UAJ, FU41, LEFT), 0x0},
-	{TAC_VOLUME_REG(UAJ, FU41, RIGHT), 0x0},
+	{TAC_VOLUME_REG(UAJ, FU41, LEFT), 0x9c00},
+	{TAC_VOLUME_REG(UAJ, FU41, RIGHT), 0x9c00},
 	{TAC_MUTE_REG(UAJ, FU36, RIGHT), 0x1},
 	{SDW_SDCA_CTL(TAC_FUNCTION_ID_UAJ, TAC_SDCA_ENT_FU36,
-		      TAC_SDCA_CHANNEL_VOLUME, TAC_JACK_MONO_CS), 0x0},
+		      TAC_SDCA_CHANNEL_VOLUME, TAC_JACK_MONO_CS), 0x9c00},
 	{TAC_XU_BYPASS_REG(UAJ, XU42), 0x0},
 	{SDW_SDCA_CTL(TAC_FUNCTION_ID_UAJ, TAC_SDCA_ENT_CS36,
 		      TAC_SDCA_CTL_CS_SAMP_RATE_IDX, 0), 0x0},
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 3/5] ASoC: tac5xx2-sdw: correct default volume registers

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] ASoC: tac5xx2-sdw: missing Fixes trailer for volume reg_default fix --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] ASoC: tac5xx2-sdw: missing Fixes trailer for volume reg_default fix
--

commit ddc6ab01eca5092c2a9cba76fe32f9d666b7219b
Author: Niranjan H Y <[email protected]>

Quoted 10 lines

ASoC: tac5xx2-sdw: correct default volume registers

The volume doesn't get correctly updated when the
volume in the mixer controls are updated to their default values as the regmap cache will not do HW write leading to unexpected behaviour. So correct them with the hardware defaults.

[Severity: Low]
This fixes the tac_reg_default volume entries from cf82dd2183cb ("ASoC:
tac5xx2-sdw: update default regmap registers"). Should this include:

Fixes cf82dd2183cb ("ASoC: tac5xx2-sdw: update default regmap registers")
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#5 lore raw

PATCH v2 4/5 ASoC: tac5xx2-sdw: initialize volume registers to 0 dBFS on first probe

In reply to Niranjan H Y

The SDCA volume registers power on at 0x9c00 (-100 dBFS in Q7.8 format) which is below the mixer control range (-72 dBFS to +6 dBFS). Write 0x0 (0 dBFS) to all volume registers on first probe so the initial HW state is within the valid range and consistent with the regmap cache.

SA FU21 is already handled by the existing tac_spk_seq. Add tac_dmic_seq for SM FU113 and tac_uaj_seq for UAJ FU41/FU36.

---
changes since v1:
* newly added patch

 sound/soc/codecs/tac5xx2-sdw.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
sound/soc/codecs/tac5xx2-sdw.c +28 -0
index 1cea864a2..d679a4194 100644
@@ -438,6 +438,18 @@ static const struct reg_sequence tac_spk_seq[] = {
 			      TAC_SDCA_CHANNEL_VOLUME, TAC_CHANNEL_RIGHT), 0),
 };
 
+static const struct reg_sequence tac_dmic_seq[] = {
+	REG_SEQ0(TAC_VOLUME_REG(SM, FU113, LEFT), 0),
+	REG_SEQ0(TAC_VOLUME_REG(SM, FU113, RIGHT), 0),
+};
+
+static const struct reg_sequence tac_uaj_seq[] = {
+	REG_SEQ0(TAC_VOLUME_REG(UAJ, FU41, LEFT), 0),
+	REG_SEQ0(TAC_VOLUME_REG(UAJ, FU41, RIGHT), 0),
+	REG_SEQ0(SDW_SDCA_CTL(TAC_FUNCTION_ID_UAJ, TAC_SDCA_ENT_FU36,
+			      TAC_SDCA_CHANNEL_VOLUME, TAC_JACK_MONO_CS), 0),
+};
+
 static bool tac_volatile_reg(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
@@ -1854,6 +1866,15 @@ static int tac_io_init(struct device *dev, struct sdw_slave *slave, bool first)
 			goto io_init_err;
 		}
 		dev_dbg(dev, "smartmic init done\n");
+
+		if (first) {
+			ret = regmap_multi_reg_write(tac_dev->regmap, tac_dmic_seq,
+						     ARRAY_SIZE(tac_dmic_seq));
+			if (ret) {
+				dev_err(dev, "dmic vol init failed, err=%d\n", ret);
+				goto io_init_err;
+			}
+		}
 	}
 
 	if (tac_dev->uaj_func_data) {
@@ -1866,6 +1887,13 @@ static int tac_io_init(struct device *dev, struct sdw_slave *slave, bool first)
 		dev_dbg(dev, "uaj init done\n");
 
 		if (first) {
+			ret = regmap_multi_reg_write(tac_dev->regmap, tac_uaj_seq,
+						     ARRAY_SIZE(tac_uaj_seq));
+			if (ret) {
+				dev_err(dev, "uaj vol init failed, err=%d\n", ret);
+				goto io_init_err;
+			}
+
 			if (tac_dev->hs_jack) {
 				ret = tac5xx2_jack_init(tac_dev);
 				if (ret) {
Signature · 1 line
2.34.1
#6 lore raw

PATCH v2 5/5 ASoC: tac5xx2-sdw: drop DSP algo re-enable from port post-prepare

In reply to Niranjan H Y

The post port prepare callback was re-enabling the DSP algorithm by writing TAC_DSP_ALGO_STATUS_RUNNING if the algo was found not running. This is not needed as the algorithm state is managed independently of the stream prepare sequence.

Remove tac_port_prep() and clear the .port_prep ops entry.

---
changes since v1:
* newly added patch

 sound/soc/codecs/tac5xx2-sdw.c | 34 ----------------------------------
 1 file changed, 34 deletions(-)
sound/soc/codecs/tac5xx2-sdw.c +0 -34
index d679a4194..7140cc111 100644
@@ -1984,44 +1984,10 @@ static int tac5xx2_sdw_read_prop(struct sdw_slave *peripheral)
 	return 0;
 }
 
-static int tac_port_prep(struct sdw_slave *slave, struct sdw_prepare_ch *prep_ch,
-			 enum sdw_port_prep_ops pre_ops)
-{
-	struct device *dev = &slave->dev;
-	struct tac5xx2_prv *tac_dev = dev_get_drvdata(dev);
-	unsigned int val;
-	int ret;
-
-	if (pre_ops != SDW_OPS_PORT_POST_PREP)
-		return 0;
-
-	if (!tac_dev->fw_dl_success)
-		return 0;
-
-	ret = regmap_read(tac_dev->regmap, TAC_DSP_ALGO_STATUS, &val);
-	if (ret) {
-		dev_err(dev, "Failed to read algo status: %d\n", ret);
-		return ret;
-	}
-
-	if (val != TAC_DSP_ALGO_STATUS_RUNNING) {
-		dev_dbg(dev, "Algo not running (0x%02x), re-enabling\n", val);
-		ret = regmap_write(tac_dev->regmap, TAC_DSP_ALGO_STATUS,
-				   TAC_DSP_ALGO_STATUS_RUNNING);
-		if (ret) {
-			dev_err(dev, "Failed to re-enable algo: %d\n", ret);
-			return ret;
-		}
-	}
-
-	return 0;
-}
-
 static const struct sdw_slave_ops tac_sdw_ops = {
 	.read_prop = tac5xx2_sdw_read_prop,
 	.update_status = tac_update_status,
 	.interrupt_callback = tac_interrupt_callback,
-	.port_prep = tac_port_prep,
 };
 
 static s32 tac_sdw_probe(struct sdw_slave *peripheral,
Signature · 1 line
2.34.1
#7 lore raw
In reply to Niranjan H Y
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] ASoC: tac5xx2-sdw: tac_component_probe() registers speaker path on tac5272 --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] ASoC: tac5xx2-sdw: tac_component_probe() registers speaker path on tac5272
--

commit fd04f2d835d7450161d1e9e240c16a2e7cecb8a0
Author: Niranjan H Y <[email protected]>

ASoC: tac5xx2-sdw: add tac5272 support

This commit adds support for the tac5272 SoundWire codec variant and refactors tac_component_probe() to dynamically register common and UAJ DAPM widgets, routes, and controls based on the part ID.

Quoted 4 lines
sound/soc/codecs/tac5xx2-sdw.c +0 -0
index 43584bebdafee..a541f95e4cc5b 100644

[ ... ]

Quoted 40 lines
sound/soc/codecs/tac5xx2-sdw.c +20 -9
@@ -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;

sound/soc/codecs/tac5xx2-sdw.c static struct snd_soc_dai_driver tas2883_dai_driver[] = { · line 1420

Quoted 10 lines
sound/soc/codecs/tac5xx2-sdw.c +3 -6
+		}
 
-	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));

[Severity: Medium]
Does registering tac5xx2_common_widgets, tac5xx2_common_routes, and tac5xx2_snd_controls for case 0x5272 still register the speaker path on tac5272?

Although tac5272_dai_driver omits tac5xx2-aif1 ("DP1 Speaker Playback"), those three tables still bundle the Port 1 speaker widgets, routes, and SmartAmp controls alongside the DMIC definitions:

sound/soc/codecs/tac5xx2-sdw.c:

static const struct snd_kcontrol_new tac5xx2_snd_controls[] = {
	SOC_DOUBLE_R_RANGE_TLV("Amp Volume", TAC_AMP_LVL_CFG0, TAC_AMP_LVL_CFG1,
			       2, 0, 44, 1, tac5xx2_amp_tlv),
	TAC_DOUBLE_Q78_TLV("DMIC Capture Volume", SM, FU113),
	TAC_DOUBLE_Q78_TLV("Speaker Volume", SA, FU21),
};
...
static const struct snd_soc_dapm_widget tac5xx2_common_widgets[] = {
	/* Port 1: Speaker Playback Path */
	SND_SOC_DAPM_AIF_IN("AIF1 Playback", "DP1 Speaker Playback", 0,
			    SND_SOC_NOPM, 0, 0),
	SND_SOC_DAPM_PGA("FU21_L", FU21_L_MUTE_REG, 0, 1, NULL, 0),
	SND_SOC_DAPM_PGA("FU21_R", FU21_R_MUTE_REG, 0, 1, NULL, 0),
	SND_SOC_DAPM_PGA("FU23_L", FU23_L_MUTE_REG, 0, 1, NULL, 0),
	SND_SOC_DAPM_PGA("FU23_R", FU23_R_MUTE_REG, 0, 1, NULL, 0),
	SND_SOC_DAPM_OUTPUT("SPK_L"),
	SND_SOC_DAPM_OUTPUT("SPK_R"),

On tac5272, this exposes dangling speaker DAPM widgets/routes and non-existent "Amp Volume" and "Speaker Volume" mixer controls that access unimplemented SmartAmp SDCA registers when read or written from userspace.

Should the speaker widgets, routes, and controls be split out from the DMIC entries so that 0x5272 only registers the DMIC and UAJ paths?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1