imx-audmix.c (09cda705860125ffee1b1359b1da79f8e0c77a40) imx-audmix.c (3ce08f85133fc93278801aba3efb4548d3ef3ca0)
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 *

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

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
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 *

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

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_kcalloc(&pdev->dev, 6, sizeof(*dlc), GFP_KERNEL);
210 /* for CPU/Codec x 2 + Platform */
211 dlc = devm_kcalloc(&pdev->dev, 5, sizeof(*dlc), GFP_KERNEL);
212 if (!dlc)
213 return -ENOMEM;
214
215 ret = of_parse_phandle_with_args(audmix_np, "dais", NULL, i,
216 &args);
217 if (ret < 0) {
218 dev_err(&pdev->dev, "of_parse_phandle_with_args failed\n");
219 return ret;

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

233
234 if (i == 0) {
235 out_cpu_np = args.np;
236 capture_dai_name =
237 devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s %s",
238 dai_name, "CPU-Capture");
239 }
240
212 if (!dlc)
213 return -ENOMEM;
214
215 ret = of_parse_phandle_with_args(audmix_np, "dais", NULL, i,
216 &args);
217 if (ret < 0) {
218 dev_err(&pdev->dev, "of_parse_phandle_with_args failed\n");
219 return ret;

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

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

--- 74 unchanged lines hidden ---
276
277 priv->dai[num_dai + i].num_cpus = 1;
278 priv->dai[num_dai + i].num_codecs = 1;
279 priv->dai[num_dai + i].num_platforms = 1;
280
281 priv->dai[num_dai + i].name = be_name;
282 priv->dai[num_dai + i].codecs->dai_name = "snd-soc-dummy-dai";
283 priv->dai[num_dai + i].codecs->name = "snd-soc-dummy";

--- 74 unchanged lines hidden ---