ASoC: intel: sof: use asoc_dummy_dlc
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 24 Apr 2023 02:37:11 +0000 (02:37 +0000)
committerMark Brown <broonie@kernel.org>
Sun, 7 May 2023 23:47:13 +0000 (08:47 +0900)
Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87wn22ypig.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org
sound/soc/intel/boards/ehl_rt5660.c
sound/soc/intel/boards/sof_cs42l42.c
sound/soc/intel/boards/sof_es8336.c
sound/soc/intel/boards/sof_nau8825.c
sound/soc/intel/boards/sof_pcm512x.c
sound/soc/intel/boards/sof_rt5682.c
sound/soc/intel/boards/sof_sdw.c
sound/soc/intel/boards/sof_ssp_amp.c

index d5235c2..fee8063 100644 (file)
@@ -254,7 +254,6 @@ static void hdmi_link_init(struct snd_soc_card *card,
                           struct sof_card_private *ctx,
                           struct snd_soc_acpi_mach *mach)
 {
-       struct snd_soc_dai_link *link;
        int i;
 
        if (mach->mach_params.common_hdmi_codec_drv &&
@@ -267,11 +266,8 @@ static void hdmi_link_init(struct snd_soc_card *card,
         * if HDMI is not enabled in kernel config, or
         * hdmi codec is not supported
         */
-       for (i = HDMI_LINK_START; i <= HDMI_LINE_END; i++) {
-               link = &card->dai_link[i];
-               link->codecs[0].name = "snd-soc-dummy";
-               link->codecs[0].dai_name = "snd-soc-dummy-dai";
-       }
+       for (i = HDMI_LINK_START; i <= HDMI_LINE_END; i++)
+               card->dai_link[i].codecs[0] = asoc_dummy_dlc;
 }
 
 static int snd_ehl_rt5660_probe(struct platform_device *pdev)
index e9d190c..e6695e7 100644 (file)
@@ -296,13 +296,6 @@ static struct snd_soc_dai_link_component dmic_component[] = {
        }
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-       {
-               .name = "snd-soc-dummy",
-               .dai_name = "snd-soc-dummy-dai",
-       }
-};
-
 static int create_spk_amp_dai_links(struct device *dev,
                                    struct snd_soc_dai_link *links,
                                    struct snd_soc_dai_link_component *cpus,
@@ -510,8 +503,8 @@ static int create_bt_offload_dai_links(struct device *dev,
                goto devm_err;
 
        links[*id].id = *id;
-       links[*id].codecs = dummy_component;
-       links[*id].num_codecs = ARRAY_SIZE(dummy_component);
+       links[*id].codecs = &asoc_dummy_dlc;
+       links[*id].num_codecs = 1;
        links[*id].platforms = platform_component;
        links[*id].num_platforms = ARRAY_SIZE(platform_component);
 
index adf5852..d6c38d8 100644 (file)
@@ -393,13 +393,6 @@ static struct snd_soc_dai_link_component dmic_component[] = {
        }
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-       {
-               .name = "snd-soc-dummy",
-               .dai_name = "snd-soc-dummy-dai",
-       }
-};
-
 static int sof_es8336_late_probe(struct snd_soc_card *card)
 {
        struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card);
@@ -572,8 +565,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                        if (!links[id].name)
                                return NULL;
                        links[id].id = id + hdmi_id_offset;
-                       links[id].codecs = dummy_component;
-                       links[id].num_codecs = ARRAY_SIZE(dummy_component);
+                       links[id].codecs = &asoc_dummy_dlc;
+                       links[id].num_codecs = 1;
                        links[id].platforms = platform_component;
                        links[id].num_platforms = ARRAY_SIZE(platform_component);
                        links[id].dpcm_capture = 1;
index 6794a02..30e7984 100644 (file)
@@ -346,13 +346,6 @@ static struct snd_soc_dai_link_component nau8318_components[] = {
        }
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-       {
-               .name = "snd-soc-dummy",
-               .dai_name = "snd-soc-dummy-dai",
-       }
-};
-
 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                                                          int ssp_codec,
                                                          int ssp_amp,
@@ -532,8 +525,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
                if (!links[id].name)
                        goto devm_err;
-               links[id].codecs = dummy_component;
-               links[id].num_codecs = ARRAY_SIZE(dummy_component);
+               links[id].codecs = &asoc_dummy_dlc;
+               links[id].num_codecs = 1;
                links[id].platforms = platform_component;
                links[id].num_platforms = ARRAY_SIZE(platform_component);
                links[id].dpcm_playback = 1;
index 5192e02..9f673cc 100644 (file)
@@ -331,8 +331,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                                devm_kasprintf(dev, GFP_KERNEL,
                                               "intel-hdmi-hifi%d", i);
                } else {
-                       idisp_components[i - 1].name = "snd-soc-dummy";
-                       idisp_components[i - 1].dai_name = "snd-soc-dummy-dai";
+                       idisp_components[i - 1] = asoc_dummy_dlc;
                }
                if (!idisp_components[i - 1].dai_name)
                        goto devm_err;
