Skip to contentSkip to conversation

ASoC: tas2783A: add explicit port prepare handling

PATCH In review Niranjan H Y 2 participants 2 messages Feb 14 – Feb 17

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

PATCH 1/1 ASoC: tas2783A: add explicit port prepare handling

TAS2783a required port prepare bits to be set during playback
even when it is using simplified CP_SM.

Normally, SoundWire core handles prepare sequencing automatically
depending on the type of the device available. For simplified CP_SM there is no need to set the prepare bits. However, due to a hardware limitation in TAS2783A, the port must still be explicitly prepared and de-prepared by the driver to ensure reliable playback.

Add a custom .port_prep() callback to program DPN_PREPARECTRL during
PRE_PREP and PRE_DEPREP operations.

---
 sound/soc/codecs/tas2783-sdw.c | 43 ++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
sound/soc/codecs/tas2783-sdw.c +43 -0
index 3c1fbf523..bc8dcd6f1 100644
@@ -1216,8 +1216,51 @@ static s32 tas_update_status(struct sdw_slave *slave,
 	return tas_io_init(&slave->dev, slave);
 }
 
+/*
+ * TAS2783 requires explicit port prepare during playback stream
+ * setup even when simple_ch_prep_sm is enabled. Without this,
+ * the port fails to enter the prepared state resulting in no audio output.
+ */
+static int tas_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 sdw_dpn_prop *dpn_prop;
+	u32 addr;
+	int ret;
+
+	dpn_prop = slave->prop.sink_dpn_prop;
+	if (!dpn_prop || !dpn_prop->simple_ch_prep_sm)
+		return 0;
+
+	addr = SDW_DPN_PREPARECTRL(prep_ch->num);
+	switch (pre_ops) {
+	case SDW_OPS_PORT_PRE_PREP:
+		ret = sdw_write_no_pm(slave, addr, prep_ch->ch_mask);
+		if (ret)
+			dev_err(dev, "prep failed for port %d, err=%d\n",
+					prep_ch->num, ret);
+		return ret;
+
+	case SDW_OPS_PORT_PRE_DEPREP:
+		ret = sdw_write_no_pm(slave, addr, 0x00);
+		if (ret)
+			dev_err(dev, "de-prep failed for port %d, err=%d\n",
+					prep_ch->num, ret);
+		return ret;
+
+	case SDW_OPS_PORT_POST_PREP:
+	case SDW_OPS_PORT_POST_DEPREP:
+		/* No POST handling required for TAS2783 */
+		return 0;
+	}
+
+	return 0;
+}
+
 static const struct sdw_slave_ops tas_sdw_ops = {
 	.update_status	= tas_update_status,
+	.port_prep = tas_port_prep,
 };
 
 static void tas_remove(struct tas2783_prv *tas_dev)
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 10 lines · Niranjan H Y

TAS2783a required port prepare bits to be set during playback
even when it is using simplified CP_SM.

Normally, SoundWire core handles prepare sequencing automatically
depending on the type of the device available. For simplified CP_SM there is no need to set the prepare bits. However, due to a hardware limitation in TAS2783A, the port must still be explicitly prepared and de-prepared by the driver to ensure reliable playback.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: tas2783A: add explicit port prepare handling

      commit: 0d68ad088e334088b031423e59886ae118c11202

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark