Skip to content

Commit 6ab1146

Browse files
Fabio Estevambroonie
authored andcommitted
ASoC: fsl-asoc-card: Allow passing the number of slots in use
Currently, fsl-asoc-card supports passing the width of the TDM slot, but not the number of slots in use, as it harcodes it as two slots. Add support for passing the number of slots in use. Signed-off-by: Fabio Estevam <festevam@denx.de> Link: https://lore.kernel.org/r/20230616203913.551183-1-festevam@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent aa21a7d commit 6ab1146

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

sound/soc/fsl/fsl-asoc-card.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct codec_priv {
6262
* @sysclk_dir: SYSCLK directions for set_sysclk()
6363
* @sysclk_id: SYSCLK ids for set_sysclk()
6464
* @slot_width: Slot width of each frame
65+
* @slot_num: Number of slots of each frame
6566
*
6667
* Note: [1] for tx and [0] for rx
6768
*/
@@ -70,6 +71,7 @@ struct cpu_priv {
7071
u32 sysclk_dir[2];
7172
u32 sysclk_id[2];
7273
u32 slot_width;
74+
u32 slot_num;
7375
};
7476

7577
/**
@@ -191,7 +193,11 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
191193
}
192194

193195
if (cpu_priv->slot_width) {
194-
ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2,
196+
if (!cpu_priv->slot_num)
197+
cpu_priv->slot_num = 2;
198+
199+
ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3,
200+
cpu_priv->slot_num,
195201
cpu_priv->slot_width);
196202
if (ret && ret != -ENOTSUPP) {
197203
dev_err(dev, "failed to set TDM slot for cpu dai\n");

0 commit comments

Comments
 (0)