]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: SOF: sof-audio: add sof_dai_get_tdm_slots function
authorBrent Lu <brent.lu@intel.com>
Mon, 27 May 2024 19:35:47 +0000 (14:35 -0500)
committerMark Brown <broonie@kernel.org>
Wed, 29 May 2024 10:10:54 +0000 (11:10 +0100)
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 <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240527193552.165567-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/sof.h
sound/soc/sof/sof-audio.c
sound/soc/sof/sof-audio.h

index ec6c30d54592aecbd3cbf0a60e2420d8de8cb7d2..64fd5504cb2b63eb05e1896cb17b693f7113282f 100644 (file)
@@ -173,5 +173,6 @@ struct sof_dev_desc {
 
 int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd);
 int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd);
+int sof_dai_get_tdm_slots(struct snd_soc_pcm_runtime *rtd);
 
 #endif
index 2421a115747ec648455554aa5cbda347ebf53bf7..881eec38c2e2afca3872735166711ac27b52df48 100644 (file)
@@ -1016,3 +1016,13 @@ int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd)
        return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_BCLK);
 }
 EXPORT_SYMBOL(sof_dai_get_bclk);
+
+/*
+ * Helper to get SSP TDM slot number from a pcm_runtime.
+ * Return 0 if not exist.
+ */
+int sof_dai_get_tdm_slots(struct snd_soc_pcm_runtime *rtd)
+{
+       return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS);
+}
+EXPORT_SYMBOL(sof_dai_get_tdm_slots);
index abb2a00c520df09dbd5f4f64c4c4a743890b9feb..49be02234fc386a032df0fc57d0319cbab03e4b5 100644 (file)
@@ -44,8 +44,9 @@
 #define WIDGET_IS_AIF_OR_DAI(id) (WIDGET_IS_DAI(id) || WIDGET_IS_AIF(id))
 #define WIDGET_IS_COPIER(id) (WIDGET_IS_AIF_OR_DAI(id) || (id) == snd_soc_dapm_buffer)
 
-#define SOF_DAI_PARAM_INTEL_SSP_MCLK   0
-#define SOF_DAI_PARAM_INTEL_SSP_BCLK   1
+#define SOF_DAI_PARAM_INTEL_SSP_MCLK           0
+#define SOF_DAI_PARAM_INTEL_SSP_BCLK           1
+#define SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS      2
 
 enum sof_widget_op {
        SOF_WIDGET_PREPARE,