Lines Matching +full:cpb +full:- +full:codec +full:- +full:scki +full:- +full:48000

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com
17 #include "davinci-mcasp.h"
21 * CPB: 2 (mcasp10 + codec)
22 * IVI: 3 (mcasp0 + 2x codec)
65 struct j721e_audio_clocks codec; member
90 SND_SOC_DAPM_HP("CPB Stereo HP 1", NULL),
91 SND_SOC_DAPM_HP("CPB Stereo HP 2", NULL),
92 SND_SOC_DAPM_HP("CPB Stereo HP 3", NULL),
93 SND_SOC_DAPM_LINE("CPB Line Out", NULL),
94 SND_SOC_DAPM_MIC("CPB Stereo Mic 1", NULL),
95 SND_SOC_DAPM_MIC("CPB Stereo Mic 2", NULL),
96 SND_SOC_DAPM_LINE("CPB Line In", NULL),
100 {"CPB Stereo HP 1", NULL, "codec-1 AOUT1L"},
101 {"CPB Stereo HP 1", NULL, "codec-1 AOUT1R"},
102 {"CPB Stereo HP 2", NULL, "codec-1 AOUT2L"},
103 {"CPB Stereo HP 2", NULL, "codec-1 AOUT2R"},
104 {"CPB Stereo HP 3", NULL, "codec-1 AOUT3L"},
105 {"CPB Stereo HP 3", NULL, "codec-1 AOUT3R"},
106 {"CPB Line Out", NULL, "codec-1 AOUT4L"},
107 {"CPB Line Out", NULL, "codec-1 AOUT4R"},
109 {"codec-1 AIN1L", NULL, "CPB Stereo Mic 1"},
110 {"codec-1 AIN1R", NULL, "CPB Stereo Mic 1"},
111 {"codec-1 AIN2L", NULL, "CPB Stereo Mic 2"},
112 {"codec-1 AIN2R", NULL, "CPB Stereo Mic 2"},
113 {"codec-1 AIN3L", NULL, "CPB Line In"},
114 {"codec-1 AIN3R", NULL, "CPB Line In"},
128 {"IVI A Line Out 1", NULL, "codec-a AOUT1L"},
129 {"IVI A Line Out 1", NULL, "codec-a AOUT1R"},
130 {"IVI A Line Out 2", NULL, "codec-a AOUT2L"},
131 {"IVI A Line Out 2", NULL, "codec-a AOUT2R"},
132 {"IVI A Line Out 3", NULL, "codec-a AOUT3L"},
133 {"IVI A Line Out 3", NULL, "codec-a AOUT3R"},
134 {"IVI A Line Out 4", NULL, "codec-a AOUT4L"},
135 {"IVI A Line Out 4", NULL, "codec-a AOUT4R"},
137 {"codec-a AIN1L", NULL, "IVI A Stereo Mic 1"},
138 {"codec-a AIN1R", NULL, "IVI A Stereo Mic 1"},
139 {"codec-a AIN2L", NULL, "IVI A Stereo Mic 2"},
140 {"codec-a AIN2R", NULL, "IVI A Stereo Mic 2"},
141 {"codec-a AIN3L", NULL, "IVI A Line In"},
142 {"codec-a AIN3R", NULL, "IVI A Line In"},
156 {"IVI B Line Out 1", NULL, "codec-b AOUT1L"},
157 {"IVI B Line Out 1", NULL, "codec-b AOUT1R"},
158 {"IVI B Line Out 2", NULL, "codec-b AOUT2L"},
159 {"IVI B Line Out 2", NULL, "codec-b AOUT2R"},
160 {"IVI B Line Out 3", NULL, "codec-b AOUT3L"},
161 {"IVI B Line Out 3", NULL, "codec-b AOUT3R"},
162 {"IVI B Line Out 4", NULL, "codec-b AOUT4L"},
163 {"IVI B Line Out 4", NULL, "codec-b AOUT4R"},
165 {"codec-b AIN1L", NULL, "IVI B Stereo Mic 1"},
166 {"codec-b AIN1R", NULL, "IVI B Stereo Mic 1"},
167 {"codec-b AIN2L", NULL, "IVI B Stereo Mic 2"},
168 {"codec-b AIN2R", NULL, "IVI B Stereo Mic 2"},
169 {"codec-b AIN3L", NULL, "IVI B Line In"},
170 {"codec-b AIN3R", NULL, "IVI B Line In"},
176 struct j721e_audio_domain *domain = &priv->audio_domains[audio_domain]; in j721e_configure_refclk()
177 unsigned int scki; in j721e_configure_refclk() local
178 int ret = -EINVAL; in j721e_configure_refclk()
181 if (!(rate % 8000) && priv->pll_rates[J721E_CLK_PARENT_48000]) in j721e_configure_refclk()
183 else if (!(rate % 11025) && priv->pll_rates[J721E_CLK_PARENT_44100]) in j721e_configure_refclk()
189 scki = ratios_for_pcm3168a[i] * rate; in j721e_configure_refclk()
191 if (priv->pll_rates[clk_id] / scki <= J721E_MAX_CLK_HSDIV) { in j721e_configure_refclk()
198 dev_err(priv->dev, "No valid clock configuration for %u Hz\n", in j721e_configure_refclk()
203 if (domain->parent_clk_id == -1 || priv->hsdiv_rates[domain->parent_clk_id] != scki) { in j721e_configure_refclk()
204 dev_dbg(priv->dev, in j721e_configure_refclk()
205 "domain%u configuration for %u Hz: %s, %dxFS (SCKI: %u Hz)\n", in j721e_configure_refclk()
208 ratios_for_pcm3168a[i], scki); in j721e_configure_refclk()
210 if (domain->parent_clk_id != clk_id) { in j721e_configure_refclk()
211 ret = clk_set_parent(domain->codec.target, in j721e_configure_refclk()
212 domain->codec.parent[clk_id]); in j721e_configure_refclk()
216 ret = clk_set_parent(domain->mcasp.target, in j721e_configure_refclk()
217 domain->mcasp.parent[clk_id]); in j721e_configure_refclk()
221 domain->parent_clk_id = clk_id; in j721e_configure_refclk()
224 ret = clk_set_rate(domain->codec.target, scki); in j721e_configure_refclk()
226 dev_err(priv->dev, "codec set rate failed for %u Hz\n", in j721e_configure_refclk()
227 scki); in j721e_configure_refclk()
231 ret = clk_set_rate(domain->mcasp.target, scki); in j721e_configure_refclk()
233 priv->hsdiv_rates[domain->parent_clk_id] = scki; in j721e_configure_refclk()
235 dev_err(priv->dev, "mcasp set rate failed for %u Hz\n", in j721e_configure_refclk()
236 scki); in j721e_configure_refclk()
247 struct snd_interval *t = rule->private; in j721e_rule_rate()
249 return snd_interval_refine(hw_param_interval(params, rule->var), t); in j721e_rule_rate()
255 struct j721e_priv *priv = snd_soc_card_get_drvdata(rtd->card); in j721e_audio_startup()
256 unsigned int domain_id = rtd->dai_link->id; in j721e_audio_startup()
257 struct j721e_audio_domain *domain = &priv->audio_domains[domain_id]; in j721e_audio_startup()
264 mutex_lock(&priv->mutex); in j721e_audio_startup()
266 domain->active++; in j721e_audio_startup()
269 active_rate = priv->audio_domains[i].rate; in j721e_audio_startup()
275 ret = snd_pcm_hw_constraint_single(substream->runtime, in j721e_audio_startup()
279 ret = snd_pcm_hw_rule_add(substream->runtime, 0, in j721e_audio_startup()
281 j721e_rule_rate, &priv->rate_range, in j721e_audio_startup()
282 SNDRV_PCM_HW_PARAM_RATE, -1); in j721e_audio_startup()
290 if (ret && ret != -ENOTSUPP) in j721e_audio_startup()
295 if (ret && ret != -ENOTSUPP) in j721e_audio_startup()
299 if (ret == -ENOTSUPP) in j721e_audio_startup()
303 domain->active--; in j721e_audio_startup()
304 mutex_unlock(&priv->mutex); in j721e_audio_startup()
313 struct snd_soc_card *card = rtd->card; in j721e_audio_hw_params()
315 unsigned int domain_id = rtd->dai_link->id; in j721e_audio_hw_params()
316 struct j721e_audio_domain *domain = &priv->audio_domains[domain_id]; in j721e_audio_hw_params()
324 mutex_lock(&priv->mutex); in j721e_audio_hw_params()
326 if (domain->rate && domain->rate != params_rate(params)) { in j721e_audio_hw_params()
327 ret = -EINVAL; in j721e_audio_hw_params()
335 if (ret && ret != -ENOTSUPP) in j721e_audio_hw_params()
341 if (ret && ret != -ENOTSUPP) in j721e_audio_hw_params()
349 sysclk_rate = priv->hsdiv_rates[domain->parent_clk_id]; in j721e_audio_hw_params()
353 if (ret && ret != -ENOTSUPP) { in j721e_audio_hw_params()
354 dev_err(priv->dev, in j721e_audio_hw_params()
355 "codec set_sysclk failed for %u Hz\n", in j721e_audio_hw_params()
364 if (ret && ret != -ENOTSUPP) { in j721e_audio_hw_params()
365 dev_err(priv->dev, "mcasp set_sysclk failed for %u Hz\n", in j721e_audio_hw_params()
368 domain->rate = params_rate(params); in j721e_audio_hw_params()
373 mutex_unlock(&priv->mutex); in j721e_audio_hw_params()
380 struct j721e_priv *priv = snd_soc_card_get_drvdata(rtd->card); in j721e_audio_shutdown()
381 unsigned int domain_id = rtd->dai_link->id; in j721e_audio_shutdown()
382 struct j721e_audio_domain *domain = &priv->audio_domains[domain_id]; in j721e_audio_shutdown()
384 mutex_lock(&priv->mutex); in j721e_audio_shutdown()
386 domain->active--; in j721e_audio_shutdown()
387 if (!domain->active) { in j721e_audio_shutdown()
388 domain->rate = 0; in j721e_audio_shutdown()
389 domain->active_link = 0; in j721e_audio_shutdown()
392 mutex_unlock(&priv->mutex); in j721e_audio_shutdown()
403 struct j721e_priv *priv = snd_soc_card_get_drvdata(rtd->card); in j721e_audio_init()
404 unsigned int domain_id = rtd->dai_link->id; in j721e_audio_init()
405 struct j721e_audio_domain *domain = &priv->audio_domains[domain_id]; in j721e_audio_init()
412 ret = j721e_configure_refclk(priv, domain_id, 48000); in j721e_audio_init()
416 sysclk_rate = priv->hsdiv_rates[domain->parent_clk_id]; in j721e_audio_init()
420 if (ret && ret != -ENOTSUPP) in j721e_audio_init()
426 if (ret && ret != -ENOTSUPP) in j721e_audio_init()
431 if (ret && ret != -ENOTSUPP) in j721e_audio_init()
436 if (ret && ret != -ENOTSUPP) in j721e_audio_init()
445 struct snd_soc_dapm_context *dapm = &rtd->card->dapm; in j721e_audio_init_ivi()
466 clocks->target = devm_clk_get(dev, prefix); in j721e_get_clocks()
467 if (IS_ERR(clocks->target)) in j721e_get_clocks()
468 return dev_err_probe(dev, PTR_ERR(clocks->target), in j721e_get_clocks()
471 clk_name = kasprintf(GFP_KERNEL, "%s-48000", prefix); in j721e_get_clocks()
477 if (ret == -EPROBE_DEFER) in j721e_get_clocks()
483 clocks->parent[J721E_CLK_PARENT_48000] = parent; in j721e_get_clocks()
485 return -ENOMEM; in j721e_get_clocks()
488 clk_name = kasprintf(GFP_KERNEL, "%s-44100", prefix); in j721e_get_clocks()
494 if (ret == -EPROBE_DEFER) in j721e_get_clocks()
500 clocks->parent[J721E_CLK_PARENT_44100] = parent; in j721e_get_clocks()
502 return -ENOMEM; in j721e_get_clocks()
505 if (!clocks->parent[J721E_CLK_PARENT_44100] && in j721e_get_clocks()
506 !clocks->parent[J721E_CLK_PARENT_48000]) { in j721e_get_clocks()
509 return -EINVAL; in j721e_get_clocks()
517 .num_links = 2, /* CPB pcm3168a */
526 .num_links = 4, /* CPB pcm3168a + 2x pcm3168a on IVI */
535 .num_links = 2, /* CPB pcm3168a */
543 .compatible = "ti,j721e-cpb-audio",
546 .compatible = "ti,j721e-cpb-ivi-audio",
549 .compatible = "ti,j7200-cpb-audio",
558 const struct j721e_audio_match_data *match_data = priv->match_data; in j721e_calculate_rate_range()
563 domain_clocks = &priv->audio_domains[J721E_AUDIO_DOMAIN_CPB].mcasp; in j721e_calculate_rate_range()
565 pll = clk_get_parent(domain_clocks->parent[J721E_CLK_PARENT_44100]); in j721e_calculate_rate_range()
567 priv->pll_rates[J721E_CLK_PARENT_44100] = in j721e_calculate_rate_range()
568 match_data->pll_rates[J721E_CLK_PARENT_44100]; in j721e_calculate_rate_range()
570 priv->pll_rates[J721E_CLK_PARENT_44100] = clk_get_rate(pll); in j721e_calculate_rate_range()
574 pll = clk_get_parent(domain_clocks->parent[J721E_CLK_PARENT_48000]); in j721e_calculate_rate_range()
576 priv->pll_rates[J721E_CLK_PARENT_48000] = in j721e_calculate_rate_range()
577 match_data->pll_rates[J721E_CLK_PARENT_48000]; in j721e_calculate_rate_range()
579 priv->pll_rates[J721E_CLK_PARENT_48000] = clk_get_rate(pll); in j721e_calculate_rate_range()
583 if (!priv->pll_rates[J721E_CLK_PARENT_44100] && in j721e_calculate_rate_range()
584 !priv->pll_rates[J721E_CLK_PARENT_48000]) { in j721e_calculate_rate_range()
585 dev_err(priv->dev, "At least one PLL is needed\n"); in j721e_calculate_rate_range()
586 return -EINVAL; in j721e_calculate_rate_range()
589 if (priv->pll_rates[J721E_CLK_PARENT_44100]) in j721e_calculate_rate_range()
590 pll_rate = priv->pll_rates[J721E_CLK_PARENT_44100]; in j721e_calculate_rate_range()
592 pll_rate = priv->pll_rates[J721E_CLK_PARENT_48000]; in j721e_calculate_rate_range()
595 min_rate /= ratios_for_pcm3168a[ARRAY_SIZE(ratios_for_pcm3168a) - 1]; in j721e_calculate_rate_range()
597 if (priv->pll_rates[J721E_CLK_PARENT_48000]) in j721e_calculate_rate_range()
598 pll_rate = priv->pll_rates[J721E_CLK_PARENT_48000]; in j721e_calculate_rate_range()
600 pll_rate = priv->pll_rates[J721E_CLK_PARENT_44100]; in j721e_calculate_rate_range()
607 snd_interval_any(&priv->rate_range); in j721e_calculate_rate_range()
608 priv->rate_range.min = min_rate; in j721e_calculate_rate_range()
609 priv->rate_range.max = max_rate; in j721e_calculate_rate_range()
617 struct device_node *node = priv->dev->of_node; in j721e_soc_probe_cpb()
624 dai_node = of_parse_phandle(node, "ti,cpb-mcasp", 0); in j721e_soc_probe_cpb()
626 dev_err(priv->dev, "CPB McASP node is not provided\n"); in j721e_soc_probe_cpb()
627 return -EINVAL; in j721e_soc_probe_cpb()
630 codec_node = of_parse_phandle(node, "ti,cpb-codec", 0); in j721e_soc_probe_cpb()
632 dev_err(priv->dev, "CPB codec node is not provided\n"); in j721e_soc_probe_cpb()
633 ret = -EINVAL; in j721e_soc_probe_cpb()
637 domain = &priv->audio_domains[J721E_AUDIO_DOMAIN_CPB]; in j721e_soc_probe_cpb()
638 ret = j721e_get_clocks(priv->dev, &domain->codec, "cpb-codec-scki"); in j721e_soc_probe_cpb()
642 ret = j721e_get_clocks(priv->dev, &domain->mcasp, "cpb-mcasp-auxclk"); in j721e_soc_probe_cpb()
648 * Link 1: McASP10 -> pcm3168a_1 DAC in j721e_soc_probe_cpb()
649 * Link 2: McASP10 <- pcm3168a_1 ADC in j721e_soc_probe_cpb()
652 compnent = devm_kzalloc(priv->dev, comp_count * sizeof(*compnent), in j721e_soc_probe_cpb()
655 ret = -ENOMEM; in j721e_soc_probe_cpb()
660 priv->dai_links[*link_idx].cpus = &compnent[comp_idx++]; in j721e_soc_probe_cpb()
661 priv->dai_links[*link_idx].num_cpus = 1; in j721e_soc_probe_cpb()
662 priv->dai_links[*link_idx].codecs = &compnent[comp_idx++]; in j721e_soc_probe_cpb()
663 priv->dai_links[*link_idx].num_codecs = 1; in j721e_soc_probe_cpb()
664 priv->dai_links[*link_idx].platforms = &compnent[comp_idx++]; in j721e_soc_probe_cpb()
665 priv->dai_links[*link_idx].num_platforms = 1; in j721e_soc_probe_cpb()
667 priv->dai_links[*link_idx].name = "CPB PCM3168A Playback"; in j721e_soc_probe_cpb()
668 priv->dai_links[*link_idx].stream_name = "CPB PCM3168A Analog"; in j721e_soc_probe_cpb()
669 priv->dai_links[*link_idx].cpus->of_node = dai_node; in j721e_soc_probe_cpb()
670 priv->dai_links[*link_idx].platforms->of_node = dai_node; in j721e_soc_probe_cpb()
671 priv->dai_links[*link_idx].codecs->of_node = codec_node; in j721e_soc_probe_cpb()
672 priv->dai_links[*link_idx].codecs->dai_name = "pcm3168a-dac"; in j721e_soc_probe_cpb()
673 priv->dai_links[*link_idx].playback_only = 1; in j721e_soc_probe_cpb()
674 priv->dai_links[*link_idx].id = J721E_AUDIO_DOMAIN_CPB; in j721e_soc_probe_cpb()
675 priv->dai_links[*link_idx].dai_fmt = J721E_DAI_FMT; in j721e_soc_probe_cpb()
676 priv->dai_links[*link_idx].init = j721e_audio_init; in j721e_soc_probe_cpb()
677 priv->dai_links[*link_idx].ops = &j721e_audio_ops; in j721e_soc_probe_cpb()
680 priv->dai_links[*link_idx].cpus = &compnent[comp_idx++]; in j721e_soc_probe_cpb()
681 priv->dai_links[*link_idx].num_cpus = 1; in j721e_soc_probe_cpb()
682 priv->dai_links[*link_idx].codecs = &compnent[comp_idx++]; in j721e_soc_probe_cpb()
683 priv->dai_links[*link_idx].num_codecs = 1; in j721e_soc_probe_cpb()
684 priv->dai_links[*link_idx].platforms = &compnent[comp_idx++]; in j721e_soc_probe_cpb()
685 priv->dai_links[*link_idx].num_platforms = 1; in j721e_soc_probe_cpb()
687 priv->dai_links[*link_idx].name = "CPB PCM3168A Capture"; in j721e_soc_probe_cpb()
688 priv->dai_links[*link_idx].stream_name = "CPB PCM3168A Analog"; in j721e_soc_probe_cpb()
689 priv->dai_links[*link_idx].cpus->of_node = dai_node; in j721e_soc_probe_cpb()
690 priv->dai_links[*link_idx].platforms->of_node = dai_node; in j721e_soc_probe_cpb()
691 priv->dai_links[*link_idx].codecs->of_node = codec_node; in j721e_soc_probe_cpb()
692 priv->dai_links[*link_idx].codecs->dai_name = "pcm3168a-adc"; in j721e_soc_probe_cpb()
693 priv->dai_links[*link_idx].capture_only = 1; in j721e_soc_probe_cpb()
694 priv->dai_links[*link_idx].id = J721E_AUDIO_DOMAIN_CPB; in j721e_soc_probe_cpb()
695 priv->dai_links[*link_idx].dai_fmt = J721E_DAI_FMT; in j721e_soc_probe_cpb()
696 priv->dai_links[*link_idx].init = j721e_audio_init; in j721e_soc_probe_cpb()
697 priv->dai_links[*link_idx].ops = &j721e_audio_ops; in j721e_soc_probe_cpb()
700 priv->codec_conf[*conf_idx].dlc.of_node = codec_node; in j721e_soc_probe_cpb()
701 priv->codec_conf[*conf_idx].name_prefix = "codec-1"; in j721e_soc_probe_cpb()
703 priv->codec_conf[*conf_idx].dlc.of_node = dai_node; in j721e_soc_probe_cpb()
704 priv->codec_conf[*conf_idx].name_prefix = "McASP10"; in j721e_soc_probe_cpb()
719 struct device_node *node = priv->dev->of_node; in j721e_soc_probe_ivi()
726 if (priv->match_data->board_type != J721E_BOARD_CPB_IVI) in j721e_soc_probe_ivi()
729 dai_node = of_parse_phandle(node, "ti,ivi-mcasp", 0); in j721e_soc_probe_ivi()
731 dev_err(priv->dev, "IVI McASP node is not provided\n"); in j721e_soc_probe_ivi()
732 return -EINVAL; in j721e_soc_probe_ivi()
735 codeca_node = of_parse_phandle(node, "ti,ivi-codec-a", 0); in j721e_soc_probe_ivi()
737 dev_err(priv->dev, "IVI codec-a node is not provided\n"); in j721e_soc_probe_ivi()
738 ret = -EINVAL; in j721e_soc_probe_ivi()
742 codecb_node = of_parse_phandle(node, "ti,ivi-codec-b", 0); in j721e_soc_probe_ivi()
744 dev_warn(priv->dev, "IVI codec-b node is not provided\n"); in j721e_soc_probe_ivi()
749 domain = &priv->audio_domains[J721E_AUDIO_DOMAIN_IVI]; in j721e_soc_probe_ivi()
750 ret = j721e_get_clocks(priv->dev, &domain->codec, "ivi-codec-scki"); in j721e_soc_probe_ivi()
754 ret = j721e_get_clocks(priv->dev, &domain->mcasp, "ivi-mcasp-auxclk"); in j721e_soc_probe_ivi()
760 * Link 1: McASP0 -> pcm3168a_a DAC in j721e_soc_probe_ivi()
762 * Link 2: McASP0 <- pcm3168a_a ADC in j721e_soc_probe_ivi()
766 compnent = devm_kzalloc(priv->dev, comp_count * sizeof(*compnent), in j721e_soc_probe_ivi()
769 ret = -ENOMEM; in j721e_soc_probe_ivi()
774 priv->dai_links[*link_idx].cpus = &compnent[comp_idx++]; in j721e_soc_probe_ivi()
775 priv->dai_links[*link_idx].num_cpus = 1; in j721e_soc_probe_ivi()
776 priv->dai_links[*link_idx].platforms = &compnent[comp_idx++]; in j721e_soc_probe_ivi()
777 priv->dai_links[*link_idx].num_platforms = 1; in j721e_soc_probe_ivi()
778 priv->dai_links[*link_idx].codecs = &compnent[comp_idx]; in j721e_soc_probe_ivi()
779 priv->dai_links[*link_idx].num_codecs = 2; in j721e_soc_probe_ivi()
782 priv->dai_links[*link_idx].name = "IVI 2xPCM3168A Playback"; in j721e_soc_probe_ivi()
783 priv->dai_links[*link_idx].stream_name = "IVI 2xPCM3168A Analog"; in j721e_soc_probe_ivi()
784 priv->dai_links[*link_idx].cpus->of_node = dai_node; in j721e_soc_probe_ivi()
785 priv->dai_links[*link_idx].platforms->of_node = dai_node; in j721e_soc_probe_ivi()
786 priv->dai_links[*link_idx].codecs[0].of_node = codeca_node; in j721e_soc_probe_ivi()
787 priv->dai_links[*link_idx].codecs[0].dai_name = "pcm3168a-dac"; in j721e_soc_probe_ivi()
788 priv->dai_links[*link_idx].codecs[1].of_node = codecb_node; in j721e_soc_probe_ivi()
789 priv->dai_links[*link_idx].codecs[1].dai_name = "pcm3168a-dac"; in j721e_soc_probe_ivi()
790 priv->dai_links[*link_idx].playback_only = 1; in j721e_soc_probe_ivi()
791 priv->dai_links[*link_idx].id = J721E_AUDIO_DOMAIN_IVI; in j721e_soc_probe_ivi()
792 priv->dai_links[*link_idx].dai_fmt = J721E_DAI_FMT; in j721e_soc_probe_ivi()
793 priv->dai_links[*link_idx].init = j721e_audio_init_ivi; in j721e_soc_probe_ivi()
794 priv->dai_links[*link_idx].ops = &j721e_audio_ops; in j721e_soc_probe_ivi()
797 priv->dai_links[*link_idx].cpus = &compnent[comp_idx++]; in j721e_soc_probe_ivi()
798 priv->dai_links[*link_idx].num_cpus = 1; in j721e_soc_probe_ivi()
799 priv->dai_links[*link_idx].platforms = &compnent[comp_idx++]; in j721e_soc_probe_ivi()
800 priv->dai_links[*link_idx].num_platforms = 1; in j721e_soc_probe_ivi()
801 priv->dai_links[*link_idx].codecs = &compnent[comp_idx]; in j721e_soc_probe_ivi()
802 priv->dai_links[*link_idx].num_codecs = 2; in j721e_soc_probe_ivi()
804 priv->dai_links[*link_idx].name = "IVI 2xPCM3168A Capture"; in j721e_soc_probe_ivi()
805 priv->dai_links[*link_idx].stream_name = "IVI 2xPCM3168A Analog"; in j721e_soc_probe_ivi()
806 priv->dai_links[*link_idx].cpus->of_node = dai_node; in j721e_soc_probe_ivi()
807 priv->dai_links[*link_idx].platforms->of_node = dai_node; in j721e_soc_probe_ivi()
808 priv->dai_links[*link_idx].codecs[0].of_node = codeca_node; in j721e_soc_probe_ivi()
809 priv->dai_links[*link_idx].codecs[0].dai_name = "pcm3168a-adc"; in j721e_soc_probe_ivi()
810 priv->dai_links[*link_idx].codecs[1].of_node = codecb_node; in j721e_soc_probe_ivi()
811 priv->dai_links[*link_idx].codecs[1].dai_name = "pcm3168a-adc"; in j721e_soc_probe_ivi()
812 priv->dai_links[*link_idx].capture_only = 1; in j721e_soc_probe_ivi()
813 priv->dai_links[*link_idx].id = J721E_AUDIO_DOMAIN_IVI; in j721e_soc_probe_ivi()
814 priv->dai_links[*link_idx].dai_fmt = J721E_DAI_FMT; in j721e_soc_probe_ivi()
815 priv->dai_links[*link_idx].init = j721e_audio_init; in j721e_soc_probe_ivi()
816 priv->dai_links[*link_idx].ops = &j721e_audio_ops; in j721e_soc_probe_ivi()
819 priv->codec_conf[*conf_idx].dlc.of_node = codeca_node; in j721e_soc_probe_ivi()
820 priv->codec_conf[*conf_idx].name_prefix = "codec-a"; in j721e_soc_probe_ivi()
823 priv->codec_conf[*conf_idx].dlc.of_node = codecb_node; in j721e_soc_probe_ivi()
824 priv->codec_conf[*conf_idx].name_prefix = "codec-b"; in j721e_soc_probe_ivi()
827 priv->codec_conf[*conf_idx].dlc.of_node = dai_node; in j721e_soc_probe_ivi()
828 priv->codec_conf[*conf_idx].name_prefix = "McASP0"; in j721e_soc_probe_ivi()
845 struct device_node *node = pdev->dev.of_node; in j721e_soc_probe()
852 dev_err(&pdev->dev, "of node is missing.\n"); in j721e_soc_probe()
853 return -ENODEV; in j721e_soc_probe()
858 dev_err(&pdev->dev, "No compatible match found\n"); in j721e_soc_probe()
859 return -ENODEV; in j721e_soc_probe()
862 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in j721e_soc_probe()
864 return -ENOMEM; in j721e_soc_probe()
866 priv->match_data = match->data; in j721e_soc_probe()
868 priv->dai_links = devm_kcalloc(&pdev->dev, priv->match_data->num_links, in j721e_soc_probe()
869 sizeof(*priv->dai_links), GFP_KERNEL); in j721e_soc_probe()
870 if (!priv->dai_links) in j721e_soc_probe()
871 return -ENOMEM; in j721e_soc_probe()
874 priv->audio_domains[i].parent_clk_id = -1; in j721e_soc_probe()
876 priv->dev = &pdev->dev; in j721e_soc_probe()
877 card = &priv->card; in j721e_soc_probe()
878 card->dev = &pdev->dev; in j721e_soc_probe()
879 card->owner = THIS_MODULE; in j721e_soc_probe()
880 card->dapm_widgets = j721e_cpb_dapm_widgets; in j721e_soc_probe()
881 card->num_dapm_widgets = ARRAY_SIZE(j721e_cpb_dapm_widgets); in j721e_soc_probe()
882 card->dapm_routes = j721e_cpb_dapm_routes; in j721e_soc_probe()
883 card->num_dapm_routes = ARRAY_SIZE(j721e_cpb_dapm_routes); in j721e_soc_probe()
884 card->fully_routed = 1; in j721e_soc_probe()
887 dev_err(&pdev->dev, "Card name is not provided\n"); in j721e_soc_probe()
888 return -ENODEV; in j721e_soc_probe()
901 card->dai_link = priv->dai_links; in j721e_soc_probe()
902 card->num_links = link_cnt; in j721e_soc_probe()
904 card->codec_conf = priv->codec_conf; in j721e_soc_probe()
905 card->num_configs = conf_cnt; in j721e_soc_probe()
913 mutex_init(&priv->mutex); in j721e_soc_probe()
914 ret = devm_snd_soc_register_card(&pdev->dev, card); in j721e_soc_probe()
916 dev_err(&pdev->dev, "devm_snd_soc_register_card() failed: %d\n", in j721e_soc_probe()
924 .name = "j721e-audio",