ASoC: qcom: merge DAI call back functions into ops
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 8 Aug 2023 22:56:34 +0000 (22:56 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 14 Aug 2023 12:09:27 +0000 (13:09 +0100)
ALSA SoC merges DAI call backs into .ops.
This patch merge these into one.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a5v1b0ta.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/lpass-apq8016.c
sound/soc/qcom/lpass-cpu.c
sound/soc/qcom/lpass-ipq806x.c
sound/soc/qcom/lpass-sc7180.c
sound/soc/qcom/lpass-sc7280.c
sound/soc/qcom/lpass.h
sound/soc/qcom/qdsp6/q6afe-dai.c
sound/soc/qcom/qdsp6/q6asm-dai.c
sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c

index abaf694..f919d46 100644 (file)
@@ -41,7 +41,6 @@ static struct snd_soc_dai_driver apq8016_lpass_cpu_dai_driver[] = {
                        .channels_min   = 1,
                        .channels_max   = 8,
                },
-               .probe  = &asoc_qcom_lpass_cpu_dai_probe,
                .ops    = &asoc_qcom_lpass_cpu_dai_ops,
        },
        [MI2S_SECONDARY] =  {
@@ -62,7 +61,6 @@ static struct snd_soc_dai_driver apq8016_lpass_cpu_dai_driver[] = {
                        .channels_min   = 1,
                        .channels_max   = 8,
                },
-               .probe  = &asoc_qcom_lpass_cpu_dai_probe,
                .ops    = &asoc_qcom_lpass_cpu_dai_ops,
        },
        [MI2S_TERTIARY] =  {
@@ -83,7 +81,6 @@ static struct snd_soc_dai_driver apq8016_lpass_cpu_dai_driver[] = {
                        .channels_min   = 1,
                        .channels_max   = 8,
                },
-               .probe  = &asoc_qcom_lpass_cpu_dai_probe,
                .ops    = &asoc_qcom_lpass_cpu_dai_ops,
        },
        [MI2S_QUATERNARY] =  {
@@ -119,7 +116,6 @@ static struct snd_soc_dai_driver apq8016_lpass_cpu_dai_driver[] = {
                        .channels_min   = 1,
                        .channels_max   = 8,
                },
-               .probe  = &asoc_qcom_lpass_cpu_dai_probe,
                .ops    = &asoc_qcom_lpass_cpu_dai_ops,
        },
 };
index dbdaaa8..39571fe 100644 (file)
@@ -404,18 +404,7 @@ static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream,
        return 0;
 }
 
-const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops = {
-       .set_sysclk     = lpass_cpu_daiops_set_sysclk,
-       .startup        = lpass_cpu_daiops_startup,
-       .shutdown       = lpass_cpu_daiops_shutdown,
-       .hw_params      = lpass_cpu_daiops_hw_params,
-       .trigger        = lpass_cpu_daiops_trigger,
-       .prepare        = lpass_cpu_daiops_prepare,
-};
-EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_dai_ops);
-
-int lpass_cpu_pcm_new(struct snd_soc_pcm_runtime *rtd,
-                               struct snd_soc_dai *dai)
+static int lpass_cpu_daiops_pcm_new(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
 {
        int ret;
        struct snd_soc_dai_driver *drv = dai->driver;
@@ -431,9 +420,8 @@ int lpass_cpu_pcm_new(struct snd_soc_pcm_runtime *rtd,
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(lpass_cpu_pcm_new);
 
-int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai)
+static int lpass_cpu_daiops_probe(struct snd_soc_dai *dai)
 {
        struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
        int ret;
@@ -446,7 +434,29 @@ int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai)
 
        return ret;
 }
-EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_dai_probe);
+
+const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops = {
+       .probe          = lpass_cpu_daiops_probe,
+       .set_sysclk     = lpass_cpu_daiops_set_sysclk,
+       .startup        = lpass_cpu_daiops_startup,
+       .shutdown       = lpass_cpu_daiops_shutdown,
+       .hw_params      = lpass_cpu_daiops_hw_params,
+       .trigger        = lpass_cpu_daiops_trigger,
+       .prepare        = lpass_cpu_daiops_prepare,
+};
+EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_dai_ops);
+
+const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops2 = {
+       .pcm_new        = lpass_cpu_daiops_pcm_new,
+       .probe          = lpass_cpu_daiops_probe,
+       .set_sysclk     = lpass_cpu_daiops_set_sysclk,
+       .startup        = lpass_cpu_daiops_startup,
+       .shutdown       = lpass_cpu_daiops_shutdown,
+       .hw_params      = lpass_cpu_daiops_hw_params,
+       .trigger        = lpass_cpu_daiops_trigger,
+       .prepare        = lpass_cpu_daiops_prepare,
+};
+EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_dai_ops2);
 
 static int asoc_qcom_of_xlate_dai_name(struct snd_soc_component *component,
                                   const struct of_phandle_args *args,
index ef8a798..2c97f29 100644 (file)
@@ -51,7 +51,6 @@ static struct snd_soc_dai_driver ipq806x_lpass_cpu_dai_driver = {
                .channels_min   = 1,
                .channels_max   = 8,
        },
-       .probe  = &asoc_qcom_lpass_cpu_dai_probe,
        .ops    = &asoc_qcom_lpass_cpu_dai_ops,
 };
 
