.. | .. |
---|
336 | 336 | static int rk_multicodecs_hw_params(struct snd_pcm_substream *substream, |
---|
337 | 337 | struct snd_pcm_hw_params *params) |
---|
338 | 338 | { |
---|
339 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
340 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
---|
| 339 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
---|
| 340 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
---|
341 | 341 | struct snd_soc_dai *codec_dai; |
---|
342 | 342 | struct multicodecs_data *mc_data = snd_soc_card_get_drvdata(rtd->card); |
---|
343 | 343 | unsigned int mclk; |
---|
.. | .. |
---|
345 | 345 | |
---|
346 | 346 | mclk = params_rate(params) * mc_data->mclk_fs; |
---|
347 | 347 | |
---|
348 | | - for (i = 0; i < rtd->num_codecs; i++) { |
---|
349 | | - codec_dai = rtd->codec_dais[i]; |
---|
| 348 | + for_each_rtd_codec_dais(rtd, i, codec_dai) { |
---|
350 | 349 | ret = snd_soc_dai_set_sysclk(codec_dai, substream->stream, mclk, |
---|
351 | 350 | SND_SOC_CLOCK_IN); |
---|
352 | 351 | if (ret && ret != -ENOTSUPP) { |
---|
.. | .. |
---|
437 | 436 | int i; |
---|
438 | 437 | |
---|
439 | 438 | /* set jack for the first successful one */ |
---|
440 | | - for (i = 0; i < rtd->num_codecs; i++) { |
---|
441 | | - codec_dai = rtd->codec_dais[i]; |
---|
| 439 | + for_each_rtd_codec_dais(rtd, i, codec_dai) { |
---|
442 | 440 | ret = snd_soc_component_set_jack(codec_dai->component, |
---|
443 | 441 | jack_headset, NULL); |
---|
444 | 442 | if (ret >= 0) |
---|
.. | .. |
---|
584 | 582 | struct snd_soc_card *card; |
---|
585 | 583 | struct device_node *np = pdev->dev.of_node; |
---|
586 | 584 | struct snd_soc_dai_link *link; |
---|
| 585 | + struct snd_soc_dai_link_component *cpus; |
---|
| 586 | + struct snd_soc_dai_link_component *platforms; |
---|
587 | 587 | struct snd_soc_dai_link_component *codecs; |
---|
588 | 588 | struct multicodecs_data *mc_data; |
---|
589 | 589 | struct of_phandle_args args; |
---|
.. | .. |
---|
604 | 604 | if (!mc_data) |
---|
605 | 605 | return -ENOMEM; |
---|
606 | 606 | |
---|
| 607 | + cpus = devm_kzalloc(&pdev->dev, sizeof(*cpus), GFP_KERNEL); |
---|
| 608 | + if (!cpus) |
---|
| 609 | + return -ENOMEM; |
---|
| 610 | + |
---|
| 611 | + platforms = devm_kzalloc(&pdev->dev, sizeof(*platforms), GFP_KERNEL); |
---|
| 612 | + if (!platforms) |
---|
| 613 | + return -ENOMEM; |
---|
| 614 | + |
---|
607 | 615 | card = &mc_data->snd_card; |
---|
608 | 616 | card->dev = &pdev->dev; |
---|
609 | 617 | |
---|
.. | .. |
---|
617 | 625 | link->stream_name = link->name; |
---|
618 | 626 | link->init = rk_dailink_init; |
---|
619 | 627 | link->ops = &rk_ops; |
---|
| 628 | + link->cpus = cpus; |
---|
| 629 | + link->platforms = platforms; |
---|
| 630 | + link->num_cpus = 1; |
---|
| 631 | + link->num_platforms = 1; |
---|
620 | 632 | link->ignore_pmdown_time = 1; |
---|
621 | 633 | |
---|
622 | 634 | card->dai_link = link; |
---|
.. | .. |
---|
673 | 685 | /* Only reference the codecs[0].of_node which maybe as master. */ |
---|
674 | 686 | rk_multicodecs_parse_daifmt(np, codecs[0].of_node, mc_data, prefix); |
---|
675 | 687 | |
---|
676 | | - link->cpu_of_node = of_parse_phandle(np, "rockchip,cpu", 0); |
---|
677 | | - if (!link->cpu_of_node) |
---|
| 688 | + link->cpus->of_node = of_parse_phandle(np, "rockchip,cpu", 0); |
---|
| 689 | + if (!link->cpus->of_node) |
---|
678 | 690 | return -ENODEV; |
---|
679 | 691 | |
---|
680 | | - link->platform_of_node = link->cpu_of_node; |
---|
| 692 | + link->platforms->of_node = link->cpus->of_node; |
---|
681 | 693 | |
---|
682 | 694 | mc_data->mclk_fs = DEFAULT_MCLK_FS; |
---|
683 | 695 | if (!of_property_read_u32(np, "rockchip,mclk-fs", &val)) |
---|