imx-audmix.c (860dbce3d8dd90cb9e909c58fa79808766243651) imx-audmix.c (79782e283ed3df04bfb77129091f1d6726987f1e)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2017 NXP
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *

--- 191 unchanged lines hidden (view full) ---

200 priv->num_dapm_routes = 3 * num_dai;
201 priv->dapm_routes = devm_kzalloc(&pdev->dev, priv->num_dapm_routes *
202 sizeof(struct snd_soc_dapm_route),
203 GFP_KERNEL);
204 if (!priv->dapm_routes)
205 return -ENOMEM;
206
207 for (i = 0; i < num_dai; i++) {
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2017 NXP
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *

--- 191 unchanged lines hidden (view full) ---

200 priv->num_dapm_routes = 3 * num_dai;
201 priv->dapm_routes = devm_kzalloc(&pdev->dev, priv->num_dapm_routes *
202 sizeof(struct snd_soc_dapm_route),
203 GFP_KERNEL);
204 if (!priv->dapm_routes)
205 return -ENOMEM;
206
207 for (i = 0; i < num_dai; i++) {
208 struct snd_soc_dai_link_component *dlc;
209
210 /* for CPU/Codec/Platform x 2 */
211 dlc = devm_kzalloc(&pdev->dev, 6 * sizeof(*dlc), GFP_KERNEL);
212 if (!dlc) {
213 dev_err(&pdev->dev, "failed to allocate dai_link\n");
214 return -ENOMEM;
215 }
216
208 ret = of_parse_phandle_with_args(audmix_np, "dais", NULL, i,
209 &args);
210 if (ret < 0) {
211 dev_err(&pdev->dev, "of_parse_phandle_with_args failed\n");
212 return ret;
213 }
214
215 cpu_pdev = of_find_device_by_node(args.np);

--- 10 unchanged lines hidden (view full) ---

226
227 if (i == 0) {
228 out_cpu_np = args.np;
229 capture_dai_name =
230 devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s %s",
231 dai_name, "CPU-Capture");
232 }
233
217 ret = of_parse_phandle_with_args(audmix_np, "dais", NULL, i,
218 &args);
219 if (ret < 0) {
220 dev_err(&pdev->dev, "of_parse_phandle_with_args failed\n");
221 return ret;
222 }
223
224 cpu_pdev = of_find_device_by_node(args.np);

--- 10 unchanged lines hidden (view full) ---

235
236 if (i == 0) {
237 out_cpu_np = args.np;
238 capture_dai_name =
239 devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s %s",
240 dai_name, "CPU-Capture");
241 }
242
243 priv->dai[i].cpus = &dlc[0];
244 priv->dai[i].codecs = &dlc[1];
245 priv->dai[i].platforms = &dlc[2];
246
247 priv->dai[i].num_cpus = 1;
248 priv->dai[i].num_codecs = 1;
249 priv->dai[i].num_platforms = 1;
250
234 priv->dai[i].name = dai_name;
235 priv->dai[i].stream_name = "HiFi-AUDMIX-FE";
251 priv->dai[i].name = dai_name;
252 priv->dai[i].stream_name = "HiFi-AUDMIX-FE";
236 priv->dai[i].codec_dai_name = "snd-soc-dummy-dai";
237 priv->dai[i].codec_name = "snd-soc-dummy";
238 priv->dai[i].cpu_of_node = args.np;
239 priv->dai[i].cpu_dai_name = dev_name(&cpu_pdev->dev);
240 priv->dai[i].platform_of_node = args.np;
253 priv->dai[i].codecs->dai_name = "snd-soc-dummy-dai";
254 priv->dai[i].codecs->name = "snd-soc-dummy";
255 priv->dai[i].cpus->of_node = args.np;
256 priv->dai[i].cpus->dai_name = dev_name(&cpu_pdev->dev);
257 priv->dai[i].platforms->of_node = args.np;
241 priv->dai[i].dynamic = 1;
242 priv->dai[i].dpcm_playback = 1;
243 priv->dai[i].dpcm_capture = (i == 0 ? 1 : 0);
244 priv->dai[i].ignore_pmdown_time = 1;
245 priv->dai[i].ops = &imx_audmix_fe_ops;
246
247 /* Add AUDMIX Backend */
248 be_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
249 "audmix-%d", i);
250 be_pb = devm_kasprintf(&pdev->dev, GFP_KERNEL,
251 "AUDMIX-Playback-%d", i);
252 be_cp = devm_kasprintf(&pdev->dev, GFP_KERNEL,
253 "AUDMIX-Capture-%d", i);
254
258 priv->dai[i].dynamic = 1;
259 priv->dai[i].dpcm_playback = 1;
260 priv->dai[i].dpcm_capture = (i == 0 ? 1 : 0);
261 priv->dai[i].ignore_pmdown_time = 1;
262 priv->dai[i].ops = &imx_audmix_fe_ops;
263
264 /* Add AUDMIX Backend */
265 be_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
266 "audmix-%d", i);
267 be_pb = devm_kasprintf(&pdev->dev, GFP_KERNEL,
268 "AUDMIX-Playback-%d", i);
269 be_cp = devm_kasprintf(&pdev->dev, GFP_KERNEL,
270 "AUDMIX-Capture-%d", i);
271
272 priv->dai[num_dai + i].cpus = &dlc[3];
273 priv->dai[num_dai + i].codecs = &dlc[4];
274 priv->dai[num_dai + i].platforms = &dlc[5];
275
276 priv->dai[num_dai + i].num_cpus = 1;
277 priv->dai[num_dai + i].num_codecs = 1;
278 priv->dai[num_dai + i].num_platforms = 1;
279
255 priv->dai[num_dai + i].name = be_name;
280 priv->dai[num_dai + i].name = be_name;
256 priv->dai[num_dai + i].codec_dai_name = "snd-soc-dummy-dai";
257 priv->dai[num_dai + i].codec_name = "snd-soc-dummy";
258 priv->dai[num_dai + i].cpu_of_node = audmix_np;
259 priv->dai[num_dai + i].cpu_dai_name = be_name;
260 priv->dai[num_dai + i].platform_name = "snd-soc-dummy";
281 priv->dai[num_dai + i].codecs->dai_name = "snd-soc-dummy-dai";
282 priv->dai[num_dai + i].codecs->name = "snd-soc-dummy";
283 priv->dai[num_dai + i].cpus->of_node = audmix_np;
284 priv->dai[num_dai + i].cpus->dai_name = be_name;
285 priv->dai[num_dai + i].platforms->name = "snd-soc-dummy";
261 priv->dai[num_dai + i].no_pcm = 1;
262 priv->dai[num_dai + i].dpcm_playback = 1;
263 priv->dai[num_dai + i].dpcm_capture = 1;
264 priv->dai[num_dai + i].ignore_pmdown_time = 1;
265 priv->dai[num_dai + i].ops = &imx_audmix_be_ops;
266
267 priv->dai_conf[i].of_node = args.np;
268 priv->dai_conf[i].name_prefix = dai_name;

--- 63 unchanged lines hidden ---
286 priv->dai[num_dai + i].no_pcm = 1;
287 priv->dai[num_dai + i].dpcm_playback = 1;
288 priv->dai[num_dai + i].dpcm_capture = 1;
289 priv->dai[num_dai + i].ignore_pmdown_time = 1;
290 priv->dai[num_dai + i].ops = &imx_audmix_be_ops;
291
292 priv->dai_conf[i].of_node = args.np;
293 priv->dai_conf[i].name_prefix = dai_name;

--- 63 unchanged lines hidden ---