x86/xen: resume timer irqs early
[linux/fpc-iii.git] / sound / soc / codecs / wm5110.c
blobc09a5305d6012978ce5f8b8012da63de238ac61c
1 /*
2 * wm5110.c -- WM5110 ALSA SoC Audio driver
4 * Copyright 2012 Wolfson Microelectronics plc
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/module.h>
14 #include <linux/moduleparam.h>
15 #include <linux/init.h>
16 #include <linux/delay.h>
17 #include <linux/pm.h>
18 #include <linux/pm_runtime.h>
19 #include <linux/regmap.h>
20 #include <linux/slab.h>
21 #include <sound/core.h>
22 #include <sound/pcm.h>
23 #include <sound/pcm_params.h>
24 #include <sound/soc.h>
25 #include <sound/jack.h>
26 #include <sound/initval.h>
27 #include <sound/tlv.h>
29 #include <linux/mfd/arizona/core.h>
30 #include <linux/mfd/arizona/registers.h>
32 #include "arizona.h"
33 #include "wm5110.h"
35 struct wm5110_priv {
36 struct arizona_priv core;
37 struct arizona_fll fll[2];
40 static const struct reg_default wm5110_sysclk_revd_patch[] = {
41 { 0x3093, 0x1001 },
42 { 0x30E3, 0x1301 },
43 { 0x3133, 0x1201 },
44 { 0x3183, 0x1501 },
45 { 0x31D3, 0x1401 },
46 { 0x0049, 0x01ea },
47 { 0x004a, 0x01f2 },
48 { 0x0057, 0x01e7 },
49 { 0x0058, 0x01fb },
50 { 0x33ce, 0xc4f5 },
51 { 0x33cf, 0x1361 },
52 { 0x33d0, 0x0402 },
53 { 0x33d1, 0x4700 },
54 { 0x33d2, 0x026d },
55 { 0x33d3, 0xff00 },
56 { 0x33d4, 0x026d },
57 { 0x33d5, 0x0101 },
58 { 0x33d6, 0xc4f5 },
59 { 0x33d7, 0x0361 },
60 { 0x33d8, 0x0402 },
61 { 0x33d9, 0x6701 },
62 { 0x33da, 0xc4f5 },
63 { 0x33db, 0x136f },
64 { 0x33dc, 0xc4f5 },
65 { 0x33dd, 0x134f },
66 { 0x33de, 0xc4f5 },
67 { 0x33df, 0x131f },
68 { 0x33e0, 0x026d },
69 { 0x33e1, 0x4f01 },
70 { 0x33e2, 0x026d },
71 { 0x33e3, 0xf100 },
72 { 0x33e4, 0x026d },
73 { 0x33e5, 0x0001 },
74 { 0x33e6, 0xc4f5 },
75 { 0x33e7, 0x0361 },
76 { 0x33e8, 0x0402 },
77 { 0x33e9, 0x6601 },
78 { 0x33ea, 0xc4f5 },
79 { 0x33eb, 0x136f },
80 { 0x33ec, 0xc4f5 },
81 { 0x33ed, 0x134f },
82 { 0x33ee, 0xc4f5 },
83 { 0x33ef, 0x131f },
84 { 0x33f0, 0x026d },
85 { 0x33f1, 0x4e01 },
86 { 0x33f2, 0x026d },
87 { 0x33f3, 0xf000 },
88 { 0x33f6, 0xc4f5 },
89 { 0x33f7, 0x1361 },
90 { 0x33f8, 0x0402 },
91 { 0x33f9, 0x4600 },
92 { 0x33fa, 0x026d },
93 { 0x33fb, 0xfe00 },
96 static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
97 struct snd_kcontrol *kcontrol, int event)
99 struct snd_soc_codec *codec = w->codec;
100 struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
101 struct regmap *regmap = codec->control_data;
102 const struct reg_default *patch = NULL;
103 int i, patch_size;
105 switch (arizona->rev) {
106 case 3:
107 patch = wm5110_sysclk_revd_patch;
108 patch_size = ARRAY_SIZE(wm5110_sysclk_revd_patch);
109 break;
110 default:
111 return 0;
114 switch (event) {
115 case SND_SOC_DAPM_POST_PMU:
116 if (patch)
117 for (i = 0; i < patch_size; i++)
118 regmap_write(regmap, patch[i].reg,
119 patch[i].def);
120 break;
122 default:
123 break;
126 return 0;
129 static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
130 static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
131 static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
132 static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
133 static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
135 #define WM5110_NG_SRC(name, base) \
136 SOC_SINGLE(name " NG HPOUT1L Switch", base, 0, 1, 0), \
137 SOC_SINGLE(name " NG HPOUT1R Switch", base, 1, 1, 0), \
138 SOC_SINGLE(name " NG HPOUT2L Switch", base, 2, 1, 0), \
139 SOC_SINGLE(name " NG HPOUT2R Switch", base, 3, 1, 0), \
140 SOC_SINGLE(name " NG HPOUT3L Switch", base, 4, 1, 0), \
141 SOC_SINGLE(name " NG HPOUT3R Switch", base, 5, 1, 0), \
142 SOC_SINGLE(name " NG SPKOUTL Switch", base, 6, 1, 0), \
143 SOC_SINGLE(name " NG SPKOUTR Switch", base, 7, 1, 0), \
144 SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \
145 SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0), \
146 SOC_SINGLE(name " NG SPKDAT2L Switch", base, 10, 1, 0), \
147 SOC_SINGLE(name " NG SPKDAT2R Switch", base, 11, 1, 0)
149 static const struct snd_kcontrol_new wm5110_snd_controls[] = {
150 SOC_ENUM("IN1 OSR", arizona_in_dmic_osr[0]),
151 SOC_ENUM("IN2 OSR", arizona_in_dmic_osr[1]),
152 SOC_ENUM("IN3 OSR", arizona_in_dmic_osr[2]),
153 SOC_ENUM("IN4 OSR", arizona_in_dmic_osr[3]),
155 SOC_SINGLE_RANGE_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL,
156 ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
157 SOC_SINGLE_RANGE_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL,
158 ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
159 SOC_SINGLE_RANGE_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL,
160 ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
161 SOC_SINGLE_RANGE_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL,
162 ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
163 SOC_SINGLE_RANGE_TLV("IN3L Volume", ARIZONA_IN3L_CONTROL,
164 ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
165 SOC_SINGLE_RANGE_TLV("IN3R Volume", ARIZONA_IN3R_CONTROL,
166 ARIZONA_IN3R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
168 SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
169 ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
170 SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
171 ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
172 SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
173 ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
174 SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
175 ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
176 SOC_SINGLE_TLV("IN3L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L,
177 ARIZONA_IN3L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
178 SOC_SINGLE_TLV("IN3R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3R,
179 ARIZONA_IN3R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
180 SOC_SINGLE_TLV("IN4L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4L,
181 ARIZONA_IN4L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
182 SOC_SINGLE_TLV("IN4R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4R,
183 ARIZONA_IN4R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
185 SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
186 SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
188 ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
189 ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
190 ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
191 ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
193 SND_SOC_BYTES_MASK("EQ1 Coefficeints", ARIZONA_EQ1_1, 21,
194 ARIZONA_EQ1_ENA_MASK),
195 SND_SOC_BYTES_MASK("EQ2 Coefficeints", ARIZONA_EQ2_1, 21,
196 ARIZONA_EQ2_ENA_MASK),
197 SND_SOC_BYTES_MASK("EQ3 Coefficeints", ARIZONA_EQ3_1, 21,
198 ARIZONA_EQ3_ENA_MASK),
199 SND_SOC_BYTES_MASK("EQ4 Coefficeints", ARIZONA_EQ4_1, 21,
200 ARIZONA_EQ4_ENA_MASK),
202 SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
203 24, 0, eq_tlv),
204 SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
205 24, 0, eq_tlv),
206 SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
207 24, 0, eq_tlv),
208 SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
209 24, 0, eq_tlv),
210 SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
211 24, 0, eq_tlv),
213 SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
214 24, 0, eq_tlv),
215 SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
216 24, 0, eq_tlv),
217 SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
218 24, 0, eq_tlv),
219 SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
220 24, 0, eq_tlv),
221 SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
222 24, 0, eq_tlv),
224 SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
225 24, 0, eq_tlv),
226 SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
227 24, 0, eq_tlv),
228 SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
229 24, 0, eq_tlv),
230 SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
231 24, 0, eq_tlv),
232 SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
233 24, 0, eq_tlv),
235 SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
236 24, 0, eq_tlv),
237 SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
238 24, 0, eq_tlv),
239 SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
240 24, 0, eq_tlv),
241 SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
242 24, 0, eq_tlv),
243 SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
244 24, 0, eq_tlv),
246 ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
247 ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
248 ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE),
249 ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE),
251 SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
252 ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
253 SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5,
254 ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA),
256 ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
257 ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
258 ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
259 ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
261 SND_SOC_BYTES("LHPF1 Coefficients", ARIZONA_HPLPF1_2, 1),
262 SND_SOC_BYTES("LHPF2 Coefficients", ARIZONA_HPLPF2_2, 1),
263 SND_SOC_BYTES("LHPF3 Coefficients", ARIZONA_HPLPF3_2, 1),
264 SND_SOC_BYTES("LHPF4 Coefficients", ARIZONA_HPLPF4_2, 1),
266 SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
267 SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
268 SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
269 SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
271 ARIZONA_MIXER_CONTROLS("DSP1L", ARIZONA_DSP1LMIX_INPUT_1_SOURCE),
272 ARIZONA_MIXER_CONTROLS("DSP1R", ARIZONA_DSP1RMIX_INPUT_1_SOURCE),
273 ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE),
274 ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE),
275 ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE),
276 ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE),
277 ARIZONA_MIXER_CONTROLS("DSP4L", ARIZONA_DSP4LMIX_INPUT_1_SOURCE),
278 ARIZONA_MIXER_CONTROLS("DSP4R", ARIZONA_DSP4RMIX_INPUT_1_SOURCE),
280 ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
281 ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
283 SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
284 ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
286 ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
287 ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
288 ARIZONA_MIXER_CONTROLS("HPOUT2L", ARIZONA_OUT2LMIX_INPUT_1_SOURCE),
289 ARIZONA_MIXER_CONTROLS("HPOUT2R", ARIZONA_OUT2RMIX_INPUT_1_SOURCE),
290 ARIZONA_MIXER_CONTROLS("HPOUT3L", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
291 ARIZONA_MIXER_CONTROLS("HPOUT3R", ARIZONA_OUT3RMIX_INPUT_1_SOURCE),
292 ARIZONA_MIXER_CONTROLS("SPKOUTL", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
293 ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE),
294 ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
295 ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
296 ARIZONA_MIXER_CONTROLS("SPKDAT2L", ARIZONA_OUT6LMIX_INPUT_1_SOURCE),
297 ARIZONA_MIXER_CONTROLS("SPKDAT2R", ARIZONA_OUT6RMIX_INPUT_1_SOURCE),
299 SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L,
300 ARIZONA_OUT1_OSR_SHIFT, 1, 0),
301 SOC_SINGLE("HPOUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L,
302 ARIZONA_OUT2_OSR_SHIFT, 1, 0),
303 SOC_SINGLE("HPOUT3 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L,
304 ARIZONA_OUT3_OSR_SHIFT, 1, 0),
305 SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L,
306 ARIZONA_OUT4_OSR_SHIFT, 1, 0),
307 SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
308 ARIZONA_OUT5_OSR_SHIFT, 1, 0),
309 SOC_SINGLE("SPKDAT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_6L,
310 ARIZONA_OUT6_OSR_SHIFT, 1, 0),
312 SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
313 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
314 SOC_DOUBLE_R("HPOUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L,
315 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1),
316 SOC_DOUBLE_R("HPOUT3 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
317 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
318 SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
319 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
320 SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
321 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
322 SOC_DOUBLE_R("SPKDAT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_6L,
323 ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_MUTE_SHIFT, 1, 1),
325 SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
326 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
327 0xbf, 0, digital_tlv),
328 SOC_DOUBLE_R_TLV("HPOUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L,
329 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT,
330 0xbf, 0, digital_tlv),
331 SOC_DOUBLE_R_TLV("HPOUT3 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
332 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_VOL_SHIFT,
333 0xbf, 0, digital_tlv),
334 SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
335 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_VOL_SHIFT,
336 0xbf, 0, digital_tlv),
337 SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
338 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
339 0xbf, 0, digital_tlv),
340 SOC_DOUBLE_R_TLV("SPKDAT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_6L,
341 ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_VOL_SHIFT,
342 0xbf, 0, digital_tlv),
344 SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L,
345 ARIZONA_OUTPUT_PATH_CONFIG_1R,
346 ARIZONA_OUT1L_PGA_VOL_SHIFT,
347 0x34, 0x40, 0, ana_tlv),
348 SOC_DOUBLE_R_RANGE_TLV("HPOUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L,
349 ARIZONA_OUTPUT_PATH_CONFIG_2R,
350 ARIZONA_OUT2L_PGA_VOL_SHIFT,
351 0x34, 0x40, 0, ana_tlv),
352 SOC_DOUBLE_R_RANGE_TLV("HPOUT3 Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L,
353 ARIZONA_OUTPUT_PATH_CONFIG_3R,
354 ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv),
356 SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
357 ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
358 SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT,
359 ARIZONA_SPK2R_MUTE_SHIFT, 1, 1),
361 SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
362 SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
364 SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
365 ARIZONA_NGATE_ENA_SHIFT, 1, 0),
366 SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
367 ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
368 SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
370 WM5110_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
371 WM5110_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
372 WM5110_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L),
373 WM5110_NG_SRC("HPOUT2R", ARIZONA_NOISE_GATE_SELECT_2R),
374 WM5110_NG_SRC("HPOUT3L", ARIZONA_NOISE_GATE_SELECT_3L),
375 WM5110_NG_SRC("HPOUT3R", ARIZONA_NOISE_GATE_SELECT_3R),
376 WM5110_NG_SRC("SPKOUTL", ARIZONA_NOISE_GATE_SELECT_4L),
377 WM5110_NG_SRC("SPKOUTR", ARIZONA_NOISE_GATE_SELECT_4R),
378 WM5110_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L),
379 WM5110_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R),
380 WM5110_NG_SRC("SPKDAT2L", ARIZONA_NOISE_GATE_SELECT_6L),
381 WM5110_NG_SRC("SPKDAT2R", ARIZONA_NOISE_GATE_SELECT_6R),
383 ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
384 ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
385 ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
386 ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
387 ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
388 ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
389 ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
390 ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
392 ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
393 ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
395 ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
396 ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
398 ARIZONA_MIXER_CONTROLS("SLIMTX1", ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE),
399 ARIZONA_MIXER_CONTROLS("SLIMTX2", ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE),
400 ARIZONA_MIXER_CONTROLS("SLIMTX3", ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE),
401 ARIZONA_MIXER_CONTROLS("SLIMTX4", ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE),
402 ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
403 ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
404 ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
405 ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
408 ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
409 ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
410 ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
411 ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
413 ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
414 ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
415 ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE);
416 ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE);
418 ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
419 ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
420 ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
421 ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
423 ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE);
424 ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE);
426 ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
427 ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
429 ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
430 ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
431 ARIZONA_MIXER_ENUMS(OUT2L, ARIZONA_OUT2LMIX_INPUT_1_SOURCE);
432 ARIZONA_MIXER_ENUMS(OUT2R, ARIZONA_OUT2RMIX_INPUT_1_SOURCE);
433 ARIZONA_MIXER_ENUMS(OUT3L, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
434 ARIZONA_MIXER_ENUMS(OUT3R, ARIZONA_OUT3RMIX_INPUT_1_SOURCE);
435 ARIZONA_MIXER_ENUMS(SPKOUTL, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
436 ARIZONA_MIXER_ENUMS(SPKOUTR, ARIZONA_OUT4RMIX_INPUT_1_SOURCE);
437 ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
438 ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
439 ARIZONA_MIXER_ENUMS(SPKDAT2L, ARIZONA_OUT6LMIX_INPUT_1_SOURCE);
440 ARIZONA_MIXER_ENUMS(SPKDAT2R, ARIZONA_OUT6RMIX_INPUT_1_SOURCE);
442 ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
443 ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
444 ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
445 ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
446 ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
447 ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
448 ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
449 ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
451 ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
452 ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
454 ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
455 ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
457 ARIZONA_MIXER_ENUMS(SLIMTX1, ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE);
458 ARIZONA_MIXER_ENUMS(SLIMTX2, ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE);
459 ARIZONA_MIXER_ENUMS(SLIMTX3, ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE);
460 ARIZONA_MIXER_ENUMS(SLIMTX4, ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE);
461 ARIZONA_MIXER_ENUMS(SLIMTX5, ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE);
462 ARIZONA_MIXER_ENUMS(SLIMTX6, ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE);
463 ARIZONA_MIXER_ENUMS(SLIMTX7, ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE);
464 ARIZONA_MIXER_ENUMS(SLIMTX8, ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE);
466 ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
467 ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
468 ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
469 ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
471 static const char *wm5110_aec_loopback_texts[] = {
472 "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R",
473 "SPKOUTL", "SPKOUTR", "SPKDAT1L", "SPKDAT1R", "SPKDAT2L", "SPKDAT2R",
476 static const unsigned int wm5110_aec_loopback_values[] = {
477 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
480 static const struct soc_enum wm5110_aec_loopback =
481 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
482 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
483 ARRAY_SIZE(wm5110_aec_loopback_texts),
484 wm5110_aec_loopback_texts,
485 wm5110_aec_loopback_values);
487 static const struct snd_kcontrol_new wm5110_aec_loopback_mux =
488 SOC_DAPM_VALUE_ENUM("AEC Loopback", wm5110_aec_loopback);
490 static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = {
491 SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
492 0, wm5110_sysclk_ev, SND_SOC_DAPM_POST_PMU),
493 SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
494 ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
495 SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
496 ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
497 SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
498 ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
500 SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
501 SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0, 0),
502 SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
503 SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
504 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0, 0),
505 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
507 SND_SOC_DAPM_SIGGEN("TONE"),
508 SND_SOC_DAPM_SIGGEN("NOISE"),
509 SND_SOC_DAPM_SIGGEN("HAPTICS"),
511 SND_SOC_DAPM_INPUT("IN1L"),
512 SND_SOC_DAPM_INPUT("IN1R"),
513 SND_SOC_DAPM_INPUT("IN2L"),
514 SND_SOC_DAPM_INPUT("IN2R"),
515 SND_SOC_DAPM_INPUT("IN3L"),
516 SND_SOC_DAPM_INPUT("IN3R"),
517 SND_SOC_DAPM_INPUT("IN4L"),
518 SND_SOC_DAPM_INPUT("IN4R"),
520 SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
521 SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
523 SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
524 0, NULL, 0, arizona_in_ev,
525 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
526 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
527 SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
528 0, NULL, 0, arizona_in_ev,
529 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
530 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
531 SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
532 0, NULL, 0, arizona_in_ev,
533 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
534 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
535 SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
536 0, NULL, 0, arizona_in_ev,
537 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
538 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
539 SND_SOC_DAPM_PGA_E("IN3L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3L_ENA_SHIFT,
540 0, NULL, 0, arizona_in_ev,
541 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
542 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
543 SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3R_ENA_SHIFT,
544 0, NULL, 0, arizona_in_ev,
545 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
546 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
547 SND_SOC_DAPM_PGA_E("IN4L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4L_ENA_SHIFT,
548 0, NULL, 0, arizona_in_ev,
549 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
550 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
551 SND_SOC_DAPM_PGA_E("IN4R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4R_ENA_SHIFT,
552 0, NULL, 0, arizona_in_ev,
553 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
554 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
556 SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
557 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
558 SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
559 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
560 SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
561 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
563 SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
564 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
566 SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
567 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
568 SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
569 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
571 SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1,
572 ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0),
574 SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
575 SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
576 SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
577 SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
579 SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
580 NULL, 0),
581 SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
582 NULL, 0),
583 SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0,
584 NULL, 0),
585 SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0,
586 NULL, 0),
588 SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
589 NULL, 0),
590 SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
591 NULL, 0),
592 SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
593 NULL, 0),
594 SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
595 NULL, 0),
597 SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
598 0, NULL, 0),
599 SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
600 0, NULL, 0),
602 SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
603 NULL, 0),
604 SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
605 NULL, 0),
606 SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
607 NULL, 0),
608 SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
609 NULL, 0),
611 SND_SOC_DAPM_VALUE_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
612 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0,
613 &wm5110_aec_loopback_mux),
615 SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
616 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
617 SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
618 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
619 SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
620 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
621 SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
622 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
623 SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
624 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
625 SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
626 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
627 SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0,
628 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
629 SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0,
630 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
632 SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
633 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
634 SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
635 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
636 SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
637 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
638 SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
639 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
640 SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
641 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
642 SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
643 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
644 SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0,
645 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
646 SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0,
647 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
649 SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
650 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
651 SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
652 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
654 SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
655 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
656 SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
657 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
659 SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0,
660 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
661 ARIZONA_SLIMRX1_ENA_SHIFT, 0),
662 SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 0,
663 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
664 ARIZONA_SLIMRX2_ENA_SHIFT, 0),
665 SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 0,
666 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
667 ARIZONA_SLIMRX3_ENA_SHIFT, 0),
668 SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 0,
669 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
670 ARIZONA_SLIMRX4_ENA_SHIFT, 0),
671 SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL, 0,
672 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
673 ARIZONA_SLIMRX5_ENA_SHIFT, 0),
674 SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL, 0,
675 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
676 ARIZONA_SLIMRX6_ENA_SHIFT, 0),
677 SND_SOC_DAPM_AIF_IN("SLIMRX7", NULL, 0,
678 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
679 ARIZONA_SLIMRX7_ENA_SHIFT, 0),
680 SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 0,
681 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
682 ARIZONA_SLIMRX8_ENA_SHIFT, 0),
684 SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
685 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
686 ARIZONA_SLIMTX1_ENA_SHIFT, 0),
687 SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 0,
688 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
689 ARIZONA_SLIMTX2_ENA_SHIFT, 0),
690 SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 0,
691 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
692 ARIZONA_SLIMTX3_ENA_SHIFT, 0),
693 SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 0,
694 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
695 ARIZONA_SLIMTX4_ENA_SHIFT, 0),
696 SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 0,
697 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
698 ARIZONA_SLIMTX5_ENA_SHIFT, 0),
699 SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 0,
700 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
701 ARIZONA_SLIMTX6_ENA_SHIFT, 0),
702 SND_SOC_DAPM_AIF_OUT("SLIMTX7", NULL, 0,
703 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
704 ARIZONA_SLIMTX7_ENA_SHIFT, 0),
705 SND_SOC_DAPM_AIF_OUT("SLIMTX8", NULL, 0,
706 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
707 ARIZONA_SLIMTX8_ENA_SHIFT, 0),
709 SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
710 ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
711 SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0,
712 ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
714 SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
715 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
716 SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
717 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
719 SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
720 ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
721 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
722 SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
723 ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
724 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
725 SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1,
726 ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
727 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
728 SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1,
729 ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
730 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
731 SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
732 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
733 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
734 SND_SOC_DAPM_PGA_E("OUT3R", ARIZONA_OUTPUT_ENABLES_1,
735 ARIZONA_OUT3R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
736 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
737 SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
738 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
739 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
740 SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
741 ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
742 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
743 SND_SOC_DAPM_PGA_E("OUT6L", ARIZONA_OUTPUT_ENABLES_1,
744 ARIZONA_OUT6L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
745 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
746 SND_SOC_DAPM_PGA_E("OUT6R", ARIZONA_OUTPUT_ENABLES_1,
747 ARIZONA_OUT6R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
748 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
750 ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
751 ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
752 ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"),
753 ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"),
755 ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
756 ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
757 ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"),
758 ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"),
760 ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
761 ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
762 ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
763 ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
765 ARIZONA_MIXER_WIDGETS(Mic, "Mic"),
766 ARIZONA_MIXER_WIDGETS(Noise, "Noise"),
768 ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
769 ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
771 ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
772 ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
773 ARIZONA_MIXER_WIDGETS(OUT2L, "HPOUT2L"),
774 ARIZONA_MIXER_WIDGETS(OUT2R, "HPOUT2R"),
775 ARIZONA_MIXER_WIDGETS(OUT3L, "HPOUT3L"),
776 ARIZONA_MIXER_WIDGETS(OUT3R, "HPOUT3R"),
777 ARIZONA_MIXER_WIDGETS(SPKOUTL, "SPKOUTL"),
778 ARIZONA_MIXER_WIDGETS(SPKOUTR, "SPKOUTR"),
779 ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
780 ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
781 ARIZONA_MIXER_WIDGETS(SPKDAT2L, "SPKDAT2L"),
782 ARIZONA_MIXER_WIDGETS(SPKDAT2R, "SPKDAT2R"),
784 ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
785 ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
786 ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
787 ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
788 ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
789 ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
790 ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
791 ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
793 ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
794 ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
796 ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
797 ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
799 ARIZONA_MIXER_WIDGETS(SLIMTX1, "SLIMTX1"),
800 ARIZONA_MIXER_WIDGETS(SLIMTX2, "SLIMTX2"),
801 ARIZONA_MIXER_WIDGETS(SLIMTX3, "SLIMTX3"),
802 ARIZONA_MIXER_WIDGETS(SLIMTX4, "SLIMTX4"),
803 ARIZONA_MIXER_WIDGETS(SLIMTX5, "SLIMTX5"),
804 ARIZONA_MIXER_WIDGETS(SLIMTX6, "SLIMTX6"),
805 ARIZONA_MIXER_WIDGETS(SLIMTX7, "SLIMTX7"),
806 ARIZONA_MIXER_WIDGETS(SLIMTX8, "SLIMTX8"),
808 ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
809 ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
810 ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
811 ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
813 SND_SOC_DAPM_OUTPUT("HPOUT1L"),
814 SND_SOC_DAPM_OUTPUT("HPOUT1R"),
815 SND_SOC_DAPM_OUTPUT("HPOUT2L"),
816 SND_SOC_DAPM_OUTPUT("HPOUT2R"),
817 SND_SOC_DAPM_OUTPUT("HPOUT3L"),
818 SND_SOC_DAPM_OUTPUT("HPOUT3R"),
819 SND_SOC_DAPM_OUTPUT("SPKOUTLN"),
820 SND_SOC_DAPM_OUTPUT("SPKOUTLP"),
821 SND_SOC_DAPM_OUTPUT("SPKOUTRN"),
822 SND_SOC_DAPM_OUTPUT("SPKOUTRP"),
823 SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
824 SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
825 SND_SOC_DAPM_OUTPUT("SPKDAT2L"),
826 SND_SOC_DAPM_OUTPUT("SPKDAT2R"),
828 SND_SOC_DAPM_OUTPUT("MICSUPP"),
831 #define ARIZONA_MIXER_INPUT_ROUTES(name) \
832 { name, "Noise Generator", "Noise Generator" }, \
833 { name, "Tone Generator 1", "Tone Generator 1" }, \
834 { name, "Tone Generator 2", "Tone Generator 2" }, \
835 { name, "Haptics", "HAPTICS" }, \
836 { name, "AEC", "AEC Loopback" }, \
837 { name, "IN1L", "IN1L PGA" }, \
838 { name, "IN1R", "IN1R PGA" }, \
839 { name, "IN2L", "IN2L PGA" }, \
840 { name, "IN2R", "IN2R PGA" }, \
841 { name, "IN3L", "IN3L PGA" }, \
842 { name, "IN3R", "IN3R PGA" }, \
843 { name, "IN4L", "IN4L PGA" }, \
844 { name, "IN4R", "IN4R PGA" }, \
845 { name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
846 { name, "AIF1RX1", "AIF1RX1" }, \
847 { name, "AIF1RX2", "AIF1RX2" }, \
848 { name, "AIF1RX3", "AIF1RX3" }, \
849 { name, "AIF1RX4", "AIF1RX4" }, \
850 { name, "AIF1RX5", "AIF1RX5" }, \
851 { name, "AIF1RX6", "AIF1RX6" }, \
852 { name, "AIF1RX7", "AIF1RX7" }, \
853 { name, "AIF1RX8", "AIF1RX8" }, \
854 { name, "AIF2RX1", "AIF2RX1" }, \
855 { name, "AIF2RX2", "AIF2RX2" }, \
856 { name, "AIF3RX1", "AIF3RX1" }, \
857 { name, "AIF3RX2", "AIF3RX2" }, \
858 { name, "SLIMRX1", "SLIMRX1" }, \
859 { name, "SLIMRX2", "SLIMRX2" }, \
860 { name, "SLIMRX3", "SLIMRX3" }, \
861 { name, "SLIMRX4", "SLIMRX4" }, \
862 { name, "SLIMRX5", "SLIMRX5" }, \
863 { name, "SLIMRX6", "SLIMRX6" }, \
864 { name, "SLIMRX7", "SLIMRX7" }, \
865 { name, "SLIMRX8", "SLIMRX8" }, \
866 { name, "EQ1", "EQ1" }, \
867 { name, "EQ2", "EQ2" }, \
868 { name, "EQ3", "EQ3" }, \
869 { name, "EQ4", "EQ4" }, \
870 { name, "DRC1L", "DRC1L" }, \
871 { name, "DRC1R", "DRC1R" }, \
872 { name, "DRC2L", "DRC2L" }, \
873 { name, "DRC2R", "DRC2R" }, \
874 { name, "LHPF1", "LHPF1" }, \
875 { name, "LHPF2", "LHPF2" }, \
876 { name, "LHPF3", "LHPF3" }, \
877 { name, "LHPF4", "LHPF4" }, \
878 { name, "ASRC1L", "ASRC1L" }, \
879 { name, "ASRC1R", "ASRC1R" }, \
880 { name, "ASRC2L", "ASRC2L" }, \
881 { name, "ASRC2R", "ASRC2R" }
883 static const struct snd_soc_dapm_route wm5110_dapm_routes[] = {
884 { "AIF2 Capture", NULL, "DBVDD2" },
885 { "AIF2 Playback", NULL, "DBVDD2" },
887 { "AIF3 Capture", NULL, "DBVDD3" },
888 { "AIF3 Playback", NULL, "DBVDD3" },
890 { "OUT1L", NULL, "CPVDD" },
891 { "OUT1R", NULL, "CPVDD" },
892 { "OUT2L", NULL, "CPVDD" },
893 { "OUT2R", NULL, "CPVDD" },
894 { "OUT3L", NULL, "CPVDD" },
895 { "OUT3R", NULL, "CPVDD" },
897 { "OUT4L", NULL, "SPKVDDL" },
898 { "OUT4R", NULL, "SPKVDDR" },
900 { "OUT1L", NULL, "SYSCLK" },
901 { "OUT1R", NULL, "SYSCLK" },
902 { "OUT2L", NULL, "SYSCLK" },
903 { "OUT2R", NULL, "SYSCLK" },
904 { "OUT3L", NULL, "SYSCLK" },
905 { "OUT4L", NULL, "SYSCLK" },
906 { "OUT4R", NULL, "SYSCLK" },
907 { "OUT5L", NULL, "SYSCLK" },
908 { "OUT5R", NULL, "SYSCLK" },
909 { "OUT6L", NULL, "SYSCLK" },
910 { "OUT6R", NULL, "SYSCLK" },
912 { "IN1L", NULL, "SYSCLK" },
913 { "IN1R", NULL, "SYSCLK" },
914 { "IN2L", NULL, "SYSCLK" },
915 { "IN2R", NULL, "SYSCLK" },
916 { "IN3L", NULL, "SYSCLK" },
917 { "IN3R", NULL, "SYSCLK" },
918 { "IN4L", NULL, "SYSCLK" },
919 { "IN4R", NULL, "SYSCLK" },
921 { "MICBIAS1", NULL, "MICVDD" },
922 { "MICBIAS2", NULL, "MICVDD" },
923 { "MICBIAS3", NULL, "MICVDD" },
925 { "Noise Generator", NULL, "SYSCLK" },
926 { "Tone Generator 1", NULL, "SYSCLK" },
927 { "Tone Generator 2", NULL, "SYSCLK" },
929 { "Noise Generator", NULL, "NOISE" },
930 { "Tone Generator 1", NULL, "TONE" },
931 { "Tone Generator 2", NULL, "TONE" },
933 { "AIF1 Capture", NULL, "AIF1TX1" },
934 { "AIF1 Capture", NULL, "AIF1TX2" },
935 { "AIF1 Capture", NULL, "AIF1TX3" },
936 { "AIF1 Capture", NULL, "AIF1TX4" },
937 { "AIF1 Capture", NULL, "AIF1TX5" },
938 { "AIF1 Capture", NULL, "AIF1TX6" },
939 { "AIF1 Capture", NULL, "AIF1TX7" },
940 { "AIF1 Capture", NULL, "AIF1TX8" },
942 { "AIF1RX1", NULL, "AIF1 Playback" },
943 { "AIF1RX2", NULL, "AIF1 Playback" },
944 { "AIF1RX3", NULL, "AIF1 Playback" },
945 { "AIF1RX4", NULL, "AIF1 Playback" },
946 { "AIF1RX5", NULL, "AIF1 Playback" },
947 { "AIF1RX6", NULL, "AIF1 Playback" },
948 { "AIF1RX7", NULL, "AIF1 Playback" },
949 { "AIF1RX8", NULL, "AIF1 Playback" },
951 { "AIF2 Capture", NULL, "AIF2TX1" },
952 { "AIF2 Capture", NULL, "AIF2TX2" },
954 { "AIF2RX1", NULL, "AIF2 Playback" },
955 { "AIF2RX2", NULL, "AIF2 Playback" },
957 { "AIF3 Capture", NULL, "AIF3TX1" },
958 { "AIF3 Capture", NULL, "AIF3TX2" },
960 { "AIF3RX1", NULL, "AIF3 Playback" },
961 { "AIF3RX2", NULL, "AIF3 Playback" },
963 { "Slim1 Capture", NULL, "SLIMTX1" },
964 { "Slim1 Capture", NULL, "SLIMTX2" },
965 { "Slim1 Capture", NULL, "SLIMTX3" },
966 { "Slim1 Capture", NULL, "SLIMTX4" },
968 { "SLIMRX1", NULL, "Slim1 Playback" },
969 { "SLIMRX2", NULL, "Slim1 Playback" },
970 { "SLIMRX3", NULL, "Slim1 Playback" },
971 { "SLIMRX4", NULL, "Slim1 Playback" },
973 { "Slim2 Capture", NULL, "SLIMTX5" },
974 { "Slim2 Capture", NULL, "SLIMTX6" },
976 { "SLIMRX5", NULL, "Slim2 Playback" },
977 { "SLIMRX6", NULL, "Slim2 Playback" },
979 { "Slim3 Capture", NULL, "SLIMTX7" },
980 { "Slim3 Capture", NULL, "SLIMTX8" },
982 { "SLIMRX7", NULL, "Slim3 Playback" },
983 { "SLIMRX8", NULL, "Slim3 Playback" },
985 { "AIF1 Playback", NULL, "SYSCLK" },
986 { "AIF2 Playback", NULL, "SYSCLK" },
987 { "AIF3 Playback", NULL, "SYSCLK" },
988 { "Slim1 Playback", NULL, "SYSCLK" },
989 { "Slim2 Playback", NULL, "SYSCLK" },
990 { "Slim3 Playback", NULL, "SYSCLK" },
992 { "AIF1 Capture", NULL, "SYSCLK" },
993 { "AIF2 Capture", NULL, "SYSCLK" },
994 { "AIF3 Capture", NULL, "SYSCLK" },
995 { "Slim1 Capture", NULL, "SYSCLK" },
996 { "Slim2 Capture", NULL, "SYSCLK" },
997 { "Slim3 Capture", NULL, "SYSCLK" },
999 { "IN1L PGA", NULL, "IN1L" },
1000 { "IN1R PGA", NULL, "IN1R" },
1002 { "IN2L PGA", NULL, "IN2L" },
1003 { "IN2R PGA", NULL, "IN2R" },
1005 { "IN3L PGA", NULL, "IN3L" },
1006 { "IN3R PGA", NULL, "IN3R" },
1008 { "IN4L PGA", NULL, "IN4L" },
1009 { "IN4R PGA", NULL, "IN4R" },
1011 ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
1012 ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
1013 ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"),
1014 ARIZONA_MIXER_ROUTES("OUT2R", "HPOUT2R"),
1015 ARIZONA_MIXER_ROUTES("OUT3L", "HPOUT3L"),
1016 ARIZONA_MIXER_ROUTES("OUT3R", "HPOUT3R"),
1018 ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUTL"),
1019 ARIZONA_MIXER_ROUTES("OUT4R", "SPKOUTR"),
1020 ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
1021 ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
1022 ARIZONA_MIXER_ROUTES("OUT6L", "SPKDAT2L"),
1023 ARIZONA_MIXER_ROUTES("OUT6R", "SPKDAT2R"),
1025 ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
1026 ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
1028 ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
1029 ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
1030 ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
1031 ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
1032 ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
1033 ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
1034 ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
1035 ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
1037 ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
1038 ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
1040 ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
1041 ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
1043 ARIZONA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
1044 ARIZONA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
1045 ARIZONA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
1046 ARIZONA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
1047 ARIZONA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
1048 ARIZONA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
1049 ARIZONA_MIXER_ROUTES("SLIMTX7", "SLIMTX7"),
1050 ARIZONA_MIXER_ROUTES("SLIMTX8", "SLIMTX8"),
1052 ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
1053 ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
1054 ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
1055 ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
1057 ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
1058 ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
1059 ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"),
1060 ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"),
1062 ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
1063 ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
1064 ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
1065 ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
1067 ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Noise"),
1068 ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Mic"),
1070 ARIZONA_MUX_ROUTES("ASRC1L", "ASRC1L"),
1071 ARIZONA_MUX_ROUTES("ASRC1R", "ASRC1R"),
1072 ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"),
1073 ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"),
1075 { "HPOUT1L", NULL, "OUT1L" },
1076 { "HPOUT1R", NULL, "OUT1R" },
1078 { "HPOUT2L", NULL, "OUT2L" },
1079 { "HPOUT2R", NULL, "OUT2R" },
1081 { "HPOUT3L", NULL, "OUT3L" },
1082 { "HPOUT3R", NULL, "OUT3R" },
1084 { "SPKOUTLN", NULL, "OUT4L" },
1085 { "SPKOUTLP", NULL, "OUT4L" },
1087 { "SPKOUTRN", NULL, "OUT4R" },
1088 { "SPKOUTRP", NULL, "OUT4R" },
1090 { "SPKDAT1L", NULL, "OUT5L" },
1091 { "SPKDAT1R", NULL, "OUT5R" },
1093 { "SPKDAT2L", NULL, "OUT6L" },
1094 { "SPKDAT2R", NULL, "OUT6R" },
1096 { "MICSUPP", NULL, "SYSCLK" },
1098 { "DRC1 Signal Activity", NULL, "DRC1L" },
1099 { "DRC1 Signal Activity", NULL, "DRC1R" },
1100 { "DRC2 Signal Activity", NULL, "DRC2L" },
1101 { "DRC2 Signal Activity", NULL, "DRC2R" },
1104 static int wm5110_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
1105 unsigned int Fref, unsigned int Fout)
1107 struct wm5110_priv *wm5110 = snd_soc_codec_get_drvdata(codec);
1109 switch (fll_id) {
1110 case WM5110_FLL1:
1111 return arizona_set_fll(&wm5110->fll[0], source, Fref, Fout);
1112 case WM5110_FLL2:
1113 return arizona_set_fll(&wm5110->fll[1], source, Fref, Fout);
1114 case WM5110_FLL1_REFCLK:
1115 return arizona_set_fll_refclk(&wm5110->fll[0], source, Fref,
1116 Fout);
1117 case WM5110_FLL2_REFCLK:
1118 return arizona_set_fll_refclk(&wm5110->fll[1], source, Fref,
1119 Fout);
1120 default:
1121 return -EINVAL;
1125 #define WM5110_RATES SNDRV_PCM_RATE_8000_192000
1127 #define WM5110_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
1128 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
1130 static struct snd_soc_dai_driver wm5110_dai[] = {
1132 .name = "wm5110-aif1",
1133 .id = 1,
1134 .base = ARIZONA_AIF1_BCLK_CTRL,
1135 .playback = {
1136 .stream_name = "AIF1 Playback",
1137 .channels_min = 1,
1138 .channels_max = 8,
1139 .rates = WM5110_RATES,
1140 .formats = WM5110_FORMATS,
1142 .capture = {
1143 .stream_name = "AIF1 Capture",
1144 .channels_min = 1,
1145 .channels_max = 8,
1146 .rates = WM5110_RATES,
1147 .formats = WM5110_FORMATS,
1149 .ops = &arizona_dai_ops,
1150 .symmetric_rates = 1,
1153 .name = "wm5110-aif2",
1154 .id = 2,
1155 .base = ARIZONA_AIF2_BCLK_CTRL,
1156 .playback = {
1157 .stream_name = "AIF2 Playback",
1158 .channels_min = 1,
1159 .channels_max = 2,
1160 .rates = WM5110_RATES,
1161 .formats = WM5110_FORMATS,
1163 .capture = {
1164 .stream_name = "AIF2 Capture",
1165 .channels_min = 1,
1166 .channels_max = 2,
1167 .rates = WM5110_RATES,
1168 .formats = WM5110_FORMATS,
1170 .ops = &arizona_dai_ops,
1171 .symmetric_rates = 1,
1174 .name = "wm5110-aif3",
1175 .id = 3,
1176 .base = ARIZONA_AIF3_BCLK_CTRL,
1177 .playback = {
1178 .stream_name = "AIF3 Playback",
1179 .channels_min = 1,
1180 .channels_max = 2,
1181 .rates = WM5110_RATES,
1182 .formats = WM5110_FORMATS,
1184 .capture = {
1185 .stream_name = "AIF3 Capture",
1186 .channels_min = 1,
1187 .channels_max = 2,
1188 .rates = WM5110_RATES,
1189 .formats = WM5110_FORMATS,
1191 .ops = &arizona_dai_ops,
1192 .symmetric_rates = 1,
1195 .name = "wm5110-slim1",
1196 .id = 4,
1197 .playback = {
1198 .stream_name = "Slim1 Playback",
1199 .channels_min = 1,
1200 .channels_max = 4,
1201 .rates = WM5110_RATES,
1202 .formats = WM5110_FORMATS,
1204 .capture = {
1205 .stream_name = "Slim1 Capture",
1206 .channels_min = 1,
1207 .channels_max = 4,
1208 .rates = WM5110_RATES,
1209 .formats = WM5110_FORMATS,
1211 .ops = &arizona_simple_dai_ops,
1214 .name = "wm5110-slim2",
1215 .id = 5,
1216 .playback = {
1217 .stream_name = "Slim2 Playback",
1218 .channels_min = 1,
1219 .channels_max = 2,
1220 .rates = WM5110_RATES,
1221 .formats = WM5110_FORMATS,
1223 .capture = {
1224 .stream_name = "Slim2 Capture",
1225 .channels_min = 1,
1226 .channels_max = 2,
1227 .rates = WM5110_RATES,
1228 .formats = WM5110_FORMATS,
1230 .ops = &arizona_simple_dai_ops,
1233 .name = "wm5110-slim3",
1234 .id = 6,
1235 .playback = {
1236 .stream_name = "Slim3 Playback",
1237 .channels_min = 1,
1238 .channels_max = 2,
1239 .rates = WM5110_RATES,
1240 .formats = WM5110_FORMATS,
1242 .capture = {
1243 .stream_name = "Slim3 Capture",
1244 .channels_min = 1,
1245 .channels_max = 2,
1246 .rates = WM5110_RATES,
1247 .formats = WM5110_FORMATS,
1249 .ops = &arizona_simple_dai_ops,
1253 static int wm5110_codec_probe(struct snd_soc_codec *codec)
1255 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
1256 int ret;
1258 codec->control_data = priv->core.arizona->regmap;
1259 priv->core.arizona->dapm = &codec->dapm;
1261 ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
1262 if (ret != 0)
1263 return ret;
1265 arizona_init_spk(codec);
1266 arizona_init_gpio(codec);
1268 snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
1270 priv->core.arizona->dapm = &codec->dapm;
1272 return 0;
1275 static int wm5110_codec_remove(struct snd_soc_codec *codec)
1277 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
1279 priv->core.arizona->dapm = NULL;
1281 return 0;
1284 #define WM5110_DIG_VU 0x0200
1286 static unsigned int wm5110_digital_vu[] = {
1287 ARIZONA_DAC_DIGITAL_VOLUME_1L,
1288 ARIZONA_DAC_DIGITAL_VOLUME_1R,
1289 ARIZONA_DAC_DIGITAL_VOLUME_2L,
1290 ARIZONA_DAC_DIGITAL_VOLUME_2R,
1291 ARIZONA_DAC_DIGITAL_VOLUME_3L,
1292 ARIZONA_DAC_DIGITAL_VOLUME_3R,
1293 ARIZONA_DAC_DIGITAL_VOLUME_4L,
1294 ARIZONA_DAC_DIGITAL_VOLUME_4R,
1295 ARIZONA_DAC_DIGITAL_VOLUME_5L,
1296 ARIZONA_DAC_DIGITAL_VOLUME_5R,
1297 ARIZONA_DAC_DIGITAL_VOLUME_6L,
1298 ARIZONA_DAC_DIGITAL_VOLUME_6R,
1301 static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
1302 .probe = wm5110_codec_probe,
1303 .remove = wm5110_codec_remove,
1305 .idle_bias_off = true,
1307 .set_sysclk = arizona_set_sysclk,
1308 .set_pll = wm5110_set_fll,
1310 .controls = wm5110_snd_controls,
1311 .num_controls = ARRAY_SIZE(wm5110_snd_controls),
1312 .dapm_widgets = wm5110_dapm_widgets,
1313 .num_dapm_widgets = ARRAY_SIZE(wm5110_dapm_widgets),
1314 .dapm_routes = wm5110_dapm_routes,
1315 .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes),
1318 static int wm5110_probe(struct platform_device *pdev)
1320 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
1321 struct wm5110_priv *wm5110;
1322 int i;
1324 wm5110 = devm_kzalloc(&pdev->dev, sizeof(struct wm5110_priv),
1325 GFP_KERNEL);
1326 if (wm5110 == NULL)
1327 return -ENOMEM;
1328 platform_set_drvdata(pdev, wm5110);
1330 wm5110->core.arizona = arizona;
1331 wm5110->core.num_inputs = 8;
1333 for (i = 0; i < ARRAY_SIZE(wm5110->fll); i++)
1334 wm5110->fll[i].vco_mult = 3;
1336 arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
1337 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
1338 &wm5110->fll[0]);
1339 arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
1340 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
1341 &wm5110->fll[1]);
1343 for (i = 0; i < ARRAY_SIZE(wm5110_dai); i++)
1344 arizona_init_dai(&wm5110->core, i);
1346 /* Latch volume update bits */
1347 for (i = 0; i < ARRAY_SIZE(wm5110_digital_vu); i++)
1348 regmap_update_bits(arizona->regmap, wm5110_digital_vu[i],
1349 WM5110_DIG_VU, WM5110_DIG_VU);
1351 pm_runtime_enable(&pdev->dev);
1352 pm_runtime_idle(&pdev->dev);
1354 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110,
1355 wm5110_dai, ARRAY_SIZE(wm5110_dai));
1358 static int wm5110_remove(struct platform_device *pdev)
1360 snd_soc_unregister_codec(&pdev->dev);
1361 pm_runtime_disable(&pdev->dev);
1363 return 0;
1366 static struct platform_driver wm5110_codec_driver = {
1367 .driver = {
1368 .name = "wm5110-codec",
1369 .owner = THIS_MODULE,
1371 .probe = wm5110_probe,
1372 .remove = wm5110_remove,
1375 module_platform_driver(wm5110_codec_driver);
1377 MODULE_DESCRIPTION("ASoC WM5110 driver");
1378 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
1379 MODULE_LICENSE("GPL");
1380 MODULE_ALIAS("platform:wm5110-codec");