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 d5235c294c4c8f5ba0606857111451d48f0f2e79..fee80638cba27a501a021c9d66308fde7f052427 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 e9d190cb13b0ad5a912d3691c71490a319b02d32..e6695e77d59438b46db3f8a06c0f0b5f7cb076b5 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 adf5852b2c9a107af05ddb0f016ae7e08842a710..d6c38d8ea2ffb4ac5fdafc6186c14be14e343234 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 6794a0249a9ad1ceaf21656cecebfc21335b16be..30e798431e1f75c895834cc9376c442b4b68a479 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 5192e02b3cee049dc47952f4ed08bf8894af51b6..9f673ccf81b5414b47f66b536c6c8ea7582017c7 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 791a59c5f00dcc710fd405143663643bc474fddd..7f478359266867c98b271c3394f8b7c4fb9f9b26 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 6faf4a43eaf5ad11f7d5172446116078ddd2e4c7..c845a5cf7f4d92e32821f67f2f279def478b2546 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 ffd9c583dab12e247768d2c5f0d45d2c5c131f5e..b33f720b3e6de3310ba232e0311ab415b9f612f1 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;