Lines Matching +full:spk +full:- +full:fmt
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()
85 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5682:00", "rt5682-aif1")));
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()
180 unsigned int fmt; in acp_card_hs_startup() local
182 if (drvdata->tdm_mode) in acp_card_hs_startup()
183 fmt = SND_SOC_DAIFMT_DSP_A; in acp_card_hs_startup()
185 fmt = SND_SOC_DAIFMT_I2S; in acp_card_hs_startup()
187 if (drvdata->soc_mclk) in acp_card_hs_startup()
188 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; in acp_card_hs_startup()
190 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; in acp_card_hs_startup()
192 ret = snd_soc_dai_set_fmt(codec_dai, fmt); 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()
226 unsigned int fmt, srate, ch, format; in acp_card_rt5682_hw_params() local
232 if (drvdata->tdm_mode) in acp_card_rt5682_hw_params()
233 fmt = SND_SOC_DAIFMT_DSP_A; in acp_card_rt5682_hw_params()
235 fmt = SND_SOC_DAIFMT_I2S; in acp_card_rt5682_hw_params()
237 if (drvdata->soc_mclk) in acp_card_rt5682_hw_params()
238 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; in acp_card_rt5682_hw_params()
240 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; in acp_card_rt5682_hw_params()
242 ret = snd_soc_dai_set_fmt(cpu_dai, fmt); 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()
248 ret = snd_soc_dai_set_fmt(codec_dai, fmt); 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()
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()
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()
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()
424 unsigned int fmt, srate, ch, format; in acp_card_rt5682s_hw_params() local
430 if (drvdata->tdm_mode) in acp_card_rt5682s_hw_params()
431 fmt = SND_SOC_DAIFMT_DSP_A; in acp_card_rt5682s_hw_params()
433 fmt = SND_SOC_DAIFMT_I2S; in acp_card_rt5682s_hw_params()
435 if (drvdata->soc_mclk) in acp_card_rt5682s_hw_params()
436 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; in acp_card_rt5682s_hw_params()
438 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; in acp_card_rt5682s_hw_params()
440 ret = snd_soc_dai_set_fmt(cpu_dai, fmt); 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()
446 ret = snd_soc_dai_set_fmt(codec_dai, fmt); 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()
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()
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()
552 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1019:00", "rt1019-aif"),
553 COMP_CODEC("i2c-10EC1019:01", "rt1019-aif")));
556 SOC_DAPM_PIN_SWITCH("Left Spk"),
557 SOC_DAPM_PIN_SWITCH("Right Spk"),
561 SND_SOC_DAPM_SPK("Left Spk", NULL),
562 SND_SOC_DAPM_SPK("Right Spk", NULL),
566 { "Left Spk", NULL, "Left SPO" },
567 { "Right Spk", NULL, "Right SPO" },
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()
617 unsigned int fmt, srate, ch, format; in acp_card_rt1019_hw_params() local
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()
627 fmt = SND_SOC_DAIFMT_DSP_A; in acp_card_rt1019_hw_params()
629 fmt = SND_SOC_DAIFMT_I2S; in acp_card_rt1019_hw_params()
631 if (drvdata->soc_mclk) in acp_card_rt1019_hw_params()
632 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; in acp_card_rt1019_hw_params()
634 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; in acp_card_rt1019_hw_params()
636 ret = snd_soc_dai_set_fmt(cpu_dai, fmt); 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()
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()
683 if (!strcmp(codec_dai->component->name, "i2c-10EC1019:00")) { 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()
735 SOC_DAPM_PIN_SWITCH("Spk"),
739 SND_SOC_DAPM_SPK("Spk", NULL),
743 {"Spk", NULL, "Speaker"},
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()
780 unsigned int fmt, srate, ch, format; in acp_card_maxim_hw_params() local
787 if (drvdata->tdm_mode) in acp_card_maxim_hw_params()
788 fmt = SND_SOC_DAIFMT_DSP_A; in acp_card_maxim_hw_params()
790 fmt = SND_SOC_DAIFMT_I2S; in acp_card_maxim_hw_params()
792 if (drvdata->soc_mclk) in acp_card_maxim_hw_params()
793 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; in acp_card_maxim_hw_params()
795 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; in acp_card_maxim_hw_params()
797 ret = snd_soc_dai_set_fmt(cpu_dai, fmt); 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()
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)));
835 SOC_DAPM_PIN_SWITCH("Left Spk"),
836 SOC_DAPM_PIN_SWITCH("Right Spk"),
840 SND_SOC_DAPM_SPK("Left Spk", NULL),
841 SND_SOC_DAPM_SPK("Right Spk", NULL),
845 { "Left Spk", NULL, "Left BE_OUT" },
846 { "Right Spk", NULL, "Right BE_OUT" },
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()
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()
1028 unsigned int fmt; in acp_nau8825_hw_params() local
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()
1043 fmt = SND_SOC_DAIFMT_DSP_A; in acp_nau8825_hw_params()
1045 fmt = SND_SOC_DAIFMT_I2S; in acp_nau8825_hw_params()
1047 if (drvdata->soc_mclk) in acp_nau8825_hw_params()
1048 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; in acp_nau8825_hw_params()
1050 fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; in acp_nau8825_hw_params()
1052 ret = snd_soc_dai_set_fmt(cpu_dai, fmt); 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()
1058 ret = snd_soc_dai_set_fmt(codec_dai, fmt); 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()
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()
1251 unsigned int fmt; in acp_nau8821_hw_params() local
1253 if (drvdata->soc_mclk) in acp_nau8821_hw_params()
1254 fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; in acp_nau8821_hw_params()
1256 fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; in acp_nau8821_hw_params()
1258 ret = snd_soc_dai_set_fmt(codec_dai, fmt); 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",
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()
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()
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()
1414 if (!drv_data->hs_codec_id) { in acp_sofdsp_dai_links_create()
1419 if (drv_data->hs_codec_id == RT5682) { in acp_sofdsp_dai_links_create()
1425 if (drv_data->hs_codec_id == RT5682S) { in acp_sofdsp_dai_links_create()
1431 if (drv_data->hs_codec_id == NAU8821) { in acp_sofdsp_dai_links_create()
1440 if (drv_data->hs_cpu_id == I2S_HS) { in acp_sofdsp_dai_links_create()
1441 links[i].name = "acp-headset-codec"; in acp_sofdsp_dai_links_create()
1451 if (!drv_data->hs_codec_id) { in acp_sofdsp_dai_links_create()
1456 if (drv_data->hs_codec_id == NAU8825) { in acp_sofdsp_dai_links_create()
1462 if (drv_data->hs_codec_id == RT5682S) { in acp_sofdsp_dai_links_create()
1471 if (drv_data->amp_cpu_id == I2S_SP) { in acp_sofdsp_dai_links_create()
1472 links[i].name = "acp-amp-codec"; in acp_sofdsp_dai_links_create()
1474 if (drv_data->platform == RENOIR) { in acp_sofdsp_dai_links_create()
1486 if (!drv_data->amp_codec_id) { in acp_sofdsp_dai_links_create()
1491 if (drv_data->amp_codec_id == RT1019) { in acp_sofdsp_dai_links_create()
1496 card->codec_conf = rt1019_conf; in acp_sofdsp_dai_links_create()
1497 card->num_configs = ARRAY_SIZE(rt1019_conf); in acp_sofdsp_dai_links_create()
1499 if (drv_data->amp_codec_id == MAX98360A) { in acp_sofdsp_dai_links_create()
1508 if (drv_data->amp_cpu_id == I2S_HS) { in acp_sofdsp_dai_links_create()
1509 links[i].name = "acp-amp-codec"; in acp_sofdsp_dai_links_create()
1518 if (!drv_data->amp_codec_id) { in acp_sofdsp_dai_links_create()
1523 if (drv_data->amp_codec_id == MAX98360A) { in acp_sofdsp_dai_links_create()
1529 if (drv_data->amp_codec_id == MAX98388) { in acp_sofdsp_dai_links_create()
1535 card->codec_conf = max98388_conf; in acp_sofdsp_dai_links_create()
1536 card->num_configs = ARRAY_SIZE(max98388_conf); in acp_sofdsp_dai_links_create()
1538 if (drv_data->amp_codec_id == RT1019) { in acp_sofdsp_dai_links_create()
1543 card->codec_conf = rt1019_conf; in acp_sofdsp_dai_links_create()
1544 card->num_configs = ARRAY_SIZE(rt1019_conf); in acp_sofdsp_dai_links_create()
1549 if (drv_data->bt_cpu_id == I2S_BT) { in acp_sofdsp_dai_links_create()
1550 links[i].name = "acp-bt-codec"; in acp_sofdsp_dai_links_create()
1560 if (!drv_data->bt_codec_id) { in acp_sofdsp_dai_links_create()
1568 if (drv_data->dmic_cpu_id == DMIC) { in acp_sofdsp_dai_links_create()
1569 links[i].name = "acp-dmic-codec"; in acp_sofdsp_dai_links_create()
1582 card->dai_link = links; in acp_sofdsp_dai_links_create()
1583 card->num_links = num_links; in acp_sofdsp_dai_links_create()
1584 card->set_bias_level = acp_rtk_set_bias_level; in acp_sofdsp_dai_links_create()
1593 struct device *dev = card->dev; in acp_legacy_dai_links_create()
1594 struct acp_card_drvdata *drv_data = card->drvdata; in acp_legacy_dai_links_create()
1598 if (drv_data->hs_cpu_id) in acp_legacy_dai_links_create()
1600 if (drv_data->amp_cpu_id) in acp_legacy_dai_links_create()
1602 if (drv_data->dmic_cpu_id) in acp_legacy_dai_links_create()
1607 return -ENOMEM; in acp_legacy_dai_links_create()
1609 if (drv_data->hs_cpu_id == I2S_SP) { in acp_legacy_dai_links_create()
1610 links[i].name = "acp-headset-codec"; in acp_legacy_dai_links_create()
1618 if (!drv_data->hs_codec_id) { in acp_legacy_dai_links_create()
1623 if (drv_data->hs_codec_id == RT5682) { in acp_legacy_dai_links_create()
1629 if (drv_data->hs_codec_id == RT5682S) { in acp_legacy_dai_links_create()
1635 if (drv_data->hs_codec_id == ES83XX) { in acp_legacy_dai_links_create()
1645 if (drv_data->hs_cpu_id == I2S_HS) { in acp_legacy_dai_links_create()
1646 links[i].name = "acp-headset-codec"; in acp_legacy_dai_links_create()
1650 if (drv_data->platform == REMBRANDT) { in acp_legacy_dai_links_create()
1653 } else if (drv_data->platform == ACP63) { in acp_legacy_dai_links_create()
1662 if (!drv_data->hs_codec_id) { in acp_legacy_dai_links_create()
1667 if (drv_data->hs_codec_id == NAU8825) { in acp_legacy_dai_links_create()
1673 if (drv_data->hs_codec_id == RT5682S) { in acp_legacy_dai_links_create()
1682 if (drv_data->amp_cpu_id == I2S_SP) { in acp_legacy_dai_links_create()
1683 links[i].name = "acp-amp-codec"; in acp_legacy_dai_links_create()
1690 if (!drv_data->amp_codec_id) { in acp_legacy_dai_links_create()
1695 if (drv_data->amp_codec_id == RT1019) { in acp_legacy_dai_links_create()
1700 card->codec_conf = rt1019_conf; in acp_legacy_dai_links_create()
1701 card->num_configs = ARRAY_SIZE(rt1019_conf); in acp_legacy_dai_links_create()
1703 if (drv_data->amp_codec_id == MAX98360A) { in acp_legacy_dai_links_create()
1712 if (drv_data->amp_cpu_id == I2S_HS) { in acp_legacy_dai_links_create()
1713 links[i].name = "acp-amp-codec"; in acp_legacy_dai_links_create()
1717 if (drv_data->platform == REMBRANDT) { in acp_legacy_dai_links_create()
1720 } else if (drv_data->platform == ACP63) { in acp_legacy_dai_links_create()
1728 if (!drv_data->amp_codec_id) { 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()
1753 if (drv_data->dmic_codec_id == DMIC) { in acp_legacy_dai_links_create()
1763 if (drv_data->platform == REMBRANDT) { in acp_legacy_dai_links_create()
1766 } else if (drv_data->platform == ACP63) { in acp_legacy_dai_links_create()
1769 } else if ((drv_data->platform == ACP70) || (drv_data->platform == ACP71)) { in acp_legacy_dai_links_create()
1780 card->dai_link = links; in acp_legacy_dai_links_create()
1781 card->num_links = num_links; in acp_legacy_dai_links_create()
1782 card->set_bias_level = acp_rtk_set_bias_level; in acp_legacy_dai_links_create()