aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2016-11-07 05:06:59 -0500
committerMark Brown <broonie@kernel.org>2016-11-09 09:43:35 -0500
commit24c99f843208df70ec7d1e04aa405f7e4c36f228 (patch)
tree68db69746646327ed8430d0953a3fdffc3a356e1
parentb2b7b56f713ab833413548b119c53bbe2a9a9f8f (diff)
ASoC: sun4i-codec: Add support for A31 ADC capture path
The A31's internal codec capture path has a mixer in front of the ADC for each channel, capable of selecting various inputs, including microphones, line in, phone in, and the main output mixer. This patch adds the various controls, widgets and routes needed for audio capture from the already supported inputs on the A31. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sunxi/sun4i-codec.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 1934db29b2b5..735115244b17 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -786,6 +786,30 @@ static const struct snd_kcontrol_new sun6i_codec_mixer_controls[] = {
786 SUN6I_CODEC_OM_DACA_CTRL_RMIX_MIC2, 1, 0), 786 SUN6I_CODEC_OM_DACA_CTRL_RMIX_MIC2, 1, 0),
787}; 787};
788 788
789/* ADC mixer controls */
790static const struct snd_kcontrol_new sun6i_codec_adc_mixer_controls[] = {
791 SOC_DAPM_DOUBLE("Mixer Capture Switch",
792 SUN6I_CODEC_ADC_ACTL,
793 SUN6I_CODEC_ADC_ACTL_LADCMIX_OMIXL,
794 SUN6I_CODEC_ADC_ACTL_RADCMIX_OMIXR, 1, 0),
795 SOC_DAPM_DOUBLE("Mixer Reversed Capture Switch",
796 SUN6I_CODEC_ADC_ACTL,
797 SUN6I_CODEC_ADC_ACTL_LADCMIX_OMIXR,
798 SUN6I_CODEC_ADC_ACTL_RADCMIX_OMIXL, 1, 0),
799 SOC_DAPM_DOUBLE("Line In Capture Switch",
800 SUN6I_CODEC_ADC_ACTL,
801 SUN6I_CODEC_ADC_ACTL_LADCMIX_LINEINL,
802 SUN6I_CODEC_ADC_ACTL_RADCMIX_LINEINR, 1, 0),
803 SOC_DAPM_DOUBLE("Mic1 Capture Switch",
804 SUN6I_CODEC_ADC_ACTL,
805 SUN6I_CODEC_ADC_ACTL_LADCMIX_MIC1,
806 SUN6I_CODEC_ADC_ACTL_RADCMIX_MIC1, 1, 0),
807 SOC_DAPM_DOUBLE("Mic2 Capture Switch",
808 SUN6I_CODEC_ADC_ACTL,
809 SUN6I_CODEC_ADC_ACTL_LADCMIX_MIC2,
810 SUN6I_CODEC_ADC_ACTL_RADCMIX_MIC2, 1, 0),
811};
812
789/* headphone controls */ 813/* headphone controls */
790static const char * const sun6i_codec_hp_src_enum_text[] = { 814static const char * const sun6i_codec_hp_src_enum_text[] = {
791 "DAC", "Mixer", 815 "DAC", "Mixer",
@@ -885,6 +909,10 @@ static const struct snd_kcontrol_new sun6i_codec_codec_widgets[] = {
885 SOC_SINGLE_TLV("Mic2 Boost Volume", SUN6I_CODEC_MIC_CTRL, 909 SOC_SINGLE_TLV("Mic2 Boost Volume", SUN6I_CODEC_MIC_CTRL,
886 SUN6I_CODEC_MIC_CTRL_MIC2BOOST, 0x7, 0, 910 SUN6I_CODEC_MIC_CTRL_MIC2BOOST, 0x7, 0,
887 sun6i_codec_mic_gain_scale), 911 sun6i_codec_mic_gain_scale),
912 SOC_DOUBLE_TLV("ADC Capture Volume",
913 SUN6I_CODEC_ADC_ACTL, SUN6I_CODEC_ADC_ACTL_ADCLG,
914 SUN6I_CODEC_ADC_ACTL_ADCRG, 0x7, 0,
915 sun6i_codec_out_mixer_pregain_scale),
888}; 916};
889 917
890static const struct snd_soc_dapm_widget sun6i_codec_codec_dapm_widgets[] = { 918static const struct snd_soc_dapm_widget sun6i_codec_codec_dapm_widgets[] = {
@@ -910,6 +938,23 @@ static const struct snd_soc_dapm_widget sun6i_codec_codec_dapm_widgets[] = {
910 /* Line In */ 938 /* Line In */
911 SND_SOC_DAPM_INPUT("LINEIN"), 939 SND_SOC_DAPM_INPUT("LINEIN"),
912 940
941 /* Digital parts of the ADCs */
942 SND_SOC_DAPM_SUPPLY("ADC Enable", SUN6I_CODEC_ADC_FIFOC,
943 SUN6I_CODEC_ADC_FIFOC_EN_AD, 0,
944 NULL, 0),
945
946 /* Analog parts of the ADCs */
947 SND_SOC_DAPM_ADC("Left ADC", "Codec Capture", SUN6I_CODEC_ADC_ACTL,
948 SUN6I_CODEC_ADC_ACTL_ADCLEN, 0),
949 SND_SOC_DAPM_ADC("Right ADC", "Codec Capture", SUN6I_CODEC_ADC_ACTL,
950 SUN6I_CODEC_ADC_ACTL_ADCREN, 0),
951
952 /* ADC Mixers */
953 SOC_MIXER_ARRAY("Left ADC Mixer", SND_SOC_NOPM, 0, 0,
954 sun6i_codec_adc_mixer_controls),
955 SOC_MIXER_ARRAY("Right ADC Mixer", SND_SOC_NOPM, 0, 0,
956 sun6i_codec_adc_mixer_controls),
957
913 /* Digital parts of the DACs */ 958 /* Digital parts of the DACs */
914 SND_SOC_DAPM_SUPPLY("DAC Enable", SUN4I_CODEC_DAC_DPC, 959 SND_SOC_DAPM_SUPPLY("DAC Enable", SUN4I_CODEC_DAC_DPC,
915 SUN4I_CODEC_DAC_DPC_EN_DA, 0, 960 SUN4I_CODEC_DAC_DPC_EN_DA, 0,
@@ -973,6 +1018,20 @@ static const struct snd_soc_dapm_route sun6i_codec_codec_dapm_routes[] = {
973 { "Right Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" }, 1018 { "Right Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" },
974 { "Right Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" }, 1019 { "Right Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
975 1020
1021 /* Left ADC Mixer Routes */
1022 { "Left ADC Mixer", "Mixer Capture Switch", "Left Mixer" },
1023 { "Left ADC Mixer", "Mixer Reversed Capture Switch", "Right Mixer" },
1024 { "Left ADC Mixer", "Line In Capture Switch", "LINEIN" },
1025 { "Left ADC Mixer", "Mic1 Capture Switch", "Mic1 Amplifier" },
1026 { "Left ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
1027
1028 /* Right ADC Mixer Routes */
1029 { "Right ADC Mixer", "Mixer Capture Switch", "Right Mixer" },
1030 { "Right ADC Mixer", "Mixer Reversed Capture Switch", "Left Mixer" },
1031 { "Right ADC Mixer", "Line In Capture Switch", "LINEIN" },
1032 { "Right ADC Mixer", "Mic1 Capture Switch", "Mic1 Amplifier" },
1033 { "Right ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" },
1034
976 /* Headphone Routes */ 1035 /* Headphone Routes */
977 { "Headphone Source Playback Route", "DAC", "Left DAC" }, 1036 { "Headphone Source Playback Route", "DAC", "Left DAC" },
978 { "Headphone Source Playback Route", "DAC", "Right DAC" }, 1037 { "Headphone Source Playback Route", "DAC", "Right DAC" },
@@ -987,6 +1046,12 @@ static const struct snd_soc_dapm_route sun6i_codec_codec_dapm_routes[] = {
987 { "Line Out Source Playback Route", "Stereo", "Right Mixer" }, 1046 { "Line Out Source Playback Route", "Stereo", "Right Mixer" },
988 { "Line Out Source Playback Route", "Mono Differential", "Left Mixer" }, 1047 { "Line Out Source Playback Route", "Mono Differential", "Left Mixer" },
989 { "LINEOUT", NULL, "Line Out Source Playback Route" }, 1048 { "LINEOUT", NULL, "Line Out Source Playback Route" },
1049
1050 /* ADC Routes */
1051 { "Left ADC", NULL, "ADC Enable" },
1052 { "Right ADC", NULL, "ADC Enable" },
1053 { "Left ADC", NULL, "Left ADC Mixer" },
1054 { "Right ADC", NULL, "Right ADC Mixer" },
990}; 1055};
991 1056
992static struct snd_soc_codec_driver sun6i_codec_codec = { 1057static struct snd_soc_codec_driver sun6i_codec_codec = {