Skip to content

Commit 0d68ad0

Browse files
niranjanhytibroonie
authored andcommitted
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. Signed-off-by: Niranjan H Y <niranjan.hy@ti.com> Link: https://patch.msgid.link/20260214104710.632-1-niranjan.hy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 82e3265 commit 0d68ad0

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

sound/soc/codecs/tas2783-sdw.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,8 +1216,51 @@ static s32 tas_update_status(struct sdw_slave *slave,
12161216
return tas_io_init(&slave->dev, slave);
12171217
}
12181218

1219+
/*
1220+
* TAS2783 requires explicit port prepare during playback stream
1221+
* setup even when simple_ch_prep_sm is enabled. Without this,
1222+
* the port fails to enter the prepared state resulting in no audio output.
1223+
*/
1224+
static int tas_port_prep(struct sdw_slave *slave, struct sdw_prepare_ch *prep_ch,
1225+
enum sdw_port_prep_ops pre_ops)
1226+
{
1227+
struct device *dev = &slave->dev;
1228+
struct sdw_dpn_prop *dpn_prop;
1229+
u32 addr;
1230+
int ret;
1231+
1232+
dpn_prop = slave->prop.sink_dpn_prop;
1233+
if (!dpn_prop || !dpn_prop->simple_ch_prep_sm)
1234+
return 0;
1235+
1236+
addr = SDW_DPN_PREPARECTRL(prep_ch->num);
1237+
switch (pre_ops) {
1238+
case SDW_OPS_PORT_PRE_PREP:
1239+
ret = sdw_write_no_pm(slave, addr, prep_ch->ch_mask);
1240+
if (ret)
1241+
dev_err(dev, "prep failed for port %d, err=%d\n",
1242+
prep_ch->num, ret);
1243+
return ret;
1244+
1245+
case SDW_OPS_PORT_PRE_DEPREP:
1246+
ret = sdw_write_no_pm(slave, addr, 0x00);
1247+
if (ret)
1248+
dev_err(dev, "de-prep failed for port %d, err=%d\n",
1249+
prep_ch->num, ret);
1250+
return ret;
1251+
1252+
case SDW_OPS_PORT_POST_PREP:
1253+
case SDW_OPS_PORT_POST_DEPREP:
1254+
/* No POST handling required for TAS2783 */
1255+
return 0;
1256+
}
1257+
1258+
return 0;
1259+
}
1260+
12191261
static const struct sdw_slave_ops tas_sdw_ops = {
12201262
.update_status = tas_update_status,
1263+
.port_prep = tas_port_prep,
12211264
};
12221265

12231266
static void tas_remove(struct tas2783_prv *tas_dev)

0 commit comments

Comments
 (0)