index 56db852..d16c0d8 100644 (file)
@@ -43,7 +43,6 @@ static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = {
                        .channels_min   = 2,
                        .channels_max   = 2,
                },
-               .probe  = &asoc_qcom_lpass_cpu_dai_probe,
                .ops    = &asoc_qcom_lpass_cpu_dai_ops,
        }, {
                .id = MI2S_SECONDARY,
@@ -57,9 +56,7 @@ static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = {
                        .channels_min   = 2,
                        .channels_max   = 2,
                },
-               .probe  = &asoc_qcom_lpass_cpu_dai_probe,
-               .ops    = &asoc_qcom_lpass_cpu_dai_ops,
-               .pcm_new = lpass_cpu_pcm_new,
+               .ops    = &asoc_qcom_lpass_cpu_dai_ops2,
        }, {
                .id = LPASS_DP_RX,
                .name = "Hdmi",
index bcf18fe..6b2eb25 100644 (file)
@@ -38,7 +38,6 @@ static struct snd_soc_dai_driver sc7280_lpass_cpu_dai_driver[] = {
                        .channels_min   = 2,
                        .channels_max   = 2,
                },
-               .probe  = &asoc_qcom_lpass_cpu_dai_probe,
                .ops    = &asoc_qcom_lpass_cpu_dai_ops,
        }, {
                .id = MI2S_SECONDARY,
@@ -52,7 +51,6 @@ static struct snd_soc_dai_driver sc7280_lpass_cpu_dai_driver[] = {
                        .channels_min   = 2,
                        .channels_max   = 2,
                },
-               .probe  = &asoc_qcom_lpass_cpu_dai_probe,
                .ops    = &asoc_qcom_lpass_cpu_dai_ops,
        }, {
                .id = LPASS_DP_RX,
index dd78600..bdfe66e 100644 (file)
@@ -402,10 +402,8 @@ int asoc_qcom_lpass_platform_register(struct platform_device *);
 int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev);
 void asoc_qcom_lpass_cpu_platform_shutdown(struct platform_device *pdev);
 int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev);
-int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai);
 extern const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops;
-int lpass_cpu_pcm_new(struct snd_soc_pcm_runtime *rtd,
-                               struct snd_soc_dai *dai);
+extern const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops2;
 extern const struct snd_soc_dai_ops asoc_qcom_lpass_cdc_dma_dai_ops;
 
 #endif /* __LPASS_H__ */
index dbff55a..3faa7e0 100644 (file)
@@ -619,44 +619,6 @@ static const struct snd_soc_dapm_route q6afe_dapm_routes[] = {
        {"RX_CODEC_DMA_RX_7 Playback", NULL, "RX_CODEC_DMA_RX_7"},
 };
 
-static const struct snd_soc_dai_ops q6hdmi_ops = {
-       .prepare        = q6afe_dai_prepare,
-       .hw_params      = q6hdmi_hw_params,
-       .shutdown       = q6afe_dai_shutdown,
-};
-
-static const struct snd_soc_dai_ops q6i2s_ops = {
-       .prepare        = q6afe_dai_prepare,
-       .hw_params      = q6i2s_hw_params,
-       .set_fmt        = q6i2s_set_fmt,
-       .shutdown       = q6afe_dai_shutdown,
-       .set_sysclk     = q6afe_mi2s_set_sysclk,
-};
-
-static const struct snd_soc_dai_ops q6slim_ops = {
-       .prepare        = q6afe_dai_prepare,
-       .hw_params      = q6slim_hw_params,
-       .shutdown       = q6afe_dai_shutdown,
-       .set_channel_map = q6slim_set_channel_map,
-};
-
-static const struct snd_soc_dai_ops q6tdm_ops = {
-       .prepare        = q6afe_dai_prepare,
-       .shutdown       = q6afe_dai_shutdown,
-       .set_sysclk     = q6afe_mi2s_set_sysclk,
-       .set_tdm_slot     = q6tdm_set_tdm_slot,
-       .set_channel_map  = q6tdm_set_channel_map,
-       .hw_params        = q6tdm_hw_params,
-};
-
-static const struct snd_soc_dai_ops q6dma_ops = {
-       .prepare        = q6afe_dai_prepare,
-       .shutdown       = q6afe_dai_shutdown,
-       .set_sysclk     = q6afe_mi2s_set_sysclk,
-       .set_channel_map  = q6dma_set_channel_map,
-       .hw_params        = q6dma_hw_params,
-};
-
 static int msm_dai_q6_dai_probe(struct snd_soc_dai *dai)
 {
        struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev);