index 791a59c..7f47835 100644 (file)
@@ -607,13 +607,6 @@ static struct snd_soc_dai_link_component dmic_component[] = {
        }
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-       {
-               .name = "snd-soc-dummy",
-               .dai_name = "snd-soc-dummy-dai",
-       }
-};
-
 #define IDISP_CODEC_MASK       0x4
 
 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
@@ -745,8 +738,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                        if (!idisp_components[i - 1].dai_name)
                                goto devm_err;
                } else {
-                       idisp_components[i - 1].name = "snd-soc-dummy";
-                       idisp_components[i - 1].dai_name = "snd-soc-dummy-dai";
+                       idisp_components[i - 1] = asoc_dummy_dlc;
                }
 
                links[id].codecs = &idisp_components[i - 1];
@@ -841,8 +833,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
                if (!links[id].name)
                        goto devm_err;
-               links[id].codecs = dummy_component;
-               links[id].num_codecs = ARRAY_SIZE(dummy_component);
+               links[id].codecs = &asoc_dummy_dlc;
+               links[id].num_codecs = 1;
                links[id].platforms = platform_component;
                links[id].num_platforms = ARRAY_SIZE(platform_component);
                links[id].dpcm_playback = 1;
index 6faf4a4..c845a5c 100644 (file)
@@ -1488,8 +1488,7 @@ HDMI:
                        if (!idisp_components[i].dai_name)
                                return -ENOMEM;
                } else {
-                       idisp_components[i].name = "snd-soc-dummy";
-                       idisp_components[i].dai_name = "snd-soc-dummy-dai";
+                       idisp_components[i] = asoc_dummy_dlc;
                }
 
                cpu_name = devm_kasprintf(dev, GFP_KERNEL,
@@ -1514,21 +1513,13 @@ HDMI:
                if (!name)
                        return -ENOMEM;
 
-               ssp_components = devm_kzalloc(dev, sizeof(*ssp_components),
-                                               GFP_KERNEL);
-               if (!ssp_components)
-                       return -ENOMEM;
-
-               ssp_components->name = "snd-soc-dummy";
-               ssp_components->dai_name = "snd-soc-dummy-dai";
-
                cpu_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port);
                if (!cpu_name)
                        return -ENOMEM;
 
                cpus[cpu_id].dai_name = cpu_name;
                init_dai_link(dev, links + link_index, be_id, name, 1, 1,
-                               cpus + cpu_id, 1, ssp_components, 1, NULL, NULL);
+                               cpus + cpu_id, 1, &asoc_dummy_dlc, 1, NULL, NULL);
        }
 
        card->dai_link = links;
index ffd9c58..b33f720 100644 (file)
@@ -167,13 +167,6 @@ static struct snd_soc_dai_link_component dmic_component[] = {
        }
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-       {
-               .name = "snd-soc-dummy",
-               .dai_name = "snd-soc-dummy-dai",
-       }
-};
-
 static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
@@ -233,8 +226,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                        if (!links[id].name)
                                return NULL;
                        links[id].id = id;
-                       links[id].codecs = dummy_component;
-                       links[id].num_codecs = ARRAY_SIZE(dummy_component);
+                       links[id].codecs = &asoc_dummy_dlc;
+                       links[id].num_codecs = 1;
                        links[id].platforms = platform_component;
                        links[id].num_platforms = ARRAY_SIZE(platform_component);
                        links[id].dpcm_capture = 1;
@@ -331,8 +324,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                                if (!idisp_components[i - 1].dai_name)
                                        goto devm_err;
                        } else {
-                               idisp_components[i - 1].name = "snd-soc-dummy";
-                               idisp_components[i - 1].dai_name = "snd-soc-dummy-dai";
+                               idisp_components[i - 1] = asoc_dummy_dlc;
                        }
 
                        links[id].codecs = &idisp_components[i - 1];
@@ -360,8 +352,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
                if (!links[id].name)
                        goto devm_err;
-               links[id].codecs = dummy_component;
-               links[id].num_codecs = ARRAY_SIZE(dummy_component);
+               links[id].codecs = &asoc_dummy_dlc;
+               links[id].num_codecs = 1;
                links[id].platforms = platform_component;
                links[id].num_platforms = ARRAY_SIZE(platform_component);
                links[id].dpcm_playback = 1;