Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Niranjan H Y and committed by
Mark Brown
0d68ad08 82e32654

+43
+43
sound/soc/codecs/tas2783-sdw.c
··· 1216 1216 return tas_io_init(&slave->dev, slave); 1217 1217 } 1218 1218 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 + 1219 1261 static const struct sdw_slave_ops tas_sdw_ops = { 1220 1262 .update_status = tas_update_status, 1263 + .port_prep = tas_port_prep, 1221 1264 }; 1222 1265 1223 1266 static void tas_remove(struct tas2783_prv *tas_dev)