]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: sof-audio: rename dai clock setting query function
authorBrent Lu <brent.lu@intel.com>
Mon, 27 May 2024 19:35:46 +0000 (14:35 -0500)
committerMark Brown <broonie@kernel.org>
Wed, 29 May 2024 10:10:53 +0000 (11:10 +0100)
We are going to extend the dai_get_clk() callback function to retrieve
other dai-specific settings like tdm slot number, not just mclk/bclk
frequencies. Revisit functions and macros related to the callback and
replace the string 'clk' with 'param' to reflect the ongoing change.

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-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc3-topology.c
sound/soc/sof/ipc4-topology.c
sound/soc/sof/sof-audio.c
sound/soc/sof/sof-audio.h

index 32c7d1f3b528dd63634f3ba1ab7288585a07732a..b68dea41cd9571d5e27837556e9d8959a4b0b490 100644 (file)
@@ -2500,7 +2500,7 @@ static int sof_ipc3_tear_down_all_pipelines(struct snd_sof_dev *sdev, bool verif
        return 0;
 }
 
-static int sof_ipc3_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type)
+static int sof_ipc3_dai_get_param(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type)
 {
        struct sof_dai_private_data *private = dai->private;
 
@@ -2509,15 +2509,15 @@ static int sof_ipc3_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *da
 
        switch (private->dai_config->type) {
        case SOF_DAI_INTEL_SSP:
-               switch (clk_type) {
-               case SOF_DAI_CLK_INTEL_SSP_MCLK:
+               switch (param_type) {
+               case SOF_DAI_PARAM_INTEL_SSP_MCLK:
                        return private->dai_config->ssp.mclk_rate;
-               case SOF_DAI_CLK_INTEL_SSP_BCLK:
+               case SOF_DAI_PARAM_INTEL_SSP_BCLK:
                        return private->dai_config->ssp.bclk_rate;
                default:
+                       dev_err(sdev->dev, "invalid SSP param %d\n", param_type);
                        break;
                }
-               dev_err(sdev->dev, "fail to get SSP clk %d rate\n", clk_type);
                break;
        default:
                /* not yet implemented for platforms other than the above */
@@ -2692,7 +2692,7 @@ const struct sof_ipc_tplg_ops ipc3_tplg_ops = {
        .widget_free = sof_ipc3_widget_free,
        .widget_setup = sof_ipc3_widget_setup,
        .dai_config = sof_ipc3_dai_config,
-       .dai_get_clk = sof_ipc3_dai_get_clk,
+       .dai_get_param = sof_ipc3_dai_get_param,
        .set_up_all_pipelines = sof_ipc3_set_up_all_pipelines,
        .tear_down_all_pipelines = sof_ipc3_tear_down_all_pipelines,
        .parse_manifest = sof_ipc3_parse_manifest,
index beff10989324755e68237138e598fb017c47b617..67e34fd559f2aa71e9b67392d347f5c2089cb5b4 100644 (file)
@@ -3130,7 +3130,7 @@ static int sof_ipc4_parse_manifest(struct snd_soc_component *scomp, int index,
        return 0;
 }
 
-static int sof_ipc4_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type)
+static int sof_ipc4_dai_get_param(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type)
 {
        struct sof_ipc4_copier *ipc4_copier = dai->private;
        struct snd_soc_tplg_hw_config *hw_config;
@@ -3169,13 +3169,13 @@ static int sof_ipc4_dai_get_clk(struct snd_sof_dev *sdev, struct snd_sof_dai *da
 
        switch (ipc4_copier->dai_type) {
        case SOF_DAI_INTEL_SSP:
-               switch (clk_type) {
-               case SOF_DAI_CLK_INTEL_SSP_MCLK:
+               switch (param_type) {
+               case SOF_DAI_PARAM_INTEL_SSP_MCLK:
                        return le32_to_cpu(hw_config->mclk_rate);
-               case SOF_DAI_CLK_INTEL_SSP_BCLK:
+               case SOF_DAI_PARAM_INTEL_SSP_BCLK:
                        return le32_to_cpu(hw_config->bclk_rate);
                default:
-                       dev_err(sdev->dev, "Invalid clk type for SSP %d\n", clk_type);
+                       dev_err(sdev->dev, "invalid SSP param %d\n", param_type);
                        break;
                }
                break;
@@ -3352,7 +3352,7 @@ const struct sof_ipc_tplg_ops ipc4_tplg_ops = {
        .route_free = sof_ipc4_route_free,
        .dai_config = sof_ipc4_dai_config,
        .parse_manifest = sof_ipc4_parse_manifest,
-       .dai_get_clk = sof_ipc4_dai_get_clk,
+       .dai_get_param = sof_ipc4_dai_get_param,
        .tear_down_all_pipelines = sof_ipc4_tear_down_all_pipelines,
        .link_setup = sof_ipc4_link_setup,
 };
index b3ac040811e796c9de5ed7b9ebdbba66a02c98a4..2421a115747ec648455554aa5cbda347ebf53bf7 100644 (file)
@@ -978,7 +978,7 @@ struct snd_sof_dai *snd_sof_find_dai(struct snd_soc_component *scomp,
        return NULL;
 }
 
-static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type)
+static int sof_dai_get_param(struct snd_soc_pcm_runtime *rtd, int param_type)
 {
        struct snd_soc_component *component =
                snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME);
@@ -991,8 +991,8 @@ static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type)
        if (!dai)
                return 0;
 
-       if (tplg_ops && tplg_ops->dai_get_clk)
-               return tplg_ops->dai_get_clk(sdev, dai, clk_type);
+       if (tplg_ops && tplg_ops->dai_get_param)
+               return tplg_ops->dai_get_param(sdev, dai, param_type);
 
        return 0;
 }
@@ -1003,7 +1003,7 @@ static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type)
  */
 int sof_dai_get_mclk(struct snd_soc_pcm_runtime *rtd)
 {
-       return sof_dai_get_clk(rtd, SOF_DAI_CLK_INTEL_SSP_MCLK);
+       return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_MCLK);
 }
 EXPORT_SYMBOL(sof_dai_get_mclk);
 
@@ -1013,6 +1013,6 @@ EXPORT_SYMBOL(sof_dai_get_mclk);
  */
 int sof_dai_get_bclk(struct snd_soc_pcm_runtime *rtd)
 {
-       return sof_dai_get_clk(rtd, SOF_DAI_CLK_INTEL_SSP_BCLK);
+       return sof_dai_get_param(rtd, SOF_DAI_PARAM_INTEL_SSP_BCLK);
 }
 EXPORT_SYMBOL(sof_dai_get_bclk);
index ec2a3bb644d2b62fc9530e99b49deceef7e5928a..abb2a00c520df09dbd5f4f64c4c4a743890b9feb 100644 (file)
@@ -44,8 +44,8 @@
 #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_CLK_INTEL_SSP_MCLK     0
-#define SOF_DAI_CLK_INTEL_SSP_BCLK     1
+#define SOF_DAI_PARAM_INTEL_SSP_MCLK   0
+#define SOF_DAI_PARAM_INTEL_SSP_BCLK   1
 
 enum sof_widget_op {
        SOF_WIDGET_PREPARE,
@@ -208,7 +208,7 @@ struct sof_ipc_tplg_widget_ops {
  * @widget_setup: Function pointer for setting up setup in the DSP
  * @widget_free: Function pointer for freeing widget in the DSP
  * @dai_config: Function pointer for sending DAI config IPC to the DSP
- * @dai_get_clk: Function pointer for getting the DAI clock setting
+ * @dai_get_param: Function pointer for getting the DAI parameter
  * @set_up_all_pipelines: Function pointer for setting up all topology pipelines
  * @tear_down_all_pipelines: Function pointer for tearing down all topology pipelines
  * @parse_manifest: Function pointer for ipc4 specific parsing of topology manifest
@@ -229,7 +229,7 @@ struct sof_ipc_tplg_ops {
        int (*widget_free)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
        int (*dai_config)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget,
                          unsigned int flags, struct snd_sof_dai_config_data *data);
-       int (*dai_get_clk)(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type);
+       int (*dai_get_param)(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type);
        int (*set_up_all_pipelines)(struct snd_sof_dev *sdev, bool verify);
        int (*tear_down_all_pipelines)(struct snd_sof_dev *sdev, bool verify);
        int (*parse_manifest)(struct snd_soc_component *scomp, int index,