@@ -682,6 +644,54 @@ static int msm_dai_q6_dai_remove(struct snd_soc_dai *dai)
        return 0;
 }
 
+static const struct snd_soc_dai_ops q6hdmi_ops = {
+       .probe                  = msm_dai_q6_dai_probe,
+       .remove                 = msm_dai_q6_dai_remove,
+       .prepare                = q6afe_dai_prepare,
+       .hw_params              = q6hdmi_hw_params,
+       .shutdown               = q6afe_dai_shutdown,
+};
+
+static const struct snd_soc_dai_ops q6i2s_ops = {
+       .probe                  = msm_dai_q6_dai_probe,
+       .remove                 = msm_dai_q6_dai_remove,
+       .prepare                = q6afe_dai_prepare,
+       .hw_params              = q6i2s_hw_params,
+       .set_fmt                = q6i2s_set_fmt,
+       .shutdown               = q6afe_dai_shutdown,
+       .set_sysclk             = q6afe_mi2s_set_sysclk,
+};
+
+static const struct snd_soc_dai_ops q6slim_ops = {
+       .probe                  = msm_dai_q6_dai_probe,
+       .remove                 = msm_dai_q6_dai_remove,
+       .prepare                = q6afe_dai_prepare,
+       .hw_params              = q6slim_hw_params,
+       .shutdown               = q6afe_dai_shutdown,
+       .set_channel_map        = q6slim_set_channel_map,
+};
+
+static const struct snd_soc_dai_ops q6tdm_ops = {
+       .probe                  = msm_dai_q6_dai_probe,
+       .remove                 = msm_dai_q6_dai_remove,
+       .prepare                = q6afe_dai_prepare,
+       .shutdown               = q6afe_dai_shutdown,
+       .set_sysclk             = q6afe_mi2s_set_sysclk,
+       .set_tdm_slot           = q6tdm_set_tdm_slot,
+       .set_channel_map        = q6tdm_set_channel_map,
+       .hw_params              = q6tdm_hw_params,
+};
+
+static const struct snd_soc_dai_ops q6dma_ops = {
+       .probe                  = msm_dai_q6_dai_probe,
+       .remove                 = msm_dai_q6_dai_remove,
+       .prepare                = q6afe_dai_prepare,
+       .shutdown               = q6afe_dai_shutdown,
+       .set_sysclk             = q6afe_mi2s_set_sysclk,
+       .set_channel_map        = q6dma_set_channel_map,
+       .hw_params              = q6dma_hw_params,
+};
+
 static const struct snd_soc_dapm_widget q6afe_dai_widgets[] = {
        SND_SOC_DAPM_AIF_IN("HDMI_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SLIMBUS_0_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
@@ -1041,8 +1051,6 @@ static int q6afe_dai_dev_probe(struct platform_device *pdev)
        dev_set_drvdata(dev, dai_data);
        of_q6afe_parse_dai_data(dev, dai_data);
 
-       cfg.probe = msm_dai_q6_dai_probe;
-       cfg.remove = msm_dai_q6_dai_remove;
        cfg.q6hdmi_ops = &q6hdmi_ops;
        cfg.q6slim_ops = &q6slim_ops;
        cfg.q6i2s_ops = &q6i2s_ops;
index 5fc8088..fe0666e 100644 (file)
@@ -1230,6 +1230,10 @@ static struct snd_soc_dai_driver q6asm_fe_dais_template[] = {
        Q6ASM_FEDAI_DRIVER(8),
 };
 
+static const struct snd_soc_dai_ops q6asm_dai_ops = {
+       .compress_new = snd_soc_new_compress,
+};
+
 static int of_q6asm_parse_dai_data(struct device *dev,
                                    struct q6asm_dai_data *pdata)
 {
@@ -1272,7 +1276,7 @@ static int of_q6asm_parse_dai_data(struct device *dev,
                        dai_drv->playback = empty_stream;
 
                if (of_property_read_bool(node, "is-compress-dai"))
-                       dai_drv->compress_new = snd_soc_new_compress;
+                       dai_drv->ops = &q6asm_dai_ops;
        }
 
        return 0;
index ac937a6..4919001 100644 (file)
@@ -603,9 +603,6 @@ struct snd_soc_dai_driver *q6dsp_audio_ports_set_config(struct device *dev,
        int i;
 
        for (i = 0; i  < ARRAY_SIZE(q6dsp_audio_fe_dais); i++) {
-               q6dsp_audio_fe_dais[i].probe = cfg->probe;
-               q6dsp_audio_fe_dais[i].remove = cfg->remove;
-
                switch (q6dsp_audio_fe_dais[i].id) {
                case HDMI_RX:
                case DISPLAY_PORT_RX: