adau17x1.c (0337966d121ebebf73a1c346123e8112796e684e) adau17x1.c (1e6f4fc06f6411adf98bbbe7fcd79442cd2b2a75)
1/*
2 * Common code for ADAU1X61 and ADAU1X81 codecs
3 *
4 * Copyright 2011-2014 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2 or later.
8 */

--- 76 unchanged lines hidden (view full) ---

85 regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL,
86 ADAU17X1_CLOCK_CONTROL_CORECLK_SRC_PLL,
87 ADAU17X1_CLOCK_CONTROL_CORECLK_SRC_PLL);
88 }
89
90 return 0;
91}
92
1/*
2 * Common code for ADAU1X61 and ADAU1X81 codecs
3 *
4 * Copyright 2011-2014 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2 or later.
8 */

--- 76 unchanged lines hidden (view full) ---

85 regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL,
86 ADAU17X1_CLOCK_CONTROL_CORECLK_SRC_PLL,
87 ADAU17X1_CLOCK_CONTROL_CORECLK_SRC_PLL);
88 }
89
90 return 0;
91}
92
93static int adau17x1_adc_fixup(struct snd_soc_dapm_widget *w,
94 struct snd_kcontrol *kcontrol, int event)
95{
96 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
97 struct adau *adau = snd_soc_codec_get_drvdata(codec);
98
99 /*
100 * If we are capturing, toggle the ADOSR bit in Converter Control 0 to
101 * avoid losing SNR (workaround from ADI). This must be done after
102 * the ADC(s) have been enabled. According to the data sheet, it is
103 * normally illegal to set this bit when the sampling rate is 96 kHz,
104 * but according to ADI it is acceptable for this workaround.
105 */
106 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0,
107 ADAU17X1_CONVERTER0_ADOSR, ADAU17X1_CONVERTER0_ADOSR);
108 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0,
109 ADAU17X1_CONVERTER0_ADOSR, 0);
110
111 return 0;
112}
113
93static const char * const adau17x1_mono_stereo_text[] = {
94 "Stereo",
95 "Mono Left Channel (L+R)",
96 "Mono Right Channel (L+R)",
97 "Mono (L+R)",
98};
99
100static SOC_ENUM_SINGLE_DECL(adau17x1_dac_mode_enum,

--- 15 unchanged lines hidden (view full) ---

116 SND_SOC_DAPM_SUPPLY("Right Playback Enable", ADAU17X1_PLAY_POWER_MGMT,
117 1, 0, NULL, 0),
118
119 SND_SOC_DAPM_MUX("Left DAC Mode Mux", SND_SOC_NOPM, 0, 0,
120 &adau17x1_dac_mode_mux),
121 SND_SOC_DAPM_MUX("Right DAC Mode Mux", SND_SOC_NOPM, 0, 0,
122 &adau17x1_dac_mode_mux),
123
114static const char * const adau17x1_mono_stereo_text[] = {
115 "Stereo",
116 "Mono Left Channel (L+R)",
117 "Mono Right Channel (L+R)",
118 "Mono (L+R)",
119};
120
121static SOC_ENUM_SINGLE_DECL(adau17x1_dac_mode_enum,

--- 15 unchanged lines hidden (view full) ---

137 SND_SOC_DAPM_SUPPLY("Right Playback Enable", ADAU17X1_PLAY_POWER_MGMT,
138 1, 0, NULL, 0),
139
140 SND_SOC_DAPM_MUX("Left DAC Mode Mux", SND_SOC_NOPM, 0, 0,
141 &adau17x1_dac_mode_mux),
142 SND_SOC_DAPM_MUX("Right DAC Mode Mux", SND_SOC_NOPM, 0, 0,
143 &adau17x1_dac_mode_mux),
144
124 SND_SOC_DAPM_ADC("Left Decimator", NULL, ADAU17X1_ADC_CONTROL, 0, 0),
145 SND_SOC_DAPM_ADC_E("Left Decimator", NULL, ADAU17X1_ADC_CONTROL, 0, 0,
146 adau17x1_adc_fixup, SND_SOC_DAPM_POST_PMU),
125 SND_SOC_DAPM_ADC("Right Decimator", NULL, ADAU17X1_ADC_CONTROL, 1, 0),
126 SND_SOC_DAPM_DAC("Left DAC", NULL, ADAU17X1_DAC_CONTROL0, 0, 0),
127 SND_SOC_DAPM_DAC("Right DAC", NULL, ADAU17X1_DAC_CONTROL0, 1, 0),
128};
129
130static const struct snd_soc_dapm_route adau17x1_dapm_routes[] = {
131 { "Left Decimator", NULL, "SYSCLK" },
132 { "Right Decimator", NULL, "SYSCLK" },

--- 855 unchanged lines hidden ---
147 SND_SOC_DAPM_ADC("Right Decimator", NULL, ADAU17X1_ADC_CONTROL, 1, 0),
148 SND_SOC_DAPM_DAC("Left DAC", NULL, ADAU17X1_DAC_CONTROL0, 0, 0),
149 SND_SOC_DAPM_DAC("Right DAC", NULL, ADAU17X1_DAC_CONTROL0, 1, 0),
150};
151
152static const struct snd_soc_dapm_route adau17x1_dapm_routes[] = {
153 { "Left Decimator", NULL, "SYSCLK" },
154 { "Right Decimator", NULL, "SYSCLK" },

--- 855 unchanged lines hidden ---