Lines Matching +full:codec +full:- +full:aif1 +full:- +full:bclk
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
19 #include <sound/soc-dapm.h>
29 #include "acp-mach.h"
35 #define NAU8821_CODEC_DAI "nau8821-hifi"
38 #define MAX98388_CODEC_DAI "max98388-aif1"
44 /* Google skyrim proto-0 */
77 clk_set_rate(drvdata->wclk, srate); in acp_clk_enable()
78 clk_set_rate(drvdata->bclk, srate * bclk_ratio); in acp_clk_enable()
80 return clk_prepare_enable(drvdata->wclk); in acp_clk_enable()
83 /* Declare RT5682 codec components */
85 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5682:00", "rt5682-aif1")));
115 /* Define card ops for RT5682 CODEC */
118 struct snd_soc_card *card = rtd->card; in acp_card_rt5682_init()
119 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_rt5682_init()
121 struct snd_soc_component *component = codec_dai->component; in acp_card_rt5682_init()
124 dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); in acp_card_rt5682_init()
126 if (drvdata->hs_codec_id != RT5682) in acp_card_rt5682_init()
127 return -EINVAL; in acp_card_rt5682_init()
129 drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk"); in acp_card_rt5682_init()
130 drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); in acp_card_rt5682_init()
132 ret = snd_soc_dapm_new_controls(&card->dapm, rt5682_widgets, in acp_card_rt5682_init()
135 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); in acp_card_rt5682_init()
142 dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); in acp_card_rt5682_init()
154 dev_err(card->dev, "HP jack creation failed %d\n", ret); in acp_card_rt5682_init()
165 dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); in acp_card_rt5682_init()
169 return snd_soc_dapm_add_routes(&rtd->card->dapm, rt5682_map, ARRAY_SIZE(rt5682_map)); in acp_card_rt5682_init()
174 struct snd_pcm_runtime *runtime = substream->runtime; in acp_card_hs_startup()
176 struct snd_soc_card *card = rtd->card; in acp_card_hs_startup()
177 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_hs_startup()
182 if (drvdata->tdm_mode) in acp_card_hs_startup()
187 if (drvdata->soc_mclk) in acp_card_hs_startup()
194 dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); in acp_card_hs_startup()
198 runtime->hw.channels_max = DUAL_CHANNEL; in acp_card_hs_startup()
210 struct snd_soc_card *card = rtd->card; in acp_card_shutdown()
211 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_shutdown()
213 if (!drvdata->soc_mclk) in acp_card_shutdown()
214 clk_disable_unprepare(drvdata->wclk); in acp_card_shutdown()
221 struct snd_soc_card *card = rtd->card; in acp_card_rt5682_hw_params()
222 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_rt5682_hw_params()
232 if (drvdata->tdm_mode) in acp_card_rt5682_hw_params()
237 if (drvdata->soc_mclk) in acp_card_rt5682_hw_params()
243 if (ret && ret != -ENOTSUPP) { in acp_card_rt5682_hw_params()
244 dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); in acp_card_rt5682_hw_params()
250 dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); in acp_card_rt5682_hw_params()
254 if (drvdata->tdm_mode) { in acp_card_rt5682_hw_params()
256 * As codec supports slot 0 and slot 1 for playback and capture. in acp_card_rt5682_hw_params()
259 if (ret && ret != -ENOTSUPP) { in acp_card_rt5682_hw_params()
260 dev_err(rtd->dev, "set TDM slot err: %d\n", ret); in acp_card_rt5682_hw_params()
266 dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); in acp_card_rt5682_hw_params()
274 dev_err(rtd->dev, "Failed to set codec PLL: %d\n", ret); in acp_card_rt5682_hw_params()
281 dev_err(rtd->dev, "Failed to set codec SYSCLK: %d\n", ret); in acp_card_rt5682_hw_params()
285 if (drvdata->tdm_mode) { in acp_card_rt5682_hw_params()
289 dev_err(rtd->dev, "Failed to set codec PLL: %d\n", ret); in acp_card_rt5682_hw_params()
296 dev_err(rtd->dev, "Failed to set codec SYSCLK: %d\n", ret); in acp_card_rt5682_hw_params()
301 /* Set tdm/i2s1 master bclk ratio */ in acp_card_rt5682_hw_params()
304 dev_err(rtd->dev, "Failed to set rt5682 tdm bclk ratio: %d\n", ret); in acp_card_rt5682_hw_params()
308 if (!drvdata->soc_mclk) { in acp_card_rt5682_hw_params()
311 dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret); in acp_card_rt5682_hw_params()
325 /* Define RT5682S CODEC component*/
327 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-RTL5682:00", "rt5682s-aif1")));
359 struct snd_soc_card *card = rtd->card; in acp_card_rt5682s_init()
360 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_rt5682s_init()
362 struct snd_soc_component *component = codec_dai->component; in acp_card_rt5682s_init()
365 dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); in acp_card_rt5682s_init()
367 if (drvdata->hs_codec_id != RT5682S) in acp_card_rt5682s_init()
368 return -EINVAL; in acp_card_rt5682s_init()
370 if (!drvdata->soc_mclk) { in acp_card_rt5682s_init()
371 drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk"); in acp_card_rt5682s_init()
372 drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); in acp_card_rt5682s_init()
375 ret = snd_soc_dapm_new_controls(&card->dapm, rt5682s_widgets, in acp_card_rt5682s_init()
378 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); in acp_card_rt5682s_init()
385 dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); in acp_card_rt5682s_init()
397 dev_err(card->dev, "HP jack creation failed %d\n", ret); in acp_card_rt5682s_init()
408 dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); in acp_card_rt5682s_init()
412 return snd_soc_dapm_add_routes(&rtd->card->dapm, rt5682s_map, ARRAY_SIZE(rt5682s_map)); in acp_card_rt5682s_init()
418 struct snd_soc_pcm_runtime *rtd = substream->private_data; in acp_card_rt5682s_hw_params()
419 struct snd_soc_card *card = rtd->card; in acp_card_rt5682s_hw_params()
420 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_rt5682s_hw_params()
430 if (drvdata->tdm_mode) in acp_card_rt5682s_hw_params()
435 if (drvdata->soc_mclk) in acp_card_rt5682s_hw_params()
441 if (ret && ret != -ENOTSUPP) { in acp_card_rt5682s_hw_params()
442 dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); in acp_card_rt5682s_hw_params()
448 dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); in acp_card_rt5682s_hw_params()
452 if (drvdata->tdm_mode) { in acp_card_rt5682s_hw_params()
454 * As codec supports slot 0 and slot 1 for playback and capture. in acp_card_rt5682s_hw_params()
457 if (ret && ret != -ENOTSUPP) { in acp_card_rt5682s_hw_params()
458 dev_err(rtd->dev, "set TDM slot err: %d\n", ret); in acp_card_rt5682s_hw_params()
464 dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); in acp_card_rt5682s_hw_params()
472 dev_err(rtd->dev, "Failed to set codec PLL: %d\n", ret); in acp_card_rt5682s_hw_params()
479 dev_err(rtd->dev, "Failed to set codec SYSCLK: %d\n", ret); in acp_card_rt5682s_hw_params()
483 if (drvdata->tdm_mode) { in acp_card_rt5682s_hw_params()
487 dev_err(rtd->dev, "Failed to set codec PLL: %d\n", ret); in acp_card_rt5682s_hw_params()
494 dev_err(rtd->dev, "Failed to set codec SYSCLK: %d\n", ret); in acp_card_rt5682s_hw_params()
499 /* Set tdm/i2s1 master bclk ratio */ in acp_card_rt5682s_hw_params()
502 dev_err(rtd->dev, "Failed to set rt5682 tdm bclk ratio: %d\n", ret); in acp_card_rt5682s_hw_params()
506 clk_set_rate(drvdata->wclk, srate); in acp_card_rt5682s_hw_params()
507 clk_set_rate(drvdata->bclk, srate * ch * format); in acp_card_rt5682s_hw_params()
508 if (!drvdata->soc_mclk) { in acp_card_rt5682s_hw_params()
511 dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret); in acp_card_rt5682s_hw_params()
536 struct snd_pcm_runtime *runtime = substream->runtime; in acp_card_dmic_startup()
550 /* Declare RT1019 codec components */
552 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1019:00", "rt1019-aif"),
553 COMP_CODEC("i2c-10EC1019:01", "rt1019-aif")));
572 .dlc = COMP_CODEC_CONF("i2c-10EC1019:01"),
576 .dlc = COMP_CODEC_CONF("i2c-10EC1019:00"),
583 struct snd_soc_card *card = rtd->card; in acp_card_rt1019_init()
584 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_rt1019_init()
587 if (drvdata->amp_codec_id != RT1019) in acp_card_rt1019_init()
588 return -EINVAL; in acp_card_rt1019_init()
590 ret = snd_soc_dapm_new_controls(&card->dapm, rt1019_widgets, in acp_card_rt1019_init()
593 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); in acp_card_rt1019_init()
600 dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); in acp_card_rt1019_init()
604 return snd_soc_dapm_add_routes(&rtd->card->dapm, rt1019_map_lr, in acp_card_rt1019_init()
611 struct snd_soc_pcm_runtime *rtd = substream->private_data; in acp_card_rt1019_hw_params()
612 struct snd_soc_card *card = rtd->card; in acp_card_rt1019_hw_params()
613 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_rt1019_hw_params()
623 if (drvdata->amp_codec_id != RT1019) in acp_card_rt1019_hw_params()
624 return -EINVAL; in acp_card_rt1019_hw_params()
626 if (drvdata->tdm_mode) in acp_card_rt1019_hw_params()
631 if (drvdata->soc_mclk) in acp_card_rt1019_hw_params()
637 if (ret && ret != -ENOTSUPP) { in acp_card_rt1019_hw_params()
638 dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); in acp_card_rt1019_hw_params()
642 if (drvdata->tdm_mode) { in acp_card_rt1019_hw_params()
644 * As codec supports slot 2 and slot 3 for playback. in acp_card_rt1019_hw_params()
647 if (ret && ret != -ENOTSUPP) { in acp_card_rt1019_hw_params()
648 dev_err(rtd->dev, "set TDM slot err: %d\n", ret); in acp_card_rt1019_hw_params()
654 if (strcmp(codec_dai->name, "rt1019-aif")) in acp_card_rt1019_hw_params()
657 if (drvdata->tdm_mode) in acp_card_rt1019_hw_params()
672 if (drvdata->tdm_mode) { in acp_card_rt1019_hw_params()
676 dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); in acp_card_rt1019_hw_params()
681 * As codec supports slot 2 for left channel playback. in acp_card_rt1019_hw_params()
683 if (!strcmp(codec_dai->component->name, "i2c-10EC1019:00")) { in acp_card_rt1019_hw_params()
690 * As codec supports slot 3 for right channel playback. in acp_card_rt1019_hw_params()
692 if (!strcmp(codec_dai->component->name, "i2c-10EC1019:01")) { in acp_card_rt1019_hw_params()
700 if (!drvdata->soc_mclk) { in acp_card_rt1019_hw_params()
703 dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret); in acp_card_rt1019_hw_params()
713 struct snd_pcm_runtime *runtime = substream->runtime; in acp_card_amp_startup()
715 runtime->hw.channels_max = DUAL_CHANNEL; in acp_card_amp_startup()
730 /* Declare Maxim codec components */
748 struct snd_soc_card *card = rtd->card; in acp_card_maxim_init()
749 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_maxim_init()
752 if (drvdata->amp_codec_id != MAX98360A) in acp_card_maxim_init()
753 return -EINVAL; in acp_card_maxim_init()
755 ret = snd_soc_dapm_new_controls(&card->dapm, max98360a_widgets, in acp_card_maxim_init()
758 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); in acp_card_maxim_init()
765 dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); in acp_card_maxim_init()
769 return snd_soc_dapm_add_routes(&rtd->card->dapm, max98360a_map, in acp_card_maxim_init()
776 struct snd_soc_pcm_runtime *rtd = substream->private_data; in acp_card_maxim_hw_params()
777 struct snd_soc_card *card = rtd->card; in acp_card_maxim_hw_params()
778 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_maxim_hw_params()
787 if (drvdata->tdm_mode) in acp_card_maxim_hw_params()
792 if (drvdata->soc_mclk) in acp_card_maxim_hw_params()
798 if (ret && ret != -ENOTSUPP) { in acp_card_maxim_hw_params()
799 dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); in acp_card_maxim_hw_params()
803 if (drvdata->tdm_mode) { in acp_card_maxim_hw_params()
805 * As codec supports slot 2 and slot 3 for playback. in acp_card_maxim_hw_params()
808 if (ret && ret != -ENOTSUPP) { in acp_card_maxim_hw_params()
809 dev_err(rtd->dev, "set TDM slot err: %d\n", ret); in acp_card_maxim_hw_params()
814 if (!drvdata->soc_mclk) { in acp_card_maxim_hw_params()
817 dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret); in acp_card_maxim_hw_params()
831 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-ADS8388:00", MAX98388_CODEC_DAI),
832 COMP_CODEC("i2c-ADS8388:01", MAX98388_CODEC_DAI)));
851 .dlc = COMP_CODEC_CONF("i2c-ADS8388:00"),
855 .dlc = COMP_CODEC_CONF("i2c-ADS8388:01"),
869 struct snd_pcm_runtime *runtime = substream->runtime; in acp_card_max98388_startup()
871 runtime->hw.channels_max = DUAL_CHANNEL; in acp_card_max98388_startup()
884 struct snd_soc_card *card = rtd->card; in acp_card_max98388_init()
885 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_max98388_init()
888 if (drvdata->amp_codec_id != MAX98388) in acp_card_max98388_init()
889 return -EINVAL; in acp_card_max98388_init()
891 ret = snd_soc_dapm_new_controls(&card->dapm, max98388_widgets, in acp_card_max98388_init()
895 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); in acp_card_max98388_init()
903 dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); in acp_card_max98388_init()
907 return snd_soc_dapm_add_routes(&rtd->card->dapm, max98388_map, in acp_card_max98388_init()
914 struct snd_soc_pcm_runtime *rtd = substream->private_data; in acp_max98388_hw_params()
915 struct snd_soc_card *card = rtd->card; in acp_max98388_hw_params()
935 /* Declare nau8825 codec components */
937 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10508825:00", "nau8825-hifi")));
968 struct snd_soc_card *card = rtd->card; in acp_card_nau8825_init()
969 struct acp_card_drvdata *drvdata = card->drvdata; in acp_card_nau8825_init()
971 struct snd_soc_component *component = codec_dai->component; in acp_card_nau8825_init()
974 dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); in acp_card_nau8825_init()
976 if (drvdata->hs_codec_id != NAU8825) in acp_card_nau8825_init()
977 return -EINVAL; in acp_card_nau8825_init()
979 ret = snd_soc_dapm_new_controls(&card->dapm, nau8825_widgets, in acp_card_nau8825_init()
982 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); in acp_card_nau8825_init()
989 dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); in acp_card_nau8825_init()
1001 dev_err(card->dev, "HP jack creation failed %d\n", ret); in acp_card_nau8825_init()
1012 dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); in acp_card_nau8825_init()
1016 return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8825_map, ARRAY_SIZE(nau8825_map)); in acp_card_nau8825_init()
1023 struct snd_soc_card *card = rtd->card; in acp_nau8825_hw_params()
1024 struct acp_card_drvdata *drvdata = card->drvdata; in acp_nau8825_hw_params()
1033 dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret); in acp_nau8825_hw_params()
1038 dev_err(rtd->dev, "can't set FLL: %d\n", ret); in acp_nau8825_hw_params()
1042 if (drvdata->tdm_mode) in acp_nau8825_hw_params()
1047 if (drvdata->soc_mclk) in acp_nau8825_hw_params()
1053 if (ret && ret != -ENOTSUPP) { in acp_nau8825_hw_params()
1054 dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); in acp_nau8825_hw_params()
1060 dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); in acp_nau8825_hw_params()
1064 if (drvdata->tdm_mode) { in acp_nau8825_hw_params()
1066 * As codec supports slot 4 and slot 5 for playback and slot 6 for capture. in acp_nau8825_hw_params()
1069 if (ret && ret != -ENOTSUPP) { in acp_nau8825_hw_params()
1070 dev_err(rtd->dev, "set TDM slot err: %d\n", ret); in acp_nau8825_hw_params()
1076 dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); in acp_nau8825_hw_params()
1085 struct snd_pcm_runtime *runtime = substream->runtime; in acp_nau8825_startup()
1087 runtime->hw.channels_max = 2; in acp_nau8825_startup()
1091 runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; in acp_nau8825_startup()
1105 struct snd_soc_dapm_context *dapm = w->dapm; in platform_clock_control()
1106 struct snd_soc_card *card = dapm->card; in platform_clock_control()
1112 dev_err(card->dev, "Codec dai not found\n"); in platform_clock_control()
1113 return -EIO; in platform_clock_control()
1120 dev_err(card->dev, "set sysclk err = %d\n", ret); in platform_clock_control()
1121 return -EIO; in platform_clock_control()
1127 dev_err(codec_dai->dev, "can't set FS clock %d\n", ret); in platform_clock_control()
1131 dev_err(codec_dai->dev, "can't set FLL: %d\n", ret); in platform_clock_control()
1163 /* HP jack connectors - unknown if we have jack detection */
1183 struct snd_soc_card *card = rtd->card; in acp_8821_init()
1185 struct snd_soc_component *component = codec_dai->component; in acp_8821_init()
1188 dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); in acp_8821_init()
1190 ret = snd_soc_dapm_new_controls(&card->dapm, nau8821_widgets, in acp_8821_init()
1193 dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); in acp_8821_init()
1201 dev_err(rtd->dev, "unable to add card controls, ret %d\n", ret); in acp_8821_init()
1213 dev_err(rtd->dev, "Headset Jack creation failed %d\n", ret); in acp_8821_init()
1224 return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8821_audio_route, in acp_8821_init()
1230 struct snd_pcm_runtime *runtime = substream->runtime; in acp_8821_startup()
1232 runtime->hw.channels_max = DUAL_CHANNEL; in acp_8821_startup()
1237 snd_pcm_hw_constraint_list(substream->runtime, 0, in acp_8821_startup()
1247 struct snd_soc_card *card = rtd->card; in acp_nau8821_hw_params()
1248 struct acp_card_drvdata *drvdata = card->drvdata; in acp_nau8821_hw_params()
1253 if (drvdata->soc_mclk) in acp_nau8821_hw_params()
1260 dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); in acp_nau8821_hw_params()
1267 dev_err(card->dev, "can't set FS clock %d\n", ret); in acp_nau8821_hw_params()
1271 dev_err(card->dev, "can't set FLL: %d\n", ret); in acp_nau8821_hw_params()
1282 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-NVTN2020:00",
1285 /* Declare DMIC codec components */
1287 DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
1321 DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-sp")));
1323 DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-hs")));
1325 DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp")));
1327 DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp-virtual")));
1329 DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs")));
1331 DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs-virtual")));
1333 DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-bt")));
1335 DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic")));
1337 DAILINK_COMP_ARRAY(COMP_CPU("acp-pdm-dmic")));
1343 struct snd_soc_component *component = dapm->component; in acp_rtk_set_bias_level()
1344 struct acp_card_drvdata *drvdata = card->drvdata; in acp_rtk_set_bias_level()
1350 if (strncmp(component->name, "i2c-RTL5682", 11) && in acp_rtk_set_bias_level()
1351 strncmp(component->name, "i2c-10EC1019", 12)) in acp_rtk_set_bias_level()
1355 * For Realtek's codec and amplifier components, in acp_rtk_set_bias_level()
1356 * the lrck and bclk must be enabled brfore their all dapms be powered on, in acp_rtk_set_bias_level()
1364 /* Increase bclk's enable_count */ in acp_rtk_set_bias_level()
1365 ret = clk_prepare_enable(drvdata->bclk); in acp_rtk_set_bias_level()
1367 dev_err(component->dev, "Failed to enable bclk %d\n", ret); in acp_rtk_set_bias_level()
1370 * Decrease bclk's enable_count. in acp_rtk_set_bias_level()
1371 * While the enable_count is 0, the bclk would be closed. in acp_rtk_set_bias_level()
1373 clk_disable_unprepare(drvdata->bclk); in acp_rtk_set_bias_level()
1386 struct device *dev = card->dev; in acp_sofdsp_dai_links_create()
1387 struct acp_card_drvdata *drv_data = card->drvdata; in acp_sofdsp_dai_links_create()
1390 if (drv_data->hs_cpu_id) in acp_sofdsp_dai_links_create()
1392 if (drv_data->bt_cpu_id) in acp_sofdsp_dai_links_create()
1394 if (drv_data->amp_cpu_id) in acp_sofdsp_dai_links_create()
1396 if (drv_data->dmic_cpu_id) in acp_sofdsp_dai_links_create()
1401 return -ENOMEM; in acp_sofdsp_dai_links_create()
1403 if (drv_data->hs_cpu_id == I2S_SP) { in acp_sofdsp_dai_links_create()
1404 links[i].name = "acp-headset-codec"; in acp_sofdsp_dai_links_create()
1412 if (!drv_data->hs_codec_id) { in acp_sofdsp_dai_links_create()
1413 /* Use dummy codec if codec id not specified */ in acp_sofdsp_dai_links_create()
1417 if (drv_data->hs_codec_id == RT5682) { in acp_sofdsp_dai_links_create()
1423 if (drv_data->hs_codec_id == RT5682S) { in acp_sofdsp_dai_links_create()
1429 if (drv_data->hs_codec_id == NAU8821) { in acp_sofdsp_dai_links_create()
1438 if (drv_data->hs_cpu_id == I2S_HS) { in acp_sofdsp_dai_links_create()
1439 links[i].name = "acp-headset-codec"; in acp_sofdsp_dai_links_create()
1447 if (!drv_data->hs_codec_id) { in acp_sofdsp_dai_links_create()
1448 /* Use dummy codec if codec id not specified */ in acp_sofdsp_dai_links_create()
1452 if (drv_data->hs_codec_id == NAU8825) { in acp_sofdsp_dai_links_create()
1458 if (drv_data->hs_codec_id == RT5682S) { in acp_sofdsp_dai_links_create()
1467 if (drv_data->amp_cpu_id == I2S_SP) { in acp_sofdsp_dai_links_create()
1468 links[i].name = "acp-amp-codec"; in acp_sofdsp_dai_links_create()
1470 if (drv_data->acp_rev == ACP_RN_PCI_ID) { in acp_sofdsp_dai_links_create()
1482 if (!drv_data->amp_codec_id) { in acp_sofdsp_dai_links_create()
1483 /* Use dummy codec if codec id not specified */ in acp_sofdsp_dai_links_create()
1487 if (drv_data->amp_codec_id == RT1019) { in acp_sofdsp_dai_links_create()
1492 card->codec_conf = rt1019_conf; in acp_sofdsp_dai_links_create()
1493 card->num_configs = ARRAY_SIZE(rt1019_conf); in acp_sofdsp_dai_links_create()
1495 if (drv_data->amp_codec_id == MAX98360A) { in acp_sofdsp_dai_links_create()
1504 if (drv_data->amp_cpu_id == I2S_HS) { in acp_sofdsp_dai_links_create()
1505 links[i].name = "acp-amp-codec"; in acp_sofdsp_dai_links_create()
1514 if (!drv_data->amp_codec_id) { in acp_sofdsp_dai_links_create()
1515 /* Use dummy codec if codec id not specified */ in acp_sofdsp_dai_links_create()
1519 if (drv_data->amp_codec_id == MAX98360A) { in acp_sofdsp_dai_links_create()
1525 if (drv_data->amp_codec_id == MAX98388) { in acp_sofdsp_dai_links_create()
1531 card->codec_conf = max98388_conf; in acp_sofdsp_dai_links_create()
1532 card->num_configs = ARRAY_SIZE(max98388_conf); in acp_sofdsp_dai_links_create()
1534 if (drv_data->amp_codec_id == RT1019) { in acp_sofdsp_dai_links_create()
1539 card->codec_conf = rt1019_conf; in acp_sofdsp_dai_links_create()
1540 card->num_configs = ARRAY_SIZE(rt1019_conf); in acp_sofdsp_dai_links_create()
1545 if (drv_data->bt_cpu_id == I2S_BT) { in acp_sofdsp_dai_links_create()
1546 links[i].name = "acp-bt-codec"; in acp_sofdsp_dai_links_create()
1554 if (!drv_data->bt_codec_id) { in acp_sofdsp_dai_links_create()
1555 /* Use dummy codec if codec id not specified */ in acp_sofdsp_dai_links_create()
1562 if (drv_data->dmic_cpu_id == DMIC) { in acp_sofdsp_dai_links_create()
1563 links[i].name = "acp-dmic-codec"; in acp_sofdsp_dai_links_create()
1576 card->dai_link = links; in acp_sofdsp_dai_links_create()
1577 card->num_links = num_links; in acp_sofdsp_dai_links_create()
1578 card->set_bias_level = acp_rtk_set_bias_level; in acp_sofdsp_dai_links_create()
1587 struct device *dev = card->dev; in acp_legacy_dai_links_create()
1588 struct acp_card_drvdata *drv_data = card->drvdata; in acp_legacy_dai_links_create()
1592 if (drv_data->hs_cpu_id) in acp_legacy_dai_links_create()
1594 if (drv_data->amp_cpu_id) in acp_legacy_dai_links_create()
1596 if (drv_data->dmic_cpu_id) in acp_legacy_dai_links_create()
1601 return -ENOMEM; in acp_legacy_dai_links_create()
1603 if (drv_data->hs_cpu_id == I2S_SP) { in acp_legacy_dai_links_create()
1604 links[i].name = "acp-headset-codec"; in acp_legacy_dai_links_create()
1610 if (!drv_data->hs_codec_id) { in acp_legacy_dai_links_create()
1611 /* Use dummy codec if codec id not specified */ in acp_legacy_dai_links_create()
1615 if (drv_data->hs_codec_id == RT5682) { in acp_legacy_dai_links_create()
1621 if (drv_data->hs_codec_id == RT5682S) { in acp_legacy_dai_links_create()
1627 if (drv_data->hs_codec_id == ES83XX) { in acp_legacy_dai_links_create()
1637 if (drv_data->hs_cpu_id == I2S_HS) { in acp_legacy_dai_links_create()
1638 links[i].name = "acp-headset-codec"; in acp_legacy_dai_links_create()
1642 switch (drv_data->acp_rev) { in acp_legacy_dai_links_create()
1657 if (!drv_data->hs_codec_id) { in acp_legacy_dai_links_create()
1658 /* Use dummy codec if codec id not specified */ in acp_legacy_dai_links_create()
1662 if (drv_data->hs_codec_id == NAU8825) { in acp_legacy_dai_links_create()
1668 if (drv_data->hs_codec_id == RT5682S) { in acp_legacy_dai_links_create()
1677 if (drv_data->amp_cpu_id == I2S_SP) { in acp_legacy_dai_links_create()
1678 links[i].name = "acp-amp-codec"; in acp_legacy_dai_links_create()
1685 if (!drv_data->amp_codec_id) { in acp_legacy_dai_links_create()
1686 /* Use dummy codec if codec id not specified */ in acp_legacy_dai_links_create()
1690 if (drv_data->amp_codec_id == RT1019) { in acp_legacy_dai_links_create()
1695 card->codec_conf = rt1019_conf; in acp_legacy_dai_links_create()
1696 card->num_configs = ARRAY_SIZE(rt1019_conf); in acp_legacy_dai_links_create()
1698 if (drv_data->amp_codec_id == MAX98360A) { in acp_legacy_dai_links_create()
1707 if (drv_data->amp_cpu_id == I2S_HS) { in acp_legacy_dai_links_create()
1708 links[i].name = "acp-amp-codec"; in acp_legacy_dai_links_create()
1712 switch (drv_data->acp_rev) { in acp_legacy_dai_links_create()
1728 if (!drv_data->amp_codec_id) { in acp_legacy_dai_links_create()
1729 /* Use dummy codec if codec id not specified */ in acp_legacy_dai_links_create()
1733 if (drv_data->amp_codec_id == MAX98360A) { in acp_legacy_dai_links_create()
1739 if (drv_data->amp_codec_id == RT1019) { in acp_legacy_dai_links_create()
1744 card->codec_conf = rt1019_conf; in acp_legacy_dai_links_create()
1745 card->num_configs = ARRAY_SIZE(rt1019_conf); in acp_legacy_dai_links_create()
1750 if (drv_data->dmic_cpu_id == DMIC) { in acp_legacy_dai_links_create()
1751 links[i].name = "acp-dmic-codec"; in acp_legacy_dai_links_create()
1754 if (drv_data->dmic_codec_id == DMIC) { in acp_legacy_dai_links_create()
1758 /* Use dummy codec if codec id not specified */ in acp_legacy_dai_links_create()
1764 switch (drv_data->acp_rev) { in acp_legacy_dai_links_create()
1787 card->dai_link = links; in acp_legacy_dai_links_create()
1788 card->num_links = num_links; in acp_legacy_dai_links_create()
1789 card->set_bias_level = acp_rtk_set_bias_level; in acp_legacy_dai_links_create()