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

Soundwire dai link init logic refactor

Merge series from Vijendar Mukunda <Vijendar.Mukunda@amd.com>:

This patch series refactors the SoundWire dai link init logic for Intel
and AMD generic SoundWire machine driver and also updates the stream_name
in dai_links structure.

Link: https://github.com/thesofproject/linux/pull/5218

+19 -16
+3 -2
include/sound/soc_sdw_utils.h
··· 152 152 struct snd_soc_dai_link_component *cpus, int cpus_num, 153 153 struct snd_soc_dai_link_component *platform_component, 154 154 int num_platforms, struct snd_soc_dai_link_component *codecs, 155 - int codecs_num, int (*init)(struct snd_soc_pcm_runtime *rtd), 155 + int codecs_num, int no_pcm, 156 + int (*init)(struct snd_soc_pcm_runtime *rtd), 156 157 const struct snd_soc_ops *ops); 157 158 158 159 int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *dai_links, 159 160 int *be_id, char *name, int playback, int capture, 160 161 const char *cpu_dai_name, const char *platform_comp_name, 161 162 int num_platforms, const char *codec_name, 162 - const char *codec_dai_name, 163 + const char *codec_dai_name, int no_pcm, 163 164 int (*init)(struct snd_soc_pcm_runtime *rtd), 164 165 const struct snd_soc_ops *ops); 165 166
+4 -4
sound/soc/amd/acp/acp-sdw-sof-mach.c
··· 236 236 asoc_sdw_init_dai_link(dev, *dai_links, be_id, name, playback, capture, 237 237 cpus, num_cpus, platform_component, 238 238 ARRAY_SIZE(platform_component), codecs, num_codecs, 239 - asoc_sdw_rtd_init, &sdw_ops); 239 + 1, asoc_sdw_rtd_init, &sdw_ops); 240 240 241 241 /* 242 242 * SoundWire DAILINKs use 'stream' functions and Bank Switch operations ··· 285 285 } 286 286 287 287 static int create_dmic_dailinks(struct snd_soc_card *card, 288 - struct snd_soc_dai_link **dai_links, int *be_id) 288 + struct snd_soc_dai_link **dai_links, int *be_id, int no_pcm) 289 289 { 290 290 struct device *dev = card->dev; 291 291 int ret; ··· 294 294 0, 1, // DMIC only supports capture 295 295 "acp-sof-dmic", platform_component->name, 296 296 ARRAY_SIZE(platform_component), 297 - "dmic-codec", "dmic-hifi", 297 + "dmic-codec", "dmic-hifi", no_pcm, 298 298 asoc_sdw_dmic_init, NULL); 299 299 if (ret) 300 300 return ret; ··· 377 377 if (ctx->ignore_internal_dmic) { 378 378 dev_warn(dev, "Ignoring ACP DMIC\n"); 379 379 } else { 380 - ret = create_dmic_dailinks(card, &dai_links, &be_id); 380 + ret = create_dmic_dailinks(card, &dai_links, &be_id, 1); 381 381 if (ret) 382 382 return ret; 383 383 }
+6 -6
sound/soc/intel/boards/sof_sdw.c
··· 838 838 asoc_sdw_init_dai_link(dev, *dai_links, be_id, name, playback, capture, 839 839 cpus, num_cpus, platform_component, 840 840 ARRAY_SIZE(platform_component), codecs, num_codecs, 841 - asoc_sdw_rtd_init, &sdw_ops); 841 + 1, asoc_sdw_rtd_init, &sdw_ops); 842 842 843 843 /* 844 844 * SoundWire DAILINKs use 'stream' functions and Bank Switch operations ··· 915 915 playback, capture, cpu_dai_name, 916 916 platform_component->name, 917 917 ARRAY_SIZE(platform_component), codec_name, 918 - ssp_info->dais[0].dai_name, NULL, 918 + ssp_info->dais[0].dai_name, 1, NULL, 919 919 ssp_info->ops); 920 920 if (ret) 921 921 return ret; ··· 940 940 0, 1, // DMIC only supports capture 941 941 "DMIC01 Pin", platform_component->name, 942 942 ARRAY_SIZE(platform_component), 943 - "dmic-codec", "dmic-hifi", 943 + "dmic-codec", "dmic-hifi", 1, 944 944 asoc_sdw_dmic_init, NULL); 945 945 if (ret) 946 946 return ret; ··· 951 951 0, 1, // DMIC only supports capture 952 952 "DMIC16k Pin", platform_component->name, 953 953 ARRAY_SIZE(platform_component), 954 - "dmic-codec", "dmic-hifi", 954 + "dmic-codec", "dmic-hifi", 1, 955 955 /* don't call asoc_sdw_dmic_init() twice */ 956 956 NULL, NULL); 957 957 if (ret) ··· 995 995 1, 0, // HDMI only supports playback 996 996 cpu_dai_name, platform_component->name, 997 997 ARRAY_SIZE(platform_component), 998 - codec_name, codec_dai_name, 998 + codec_name, codec_dai_name, 1, 999 999 i == 0 ? sof_sdw_hdmi_init : NULL, NULL); 1000 1000 if (ret) 1001 1001 return ret; ··· 1023 1023 1, 1, cpu_dai_name, platform_component->name, 1024 1024 ARRAY_SIZE(platform_component), 1025 1025 snd_soc_dummy_dlc.name, snd_soc_dummy_dlc.dai_name, 1026 - NULL, NULL); 1026 + 1, NULL, NULL); 1027 1027 if (ret) 1028 1028 return ret; 1029 1029
+6 -4
sound/soc/sdw_utils/soc_sdw_utils.c
··· 1015 1015 struct snd_soc_dai_link_component *cpus, int cpus_num, 1016 1016 struct snd_soc_dai_link_component *platform_component, 1017 1017 int num_platforms, struct snd_soc_dai_link_component *codecs, 1018 - int codecs_num, int (*init)(struct snd_soc_pcm_runtime *rtd), 1018 + int codecs_num, int no_pcm, 1019 + int (*init)(struct snd_soc_pcm_runtime *rtd), 1019 1020 const struct snd_soc_ops *ops) 1020 1021 { 1021 1022 dev_dbg(dev, "create dai link %s, id %d\n", name, *be_id); 1022 1023 dai_links->id = (*be_id)++; 1023 1024 dai_links->name = name; 1025 + dai_links->stream_name = name; 1024 1026 dai_links->platforms = platform_component; 1025 1027 dai_links->num_platforms = num_platforms; 1026 - dai_links->no_pcm = 1; 1028 + dai_links->no_pcm = no_pcm; 1027 1029 dai_links->cpus = cpus; 1028 1030 dai_links->num_cpus = cpus_num; 1029 1031 dai_links->codecs = codecs; ··· 1041 1039 int *be_id, char *name, int playback, int capture, 1042 1040 const char *cpu_dai_name, const char *platform_comp_name, 1043 1041 int num_platforms, const char *codec_name, 1044 - const char *codec_dai_name, 1042 + const char *codec_dai_name, int no_pcm, 1045 1043 int (*init)(struct snd_soc_pcm_runtime *rtd), 1046 1044 const struct snd_soc_ops *ops) 1047 1045 { ··· 1060 1058 1061 1059 asoc_sdw_init_dai_link(dev, dai_links, be_id, name, playback, capture, 1062 1060 &dlc[0], 1, &dlc[1], num_platforms, 1063 - &dlc[2], 1, init, ops); 1061 + &dlc[2], 1, no_pcm, init, ops); 1064 1062 1065 1063 return 0; 1066 1064 }