Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: tegra: Support CPCAP by machine driver

Add CPCAP codec support to the Tegra ASoC machine driver. This codec is
found in Motorola T20 devices like Atrix 4G and Droid X2.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Link: https://patch.msgid.link/20260223065051.13070-3-clamor95@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Svyatoslav Ryhel and committed by
Mark Brown
a34547b3 d6b634cb

+61
+9
sound/soc/tegra/Kconfig
··· 294 294 boards using the SGTL5000 codec, such as Apalis T30, Apalis TK1 or 295 295 Colibri T30. 296 296 297 + config SND_SOC_TEGRA_CPCAP 298 + tristate "SoC Audio support for Tegra boards using a CPCAP codec" 299 + depends on I2C && GPIOLIB && MFD_CPCAP 300 + select SND_SOC_TEGRA_MACHINE_DRV 301 + select SND_SOC_CPCAP 302 + help 303 + Say Y or M here if you want to add support for SoC audio on Tegra 304 + boards using the CPCAP codec, such as Motorola Atrix 4G or Droid X2. 305 + 297 306 endif 298 307 299 308 endmenu
+52
sound/soc/tegra/tegra_asoc_machine.c
··· 287 287 return mclk; 288 288 } 289 289 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 + 290 309 static int tegra_machine_hw_params(struct snd_pcm_substream *substream, 291 310 struct snd_pcm_hw_params *params) 292 311 { ··· 1004 985 .add_hp_jack = true, 1005 986 }; 1006 987 988 + /* CPCAP machine */ 989 + 990 + SND_SOC_DAILINK_DEFS(cpcap_hifi, 991 + DAILINK_COMP_ARRAY(COMP_EMPTY()), 992 + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "cpcap-hifi")), 993 + DAILINK_COMP_ARRAY(COMP_EMPTY())); 994 + 995 + static struct snd_soc_dai_link tegra_cpcap_dai = { 996 + .name = "CPCAP", 997 + .stream_name = "CPCAP PCM", 998 + .init = tegra_asoc_machine_init, 999 + .dai_fmt = SND_SOC_DAIFMT_I2S | 1000 + SND_SOC_DAIFMT_NB_NF | 1001 + SND_SOC_DAIFMT_CBP_CFP, 1002 + SND_SOC_DAILINK_REG(cpcap_hifi), 1003 + }; 1004 + 1005 + static struct snd_soc_card snd_soc_tegra_cpcap = { 1006 + .components = "codec:cpcap", 1007 + .dai_link = &tegra_cpcap_dai, 1008 + .num_links = 1, 1009 + .fully_routed = true, 1010 + }; 1011 + 1012 + static const struct tegra_asoc_data tegra_cpcap_data = { 1013 + .mclk_rate = tegra_machine_mclk_rate_cpcap, 1014 + .card = &snd_soc_tegra_cpcap, 1015 + .add_common_dapm_widgets = true, 1016 + .add_common_controls = true, 1017 + .add_common_snd_ops = true, 1018 + }; 1019 + 1007 1020 static const struct of_device_id tegra_machine_of_match[] = { 1008 1021 { .compatible = "nvidia,tegra-audio-trimslice", .data = &tegra_trimslice_data }, 1009 1022 { .compatible = "nvidia,tegra-audio-max98090", .data = &tegra_max98090_data }, ··· 1048 997 { .compatible = "nvidia,tegra-audio-rt5640", .data = &tegra_rt5640_data }, 1049 998 { .compatible = "nvidia,tegra-audio-alc5632", .data = &tegra_rt5632_data }, 1050 999 { .compatible = "nvidia,tegra-audio-rt5631", .data = &tegra_rt5631_data }, 1000 + { .compatible = "nvidia,tegra-audio-cpcap", .data = &tegra_cpcap_data }, 1051 1001 {}, 1052 1002 }; 1053 1003 MODULE_DEVICE_TABLE(of, tegra_machine_of_match);