diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-06-30 16:10:34 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-06-30 16:30:42 -0400 |
commit | 8a123ee2a46daa5c1b6f24eb3b004a5156244889 (patch) | |
tree | 329d021448bc1f3d2cc81aa1ae43bb2770022d01 /sound/soc/codecs | |
parent | 8b83a19367dc3bdfef07634646bbad90f6cba898 (diff) |
ASoC: WM8974 DAPM cleanups
Also implement AUX mode control.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/wm8974.c | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index 6f0455c5318b..c400e5d93bd0 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c | |||
@@ -138,6 +138,11 @@ static const struct soc_enum wm8974_enum[] = { | |||
138 | SOC_ENUM_SINGLE(WM8974_ALC3, 8, 2, wm8974_alc), | 138 | SOC_ENUM_SINGLE(WM8974_ALC3, 8, 2, wm8974_alc), |
139 | }; | 139 | }; |
140 | 140 | ||
141 | static const char *wm8974_auxmode_text[] = { "Buffer", "Mixer" }; | ||
142 | |||
143 | static const struct soc_enum wm8974_auxmode = | ||
144 | SOC_ENUM_SINGLE(WM8974_INPUT, 3, 2, wm8974_auxmode_text); | ||
145 | |||
141 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1); | 146 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1); |
142 | static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); | 147 | static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
143 | static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1200, 75, 0); | 148 | static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1200, 75, 0); |
@@ -208,10 +213,12 @@ SOC_SINGLE_TLV("Capture PGA Volume", WM8974_INPPGA, 0, 63, 0, inpga_tlv), | |||
208 | 213 | ||
209 | SOC_SINGLE("Speaker Playback ZC Switch", WM8974_SPKVOL, 7, 1, 0), | 214 | SOC_SINGLE("Speaker Playback ZC Switch", WM8974_SPKVOL, 7, 1, 0), |
210 | SOC_SINGLE("Speaker Playback Switch", WM8974_SPKVOL, 6, 1, 1), | 215 | SOC_SINGLE("Speaker Playback Switch", WM8974_SPKVOL, 6, 1, 1), |
211 | SOC_SINGLE_TLV("Speaker Playback Volume", WM8974_SPKVOL, 0, 63, 1, spk_tlv), | 216 | SOC_SINGLE_TLV("Speaker Playback Volume", WM8974_SPKVOL, 0, 63, 0, spk_tlv), |
217 | |||
218 | SOC_ENUM("Aux Mode", wm8974_auxmode), | ||
212 | 219 | ||
213 | SOC_SINGLE("Capture Boost(+20dB)", WM8974_ADCBOOST, 8, 1, 0), | 220 | SOC_SINGLE("Capture Boost(+20dB)", WM8974_ADCBOOST, 8, 1, 0), |
214 | SOC_SINGLE("Mono Playback Switch", WM8974_MONOMIX, 6, 1, 0), | 221 | SOC_SINGLE("Mono Playback Switch", WM8974_MONOMIX, 6, 1, 1), |
215 | }; | 222 | }; |
216 | 223 | ||
217 | /* Speaker Output Mixer */ | 224 | /* Speaker Output Mixer */ |
@@ -225,7 +232,19 @@ SOC_DAPM_SINGLE("PCM Playback Switch", WM8974_SPKMIX, 0, 1, 1), | |||
225 | static const struct snd_kcontrol_new wm8974_mono_mixer_controls[] = { | 232 | static const struct snd_kcontrol_new wm8974_mono_mixer_controls[] = { |
226 | SOC_DAPM_SINGLE("Line Bypass Switch", WM8974_MONOMIX, 1, 1, 0), | 233 | SOC_DAPM_SINGLE("Line Bypass Switch", WM8974_MONOMIX, 1, 1, 0), |
227 | SOC_DAPM_SINGLE("Aux Playback Switch", WM8974_MONOMIX, 2, 1, 0), | 234 | SOC_DAPM_SINGLE("Aux Playback Switch", WM8974_MONOMIX, 2, 1, 0), |
228 | SOC_DAPM_SINGLE("PCM Playback Switch", WM8974_MONOMIX, 0, 1, 1), | 235 | SOC_DAPM_SINGLE("PCM Playback Switch", WM8974_MONOMIX, 0, 1, 0), |
236 | }; | ||
237 | |||
238 | /* Boost mixer */ | ||
239 | static const struct snd_kcontrol_new wm8974_boost_mixer[] = { | ||
240 | SOC_DAPM_SINGLE("Aux Switch", WM8974_INPPGA, 6, 1, 0), | ||
241 | }; | ||
242 | |||
243 | /* Input PGA */ | ||
244 | static const struct snd_kcontrol_new wm8974_inpga[] = { | ||
245 | SOC_DAPM_SINGLE("Aux Switch", WM8974_INPUT, 2, 1, 0), | ||
246 | SOC_DAPM_SINGLE("MicN Switch", WM8974_INPUT, 1, 1, 0), | ||
247 | SOC_DAPM_SINGLE("MicP Switch", WM8974_INPUT, 0, 1, 0), | ||
229 | }; | 248 | }; |
230 | 249 | ||
231 | /* AUX Input boost vol */ | 250 | /* AUX Input boost vol */ |
@@ -236,22 +255,6 @@ SOC_DAPM_SINGLE("Aux Volume", WM8974_ADCBOOST, 0, 7, 0); | |||
236 | static const struct snd_kcontrol_new wm8974_mic_boost_controls = | 255 | static const struct snd_kcontrol_new wm8974_mic_boost_controls = |
237 | SOC_DAPM_SINGLE("Mic Volume", WM8974_ADCBOOST, 4, 7, 0); | 256 | SOC_DAPM_SINGLE("Mic Volume", WM8974_ADCBOOST, 4, 7, 0); |
238 | 257 | ||
239 | /* Capture boost switch */ | ||
240 | static const struct snd_kcontrol_new wm8974_capture_boost_controls = | ||
241 | SOC_DAPM_SINGLE("Capture Boost Switch", WM8974_INPPGA, 6, 1, 0); | ||
242 | |||
243 | /* Aux In to PGA */ | ||
244 | static const struct snd_kcontrol_new wm8974_aux_capture_boost_controls = | ||
245 | SOC_DAPM_SINGLE("Aux Capture Boost Switch", WM8974_INPPGA, 2, 1, 0); | ||
246 | |||
247 | /* Mic P In to PGA */ | ||
248 | static const struct snd_kcontrol_new wm8974_micp_capture_boost_controls = | ||
249 | SOC_DAPM_SINGLE("Mic P Capture Boost Switch", WM8974_INPPGA, 0, 1, 0); | ||
250 | |||
251 | /* Mic N In to PGA */ | ||
252 | static const struct snd_kcontrol_new wm8974_micn_capture_boost_controls = | ||
253 | SOC_DAPM_SINGLE("Mic N Capture Boost Switch", WM8974_INPPGA, 1, 1, 0); | ||
254 | |||
255 | static const struct snd_soc_dapm_widget wm8974_dapm_widgets[] = { | 258 | static const struct snd_soc_dapm_widget wm8974_dapm_widgets[] = { |
256 | SND_SOC_DAPM_MIXER("Speaker Mixer", WM8974_POWER3, 2, 0, | 259 | SND_SOC_DAPM_MIXER("Speaker Mixer", WM8974_POWER3, 2, 0, |
257 | &wm8974_speaker_mixer_controls[0], | 260 | &wm8974_speaker_mixer_controls[0], |
@@ -260,21 +263,16 @@ SND_SOC_DAPM_MIXER("Mono Mixer", WM8974_POWER3, 3, 0, | |||
260 | &wm8974_mono_mixer_controls[0], | 263 | &wm8974_mono_mixer_controls[0], |
261 | ARRAY_SIZE(wm8974_mono_mixer_controls)), | 264 | ARRAY_SIZE(wm8974_mono_mixer_controls)), |
262 | SND_SOC_DAPM_DAC("DAC", "HiFi Playback", WM8974_POWER3, 0, 0), | 265 | SND_SOC_DAPM_DAC("DAC", "HiFi Playback", WM8974_POWER3, 0, 0), |
263 | SND_SOC_DAPM_ADC("ADC", "HiFi Capture", WM8974_POWER3, 0, 0), | 266 | SND_SOC_DAPM_ADC("ADC", "HiFi Capture", WM8974_POWER2, 0, 0), |
264 | SND_SOC_DAPM_PGA("Aux Input", WM8974_POWER1, 6, 0, NULL, 0), | 267 | SND_SOC_DAPM_PGA("Aux Input", WM8974_POWER1, 6, 0, NULL, 0), |
265 | SND_SOC_DAPM_PGA("SpkN Out", WM8974_POWER3, 5, 0, NULL, 0), | 268 | SND_SOC_DAPM_PGA("SpkN Out", WM8974_POWER3, 5, 0, NULL, 0), |
266 | SND_SOC_DAPM_PGA("SpkP Out", WM8974_POWER3, 6, 0, NULL, 0), | 269 | SND_SOC_DAPM_PGA("SpkP Out", WM8974_POWER3, 6, 0, NULL, 0), |
267 | SND_SOC_DAPM_PGA("Mono Out", WM8974_POWER3, 7, 0, NULL, 0), | 270 | SND_SOC_DAPM_PGA("Mono Out", WM8974_POWER3, 7, 0, NULL, 0), |
268 | SND_SOC_DAPM_PGA("Mic PGA", WM8974_POWER2, 2, 0, NULL, 0), | ||
269 | |||
270 | SND_SOC_DAPM_PGA("Aux Boost", SND_SOC_NOPM, 0, 0, | ||
271 | &wm8974_aux_boost_controls, 1), | ||
272 | SND_SOC_DAPM_PGA("Mic Boost", SND_SOC_NOPM, 0, 0, | ||
273 | &wm8974_mic_boost_controls, 1), | ||
274 | SND_SOC_DAPM_SWITCH("Capture Boost", SND_SOC_NOPM, 0, 0, | ||
275 | &wm8974_capture_boost_controls), | ||
276 | 271 | ||
277 | SND_SOC_DAPM_MIXER("Boost Mixer", WM8974_POWER2, 4, 0, NULL, 0), | 272 | SND_SOC_DAPM_MIXER("Input PGA", WM8974_POWER2, 2, 0, wm8974_inpga, |
273 | ARRAY_SIZE(wm8974_inpga)), | ||
274 | SND_SOC_DAPM_MIXER("Boost Mixer", WM8974_POWER2, 4, 0, | ||
275 | wm8974_boost_mixer, ARRAY_SIZE(wm8974_boost_mixer)), | ||
278 | 276 | ||
279 | SND_SOC_DAPM_MICBIAS("Mic Bias", WM8974_POWER1, 4, 0), | 277 | SND_SOC_DAPM_MICBIAS("Mic Bias", WM8974_POWER1, 4, 0), |
280 | 278 | ||
@@ -306,17 +304,18 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
306 | {"SPKOUTP", NULL, "SpkP Out"}, | 304 | {"SPKOUTP", NULL, "SpkP Out"}, |
307 | 305 | ||
308 | /* Boost Mixer */ | 306 | /* Boost Mixer */ |
309 | {"Boost Mixer", NULL, "ADC"}, | 307 | {"ADC", NULL, "Boost Mixer"}, |
310 | {"Capture Boost Switch", "Aux Capture Boost Switch", "AUX"}, | 308 | {"Boost Mixer", "Aux Switch", "Aux Input"}, |
311 | {"Aux Boost", "Aux Volume", "Boost Mixer"}, | 309 | {"Boost Mixer", NULL, "Input PGA"}, |
312 | {"Capture Boost", "Capture Switch", "Boost Mixer"}, | 310 | {"Boost Mixer", NULL, "MICP"}, |
313 | {"Mic Boost", "Mic Volume", "Boost Mixer"}, | 311 | |
312 | /* Input PGA */ | ||
313 | {"Input PGA", "Aux Switch", "Aux Input"}, | ||
314 | {"Input PGA", "MicN Switch", "MICN"}, | ||
315 | {"Input PGA", "MicP Switch", "MICP"}, | ||
314 | 316 | ||
315 | /* Inputs */ | 317 | /* Inputs */ |
316 | {"MICP", NULL, "Mic Boost"}, | 318 | {"Aux Input", NULL, "AUX"}, |
317 | {"MICN", NULL, "Mic PGA"}, | ||
318 | {"Mic PGA", NULL, "Capture Boost"}, | ||
319 | {"AUX", NULL, "Aux Input"}, | ||
320 | }; | 319 | }; |
321 | 320 | ||
322 | static int wm8974_add_widgets(struct snd_soc_codec *codec) | 321 | static int wm8974_add_widgets(struct snd_soc_codec *codec) |