Skip to content

Commit 1deba6e

Browse files
brentlubroonie
authored andcommitted
ASoC: SOF: sof-audio: add sof_dai_get_tdm_slots function
An new interface, sof_dai_get_tdm_slots(), is added for machine driver to get tdm slot number from topology. The dai_get_param() callback needs to support new parameter type SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS by returning the tdm slot number of specific SSP port. Reviewed-by: Bard Liao <[email protected]> Signed-off-by: Brent Lu <[email protected]> Signed-off-by: Pierre-Louis Bossart <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6073c47 commit 1deba6e

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

include/sound/sof.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,5 +173,6 @@ struct sof_dev_desc {
173173

174174
int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd);
175175
int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd);
176+
int sof_dai_get_tdm_slots(struct snd_soc_pcm_runtime *rtd);
176177

177178
#endif

sound/soc/sof/sof-audio.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,3 +1016,13 @@ int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd)
10161016
return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_BCLK);
10171017
}
10181018
EXPORT_SYMBOL(sof_dai_get_bclk);
1019+
1020+
/*
1021+
* Helper to get SSP TDM slot number from a pcm_runtime.
1022+
* Return 0 if not exist.
1023+
*/
1024+
int sof_dai_get_tdm_slots(struct snd_soc_pcm_runtime *rtd)
1025+
{
1026+
return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS);
1027+
}
1028+
EXPORT_SYMBOL(sof_dai_get_tdm_slots);

sound/soc/sof/sof-audio.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@
4444
#define WIDGET_IS_AIF_OR_DAI(id) (WIDGET_IS_DAI(id) || WIDGET_IS_AIF(id))
4545
#define WIDGET_IS_COPIER(id) (WIDGET_IS_AIF_OR_DAI(id) || (id) == snd_soc_dapm_buffer)
4646

47-
#define SOF_DAI_PARAM_INTEL_SSP_MCLK 0
48-
#define SOF_DAI_PARAM_INTEL_SSP_BCLK 1
47+
#define SOF_DAI_PARAM_INTEL_SSP_MCLK 0
48+
#define SOF_DAI_PARAM_INTEL_SSP_BCLK 1
49+
#define SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS 2
4950

5051
enum sof_widget_op {
5152
SOF_WIDGET_PREPARE,

0 commit comments

Comments
 (0)