aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8974.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8974.c')
-rw-r--r--sound/soc/codecs/wm8974.c75
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
141static const char *wm8974_auxmode_text[] = { "Buffer", "Mixer" };
142
143static const struct soc_enum wm8974_auxmode =
144 SOC_ENUM_SINGLE(WM8974_INPUT, 3, 2, wm8974_auxmode_text);
145
141static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1); 146static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1);
142static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); 147static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
143static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1200, 75, 0); 148static 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
209SOC_SINGLE("Speaker Playback ZC Switch", WM8974_SPKVOL, 7, 1, 0), 214SOC_SINGLE("Speaker Playback ZC Switch", WM8974_SPKVOL, 7, 1, 0),
210SOC_SINGLE("Speaker Playback Switch", WM8974_SPKVOL, 6, 1, 1), 215SOC_SINGLE("Speaker Playback Switch", WM8974_SPKVOL, 6, 1, 1),
211SOC_SINGLE_TLV("Speaker Playback Volume", WM8974_SPKVOL, 0, 63, 1, spk_tlv), 216SOC_SINGLE_TLV("Speaker Playback Volume", WM8974_SPKVOL, 0, 63, 0, spk_tlv),
217
218SOC_ENUM("Aux Mode", wm8974_auxmode),
212 219
213SOC_SINGLE("Capture Boost(+20dB)", WM8974_ADCBOOST, 8, 1, 0), 220SOC_SINGLE("Capture Boost(+20dB)", WM8974_ADCBOOST, 8, 1, 0),
214SOC_SINGLE("Mono Playback Switch", WM8974_MONOMIX, 6, 1, 0), 221SOC_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),
225static const struct snd_kcontrol_new wm8974_mono_mixer_controls[] = { 232static const struct snd_kcontrol_new wm8974_mono_mixer_controls[] = {
226SOC_DAPM_SINGLE("Line Bypass Switch", WM8974_MONOMIX, 1, 1, 0), 233SOC_DAPM_SINGLE("Line Bypass Switch", WM8974_MONOMIX, 1, 1, 0),
227SOC_DAPM_SINGLE("Aux Playback Switch", WM8974_MONOMIX, 2, 1, 0), 234SOC_DAPM_SINGLE("Aux Playback Switch", WM8974_MONOMIX, 2, 1, 0),
228SOC_DAPM_SINGLE("PCM Playback Switch", WM8974_MONOMIX, 0, 1, 1), 235SOC_DAPM_SINGLE("PCM Playback Switch", WM8974_MONOMIX, 0, 1, 0),
236};
237
238/* Boost mixer */
239static const struct snd_kcontrol_new wm8974_boost_mixer[] = {
240SOC_DAPM_SINGLE("Aux Switch", WM8974_INPPGA, 6, 1, 0),
241};
242
243/* Input PGA */
244static const struct snd_kcontrol_new wm8974_inpga[] = {
245SOC_DAPM_SINGLE("Aux Switch", WM8974_INPUT, 2, 1, 0),
246SOC_DAPM_SINGLE("MicN Switch", WM8974_INPUT, 1, 1, 0),
247SOC_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);
236static const struct snd_kcontrol_new wm8974_mic_boost_controls = 255static const struct snd_kcontrol_new wm8974_mic_boost_controls =
237SOC_DAPM_SINGLE("Mic Volume", WM8974_ADCBOOST, 4, 7, 0); 256SOC_DAPM_SINGLE("Mic Volume", WM8974_ADCBOOST, 4, 7, 0);
238 257
239/* Capture boost switch */
240static const struct snd_kcontrol_new wm8974_capture_boost_controls =
241SOC_DAPM_SINGLE("Capture Boost Switch", WM8974_INPPGA, 6, 1, 0);
242
243/* Aux In to PGA */
244static const struct snd_kcontrol_new wm8974_aux_capture_boost_controls =
245SOC_DAPM_SINGLE("Aux Capture Boost Switch", WM8974_INPPGA, 2, 1, 0);
246
247/* Mic P In to PGA */
248static const struct snd_kcontrol_new wm8974_micp_capture_boost_controls =
249SOC_DAPM_SINGLE("Mic P Capture Boost Switch", WM8974_INPPGA, 0, 1, 0);
250
251/* Mic N In to PGA */
252static const struct snd_kcontrol_new wm8974_micn_capture_boost_controls =
253SOC_DAPM_SINGLE("Mic N Capture Boost Switch", WM8974_INPPGA, 1, 1, 0);
254
255static const struct snd_soc_dapm_widget wm8974_dapm_widgets[] = { 258static const struct snd_soc_dapm_widget wm8974_dapm_widgets[] = {
256SND_SOC_DAPM_MIXER("Speaker Mixer", WM8974_POWER3, 2, 0, 259SND_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)),
262SND_SOC_DAPM_DAC("DAC", "HiFi Playback", WM8974_POWER3, 0, 0), 265SND_SOC_DAPM_DAC("DAC", "HiFi Playback", WM8974_POWER3, 0, 0),
263SND_SOC_DAPM_ADC("ADC", "HiFi Capture", WM8974_POWER3, 0, 0), 266SND_SOC_DAPM_ADC("ADC", "HiFi Capture", WM8974_POWER2, 0, 0),
264SND_SOC_DAPM_PGA("Aux Input", WM8974_POWER1, 6, 0, NULL, 0), 267SND_SOC_DAPM_PGA("Aux Input", WM8974_POWER1, 6, 0, NULL, 0),
265SND_SOC_DAPM_PGA("SpkN Out", WM8974_POWER3, 5, 0, NULL, 0), 268SND_SOC_DAPM_PGA("SpkN Out", WM8974_POWER3, 5, 0, NULL, 0),
266SND_SOC_DAPM_PGA("SpkP Out", WM8974_POWER3, 6, 0, NULL, 0), 269SND_SOC_DAPM_PGA("SpkP Out", WM8974_POWER3, 6, 0, NULL, 0),
267SND_SOC_DAPM_PGA("Mono Out", WM8974_POWER3, 7, 0, NULL, 0), 270SND_SOC_DAPM_PGA("Mono Out", WM8974_POWER3, 7, 0, NULL, 0),
268SND_SOC_DAPM_PGA("Mic PGA", WM8974_POWER2, 2, 0, NULL, 0),
269
270SND_SOC_DAPM_PGA("Aux Boost", SND_SOC_NOPM, 0, 0,
271 &wm8974_aux_boost_controls, 1),
272SND_SOC_DAPM_PGA("Mic Boost", SND_SOC_NOPM, 0, 0,
273 &wm8974_mic_boost_controls, 1),
274SND_SOC_DAPM_SWITCH("Capture Boost", SND_SOC_NOPM, 0, 0,
275 &wm8974_capture_boost_controls),
276 271
277SND_SOC_DAPM_MIXER("Boost Mixer", WM8974_POWER2, 4, 0, NULL, 0), 272SND_SOC_DAPM_MIXER("Input PGA", WM8974_POWER2, 2, 0, wm8974_inpga,
273 ARRAY_SIZE(wm8974_inpga)),
274SND_SOC_DAPM_MIXER("Boost Mixer", WM8974_POWER2, 4, 0,
275 wm8974_boost_mixer, ARRAY_SIZE(wm8974_boost_mixer)),
278 276
279SND_SOC_DAPM_MICBIAS("Mic Bias", WM8974_POWER1, 4, 0), 277SND_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
322static int wm8974_add_widgets(struct snd_soc_codec *codec) 321static int wm8974_add_widgets(struct snd_soc_codec *codec)