Lines Matching +full:wm8524 +full:- +full:audio
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
61 * struct cpu_priv - CPU private data
79 * struct fsl_asoc_card_priv - Freescale Generic ASOC card private data
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"},
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(asoc_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()
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()
319 /* DPCM Link between Front-End and Back-End (Optional) */
321 .name = "HiFi-ASRC-FE",
322 .stream_name = "HiFi-ASRC-FE",
329 .name = "HiFi-ASRC-BE",
330 .stream_name = "HiFi-ASRC-BE",
343 struct device *dev = &priv->pdev->dev; in fsl_asoc_card_audmux_init()
348 ret = of_property_read_u32(np, "mux-int-port", &int_port); in fsl_asoc_card_audmux_init()
350 dev_err(dev, "mux-int-port missing or invalid\n"); in fsl_asoc_card_audmux_init()
353 ret = of_property_read_u32(np, "mux-ext-port", &ext_port); in fsl_asoc_card_audmux_init()
355 dev_err(dev, "mux-ext-port missing or invalid\n"); in fsl_asoc_card_audmux_init()
363 int_port--; in fsl_asoc_card_audmux_init()
364 ext_port--; in fsl_asoc_card_audmux_init()
371 switch (priv->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { in fsl_asoc_card_audmux_init()
414 return -EINVAL; in fsl_asoc_card_audmux_init()
472 struct snd_soc_dapm_context *dapm = &jack->card->dapm; in hp_jack_event()
489 struct snd_soc_dapm_context *dapm = &jack->card->dapm; in mic_jack_event()
506 &card->rtd_list, struct snd_soc_pcm_runtime, list); in fsl_asoc_card_late_probe()
508 struct codec_priv *codec_priv = &priv->codec_priv; in fsl_asoc_card_late_probe()
509 struct device *dev = card->dev; in fsl_asoc_card_late_probe()
514 struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component; in fsl_asoc_card_late_probe()
529 ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id, in fsl_asoc_card_late_probe()
530 codec_priv->mclk_freq, SND_SOC_CLOCK_IN); in fsl_asoc_card_late_probe()
531 if (ret && ret != -ENOTSUPP) { in fsl_asoc_card_late_probe()
536 if (!IS_ERR_OR_NULL(codec_priv->mclk)) in fsl_asoc_card_late_probe()
537 clk_prepare_enable(codec_priv->mclk); in fsl_asoc_card_late_probe()
545 struct device_node *np = pdev->dev.of_node; in fsl_asoc_card_probe()
558 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in fsl_asoc_card_probe()
560 return -ENOMEM; in fsl_asoc_card_probe()
562 priv->pdev = pdev; in fsl_asoc_card_probe()
564 cpu_np = of_parse_phandle(np, "audio-cpu", 0); in fsl_asoc_card_probe()
567 cpu_np = of_parse_phandle(np, "ssi-controller", 0); in fsl_asoc_card_probe()
569 dev_err(&pdev->dev, "CPU phandle missing or invalid\n"); in fsl_asoc_card_probe()
570 ret = -EINVAL; in fsl_asoc_card_probe()
576 dev_err(&pdev->dev, "failed to find CPU DAI device\n"); in fsl_asoc_card_probe()
577 ret = -EINVAL; in fsl_asoc_card_probe()
581 codec_np = of_parse_phandle(np, "audio-codec", 0); in fsl_asoc_card_probe()
588 codec_dev = &codec_i2c->dev; in fsl_asoc_card_probe()
589 codec_dev_name = codec_i2c->name; in fsl_asoc_card_probe()
594 codec_dev = &codec_pdev->dev; in fsl_asoc_card_probe()
595 codec_dev_name = codec_pdev->name; in fsl_asoc_card_probe()
600 asrc_np = of_parse_phandle(np, "audio-asrc", 0); in fsl_asoc_card_probe()
609 priv->codec_priv.mclk_freq = clk_get_rate(codec_clk); in fsl_asoc_card_probe()
615 priv->sample_rate = 44100; in fsl_asoc_card_probe()
616 priv->sample_format = SNDRV_PCM_FORMAT_S16_LE; in fsl_asoc_card_probe()
619 priv->dai_fmt = DAI_FMT_BASE; in fsl_asoc_card_probe()
621 memcpy(priv->dai_link, fsl_asoc_card_dai, in fsl_asoc_card_probe()
622 sizeof(struct snd_soc_dai_link) * ARRAY_SIZE(priv->dai_link)); in fsl_asoc_card_probe()
624 priv->card.dapm_routes = audio_map; in fsl_asoc_card_probe()
625 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map); in fsl_asoc_card_probe()
626 priv->card.driver_name = DRIVER_NAME; in fsl_asoc_card_probe()
628 priv->codec_priv.fll_id = -1; in fsl_asoc_card_probe()
629 priv->codec_priv.pll_id = -1; in fsl_asoc_card_probe()
632 if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) { in fsl_asoc_card_probe()
634 priv->cpu_priv.sysclk_freq[TX] = priv->codec_priv.mclk_freq; in fsl_asoc_card_probe()
635 priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq; in fsl_asoc_card_probe()
636 priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT; in fsl_asoc_card_probe()
637 priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT; in fsl_asoc_card_probe()
638 priv->cpu_priv.slot_width = 32; in fsl_asoc_card_probe()
639 priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC; in fsl_asoc_card_probe()
640 } else if (of_device_is_compatible(np, "fsl,imx-audio-cs427x")) { in fsl_asoc_card_probe()
641 codec_dai_name = "cs4271-hifi"; in fsl_asoc_card_probe()
642 priv->codec_priv.mclk_id = CS427x_SYSCLK_MCLK; in fsl_asoc_card_probe()
643 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
644 } else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) { in fsl_asoc_card_probe()
646 priv->codec_priv.mclk_id = SGTL5000_SYSCLK; 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-tlv320aic32x4")) { in fsl_asoc_card_probe()
649 codec_dai_name = "tlv320aic32x4-hifi"; in fsl_asoc_card_probe()
650 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
651 } else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic31xx")) { in fsl_asoc_card_probe()
652 codec_dai_name = "tlv320dac31xx-hifi"; in fsl_asoc_card_probe()
653 priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; in fsl_asoc_card_probe()
654 priv->dai_link[1].dpcm_capture = 0; in fsl_asoc_card_probe()
655 priv->dai_link[2].dpcm_capture = 0; in fsl_asoc_card_probe()
656 priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT; in fsl_asoc_card_probe()
657 priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT; in fsl_asoc_card_probe()
658 priv->card.dapm_routes = audio_map_tx; in fsl_asoc_card_probe()
659 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx); in fsl_asoc_card_probe()
660 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8962")) { in fsl_asoc_card_probe()
662 priv->codec_priv.mclk_id = WM8962_SYSCLK_MCLK; in fsl_asoc_card_probe()
663 priv->codec_priv.fll_id = WM8962_SYSCLK_FLL; in fsl_asoc_card_probe()
664 priv->codec_priv.pll_id = WM8962_FLL; in fsl_asoc_card_probe()
665 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
666 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8960")) { in fsl_asoc_card_probe()
667 codec_dai_name = "wm8960-hifi"; in fsl_asoc_card_probe()
668 priv->codec_priv.fll_id = WM8960_SYSCLK_AUTO; in fsl_asoc_card_probe()
669 priv->codec_priv.pll_id = WM8960_SYSCLK_AUTO; in fsl_asoc_card_probe()
670 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
671 } else if (of_device_is_compatible(np, "fsl,imx-audio-ac97")) { in fsl_asoc_card_probe()
672 codec_dai_name = "ac97-hifi"; in fsl_asoc_card_probe()
673 priv->dai_fmt = SND_SOC_DAIFMT_AC97; in fsl_asoc_card_probe()
674 priv->card.dapm_routes = audio_map_ac97; in fsl_asoc_card_probe()
675 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_ac97); in fsl_asoc_card_probe()
676 } else if (of_device_is_compatible(np, "fsl,imx-audio-mqs")) { in fsl_asoc_card_probe()
677 codec_dai_name = "fsl-mqs-dai"; in fsl_asoc_card_probe()
678 priv->dai_fmt = SND_SOC_DAIFMT_LEFT_J | in fsl_asoc_card_probe()
681 priv->dai_link[1].dpcm_capture = 0; in fsl_asoc_card_probe()
682 priv->dai_link[2].dpcm_capture = 0; in fsl_asoc_card_probe()
683 priv->card.dapm_routes = audio_map_tx; in fsl_asoc_card_probe()
684 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx); in fsl_asoc_card_probe()
685 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8524")) { in fsl_asoc_card_probe()
686 codec_dai_name = "wm8524-hifi"; in fsl_asoc_card_probe()
687 priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC; in fsl_asoc_card_probe()
688 priv->dai_link[1].dpcm_capture = 0; in fsl_asoc_card_probe()
689 priv->dai_link[2].dpcm_capture = 0; in fsl_asoc_card_probe()
690 priv->cpu_priv.slot_width = 32; in fsl_asoc_card_probe()
691 priv->card.dapm_routes = audio_map_tx; in fsl_asoc_card_probe()
692 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx); in fsl_asoc_card_probe()
693 } else if (of_device_is_compatible(np, "fsl,imx-audio-si476x")) { in fsl_asoc_card_probe()
694 codec_dai_name = "si476x-codec"; in fsl_asoc_card_probe()
695 priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC; in fsl_asoc_card_probe()
696 priv->card.dapm_routes = audio_map_rx; in fsl_asoc_card_probe()
697 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_rx); in fsl_asoc_card_probe()
698 } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8958")) { in fsl_asoc_card_probe()
699 codec_dai_name = "wm8994-aif1"; in fsl_asoc_card_probe()
700 priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; in fsl_asoc_card_probe()
701 priv->codec_priv.mclk_id = WM8994_FLL_SRC_MCLK1; in fsl_asoc_card_probe()
702 priv->codec_priv.fll_id = WM8994_SYSCLK_FLL1; in fsl_asoc_card_probe()
703 priv->codec_priv.pll_id = WM8994_FLL1; in fsl_asoc_card_probe()
704 priv->codec_priv.free_freq = priv->codec_priv.mclk_freq; in fsl_asoc_card_probe()
705 priv->card.dapm_routes = NULL; in fsl_asoc_card_probe()
706 priv->card.num_dapm_routes = 0; in fsl_asoc_card_probe()
707 } else if (of_device_is_compatible(np, "fsl,imx-audio-nau8822")) { in fsl_asoc_card_probe()
708 codec_dai_name = "nau8822-hifi"; in fsl_asoc_card_probe()
709 priv->codec_priv.mclk_id = NAU8822_CLK_MCLK; in fsl_asoc_card_probe()
710 priv->codec_priv.fll_id = NAU8822_CLK_PLL; in fsl_asoc_card_probe()
711 priv->codec_priv.pll_id = NAU8822_CLK_PLL; in fsl_asoc_card_probe()
712 priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; in fsl_asoc_card_probe()
714 priv->codec_priv.mclk = devm_clk_get(codec_dev, NULL); in fsl_asoc_card_probe()
716 dev_err(&pdev->dev, "unknown Device Tree compatible\n"); in fsl_asoc_card_probe()
717 ret = -EINVAL; in fsl_asoc_card_probe()
722 * Allow setting mclk-id from the device-tree node. Otherwise, the in fsl_asoc_card_probe()
725 of_property_read_u32(np, "mclk-id", &priv->codec_priv.mclk_id); in fsl_asoc_card_probe()
740 priv->dai_fmt = daifmt; in fsl_asoc_card_probe()
744 if (priv->dai_fmt & SND_SOC_DAIFMT_CBP_CFP) { in fsl_asoc_card_probe()
745 priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_IN; in fsl_asoc_card_probe()
746 priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_IN; in fsl_asoc_card_probe()
753 dev_dbg(&pdev->dev, "failed to find codec device\n"); in fsl_asoc_card_probe()
754 ret = -EPROBE_DEFER; in fsl_asoc_card_probe()
763 dev_err(&pdev->dev, "failed to init audmux\n"); in fsl_asoc_card_probe()
767 struct clk *esai_clk = clk_get(&cpu_pdev->dev, "extal"); in fsl_asoc_card_probe()
770 priv->cpu_priv.sysclk_freq[TX] = clk_get_rate(esai_clk); in fsl_asoc_card_probe()
771 priv->cpu_priv.sysclk_freq[RX] = clk_get_rate(esai_clk); in fsl_asoc_card_probe()
773 } else if (PTR_ERR(esai_clk) == -EPROBE_DEFER) { in fsl_asoc_card_probe()
774 ret = -EPROBE_DEFER; in fsl_asoc_card_probe()
778 priv->cpu_priv.sysclk_id[1] = ESAI_HCKT_EXTAL; in fsl_asoc_card_probe()
779 priv->cpu_priv.sysclk_id[0] = ESAI_HCKR_EXTAL; in fsl_asoc_card_probe()
781 priv->cpu_priv.sysclk_id[1] = FSL_SAI_CLK_MAST1; in fsl_asoc_card_probe()
782 priv->cpu_priv.sysclk_id[0] = FSL_SAI_CLK_MAST1; in fsl_asoc_card_probe()
786 priv->card.dev = &pdev->dev; in fsl_asoc_card_probe()
787 priv->card.owner = THIS_MODULE; in fsl_asoc_card_probe()
788 ret = snd_soc_of_parse_card_name(&priv->card, "model"); in fsl_asoc_card_probe()
790 snprintf(priv->name, sizeof(priv->name), "%s-audio", in fsl_asoc_card_probe()
792 priv->card.name = priv->name; in fsl_asoc_card_probe()
794 priv->card.dai_link = priv->dai_link; in fsl_asoc_card_probe()
795 priv->card.late_probe = fsl_asoc_card_late_probe; in fsl_asoc_card_probe()
796 priv->card.dapm_widgets = fsl_asoc_card_dapm_widgets; in fsl_asoc_card_probe()
797 priv->card.num_dapm_widgets = ARRAY_SIZE(fsl_asoc_card_dapm_widgets); in fsl_asoc_card_probe()
799 /* Drop the second half of DAPM routes -- ASRC */ in fsl_asoc_card_probe()
801 priv->card.num_dapm_routes /= 2; in fsl_asoc_card_probe()
803 if (of_property_read_bool(np, "audio-routing")) { in fsl_asoc_card_probe()
804 ret = snd_soc_of_parse_audio_routing(&priv->card, "audio-routing"); in fsl_asoc_card_probe()
806 dev_err(&pdev->dev, "failed to parse audio-routing: %d\n", ret); in fsl_asoc_card_probe()
812 priv->dai_link[0].cpus->of_node = cpu_np; in fsl_asoc_card_probe()
813 priv->dai_link[0].codecs->dai_name = codec_dai_name; in fsl_asoc_card_probe()
816 priv->dai_link[0].codecs->of_node = codec_np; in fsl_asoc_card_probe()
820 ret = of_property_read_u32(cpu_np, "cell-index", &idx); in fsl_asoc_card_probe()
822 dev_err(&pdev->dev, in fsl_asoc_card_probe()
827 priv->dai_link[0].codecs->name = in fsl_asoc_card_probe()
828 devm_kasprintf(&pdev->dev, GFP_KERNEL, in fsl_asoc_card_probe()
829 "ac97-codec.%u", in fsl_asoc_card_probe()
831 if (!priv->dai_link[0].codecs->name) { in fsl_asoc_card_probe()
832 ret = -ENOMEM; in fsl_asoc_card_probe()
837 priv->dai_link[0].platforms->of_node = cpu_np; in fsl_asoc_card_probe()
838 priv->dai_link[0].dai_fmt = priv->dai_fmt; in fsl_asoc_card_probe()
839 priv->card.num_links = 1; in fsl_asoc_card_probe()
843 priv->dai_link[1].cpus->of_node = asrc_np; in fsl_asoc_card_probe()
844 priv->dai_link[1].platforms->of_node = asrc_np; in fsl_asoc_card_probe()
845 priv->dai_link[2].codecs->dai_name = codec_dai_name; in fsl_asoc_card_probe()
846 priv->dai_link[2].codecs->of_node = codec_np; in fsl_asoc_card_probe()
847 priv->dai_link[2].codecs->name = in fsl_asoc_card_probe()
848 priv->dai_link[0].codecs->name; in fsl_asoc_card_probe()
849 priv->dai_link[2].cpus->of_node = cpu_np; in fsl_asoc_card_probe()
850 priv->dai_link[2].dai_fmt = priv->dai_fmt; in fsl_asoc_card_probe()
851 priv->card.num_links = 3; in fsl_asoc_card_probe()
853 ret = of_property_read_u32(asrc_np, "fsl,asrc-rate", in fsl_asoc_card_probe()
854 &priv->asrc_rate); in fsl_asoc_card_probe()
856 dev_err(&pdev->dev, "failed to get output rate\n"); in fsl_asoc_card_probe()
857 ret = -EINVAL; in fsl_asoc_card_probe()
861 ret = of_property_read_u32(asrc_np, "fsl,asrc-format", &asrc_fmt); in fsl_asoc_card_probe()
862 priv->asrc_format = (__force snd_pcm_format_t)asrc_fmt; in fsl_asoc_card_probe()
865 ret = of_property_read_u32(asrc_np, "fsl,asrc-width", in fsl_asoc_card_probe()
868 dev_err(&pdev->dev, in fsl_asoc_card_probe()
874 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE; in fsl_asoc_card_probe()
876 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE; in fsl_asoc_card_probe()
882 snd_soc_card_set_drvdata(&priv->card, priv); in fsl_asoc_card_probe()
884 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card); in fsl_asoc_card_probe()
886 dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n"); in fsl_asoc_card_probe()
891 * Properties "hp-det-gpio" and "mic-det-gpio" are optional, and in fsl_asoc_card_probe()
898 if (of_property_read_bool(np, "hp-det-gpio")) { in fsl_asoc_card_probe()
899 ret = asoc_simple_init_jack(&priv->card, &priv->hp_jack, in fsl_asoc_card_probe()
904 snd_soc_jack_notifier_register(&priv->hp_jack.jack, &hp_jack_nb); in fsl_asoc_card_probe()
907 if (of_property_read_bool(np, "mic-det-gpio")) { in fsl_asoc_card_probe()
908 ret = asoc_simple_init_jack(&priv->card, &priv->mic_jack, in fsl_asoc_card_probe()
913 snd_soc_jack_notifier_register(&priv->mic_jack.jack, &mic_jack_nb); in fsl_asoc_card_probe()
919 put_device(&cpu_pdev->dev); in fsl_asoc_card_probe()
927 { .compatible = "fsl,imx-audio-ac97", },
928 { .compatible = "fsl,imx-audio-cs42888", },
929 { .compatible = "fsl,imx-audio-cs427x", },
930 { .compatible = "fsl,imx-audio-tlv320aic32x4", },
931 { .compatible = "fsl,imx-audio-tlv320aic31xx", },
932 { .compatible = "fsl,imx-audio-sgtl5000", },
933 { .compatible = "fsl,imx-audio-wm8962", },
934 { .compatible = "fsl,imx-audio-wm8960", },
935 { .compatible = "fsl,imx-audio-mqs", },
936 { .compatible = "fsl,imx-audio-wm8524", },
937 { .compatible = "fsl,imx-audio-si476x", },
938 { .compatible = "fsl,imx-audio-wm8958", },
939 { .compatible = "fsl,imx-audio-nau8822", },