@@ -287,6 +287,25 @@ static unsigned int tegra_machine_mclk_rate_6mhz(unsigned int srate)
287287 return mclk ;
288288}
289289
290+ static unsigned int tegra_machine_mclk_rate_cpcap (unsigned int srate )
291+ {
292+ unsigned int mclk ;
293+
294+ switch (srate ) {
295+ case 11025 :
296+ case 22050 :
297+ case 44100 :
298+ case 88200 :
299+ mclk = 26000000 ;
300+ break ;
301+ default :
302+ mclk = 256 * srate ;
303+ break ;
304+ }
305+
306+ return mclk ;
307+ }
308+
290309static int tegra_machine_hw_params (struct snd_pcm_substream * substream ,
291310 struct snd_pcm_hw_params * params )
292311{
@@ -985,6 +1004,38 @@ static const struct tegra_asoc_data tegra_rt5631_data = {
9851004 .add_hp_jack = true,
9861005};
9871006
1007+ /* CPCAP machine */
1008+
1009+ SND_SOC_DAILINK_DEFS (cpcap_hifi ,
1010+ DAILINK_COMP_ARRAY (COMP_EMPTY ()),
1011+ DAILINK_COMP_ARRAY (COMP_CODEC (NULL , "cpcap-hifi" )),
1012+ DAILINK_COMP_ARRAY (COMP_EMPTY ()));
1013+
1014+ static struct snd_soc_dai_link tegra_cpcap_dai = {
1015+ .name = "CPCAP" ,
1016+ .stream_name = "CPCAP PCM" ,
1017+ .init = tegra_asoc_machine_init ,
1018+ .dai_fmt = SND_SOC_DAIFMT_I2S |
1019+ SND_SOC_DAIFMT_NB_NF |
1020+ SND_SOC_DAIFMT_CBP_CFP ,
1021+ SND_SOC_DAILINK_REG (cpcap_hifi ),
1022+ };
1023+
1024+ static struct snd_soc_card snd_soc_tegra_cpcap = {
1025+ .components = "codec:cpcap" ,
1026+ .dai_link = & tegra_cpcap_dai ,
1027+ .num_links = 1 ,
1028+ .fully_routed = true,
1029+ };
1030+
1031+ static const struct tegra_asoc_data tegra_cpcap_data = {
1032+ .mclk_rate = tegra_machine_mclk_rate_cpcap ,
1033+ .card = & snd_soc_tegra_cpcap ,
1034+ .add_common_dapm_widgets = true,
1035+ .add_common_controls = true,
1036+ .add_common_snd_ops = true,
1037+ };
1038+
9881039static const struct of_device_id tegra_machine_of_match [] = {
9891040 { .compatible = "nvidia,tegra-audio-trimslice" , .data = & tegra_trimslice_data },
9901041 { .compatible = "nvidia,tegra-audio-max98090" , .data = & tegra_max98090_data },
@@ -997,6 +1048,7 @@ static const struct of_device_id tegra_machine_of_match[] = {
9971048 { .compatible = "nvidia,tegra-audio-rt5640" , .data = & tegra_rt5640_data },
9981049 { .compatible = "nvidia,tegra-audio-alc5632" , .data = & tegra_rt5632_data },
9991050 { .compatible = "nvidia,tegra-audio-rt5631" , .data = & tegra_rt5631_data },
1051+ { .compatible = "nvidia,tegra-audio-cpcap" , .data = & tegra_cpcap_data },
10001052 {},
10011053};
10021054MODULE_DEVICE_TABLE (of , tegra_machine_of_match );
0 commit comments