wm8737.c (1037d567fdfc7ab9d3e2328e27bdc1300d3fdb1e) wm8737.c (ca275811fd2eef7e0121fefbc46cc5b47d680b10)
1/*
2 * wm8737.c -- WM8737 ALSA SoC Audio driver
3 *
4 * Copyright 2010 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

94
95static const char *micbias_enum_text[] = {
96 "25%",
97 "50%",
98 "75%",
99 "100%",
100};
101
1/*
2 * wm8737.c -- WM8737 ALSA SoC Audio driver
3 *
4 * Copyright 2010 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

94
95static const char *micbias_enum_text[] = {
96 "25%",
97 "50%",
98 "75%",
99 "100%",
100};
101
102static const struct soc_enum micbias_enum =
103 SOC_ENUM_SINGLE(WM8737_MIC_PREAMP_CONTROL, 0, 4, micbias_enum_text);
102static SOC_ENUM_SINGLE_DECL(micbias_enum,
103 WM8737_MIC_PREAMP_CONTROL, 0, micbias_enum_text);
104
105static const char *low_cutoff_text[] = {
106 "Low", "High"
107};
108
104
105static const char *low_cutoff_text[] = {
106 "Low", "High"
107};
108
109static const struct soc_enum low_3d =
110 SOC_ENUM_SINGLE(WM8737_3D_ENHANCE, 6, 2, low_cutoff_text);
109static SOC_ENUM_SINGLE_DECL(low_3d,
110 WM8737_3D_ENHANCE, 6, low_cutoff_text);
111
112static const char *high_cutoff_text[] = {
113 "High", "Low"
114};
115
111
112static const char *high_cutoff_text[] = {
113 "High", "Low"
114};
115
116static const struct soc_enum high_3d =
117 SOC_ENUM_SINGLE(WM8737_3D_ENHANCE, 5, 2, high_cutoff_text);
116static SOC_ENUM_SINGLE_DECL(high_3d,
117 WM8737_3D_ENHANCE, 5, high_cutoff_text);
118
119static const char *alc_fn_text[] = {
120 "Disabled", "Right", "Left", "Stereo"
121};
122
118
119static const char *alc_fn_text[] = {
120 "Disabled", "Right", "Left", "Stereo"
121};
122
123static const struct soc_enum alc_fn =
124 SOC_ENUM_SINGLE(WM8737_ALC1, 7, 4, alc_fn_text);
123static SOC_ENUM_SINGLE_DECL(alc_fn,
124 WM8737_ALC1, 7, alc_fn_text);
125
126static const char *alc_hold_text[] = {
127 "0", "2.67ms", "5.33ms", "10.66ms", "21.32ms", "42.64ms", "85.28ms",
128 "170.56ms", "341.12ms", "682.24ms", "1.364s", "2.728s", "5.458s",
129 "10.916s", "21.832s", "43.691s"
130};
131
125
126static const char *alc_hold_text[] = {
127 "0", "2.67ms", "5.33ms", "10.66ms", "21.32ms", "42.64ms", "85.28ms",
128 "170.56ms", "341.12ms", "682.24ms", "1.364s", "2.728s", "5.458s",
129 "10.916s", "21.832s", "43.691s"
130};
131
132static const struct soc_enum alc_hold =
133 SOC_ENUM_SINGLE(WM8737_ALC2, 0, 16, alc_hold_text);
132static SOC_ENUM_SINGLE_DECL(alc_hold,
133 WM8737_ALC2, 0, alc_hold_text);
134
135static const char *alc_atk_text[] = {
136 "8.4ms", "16.8ms", "33.6ms", "67.2ms", "134.4ms", "268.8ms", "537.6ms",
137 "1.075s", "2.15s", "4.3s", "8.6s"
138};
139
134
135static const char *alc_atk_text[] = {
136 "8.4ms", "16.8ms", "33.6ms", "67.2ms", "134.4ms", "268.8ms", "537.6ms",
137 "1.075s", "2.15s", "4.3s", "8.6s"
138};
139
140static const struct soc_enum alc_atk =
141 SOC_ENUM_SINGLE(WM8737_ALC3, 0, 11, alc_atk_text);
140static SOC_ENUM_SINGLE_DECL(alc_atk,
141 WM8737_ALC3, 0, alc_atk_text);
142
143static const char *alc_dcy_text[] = {
144 "33.6ms", "67.2ms", "134.4ms", "268.8ms", "537.6ms", "1.075s", "2.15s",
145 "4.3s", "8.6s", "17.2s", "34.41s"
146};
147
142
143static const char *alc_dcy_text[] = {
144 "33.6ms", "67.2ms", "134.4ms", "268.8ms", "537.6ms", "1.075s", "2.15s",
145 "4.3s", "8.6s", "17.2s", "34.41s"
146};
147
148static const struct soc_enum alc_dcy =
149 SOC_ENUM_SINGLE(WM8737_ALC3, 4, 11, alc_dcy_text);
148static SOC_ENUM_SINGLE_DECL(alc_dcy,
149 WM8737_ALC3, 4, alc_dcy_text);
150
151static const struct snd_kcontrol_new wm8737_snd_controls[] = {
152SOC_DOUBLE_R_TLV("Mic Boost Volume", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R,
153 6, 3, 0, micboost_tlv),
154SOC_DOUBLE_R("Mic Boost Switch", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R,
155 4, 1, 0),
156SOC_DOUBLE("Mic ZC Switch", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R,
157 3, 1, 0),

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

186SOC_ENUM("ALC Attack Time", alc_atk),
187SOC_ENUM("ALC Decay Time", alc_dcy),
188};
189
190static const char *linsel_text[] = {
191 "LINPUT1", "LINPUT2", "LINPUT3", "LINPUT1 DC",
192};
193
150
151static const struct snd_kcontrol_new wm8737_snd_controls[] = {
152SOC_DOUBLE_R_TLV("Mic Boost Volume", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R,
153 6, 3, 0, micboost_tlv),
154SOC_DOUBLE_R("Mic Boost Switch", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R,
155 4, 1, 0),
156SOC_DOUBLE("Mic ZC Switch", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R,
157 3, 1, 0),

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

186SOC_ENUM("ALC Attack Time", alc_atk),
187SOC_ENUM("ALC Decay Time", alc_dcy),
188};
189
190static const char *linsel_text[] = {
191 "LINPUT1", "LINPUT2", "LINPUT3", "LINPUT1 DC",
192};
193
194static const struct soc_enum linsel_enum =
195 SOC_ENUM_SINGLE(WM8737_AUDIO_PATH_L, 7, 4, linsel_text);
194static SOC_ENUM_SINGLE_DECL(linsel_enum,
195 WM8737_AUDIO_PATH_L, 7, linsel_text);
196
197static const struct snd_kcontrol_new linsel_mux =
198 SOC_DAPM_ENUM("LINSEL", linsel_enum);
199
200
201static const char *rinsel_text[] = {
202 "RINPUT1", "RINPUT2", "RINPUT3", "RINPUT1 DC",
203};
204
196
197static const struct snd_kcontrol_new linsel_mux =
198 SOC_DAPM_ENUM("LINSEL", linsel_enum);
199
200
201static const char *rinsel_text[] = {
202 "RINPUT1", "RINPUT2", "RINPUT3", "RINPUT1 DC",
203};
204
205static const struct soc_enum rinsel_enum =
206 SOC_ENUM_SINGLE(WM8737_AUDIO_PATH_R, 7, 4, rinsel_text);
205static SOC_ENUM_SINGLE_DECL(rinsel_enum,
206 WM8737_AUDIO_PATH_R, 7, rinsel_text);
207
208static const struct snd_kcontrol_new rinsel_mux =
209 SOC_DAPM_ENUM("RINSEL", rinsel_enum);
210
211static const char *bypass_text[] = {
212 "Direct", "Preamp"
213};
214
207
208static const struct snd_kcontrol_new rinsel_mux =
209 SOC_DAPM_ENUM("RINSEL", rinsel_enum);
210
211static const char *bypass_text[] = {
212 "Direct", "Preamp"
213};
214
215static const struct soc_enum lbypass_enum =
216 SOC_ENUM_SINGLE(WM8737_MIC_PREAMP_CONTROL, 2, 2, bypass_text);
215static SOC_ENUM_SINGLE_DECL(lbypass_enum,
216 WM8737_MIC_PREAMP_CONTROL, 2, bypass_text);
217
218static const struct snd_kcontrol_new lbypass_mux =
219 SOC_DAPM_ENUM("Left Bypass", lbypass_enum);
220
221
217
218static const struct snd_kcontrol_new lbypass_mux =
219 SOC_DAPM_ENUM("Left Bypass", lbypass_enum);
220
221
222static const struct soc_enum rbypass_enum =
223 SOC_ENUM_SINGLE(WM8737_MIC_PREAMP_CONTROL, 3, 2, bypass_text);
222static SOC_ENUM_SINGLE_DECL(rbypass_enum,
223 WM8737_MIC_PREAMP_CONTROL, 3, bypass_text);
224
225static const struct snd_kcontrol_new rbypass_mux =
226 SOC_DAPM_ENUM("Left Bypass", rbypass_enum);
227
228static const struct snd_soc_dapm_widget wm8737_dapm_widgets[] = {
229SND_SOC_DAPM_INPUT("LINPUT1"),
230SND_SOC_DAPM_INPUT("LINPUT2"),
231SND_SOC_DAPM_INPUT("LINPUT3"),

--- 561 unchanged lines hidden ---
224
225static const struct snd_kcontrol_new rbypass_mux =
226 SOC_DAPM_ENUM("Left Bypass", rbypass_enum);
227
228static const struct snd_soc_dapm_widget wm8737_dapm_widgets[] = {
229SND_SOC_DAPM_INPUT("LINPUT1"),
230SND_SOC_DAPM_INPUT("LINPUT2"),
231SND_SOC_DAPM_INPUT("LINPUT3"),

--- 561 unchanged lines hidden ---