Lines Matching +full:dmic +full:- +full:sample +full:- +full:rate
1 // SPDX-License-Identifier: GPL-2.0
23 #include "imx-audmux.h"
32 #define DRIVER_NAME "fsl-asoc-card"
43 * struct codec_priv - CODEC private data
45 * @mclk_freq: Clock rate of MCLK
46 * @free_freq: Clock rate of MCLK for hw_free()
61 * struct cpu_priv - CPU private data
79 * struct fsl_asoc_card_priv - Freescale Generic ASOC card private data
88 * @sample_rate: Current sample rate
89 * @sample_format: Current sample format
90 * @asrc_rate: ASRC sample rate used by Back-Ends
91 * @asrc_format: ASRC sample format used by Back-Ends
118 * to drop them easily for non-ASRC cases.
121 /* 1st half -- Normal DAPM routes */
122 {"Playback", NULL, "CPU-Playback"},
123 {"CPU-Capture", NULL, "Capture"},
124 /* 2nd half -- ASRC DAPM routes */
125 {"CPU-Playback", NULL, "ASRC-Playback"},
126 {"ASRC-Capture", NULL, "CPU-Capture"},
130 /* 1st half -- Normal DAPM routes */
133 /* 2nd half -- ASRC DAPM routes */
134 {"CPU AC97 Playback", NULL, "ASRC-Playback"},
135 {"ASRC-Capture", NULL, "CPU AC97 Capture"},
139 /* 1st half -- Normal DAPM routes */
140 {"Playback", NULL, "CPU-Playback"},
141 /* 2nd half -- ASRC DAPM routes */
142 {"CPU-Playback", NULL, "ASRC-Playback"},
146 /* 1st half -- Normal DAPM routes */
147 {"CPU-Capture", NULL, "Capture"},
148 /* 2nd half -- ASRC DAPM routes */
149 {"ASRC-Capture", NULL, "CPU-Capture"},
160 SND_SOC_DAPM_MIC("DMIC", NULL),
165 return priv->dai_fmt == SND_SOC_DAIFMT_AC97; in fsl_asoc_card_is_ac97()
172 struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); in fsl_asoc_card_hw_params()
173 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in fsl_asoc_card_hw_params()
174 struct codec_priv *codec_priv = &priv->codec_priv; in fsl_asoc_card_hw_params()
175 struct cpu_priv *cpu_priv = &priv->cpu_priv; in fsl_asoc_card_hw_params()
176 struct device *dev = rtd->card->dev; in fsl_asoc_card_hw_params()
180 priv->sample_rate = params_rate(params); in fsl_asoc_card_hw_params()
181 priv->sample_format = params_format(params); in fsl_asoc_card_hw_params()
182 priv->streams |= BIT(substream->stream); in fsl_asoc_card_hw_params()
188 ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_cpu(rtd, 0), cpu_priv->sysclk_id[tx], in fsl_asoc_card_hw_params()
189 cpu_priv->sysclk_freq[tx], in fsl_asoc_card_hw_params()
190 cpu_priv->sysclk_dir[tx]); in fsl_asoc_card_hw_params()
191 if (ret && ret != -ENOTSUPP) { in fsl_asoc_card_hw_params()
196 if (cpu_priv->slot_width) { in fsl_asoc_card_hw_params()
197 if (!cpu_priv->slot_num) in fsl_asoc_card_hw_params()
198 cpu_priv->slot_num = 2; in fsl_asoc_card_hw_params()
201 cpu_priv->slot_num, in fsl_asoc_card_hw_params()
202 cpu_priv->slot_width); in fsl_asoc_card_hw_params()
203 if (ret && ret != -ENOTSUPP) { in fsl_asoc_card_hw_params()
210 if (codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { in fsl_asoc_card_hw_params()
211 if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE) in fsl_asoc_card_hw_params()
212 pll_out = priv->sample_rate * 384; in fsl_asoc_card_hw_params()
214 pll_out = priv->sample_rate * 256; in fsl_asoc_card_hw_params()
217 codec_priv->pll_id, in fsl_asoc_card_hw_params()
218 codec_priv->mclk_id, in fsl_asoc_card_hw_params()
219 codec_priv->mclk_freq, pll_out); in fsl_asoc_card_hw_params()
226 codec_priv->fll_id, in fsl_asoc_card_hw_params()
229 if (ret && ret != -ENOTSUPP) { in fsl_asoc_card_hw_params()
238 priv->streams &= ~BIT(substream->stream); in fsl_asoc_card_hw_params()
244 struct snd_soc_pcm_runtime *rtd = substream->private_data; in fsl_asoc_card_hw_free()
245 struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); in fsl_asoc_card_hw_free()
246 struct codec_priv *codec_priv = &priv->codec_priv; in fsl_asoc_card_hw_free()
247 struct device *dev = rtd->card->dev; in fsl_asoc_card_hw_free()
250 priv->streams &= ~BIT(substream->stream); in fsl_asoc_card_hw_free()
252 if (!priv->streams && codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { in fsl_asoc_card_hw_free()
255 codec_priv->mclk_id, in fsl_asoc_card_hw_free()
256 codec_priv->free_freq, in fsl_asoc_card_hw_free()
264 codec_priv->pll_id, 0, 0, 0); in fsl_asoc_card_hw_free()
265 if (ret && ret != -ENOTSUPP) { in fsl_asoc_card_hw_free()
282 struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); in be_hw_params_fixup()
283 struct snd_interval *rate; in be_hw_params_fixup() local
286 rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); in be_hw_params_fixup()
287 rate->max = rate->min = priv->asrc_rate; in be_hw_params_fixup()
291 snd_mask_set_format(mask, priv->asrc_format); in be_hw_params_fixup()
318 /* DPCM Link between Front-End and Back-End (Optional) */
320 .name = "HiFi-ASRC-FE",
321 .stream_name = "HiFi-ASRC-FE",
328 .name = "HiFi-ASRC-BE",
329 .stream_name = "HiFi-ASRC-BE",
342 struct device *dev = &priv->pdev->dev; in fsl_asoc_card_audmux_init()
347 ret = of_property_read_u32(np, "mux-int-port", &int_port); in fsl_asoc_card_audmux_init()
349 dev_err(dev, "mux-int-port missing or invalid\n"); in fsl_asoc_card_audmux_init()
352 ret = of_property_read_u32(np, "mux-ext-port", &ext_port); in fsl_asoc_card_audmux_init()
354 dev_err(dev, "mux-ext-port missing or invalid\n"); in fsl_asoc_card_audmux_init()
362 int_port--; in fsl_asoc_card_audmux_init()
363 ext_port--; in fsl_asoc_card_audmux_init()
370 switch (priv->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { in fsl_asoc_card_audmux_init()
413 return -EINVAL; in fsl_asoc_card_audmux_init()
471 struct snd_soc_dapm_context *dapm = &jack->card->dapm; in hp_jack_event()
488 struct snd_soc_dapm_context *dapm = &jack->card->dapm; in mic_jack_event()
491 /* Disable dmic if microphone is plugged in */ in mic_jack_event()
492 return snd_soc_dapm_disable_pin(dapm, "DMIC"); in mic_jack_event()
494 return snd_soc_dapm_enable_pin(dapm, "DMIC"); in mic_jack_event()
505 &card->rtd_list, struct snd_soc_pcm_runtime, list); in fsl_asoc_card_late_probe()
507 struct codec_priv *codec_priv = &priv->codec_priv; in fsl_asoc_card_late_probe()
508 struct device *dev = card->dev; in fsl_asoc_card_late_probe()
513 struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; in fsl_asoc_card_late_probe()
528 ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id, in fsl_asoc_card_late_probe()
529 codec_priv->mclk_freq, SND_SOC_CLOCK_IN); in fsl_asoc_card_late_probe()
530 if (ret && ret != -ENOTSUPP) { in fsl_asoc_card_late_probe()
535 if (!IS_ERR_OR_NULL(codec_priv->mclk)) in fsl_asoc_card_late_probe()
536 clk_prepare_enable(codec_priv->mclk); in fsl_asoc_card_late_probe()
544 struct device_node *np = pdev->dev.of_node; in fsl_asoc_card_probe()
557 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in fsl_asoc_card_probe()
559 return -ENOMEM; in fsl_asoc_card_probe()
561 cpu_np = of_parse_phandle(np, "audio-cpu", 0); in fsl_asoc_card_probe()
564 cpu_np = of_parse_phandle(np, "ssi-controller", 0); in fsl_asoc_card_probe()
566 dev_err(&pdev->dev, "CPU phandle missing or invalid\n"); in fsl_asoc_card_probe()
567 ret = -EINVAL; in fsl_asoc_card_probe()
573 dev_err(&pdev->dev, "failed to find CPU DAI device\n"); in fsl_asoc_card_probe()
574 ret = -EINVAL; in fsl_asoc_card_probe()
578 codec_np = of_parse_phandle(np, "audio-codec", 0); in fsl_asoc_card_probe()
585 codec_dev = &codec_i2c->dev; in fsl_asoc_card_probe()
586 codec_dev_name = codec_i2c->name; in fsl_asoc_card_probe()
591 codec_dev = &codec_pdev->dev; in fsl_asoc_card_probe()
592 codec_dev_name = codec_pdev->name; in fsl_asoc_card_probe()
597 asrc_np = of_parse_phandle(np, "audio-asrc", 0); in fsl_asoc_card_probe()
601 /* Get the MCLK rate only, and leave it controlled by CODEC drivers */ in fsl_asoc_card_probe()
606 priv->codec_priv.mclk_freq = clk_get_rate(codec_clk); in fsl_asoc_card_probe()
611 /* Default sample rate and format, will be updated in hw_params() */ in fsl_asoc_card_probe()
612 priv->sample_rate = 44100; in fsl_asoc_card_probe()
613 priv->sample_format = SNDRV_PCM_FORMAT_S16_LE; in fsl_asoc_card_probe()
616 priv->dai_fmt = DAI_FMT_BASE; in fsl_asoc_card_probe()
618 memcpy(priv->dai_link, fsl_asoc_card_dai, in fsl_asoc_card_probe()
619 sizeof(struct snd_soc_dai_link) * ARRAY_SIZE(priv->dai_link)); in fsl_asoc_card_probe()
621 priv->card.dapm_routes = audio_map; in fsl_asoc_card_probe()
622 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map); in fsl_asoc_card_probe()
623 priv->card.driver_name = DRIVER_NAME; in fsl_asoc_card_probe()
625 priv->codec_priv.fll_id = -1; in fsl_asoc_card_probe()
626 priv->codec_priv.pll_id = -1; in fsl_asoc_card_probe()
629 if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) { in fsl_asoc_card_probe()
631 priv->cpu_priv.sysclk_freq[TX] = priv->codec_priv.mclk_freq; in fsl_asoc_card_probe()
632 priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq; in fsl_asoc_card_probe()
633 priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT; in fsl_asoc_card_probe()
634 priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT; in fsl_asoc_card_probe()
635 priv->cpu_priv.slot_width = 32; in fsl_asoc_card_probe()
636 priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC; in fsl_asoc_card_probe()
637 } else if (of_device_is_compatible(np, "fsl,imx-audio-cs427x")) { in fsl_asoc_card_probe()
638 codec_dai_name = "cs4271-hifi"; in fsl_asoc_card_probe()
639 priv->codec_priv.mclk_id = CS427x_SYSCLK_MCLK; in fsl_asoc_card_probe()
640 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
641 } else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) { in fsl_asoc_card_probe()
643 priv->codec_priv.mclk_id = SGTL5000_SYSCLK; in fsl_asoc_card_probe()
644 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
645 } else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic32x4")) { in fsl_asoc_card_probe()
646 codec_dai_name = "tlv320aic32x4-hifi"; in fsl_asoc_card_probe()
647 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
648 } else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic31xx")) { in fsl_asoc_card_probe()
649 codec_dai_name = "tlv320dac31xx-hifi"; in fsl_asoc_card_probe()
650 priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; in fsl_asoc_card_probe()
651 priv->dai_link[1].dpcm_capture = 0; in fsl_asoc_card_probe()
652 priv->dai_link[2].dpcm_capture = 0; in fsl_asoc_card_probe()
653 priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT; in fsl_asoc_card_probe()
654 priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT; in fsl_asoc_card_probe()
655 priv->card.dapm_routes = audio_map_tx; in fsl_asoc_card_probe()
656 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx); in fsl_asoc_card_probe()
657 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8962")) { in fsl_asoc_card_probe()
659 priv->codec_priv.mclk_id = WM8962_SYSCLK_MCLK; in fsl_asoc_card_probe()
660 priv->codec_priv.fll_id = WM8962_SYSCLK_FLL; in fsl_asoc_card_probe()
661 priv->codec_priv.pll_id = WM8962_FLL; in fsl_asoc_card_probe()
662 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
663 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8960")) { in fsl_asoc_card_probe()
664 codec_dai_name = "wm8960-hifi"; in fsl_asoc_card_probe()
665 priv->codec_priv.fll_id = WM8960_SYSCLK_AUTO; in fsl_asoc_card_probe()
666 priv->codec_priv.pll_id = WM8960_SYSCLK_AUTO; in fsl_asoc_card_probe()
667 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
668 } else if (of_device_is_compatible(np, "fsl,imx-audio-ac97")) { in fsl_asoc_card_probe()
669 codec_dai_name = "ac97-hifi"; in fsl_asoc_card_probe()
670 priv->dai_fmt = SND_SOC_DAIFMT_AC97; in fsl_asoc_card_probe()
671 priv->card.dapm_routes = audio_map_ac97; in fsl_asoc_card_probe()
672 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_ac97); in fsl_asoc_card_probe()
673 } else if (of_device_is_compatible(np, "fsl,imx-audio-mqs")) { in fsl_asoc_card_probe()
674 codec_dai_name = "fsl-mqs-dai"; in fsl_asoc_card_probe()
675 priv->dai_fmt = SND_SOC_DAIFMT_LEFT_J | in fsl_asoc_card_probe()
678 priv->dai_link[1].dpcm_capture = 0; in fsl_asoc_card_probe()
679 priv->dai_link[2].dpcm_capture = 0; in fsl_asoc_card_probe()
680 priv->card.dapm_routes = audio_map_tx; in fsl_asoc_card_probe()
681 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx); in fsl_asoc_card_probe()
682 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8524")) { in fsl_asoc_card_probe()
683 codec_dai_name = "wm8524-hifi"; in fsl_asoc_card_probe()
684 priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC; in fsl_asoc_card_probe()
685 priv->dai_link[1].dpcm_capture = 0; in fsl_asoc_card_probe()
686 priv->dai_link[2].dpcm_capture = 0; in fsl_asoc_card_probe()
687 priv->cpu_priv.slot_width = 32; in fsl_asoc_card_probe()
688 priv->card.dapm_routes = audio_map_tx; in fsl_asoc_card_probe()
689 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx); in fsl_asoc_card_probe()
690 } else if (of_device_is_compatible(np, "fsl,imx-audio-si476x")) { in fsl_asoc_card_probe()
691 codec_dai_name = "si476x-codec"; in fsl_asoc_card_probe()
692 priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC; in fsl_asoc_card_probe()
693 priv->card.dapm_routes = audio_map_rx; in fsl_asoc_card_probe()
694 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_rx); in fsl_asoc_card_probe()
695 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8958")) { in fsl_asoc_card_probe()
696 codec_dai_name = "wm8994-aif1"; in fsl_asoc_card_probe()
697 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
698 priv->codec_priv.mclk_id = WM8994_FLL_SRC_MCLK1; in fsl_asoc_card_probe()
699 priv->codec_priv.fll_id = WM8994_SYSCLK_FLL1; in fsl_asoc_card_probe()
700 priv->codec_priv.pll_id = WM8994_FLL1; in fsl_asoc_card_probe()
701 priv->codec_priv.free_freq = priv->codec_priv.mclk_freq; in fsl_asoc_card_probe()
702 priv->card.dapm_routes = NULL; in fsl_asoc_card_probe()
703 priv->card.num_dapm_routes = 0; in fsl_asoc_card_probe()
704 } else if (of_device_is_compatible(np, "fsl,imx-audio-nau8822")) { in fsl_asoc_card_probe()
705 codec_dai_name = "nau8822-hifi"; in fsl_asoc_card_probe()
706 priv->codec_priv.mclk_id = NAU8822_CLK_MCLK; in fsl_asoc_card_probe()
707 priv->codec_priv.fll_id = NAU8822_CLK_PLL; in fsl_asoc_card_probe()
708 priv->codec_priv.pll_id = NAU8822_CLK_PLL; in fsl_asoc_card_probe()
709 priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; in fsl_asoc_card_probe()
711 priv->codec_priv.mclk = devm_clk_get(codec_dev, NULL); in fsl_asoc_card_probe()
713 dev_err(&pdev->dev, "unknown Device Tree compatible\n"); in fsl_asoc_card_probe()
714 ret = -EINVAL; in fsl_asoc_card_probe()
719 * Allow setting mclk-id from the device-tree node. Otherwise, the in fsl_asoc_card_probe()
722 of_property_read_u32(np, "mclk-id", &priv->codec_priv.mclk_id); in fsl_asoc_card_probe()
737 priv->dai_fmt = daifmt; in fsl_asoc_card_probe()
741 if (priv->dai_fmt & SND_SOC_DAIFMT_CBP_CFP) { in fsl_asoc_card_probe()
742 priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_IN; in fsl_asoc_card_probe()
743 priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_IN; in fsl_asoc_card_probe()
750 dev_dbg(&pdev->dev, "failed to find codec device\n"); in fsl_asoc_card_probe()
751 ret = -EPROBE_DEFER; in fsl_asoc_card_probe()
760 dev_err(&pdev->dev, "failed to init audmux\n"); in fsl_asoc_card_probe()
764 struct clk *esai_clk = clk_get(&cpu_pdev->dev, "extal"); in fsl_asoc_card_probe()
767 priv->cpu_priv.sysclk_freq[TX] = clk_get_rate(esai_clk); in fsl_asoc_card_probe()
768 priv->cpu_priv.sysclk_freq[RX] = clk_get_rate(esai_clk); in fsl_asoc_card_probe()
770 } else if (PTR_ERR(esai_clk) == -EPROBE_DEFER) { in fsl_asoc_card_probe()
771 ret = -EPROBE_DEFER; in fsl_asoc_card_probe()
775 priv->cpu_priv.sysclk_id[1] = ESAI_HCKT_EXTAL; in fsl_asoc_card_probe()
776 priv->cpu_priv.sysclk_id[0] = ESAI_HCKR_EXTAL; in fsl_asoc_card_probe()
778 priv->cpu_priv.sysclk_id[1] = FSL_SAI_CLK_MAST1; in fsl_asoc_card_probe()
779 priv->cpu_priv.sysclk_id[0] = FSL_SAI_CLK_MAST1; in fsl_asoc_card_probe()
783 priv->pdev = pdev; in fsl_asoc_card_probe()
784 priv->card.dev = &pdev->dev; in fsl_asoc_card_probe()
785 priv->card.owner = THIS_MODULE; in fsl_asoc_card_probe()
786 ret = snd_soc_of_parse_card_name(&priv->card, "model"); in fsl_asoc_card_probe()
788 snprintf(priv->name, sizeof(priv->name), "%s-audio", in fsl_asoc_card_probe()
790 priv->card.name = priv->name; in fsl_asoc_card_probe()
792 priv->card.dai_link = priv->dai_link; in fsl_asoc_card_probe()
793 priv->card.late_probe = fsl_asoc_card_late_probe; in fsl_asoc_card_probe()
794 priv->card.dapm_widgets = fsl_asoc_card_dapm_widgets; in fsl_asoc_card_probe()
795 priv->card.num_dapm_widgets = ARRAY_SIZE(fsl_asoc_card_dapm_widgets); in fsl_asoc_card_probe()
797 /* Drop the second half of DAPM routes -- ASRC */ in fsl_asoc_card_probe()
799 priv->card.num_dapm_routes /= 2; in fsl_asoc_card_probe()
801 if (of_property_read_bool(np, "audio-routing")) { in fsl_asoc_card_probe()
802 ret = snd_soc_of_parse_audio_routing(&priv->card, "audio-routing"); in fsl_asoc_card_probe()
804 dev_err(&pdev->dev, "failed to parse audio-routing: %d\n", ret); in fsl_asoc_card_probe()
810 priv->dai_link[0].cpus->of_node = cpu_np; in fsl_asoc_card_probe()
811 priv->dai_link[0].codecs->dai_name = codec_dai_name; in fsl_asoc_card_probe()
814 priv->dai_link[0].codecs->of_node = codec_np; in fsl_asoc_card_probe()
818 ret = of_property_read_u32(cpu_np, "cell-index", &idx); in fsl_asoc_card_probe()
820 dev_err(&pdev->dev, in fsl_asoc_card_probe()
825 priv->dai_link[0].codecs->name = in fsl_asoc_card_probe()
826 devm_kasprintf(&pdev->dev, GFP_KERNEL, in fsl_asoc_card_probe()
827 "ac97-codec.%u", in fsl_asoc_card_probe()
829 if (!priv->dai_link[0].codecs->name) { in fsl_asoc_card_probe()
830 ret = -ENOMEM; in fsl_asoc_card_probe()
835 priv->dai_link[0].platforms->of_node = cpu_np; in fsl_asoc_card_probe()
836 priv->dai_link[0].dai_fmt = priv->dai_fmt; in fsl_asoc_card_probe()
837 priv->card.num_links = 1; in fsl_asoc_card_probe()
841 priv->dai_link[1].cpus->of_node = asrc_np; in fsl_asoc_card_probe()
842 priv->dai_link[1].platforms->of_node = asrc_np; in fsl_asoc_card_probe()
843 priv->dai_link[2].codecs->dai_name = codec_dai_name; in fsl_asoc_card_probe()
844 priv->dai_link[2].codecs->of_node = codec_np; in fsl_asoc_card_probe()
845 priv->dai_link[2].codecs->name = in fsl_asoc_card_probe()
846 priv->dai_link[0].codecs->name; in fsl_asoc_card_probe()
847 priv->dai_link[2].cpus->of_node = cpu_np; in fsl_asoc_card_probe()
848 priv->dai_link[2].dai_fmt = priv->dai_fmt; in fsl_asoc_card_probe()
849 priv->card.num_links = 3; in fsl_asoc_card_probe()
851 ret = of_property_read_u32(asrc_np, "fsl,asrc-rate", in fsl_asoc_card_probe()
852 &priv->asrc_rate); in fsl_asoc_card_probe()
854 dev_err(&pdev->dev, "failed to get output rate\n"); in fsl_asoc_card_probe()
855 ret = -EINVAL; in fsl_asoc_card_probe()
859 ret = of_property_read_u32(asrc_np, "fsl,asrc-format", &asrc_fmt); in fsl_asoc_card_probe()
860 priv->asrc_format = (__force snd_pcm_format_t)asrc_fmt; in fsl_asoc_card_probe()
863 ret = of_property_read_u32(asrc_np, "fsl,asrc-width", in fsl_asoc_card_probe()
866 dev_err(&pdev->dev, in fsl_asoc_card_probe()
872 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE; in fsl_asoc_card_probe()
874 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE; in fsl_asoc_card_probe()
880 snd_soc_card_set_drvdata(&priv->card, priv); in fsl_asoc_card_probe()
882 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card); in fsl_asoc_card_probe()
884 dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n"); in fsl_asoc_card_probe()
889 * Properties "hp-det-gpio" and "mic-det-gpio" are optional, and in fsl_asoc_card_probe()
896 if (of_property_read_bool(np, "hp-det-gpio")) { in fsl_asoc_card_probe()
897 ret = simple_util_init_jack(&priv->card, &priv->hp_jack, in fsl_asoc_card_probe()
902 snd_soc_jack_notifier_register(&priv->hp_jack.jack, &hp_jack_nb); in fsl_asoc_card_probe()
905 if (of_property_read_bool(np, "mic-det-gpio")) { in fsl_asoc_card_probe()
906 ret = simple_util_init_jack(&priv->card, &priv->mic_jack, in fsl_asoc_card_probe()
911 snd_soc_jack_notifier_register(&priv->mic_jack.jack, &mic_jack_nb); in fsl_asoc_card_probe()
917 put_device(&cpu_pdev->dev); in fsl_asoc_card_probe()
925 { .compatible = "fsl,imx-audio-ac97", },
926 { .compatible = "fsl,imx-audio-cs42888", },
927 { .compatible = "fsl,imx-audio-cs427x", },
928 { .compatible = "fsl,imx-audio-tlv320aic32x4", },
929 { .compatible = "fsl,imx-audio-tlv320aic31xx", },
930 { .compatible = "fsl,imx-audio-sgtl5000", },
931 { .compatible = "fsl,imx-audio-wm8962", },
932 { .compatible = "fsl,imx-audio-wm8960", },
933 { .compatible = "fsl,imx-audio-mqs", },
934 { .compatible = "fsl,imx-audio-wm8524", },
935 { .compatible = "fsl,imx-audio-si476x", },
936 { .compatible = "fsl,imx-audio-wm8958", },
937 { .compatible = "fsl,imx-audio-nau8822", },