Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: add and use asoc_dummy_dlc

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Many ASoC drivers are using dummy DAI.
I have 2 concern about it. 1st one is there is no guarantee that local
strings ("snd-soc-dummy-dai", "snd-soc-dummy") are kept until the card
was binded if it was added at subfunction.
2nd one is we can use common snd_soc_dai_link_component for it.
This patch-set adds common asoc_dummy_dlc, and use it.

+89 -194
-1
include/sound/simple_card_utils.h
··· 73 73 struct snd_soc_dai_link *dai_link; 74 74 struct asoc_simple_dai *dais; 75 75 struct snd_soc_dai_link_component *dlcs; 76 - struct snd_soc_dai_link_component dummy; 77 76 struct snd_soc_codec_conf *codec_conf; 78 77 struct gpio_desc *pa_gpio; 79 78 const struct snd_soc_ops *ops;
+1
include/sound/soc.h
··· 878 878 #define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", } 879 879 880 880 extern struct snd_soc_dai_link_component null_dailink_component[0]; 881 + extern struct snd_soc_dai_link_component asoc_dummy_dlc; 881 882 882 883 883 884 struct snd_soc_codec_conf {
+18 -25
sound/soc/amd/acp/acp-mach-common.c
··· 795 795 DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi"))); 796 796 797 797 /* Declare ACP CPU components */ 798 - static struct snd_soc_dai_link_component dummy_codec[] = { 799 - { 800 - .name = "snd-soc-dummy", 801 - .dai_name = "snd-soc-dummy-dai", 802 - } 803 - }; 804 - 805 798 static struct snd_soc_dai_link_component platform_component[] = { 806 799 { 807 800 .name = "acp_asoc_renoir.0", ··· 905 912 links[i].no_pcm = 1; 906 913 if (!drv_data->hs_codec_id) { 907 914 /* Use dummy codec if codec id not specified */ 908 - links[i].codecs = dummy_codec; 909 - links[i].num_codecs = ARRAY_SIZE(dummy_codec); 915 + links[i].codecs = &asoc_dummy_dlc; 916 + links[i].num_codecs = 1; 910 917 } 911 918 if (drv_data->hs_codec_id == RT5682) { 912 919 links[i].codecs = rt5682; ··· 936 943 links[i].no_pcm = 1; 937 944 if (!drv_data->hs_codec_id) { 938 945 /* Use dummy codec if codec id not specified */ 939 - links[i].codecs = dummy_codec; 940 - links[i].num_codecs = ARRAY_SIZE(dummy_codec); 946 + links[i].codecs = &asoc_dummy_dlc; 947 + links[i].num_codecs = 1; 941 948 } 942 949 if (drv_data->hs_codec_id == NAU8825) { 943 950 links[i].codecs = nau8825; ··· 966 973 links[i].no_pcm = 1; 967 974 if (!drv_data->amp_codec_id) { 968 975 /* Use dummy codec if codec id not specified */ 969 - links[i].codecs = dummy_codec; 970 - links[i].num_codecs = ARRAY_SIZE(dummy_codec); 976 + links[i].codecs = &asoc_dummy_dlc; 977 + links[i].num_codecs = 1; 971 978 } 972 979 if (drv_data->amp_codec_id == RT1019) { 973 980 links[i].codecs = rt1019; ··· 998 1005 links[i].no_pcm = 1; 999 1006 if (!drv_data->amp_codec_id) { 1000 1007 /* Use dummy codec if codec id not specified */ 1001 - links[i].codecs = dummy_codec; 1002 - links[i].num_codecs = ARRAY_SIZE(dummy_codec); 1008 + links[i].codecs = &asoc_dummy_dlc; 1009 + links[i].num_codecs = 1; 1003 1010 } 1004 1011 if (drv_data->amp_codec_id == MAX98360A) { 1005 1012 links[i].codecs = max98360a; ··· 1069 1076 links[i].dpcm_capture = 1; 1070 1077 if (!drv_data->hs_codec_id) { 1071 1078 /* Use dummy codec if codec id not specified */ 1072 - links[i].codecs = dummy_codec; 1073 - links[i].num_codecs = ARRAY_SIZE(dummy_codec); 1079 + links[i].codecs = &asoc_dummy_dlc; 1080 + links[i].num_codecs = 1; 1074 1081 } 1075 1082 if (drv_data->hs_codec_id == RT5682) { 1076 1083 links[i].codecs = rt5682; ··· 1103 1110 links[i].dpcm_capture = 1; 1104 1111 if (!drv_data->hs_codec_id) { 1105 1112 /* Use dummy codec if codec id not specified */ 1106 - links[i].codecs = dummy_codec; 1107 - links[i].num_codecs = ARRAY_SIZE(dummy_codec); 1113 + links[i].codecs = &asoc_dummy_dlc; 1114 + links[i].num_codecs = 1; 1108 1115 } 1109 1116 if (drv_data->hs_codec_id == NAU8825) { 1110 1117 links[i].codecs = nau8825; ··· 1131 1138 links[i].dpcm_playback = 1; 1132 1139 if (!drv_data->amp_codec_id) { 1133 1140 /* Use dummy codec if codec id not specified */ 1134 - links[i].codecs = dummy_codec; 1135 - links[i].num_codecs = ARRAY_SIZE(dummy_codec); 1141 + links[i].codecs = &asoc_dummy_dlc; 1142 + links[i].num_codecs = 1; 1136 1143 } 1137 1144 if (drv_data->amp_codec_id == RT1019) { 1138 1145 links[i].codecs = rt1019; ··· 1166 1173 links[i].dpcm_playback = 1; 1167 1174 if (!drv_data->amp_codec_id) { 1168 1175 /* Use dummy codec if codec id not specified */ 1169 - links[i].codecs = dummy_codec; 1170 - links[i].num_codecs = ARRAY_SIZE(dummy_codec); 1176 + links[i].codecs = &asoc_dummy_dlc; 1177 + links[i].num_codecs = 1; 1171 1178 } 1172 1179 if (drv_data->amp_codec_id == MAX98360A) { 1173 1180 links[i].codecs = max98360a; ··· 1194 1201 links[i].num_codecs = ARRAY_SIZE(dmic_codec); 1195 1202 } else { 1196 1203 /* Use dummy codec if codec id not specified */ 1197 - links[i].codecs = dummy_codec; 1198 - links[i].num_codecs = ARRAY_SIZE(dummy_codec); 1204 + links[i].codecs = &asoc_dummy_dlc; 1205 + links[i].num_codecs = 1; 1199 1206 } 1200 1207 links[i].cpus = pdm_dmic; 1201 1208 links[i].num_cpus = ARRAY_SIZE(pdm_dmic);
+3 -5
sound/soc/atmel/atmel-classd.c
··· 473 473 if (!dai_link) 474 474 return -ENOMEM; 475 475 476 - comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL); 476 + comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); 477 477 if (!comp) 478 478 return -ENOMEM; 479 479 480 - dai_link->cpus = &comp[0]; 481 - dai_link->codecs = &comp[1]; 480 + dai_link->cpus = comp; 481 + dai_link->codecs = &asoc_dummy_dlc; 482 482 483 483 dai_link->num_cpus = 1; 484 484 dai_link->num_codecs = 1; 485 485 486 486 dai_link->name = "CLASSD"; 487 487 dai_link->stream_name = "CLASSD PCM"; 488 - dai_link->codecs->dai_name = "snd-soc-dummy-dai"; 489 488 dai_link->cpus->dai_name = dev_name(dev); 490 - dai_link->codecs->name = "snd-soc-dummy"; 491 489 492 490 card->dai_link = dai_link; 493 491 card->num_links = 1;
+3 -5
sound/soc/atmel/atmel-pdmic.c
··· 496 496 if (!dai_link) 497 497 return -ENOMEM; 498 498 499 - comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL); 499 + comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); 500 500 if (!comp) 501 501 return -ENOMEM; 502 502 503 - dai_link->cpus = &comp[0]; 504 - dai_link->codecs = &comp[1]; 503 + dai_link->cpus = comp; 504 + dai_link->codecs = &asoc_dummy_dlc; 505 505 506 506 dai_link->num_cpus = 1; 507 507 dai_link->num_codecs = 1; 508 508 509 509 dai_link->name = "PDMIC"; 510 510 dai_link->stream_name = "PDMIC PCM"; 511 - dai_link->codecs->dai_name = "snd-soc-dummy-dai"; 512 511 dai_link->cpus->dai_name = dev_name(dev); 513 - dai_link->codecs->name = "snd-soc-dummy"; 514 512 515 513 card->dai_link = dai_link; 516 514 card->num_links = 1;
+5 -9
sound/soc/fsl/imx-audmix.c
··· 207 207 for (i = 0; i < num_dai; i++) { 208 208 struct snd_soc_dai_link_component *dlc; 209 209 210 - /* for CPU/Codec x 2 */ 211 - dlc = devm_kcalloc(&pdev->dev, 4, sizeof(*dlc), GFP_KERNEL); 210 + /* for CPU x 2 */ 211 + dlc = devm_kcalloc(&pdev->dev, 2, sizeof(*dlc), GFP_KERNEL); 212 212 if (!dlc) 213 213 return -ENOMEM; 214 214 ··· 244 244 */ 245 245 priv->dai[i].cpus = 246 246 priv->dai[i].platforms = &dlc[0]; 247 - priv->dai[i].codecs = &dlc[1]; 247 + priv->dai[i].codecs = &asoc_dummy_dlc; 248 248 249 249 priv->dai[i].num_cpus = 1; 250 250 priv->dai[i].num_codecs = 1; ··· 252 252 253 253 priv->dai[i].name = dai_name; 254 254 priv->dai[i].stream_name = "HiFi-AUDMIX-FE"; 255 - priv->dai[i].codecs->dai_name = "snd-soc-dummy-dai"; 256 - priv->dai[i].codecs->name = "snd-soc-dummy"; 257 255 priv->dai[i].cpus->of_node = args.np; 258 256 priv->dai[i].cpus->dai_name = dev_name(&cpu_pdev->dev); 259 257 priv->dai[i].dynamic = 1; ··· 268 270 be_cp = devm_kasprintf(&pdev->dev, GFP_KERNEL, 269 271 "AUDMIX-Capture-%d", i); 270 272 271 - priv->dai[num_dai + i].cpus = &dlc[2]; 272 - priv->dai[num_dai + i].codecs = &dlc[3]; 273 + priv->dai[num_dai + i].cpus = &dlc[1]; 274 + priv->dai[num_dai + i].codecs = &asoc_dummy_dlc; 273 275 274 276 priv->dai[num_dai + i].num_cpus = 1; 275 277 priv->dai[num_dai + i].num_codecs = 1; 276 278 277 279 priv->dai[num_dai + i].name = be_name; 278 - priv->dai[num_dai + i].codecs->dai_name = "snd-soc-dummy-dai"; 279 - priv->dai[num_dai + i].codecs->name = "snd-soc-dummy"; 280 280 priv->dai[num_dai + i].cpus->of_node = audmix_np; 281 281 priv->dai[num_dai + i].cpus->dai_name = be_name; 282 282 priv->dai[num_dai + i].no_pcm = 1;
+1 -10
sound/soc/fsl/imx-card.c
··· 615 615 plat_data->type = CODEC_AK5552; 616 616 617 617 } else { 618 - dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL); 619 - if (!dlc) { 620 - ret = -ENOMEM; 621 - goto err; 622 - } 623 - 624 - link->codecs = dlc; 618 + link->codecs = &asoc_dummy_dlc; 625 619 link->num_codecs = 1; 626 - 627 - link->codecs->dai_name = "snd-soc-dummy-dai"; 628 - link->codecs->name = "snd-soc-dummy"; 629 620 } 630 621 631 622 if (!strncmp(link->name, "HiFi-ASRC-FE", 12)) {
+1 -2
sound/soc/fsl/imx-rpmsg.c
··· 92 92 /* Optional codec node */ 93 93 ret = of_parse_phandle_with_fixed_args(np, "audio-codec", 0, 0, &args); 94 94 if (ret) { 95 - data->dai.codecs->dai_name = "snd-soc-dummy-dai"; 96 - data->dai.codecs->name = "snd-soc-dummy"; 95 + *data->dai.codecs = asoc_dummy_dlc; 97 96 } else { 98 97 struct clk *clk; 99 98
+3 -5
sound/soc/fsl/imx-spdif.c
··· 26 26 } 27 27 28 28 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 29 - comp = devm_kzalloc(&pdev->dev, 2 * sizeof(*comp), GFP_KERNEL); 29 + comp = devm_kzalloc(&pdev->dev, sizeof(*comp), GFP_KERNEL); 30 30 if (!data || !comp) { 31 31 ret = -ENOMEM; 32 32 goto end; ··· 37 37 * platform is using soc-generic-dmaengine-pcm 38 38 */ 39 39 data->dai.cpus = 40 - data->dai.platforms = &comp[0]; 41 - data->dai.codecs = &comp[1]; 40 + data->dai.platforms = comp; 41 + data->dai.codecs = &asoc_dummy_dlc; 42 42 43 43 data->dai.num_cpus = 1; 44 44 data->dai.num_codecs = 1; ··· 46 46 47 47 data->dai.name = "S/PDIF PCM"; 48 48 data->dai.stream_name = "S/PDIF PCM"; 49 - data->dai.codecs->dai_name = "snd-soc-dummy-dai"; 50 - data->dai.codecs->name = "snd-soc-dummy"; 51 49 data->dai.cpus->of_node = spdif_np; 52 50 data->dai.playback_only = true; 53 51 data->dai.capture_only = true;
+2 -7
sound/soc/generic/simple-card-utils.c
··· 889 889 dev_dbg(dev, "link %d, dais %d, ccnf %d\n", 890 890 li->link, dai_num, cnf_num); 891 891 892 - /* dummy CPU/Codec */ 893 - priv->dummy.of_node = NULL; 894 - priv->dummy.dai_name = "snd-soc-dummy-dai"; 895 - priv->dummy.name = "snd-soc-dummy"; 896 - 897 892 priv->dai_props = dai_props; 898 893 priv->dai_link = dai_link; 899 894 priv->dais = dais; ··· 914 919 } else { 915 920 /* DPCM Be's CPU = dummy */ 916 921 dai_props[i].cpus = 917 - dai_link[i].cpus = &priv->dummy; 922 + dai_link[i].cpus = &asoc_dummy_dlc; 918 923 dai_props[i].num.cpus = 919 924 dai_link[i].num_cpus = 1; 920 925 } ··· 938 943 } else { 939 944 /* DPCM Fe's Codec = dummy */ 940 945 dai_props[i].codecs = 941 - dai_link[i].codecs = &priv->dummy; 946 + dai_link[i].codecs = &asoc_dummy_dlc; 942 947 dai_props[i].num.codecs = 943 948 dai_link[i].num_codecs = 1; 944 949 }
+2 -4
sound/soc/intel/avs/boards/i2s_test.c
··· 28 28 29 29 dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); 30 30 dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); 31 - dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); 32 - if (!dl->name || !dl->cpus || !dl->codecs) 31 + if (!dl->name || !dl->cpus) 33 32 return -ENOMEM; 34 33 35 34 dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); 36 - dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "snd-soc-dummy"); 37 - dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, "snd-soc-dummy-dai"); 35 + dl->codecs = &asoc_dummy_dlc; 38 36 if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) 39 37 return -ENOMEM; 40 38
+2 -6
sound/soc/intel/boards/ehl_rt5660.c
··· 254 254 struct sof_card_private *ctx, 255 255 struct snd_soc_acpi_mach *mach) 256 256 { 257 - struct snd_soc_dai_link *link; 258 257 int i; 259 258 260 259 if (mach->mach_params.common_hdmi_codec_drv && ··· 266 267 * if HDMI is not enabled in kernel config, or 267 268 * hdmi codec is not supported 268 269 */ 269 - for (i = HDMI_LINK_START; i <= HDMI_LINE_END; i++) { 270 - link = &card->dai_link[i]; 271 - link->codecs[0].name = "snd-soc-dummy"; 272 - link->codecs[0].dai_name = "snd-soc-dummy-dai"; 273 - } 270 + for (i = HDMI_LINK_START; i <= HDMI_LINE_END; i++) 271 + card->dai_link[i].codecs[0] = asoc_dummy_dlc; 274 272 } 275 273 276 274 static int snd_ehl_rt5660_probe(struct platform_device *pdev)
+2 -6
sound/soc/intel/boards/skl_hda_dsp_generic.c
··· 61 61 { "Alt Analog CPU Capture", NULL, "Alt Analog Codec Capture" }, 62 62 }; 63 63 64 - SND_SOC_DAILINK_DEF(dummy_codec, 65 - DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai"))); 66 - 67 64 static int skl_hda_card_late_probe(struct snd_soc_card *card) 68 65 { 69 66 return skl_hda_hdmi_jack_init(card); ··· 155 158 card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets); 156 159 if (!ctx->idisp_codec) { 157 160 for (i = 0; i < IDISP_DAI_COUNT; i++) { 158 - skl_hda_be_dai_links[i].codecs = dummy_codec; 159 - skl_hda_be_dai_links[i].num_codecs = 160 - ARRAY_SIZE(dummy_codec); 161 + skl_hda_be_dai_links[i].codecs = &asoc_dummy_dlc; 162 + skl_hda_be_dai_links[i].num_codecs = 1; 161 163 } 162 164 } 163 165 }
+2 -9
sound/soc/intel/boards/sof_cs42l42.c
··· 296 296 } 297 297 }; 298 298 299 - static struct snd_soc_dai_link_component dummy_component[] = { 300 - { 301 - .name = "snd-soc-dummy", 302 - .dai_name = "snd-soc-dummy-dai", 303 - } 304 - }; 305 - 306 299 static int create_spk_amp_dai_links(struct device *dev, 307 300 struct snd_soc_dai_link *links, 308 301 struct snd_soc_dai_link_component *cpus, ··· 503 510 goto devm_err; 504 511 505 512 links[*id].id = *id; 506 - links[*id].codecs = dummy_component; 507 - links[*id].num_codecs = ARRAY_SIZE(dummy_component); 513 + links[*id].codecs = &asoc_dummy_dlc; 514 + links[*id].num_codecs = 1; 508 515 links[*id].platforms = platform_component; 509 516 links[*id].num_platforms = ARRAY_SIZE(platform_component); 510 517
+2 -9
sound/soc/intel/boards/sof_es8336.c
··· 393 393 } 394 394 }; 395 395 396 - static struct snd_soc_dai_link_component dummy_component[] = { 397 - { 398 - .name = "snd-soc-dummy", 399 - .dai_name = "snd-soc-dummy-dai", 400 - } 401 - }; 402 - 403 396 static int sof_es8336_late_probe(struct snd_soc_card *card) 404 397 { 405 398 struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card); ··· 565 572 if (!links[id].name) 566 573 return NULL; 567 574 links[id].id = id + hdmi_id_offset; 568 - links[id].codecs = dummy_component; 569 - links[id].num_codecs = ARRAY_SIZE(dummy_component); 575 + links[id].codecs = &asoc_dummy_dlc; 576 + links[id].num_codecs = 1; 570 577 links[id].platforms = platform_component; 571 578 links[id].num_platforms = ARRAY_SIZE(platform_component); 572 579 links[id].dpcm_capture = 1;
+2 -9
sound/soc/intel/boards/sof_nau8825.c
··· 346 346 } 347 347 }; 348 348 349 - static struct snd_soc_dai_link_component dummy_component[] = { 350 - { 351 - .name = "snd-soc-dummy", 352 - .dai_name = "snd-soc-dummy-dai", 353 - } 354 - }; 355 - 356 349 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, 357 350 int ssp_codec, 358 351 int ssp_amp, ··· 525 532 links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); 526 533 if (!links[id].name) 527 534 goto devm_err; 528 - links[id].codecs = dummy_component; 529 - links[id].num_codecs = ARRAY_SIZE(dummy_component); 535 + links[id].codecs = &asoc_dummy_dlc; 536 + links[id].num_codecs = 1; 530 537 links[id].platforms = platform_component; 531 538 links[id].num_platforms = ARRAY_SIZE(platform_component); 532 539 links[id].dpcm_playback = 1;
+1 -2
sound/soc/intel/boards/sof_pcm512x.c
··· 331 331 devm_kasprintf(dev, GFP_KERNEL, 332 332 "intel-hdmi-hifi%d", i); 333 333 } else { 334 - idisp_components[i - 1].name = "snd-soc-dummy"; 335 - idisp_components[i - 1].dai_name = "snd-soc-dummy-dai"; 334 + idisp_components[i - 1] = asoc_dummy_dlc; 336 335 } 337 336 if (!idisp_components[i - 1].dai_name) 338 337 goto devm_err;
+3 -11
sound/soc/intel/boards/sof_rt5682.c
··· 607 607 } 608 608 }; 609 609 610 - static struct snd_soc_dai_link_component dummy_component[] = { 611 - { 612 - .name = "snd-soc-dummy", 613 - .dai_name = "snd-soc-dummy-dai", 614 - } 615 - }; 616 - 617 610 #define IDISP_CODEC_MASK 0x4 618 611 619 612 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ··· 738 745 if (!idisp_components[i - 1].dai_name) 739 746 goto devm_err; 740 747 } else { 741 - idisp_components[i - 1].name = "snd-soc-dummy"; 742 - idisp_components[i - 1].dai_name = "snd-soc-dummy-dai"; 748 + idisp_components[i - 1] = asoc_dummy_dlc; 743 749 } 744 750 745 751 links[id].codecs = &idisp_components[i - 1]; ··· 833 841 links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); 834 842 if (!links[id].name) 835 843 goto devm_err; 836 - links[id].codecs = dummy_component; 837 - links[id].num_codecs = ARRAY_SIZE(dummy_component); 844 + links[id].codecs = &asoc_dummy_dlc; 845 + links[id].num_codecs = 1; 838 846 links[id].platforms = platform_component; 839 847 links[id].num_platforms = ARRAY_SIZE(platform_component); 840 848 links[id].dpcm_playback = 1;
+2 -11
sound/soc/intel/boards/sof_sdw.c
··· 1488 1488 if (!idisp_components[i].dai_name) 1489 1489 return -ENOMEM; 1490 1490 } else { 1491 - idisp_components[i].name = "snd-soc-dummy"; 1492 - idisp_components[i].dai_name = "snd-soc-dummy-dai"; 1491 + idisp_components[i] = asoc_dummy_dlc; 1493 1492 } 1494 1493 1495 1494 cpu_name = devm_kasprintf(dev, GFP_KERNEL, ··· 1513 1514 if (!name) 1514 1515 return -ENOMEM; 1515 1516 1516 - ssp_components = devm_kzalloc(dev, sizeof(*ssp_components), 1517 - GFP_KERNEL); 1518 - if (!ssp_components) 1519 - return -ENOMEM; 1520 - 1521 - ssp_components->name = "snd-soc-dummy"; 1522 - ssp_components->dai_name = "snd-soc-dummy-dai"; 1523 - 1524 1517 cpu_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port); 1525 1518 if (!cpu_name) 1526 1519 return -ENOMEM; 1527 1520 1528 1521 cpus[cpu_id].dai_name = cpu_name; 1529 1522 init_dai_link(dev, links + link_index, be_id, name, 1, 1, 1530 - cpus + cpu_id, 1, ssp_components, 1, NULL, NULL); 1523 + cpus + cpu_id, 1, &asoc_dummy_dlc, 1, NULL, NULL); 1531 1524 } 1532 1525 1533 1526 card->dai_link = links;
+5 -13
sound/soc/intel/boards/sof_ssp_amp.c
··· 167 167 } 168 168 }; 169 169 170 - static struct snd_soc_dai_link_component dummy_component[] = { 171 - { 172 - .name = "snd-soc-dummy", 173 - .dai_name = "snd-soc-dummy-dai", 174 - } 175 - }; 176 - 177 170 static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd) 178 171 { 179 172 struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card); ··· 226 233 if (!links[id].name) 227 234 return NULL; 228 235 links[id].id = id; 229 - links[id].codecs = dummy_component; 230 - links[id].num_codecs = ARRAY_SIZE(dummy_component); 236 + links[id].codecs = &asoc_dummy_dlc; 237 + links[id].num_codecs = 1; 231 238 links[id].platforms = platform_component; 232 239 links[id].num_platforms = ARRAY_SIZE(platform_component); 233 240 links[id].dpcm_capture = 1; ··· 324 331 if (!idisp_components[i - 1].dai_name) 325 332 goto devm_err; 326 333 } else { 327 - idisp_components[i - 1].name = "snd-soc-dummy"; 328 - idisp_components[i - 1].dai_name = "snd-soc-dummy-dai"; 334 + idisp_components[i - 1] = asoc_dummy_dlc; 329 335 } 330 336 331 337 links[id].codecs = &idisp_components[i - 1]; ··· 352 360 links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); 353 361 if (!links[id].name) 354 362 goto devm_err; 355 - links[id].codecs = dummy_component; 356 - links[id].num_codecs = ARRAY_SIZE(dummy_component); 363 + links[id].codecs = &asoc_dummy_dlc; 364 + links[id].num_codecs = 1; 357 365 links[id].platforms = platform_component; 358 366 links[id].num_platforms = ARRAY_SIZE(platform_component); 359 367 links[id].dpcm_playback = 1;
+3 -5
sound/soc/meson/axg-card.c
··· 120 120 if (!lb->name) 121 121 return -ENOMEM; 122 122 123 - dlc = devm_kzalloc(card->dev, 2 * sizeof(*dlc), GFP_KERNEL); 123 + dlc = devm_kzalloc(card->dev, sizeof(*dlc), GFP_KERNEL); 124 124 if (!dlc) 125 125 return -ENOMEM; 126 126 127 - lb->cpus = &dlc[0]; 128 - lb->codecs = &dlc[1]; 127 + lb->cpus = dlc; 128 + lb->codecs = &asoc_dummy_dlc; 129 129 lb->num_cpus = 1; 130 130 lb->num_codecs = 1; 131 131 132 132 lb->stream_name = lb->name; 133 133 lb->cpus->of_node = pad->cpus->of_node; 134 134 lb->cpus->dai_name = "TDM Loopback"; 135 - lb->codecs->name = "snd-soc-dummy"; 136 - lb->codecs->dai_name = "snd-soc-dummy-dai"; 137 135 lb->dpcm_capture = 1; 138 136 lb->no_pcm = 1; 139 137 lb->ops = &axg_card_tdm_be_ops;
+1 -9
sound/soc/meson/meson-card-utils.c
··· 183 183 struct device_node *node, 184 184 bool is_playback) 185 185 { 186 - struct snd_soc_dai_link_component *codec; 187 - 188 - codec = devm_kzalloc(card->dev, sizeof(*codec), GFP_KERNEL); 189 - if (!codec) 190 - return -ENOMEM; 191 - 192 - link->codecs = codec; 186 + link->codecs = &asoc_dummy_dlc; 193 187 link->num_codecs = 1; 194 188 195 189 link->dynamic = 1; 196 190 link->dpcm_merged_format = 1; 197 191 link->dpcm_merged_chan = 1; 198 192 link->dpcm_merged_rate = 1; 199 - link->codecs->dai_name = "snd-soc-dummy-dai"; 200 - link->codecs->name = "snd-soc-dummy"; 201 193 202 194 if (is_playback) 203 195 link->dpcm_playback = 1;
+1 -10
sound/soc/qcom/common.c
··· 140 140 } 141 141 } else { 142 142 /* DPCM frontend */ 143 - dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL); 144 - if (!dlc) { 145 - ret = -ENOMEM; 146 - goto err; 147 - } 148 - 149 - link->codecs = dlc; 143 + link->codecs = &asoc_dummy_dlc; 150 144 link->num_codecs = 1; 151 - 152 - link->codecs->dai_name = "snd-soc-dummy-dai"; 153 - link->codecs->name = "snd-soc-dummy"; 154 145 link->dynamic = 1; 155 146 } 156 147
+11 -11
sound/soc/soc-topology.c
··· 1693 1693 dlc = (struct snd_soc_dai_link_component *)(link + 1); 1694 1694 1695 1695 link->cpus = &dlc[0]; 1696 - link->codecs = &dlc[1]; 1697 - 1698 1696 link->num_cpus = 1; 1699 - link->num_codecs = 1; 1700 1697 1701 1698 link->dobj.index = tplg->index; 1702 1699 link->dobj.type = SND_SOC_DOBJ_DAI_LINK; ··· 1718 1721 } 1719 1722 } 1720 1723 1721 - link->codecs->name = "snd-soc-dummy"; 1722 - link->codecs->dai_name = "snd-soc-dummy-dai"; 1723 - 1724 1724 /* 1725 - * Many topology is assuming link has Platform. 1726 - * This might be overwritten at soc_tplg_dai_link_load(). 1725 + * Many topology are assuming link has Codec / Platform, and 1726 + * these might be overwritten at soc_tplg_dai_link_load(). 1727 + * Don't use &asoc_dummy_dlc here. 1727 1728 */ 1728 - link->platforms = &dlc[2]; 1729 - link->platforms->name = "snd-soc-dummy"; 1730 - link->num_platforms = 1; 1729 + link->codecs = &dlc[1]; /* Don't use &asoc_dummy_dlc here */ 1730 + link->codecs->name = "snd-soc-dummy"; 1731 + link->codecs->dai_name = "snd-soc-dummy-dai"; 1732 + link->num_codecs = 1; 1733 + 1734 + link->platforms = &dlc[2]; /* Don't use &asoc_dummy_dlc here */ 1735 + link->platforms->name = "snd-soc-dummy"; 1736 + link->num_platforms = 1; 1731 1737 1732 1738 /* enable DPCM */ 1733 1739 link->dynamic = 1;
+7
sound/soc/soc-utils.c
··· 224 224 (component->driver == &dummy_codec)); 225 225 } 226 226 227 + struct snd_soc_dai_link_component asoc_dummy_dlc = { 228 + .of_node = NULL, 229 + .dai_name = "snd-soc-dummy-dai", 230 + .name = "snd-soc-dummy", 231 + }; 232 + EXPORT_SYMBOL_GPL(asoc_dummy_dlc); 233 + 227 234 static int snd_soc_dummy_probe(struct platform_device *pdev) 228 235 { 229 236 int ret;
+3 -5
sound/soc/sof/nocodec.c
··· 32 32 33 33 /* set up BE dai_links */ 34 34 for (i = 0; i < link_num; i++) { 35 - dlc = devm_kcalloc(dev, 3, sizeof(*dlc), GFP_KERNEL); 35 + dlc = devm_kcalloc(dev, 2, sizeof(*dlc), GFP_KERNEL); 36 36 if (!dlc) 37 37 return -ENOMEM; 38 38 ··· 44 44 links[i].stream_name = links[i].name; 45 45 46 46 links[i].cpus = &dlc[0]; 47 - links[i].codecs = &dlc[1]; 48 - links[i].platforms = &dlc[2]; 47 + links[i].codecs = &asoc_dummy_dlc; 48 + links[i].platforms = &dlc[1]; 49 49 50 50 links[i].num_cpus = 1; 51 51 links[i].num_codecs = 1; ··· 55 55 links[i].no_pcm = 1; 56 56 links[i].cpus->dai_name = drv[i].name; 57 57 links[i].platforms->name = dev_name(dev->parent); 58 - links[i].codecs->dai_name = "snd-soc-dummy-dai"; 59 - links[i].codecs->name = "snd-soc-dummy"; 60 58 if (drv[i].playback.channels_min) 61 59 links[i].dpcm_playback = 1; 62 60 if (drv[i].capture.channels_min)
+3 -5
sound/soc/ti/omap-hdmi.c
··· 365 365 if (!card->dai_link) 366 366 return -ENOMEM; 367 367 368 - compnent = devm_kzalloc(dev, 2 * sizeof(*compnent), GFP_KERNEL); 368 + compnent = devm_kzalloc(dev, sizeof(*compnent), GFP_KERNEL); 369 369 if (!compnent) 370 370 return -ENOMEM; 371 - card->dai_link->cpus = &compnent[0]; 371 + card->dai_link->cpus = compnent; 372 372 card->dai_link->num_cpus = 1; 373 - card->dai_link->codecs = &compnent[1]; 373 + card->dai_link->codecs = &asoc_dummy_dlc; 374 374 card->dai_link->num_codecs = 1; 375 375 376 376 card->dai_link->name = card->name; 377 377 card->dai_link->stream_name = card->name; 378 378 card->dai_link->cpus->dai_name = dev_name(ad->dssdev); 379 - card->dai_link->codecs->name = "snd-soc-dummy"; 380 - card->dai_link->codecs->dai_name = "snd-soc-dummy-dai"; 381 379 card->num_links = 1; 382 380 card->dev = dev; 383 381