xref: /openbmc/linux/sound/soc/codecs/wm5110.c (revision 586685f1)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * wm5110.c  --  WM5110 ALSA SoC Audio driver
4  *
5  * Copyright 2012 Wolfson Microelectronics plc
6  *
7  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
8  */
9 
10 #include <linux/module.h>
11 #include <linux/moduleparam.h>
12 #include <linux/init.h>
13 #include <linux/delay.h>
14 #include <linux/pm.h>
15 #include <linux/pm_runtime.h>
16 #include <linux/regmap.h>
17 #include <linux/slab.h>
18 #include <sound/core.h>
19 #include <sound/pcm.h>
20 #include <sound/pcm_params.h>
21 #include <sound/soc.h>
22 #include <sound/jack.h>
23 #include <sound/initval.h>
24 #include <sound/tlv.h>
25 
26 #include <linux/mfd/arizona/core.h>
27 #include <linux/mfd/arizona/registers.h>
28 
29 #include "arizona.h"
30 #include "wm_adsp.h"
31 #include "wm5110.h"
32 
33 #define WM5110_NUM_ADSP 4
34 
35 #define DRV_NAME "wm5110-codec"
36 
37 struct wm5110_priv {
38 	struct arizona_priv core;
39 	struct arizona_fll fll[2];
40 
41 	unsigned int in_value;
42 	int in_pre_pending;
43 	int in_post_pending;
44 
45 	unsigned int in_pga_cache[6];
46 };
47 
48 static const struct cs_dsp_region wm5110_dsp1_regions[] = {
49 	{ .type = WMFW_ADSP2_PM, .base = 0x100000 },
50 	{ .type = WMFW_ADSP2_ZM, .base = 0x180000 },
51 	{ .type = WMFW_ADSP2_XM, .base = 0x190000 },
52 	{ .type = WMFW_ADSP2_YM, .base = 0x1a8000 },
53 };
54 
55 static const struct cs_dsp_region wm5110_dsp2_regions[] = {
56 	{ .type = WMFW_ADSP2_PM, .base = 0x200000 },
57 	{ .type = WMFW_ADSP2_ZM, .base = 0x280000 },
58 	{ .type = WMFW_ADSP2_XM, .base = 0x290000 },
59 	{ .type = WMFW_ADSP2_YM, .base = 0x2a8000 },
60 };
61 
62 static const struct cs_dsp_region wm5110_dsp3_regions[] = {
63 	{ .type = WMFW_ADSP2_PM, .base = 0x300000 },
64 	{ .type = WMFW_ADSP2_ZM, .base = 0x380000 },
65 	{ .type = WMFW_ADSP2_XM, .base = 0x390000 },
66 	{ .type = WMFW_ADSP2_YM, .base = 0x3a8000 },
67 };
68 
69 static const struct cs_dsp_region wm5110_dsp4_regions[] = {
70 	{ .type = WMFW_ADSP2_PM, .base = 0x400000 },
71 	{ .type = WMFW_ADSP2_ZM, .base = 0x480000 },
72 	{ .type = WMFW_ADSP2_XM, .base = 0x490000 },
73 	{ .type = WMFW_ADSP2_YM, .base = 0x4a8000 },
74 };
75 
76 static const struct cs_dsp_region *wm5110_dsp_regions[] = {
77 	wm5110_dsp1_regions,
78 	wm5110_dsp2_regions,
79 	wm5110_dsp3_regions,
80 	wm5110_dsp4_regions,
81 };
82 
83 static const struct reg_default wm5110_sysclk_revd_patch[] = {
84 	{ 0x3093, 0x1001 },
85 	{ 0x30E3, 0x1301 },
86 	{ 0x3133, 0x1201 },
87 	{ 0x3183, 0x1501 },
88 	{ 0x31D3, 0x1401 },
89 	{ 0x0049, 0x01ea },
90 	{ 0x004a, 0x01f2 },
91 	{ 0x0057, 0x01e7 },
92 	{ 0x0058, 0x01fb },
93 	{ 0x33ce, 0xc4f5 },
94 	{ 0x33cf, 0x1361 },
95 	{ 0x33d0, 0x0402 },
96 	{ 0x33d1, 0x4700 },
97 	{ 0x33d2, 0x026d },
98 	{ 0x33d3, 0xff00 },
99 	{ 0x33d4, 0x026d },
100 	{ 0x33d5, 0x0101 },
101 	{ 0x33d6, 0xc4f5 },
102 	{ 0x33d7, 0x0361 },
103 	{ 0x33d8, 0x0402 },
104 	{ 0x33d9, 0x6701 },
105 	{ 0x33da, 0xc4f5 },
106 	{ 0x33db, 0x136f },
107 	{ 0x33dc, 0xc4f5 },
108 	{ 0x33dd, 0x134f },
109 	{ 0x33de, 0xc4f5 },
110 	{ 0x33df, 0x131f },
111 	{ 0x33e0, 0x026d },
112 	{ 0x33e1, 0x4f01 },
113 	{ 0x33e2, 0x026d },
114 	{ 0x33e3, 0xf100 },
115 	{ 0x33e4, 0x026d },
116 	{ 0x33e5, 0x0001 },
117 	{ 0x33e6, 0xc4f5 },
118 	{ 0x33e7, 0x0361 },
119 	{ 0x33e8, 0x0402 },
120 	{ 0x33e9, 0x6601 },
121 	{ 0x33ea, 0xc4f5 },
122 	{ 0x33eb, 0x136f },
123 	{ 0x33ec, 0xc4f5 },
124 	{ 0x33ed, 0x134f },
125 	{ 0x33ee, 0xc4f5 },
126 	{ 0x33ef, 0x131f },
127 	{ 0x33f0, 0x026d },
128 	{ 0x33f1, 0x4e01 },
129 	{ 0x33f2, 0x026d },
130 	{ 0x33f3, 0xf000 },
131 	{ 0x33f6, 0xc4f5 },
132 	{ 0x33f7, 0x1361 },
133 	{ 0x33f8, 0x0402 },
134 	{ 0x33f9, 0x4600 },
135 	{ 0x33fa, 0x026d },
136 	{ 0x33fb, 0xfe00 },
137 };
138 
139 static const struct reg_default wm5110_sysclk_reve_patch[] = {
140 	{ 0x3270, 0xE410 },
141 	{ 0x3271, 0x3078 },
142 	{ 0x3272, 0xE410 },
143 	{ 0x3273, 0x3070 },
144 	{ 0x3274, 0xE410 },
145 	{ 0x3275, 0x3066 },
146 	{ 0x3276, 0xE410 },
147 	{ 0x3277, 0x3056 },
148 	{ 0x327A, 0xE414 },
149 	{ 0x327B, 0x3078 },
150 	{ 0x327C, 0xE414 },
151 	{ 0x327D, 0x3070 },
152 	{ 0x327E, 0xE414 },
153 	{ 0x327F, 0x3066 },
154 	{ 0x3280, 0xE414 },
155 	{ 0x3281, 0x3056 },
156 };
157 
wm5110_sysclk_ev(struct snd_soc_dapm_widget * w,struct snd_kcontrol * kcontrol,int event)158 static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
159 			    struct snd_kcontrol *kcontrol, int event)
160 {
161 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
162 	struct arizona *arizona = dev_get_drvdata(component->dev->parent);
163 	struct regmap *regmap = arizona->regmap;
164 	const struct reg_default *patch = NULL;
165 	int i, patch_size;
166 
167 	switch (arizona->rev) {
168 	case 3:
169 		patch = wm5110_sysclk_revd_patch;
170 		patch_size = ARRAY_SIZE(wm5110_sysclk_revd_patch);
171 		break;
172 	default:
173 		patch = wm5110_sysclk_reve_patch;
174 		patch_size = ARRAY_SIZE(wm5110_sysclk_reve_patch);
175 		break;
176 	}
177 
178 	switch (event) {
179 	case SND_SOC_DAPM_POST_PMU:
180 		if (patch)
181 			for (i = 0; i < patch_size; i++)
182 				regmap_write_async(regmap, patch[i].reg,
183 						   patch[i].def);
184 		break;
185 	case SND_SOC_DAPM_PRE_PMU:
186 	case SND_SOC_DAPM_POST_PMD:
187 		return arizona_clk_ev(w, kcontrol, event);
188 	default:
189 		break;
190 	}
191 
192 	return 0;
193 }
194 
wm5110_adsp_power_ev(struct snd_soc_dapm_widget * w,struct snd_kcontrol * kcontrol,int event)195 static int wm5110_adsp_power_ev(struct snd_soc_dapm_widget *w,
196 				struct snd_kcontrol *kcontrol, int event)
197 {
198 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
199 	struct arizona *arizona = dev_get_drvdata(component->dev->parent);
200 	unsigned int v;
201 	int ret;
202 
203 	ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v);
204 	if (ret != 0) {
205 		dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret);
206 		return ret;
207 	}
208 
209 	v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT;
210 
211 	wm_adsp2_set_dspclk(w, v);
212 
213 	return wm_adsp_early_event(w, kcontrol, event);
214 }
215 
216 static const struct reg_sequence wm5110_no_dre_left_enable[] = {
217 	{ 0x3024, 0xE410 },
218 	{ 0x3025, 0x0056 },
219 	{ 0x301B, 0x0224 },
220 	{ 0x301F, 0x4263 },
221 	{ 0x3021, 0x5291 },
222 	{ 0x3030, 0xE410 },
223 	{ 0x3031, 0x3066 },
224 	{ 0x3032, 0xE410 },
225 	{ 0x3033, 0x3070 },
226 	{ 0x3034, 0xE410 },
227 	{ 0x3035, 0x3078 },
228 	{ 0x3036, 0xE410 },
229 	{ 0x3037, 0x3080 },
230 	{ 0x3038, 0xE410 },
231 	{ 0x3039, 0x3080 },
232 };
233 
234 static const struct reg_sequence wm5110_dre_left_enable[] = {
235 	{ 0x3024, 0x0231 },
236 	{ 0x3025, 0x0B00 },
237 	{ 0x301B, 0x0227 },
238 	{ 0x301F, 0x4266 },
239 	{ 0x3021, 0x5294 },
240 	{ 0x3030, 0xE231 },
241 	{ 0x3031, 0x0266 },
242 	{ 0x3032, 0x8231 },
243 	{ 0x3033, 0x4B15 },
244 	{ 0x3034, 0x8231 },
245 	{ 0x3035, 0x0B15 },
246 	{ 0x3036, 0xE231 },
247 	{ 0x3037, 0x5294 },
248 	{ 0x3038, 0x0231 },
249 	{ 0x3039, 0x0B00 },
250 };
251 
252 static const struct reg_sequence wm5110_no_dre_right_enable[] = {
253 	{ 0x3074, 0xE414 },
254 	{ 0x3075, 0x0056 },
255 	{ 0x306B, 0x0224 },
256 	{ 0x306F, 0x4263 },
257 	{ 0x3071, 0x5291 },
258 	{ 0x3080, 0xE414 },
259 	{ 0x3081, 0x3066 },
260 	{ 0x3082, 0xE414 },
261 	{ 0x3083, 0x3070 },
262 	{ 0x3084, 0xE414 },
263 	{ 0x3085, 0x3078 },
264 	{ 0x3086, 0xE414 },
265 	{ 0x3087, 0x3080 },
266 	{ 0x3088, 0xE414 },
267 	{ 0x3089, 0x3080 },
268 };
269 
270 static const struct reg_sequence wm5110_dre_right_enable[] = {
271 	{ 0x3074, 0x0231 },
272 	{ 0x3075, 0x0B00 },
273 	{ 0x306B, 0x0227 },
274 	{ 0x306F, 0x4266 },
275 	{ 0x3071, 0x5294 },
276 	{ 0x3080, 0xE231 },
277 	{ 0x3081, 0x0266 },
278 	{ 0x3082, 0x8231 },
279 	{ 0x3083, 0x4B17 },
280 	{ 0x3084, 0x8231 },
281 	{ 0x3085, 0x0B17 },
282 	{ 0x3086, 0xE231 },
283 	{ 0x3087, 0x5294 },
284 	{ 0x3088, 0x0231 },
285 	{ 0x3089, 0x0B00 },
286 };
287 
wm5110_hp_pre_enable(struct snd_soc_dapm_widget * w)288 static int wm5110_hp_pre_enable(struct snd_soc_dapm_widget *w)
289 {
290 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
291 	struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
292 	struct arizona *arizona = priv->arizona;
293 	unsigned int val = snd_soc_component_read(component, ARIZONA_DRE_ENABLE);
294 	const struct reg_sequence *wseq;
295 	int nregs;
296 
297 	switch (w->shift) {
298 	case ARIZONA_OUT1L_ENA_SHIFT:
299 		if (val & ARIZONA_DRE1L_ENA_MASK) {
300 			wseq = wm5110_dre_left_enable;
301 			nregs = ARRAY_SIZE(wm5110_dre_left_enable);
302 		} else {
303 			wseq = wm5110_no_dre_left_enable;
304 			nregs = ARRAY_SIZE(wm5110_no_dre_left_enable);
305 			priv->out_up_delay += 10;
306 		}
307 		break;
308 	case ARIZONA_OUT1R_ENA_SHIFT:
309 		if (val & ARIZONA_DRE1R_ENA_MASK) {
310 			wseq = wm5110_dre_right_enable;
311 			nregs = ARRAY_SIZE(wm5110_dre_right_enable);
312 		} else {
313 			wseq = wm5110_no_dre_right_enable;
314 			nregs = ARRAY_SIZE(wm5110_no_dre_right_enable);
315 			priv->out_up_delay += 10;
316 		}
317 		break;
318 	default:
319 		return 0;
320 	}
321 
322 	return regmap_multi_reg_write(arizona->regmap, wseq, nregs);
323 }
324 
wm5110_hp_pre_disable(struct snd_soc_dapm_widget * w)325 static int wm5110_hp_pre_disable(struct snd_soc_dapm_widget *w)
326 {
327 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
328 	struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
329 	unsigned int val = snd_soc_component_read(component, ARIZONA_DRE_ENABLE);
330 
331 	switch (w->shift) {
332 	case ARIZONA_OUT1L_ENA_SHIFT:
333 		if (!(val & ARIZONA_DRE1L_ENA_MASK)) {
334 			snd_soc_component_update_bits(component,
335 						      ARIZONA_SPARE_TRIGGERS,
336 						      ARIZONA_WS_TRG1,
337 						      ARIZONA_WS_TRG1);
338 			snd_soc_component_update_bits(component,
339 						      ARIZONA_SPARE_TRIGGERS,
340 						      ARIZONA_WS_TRG1, 0);
341 			priv->out_down_delay += 27;
342 		}
343 		break;
344 	case ARIZONA_OUT1R_ENA_SHIFT:
345 		if (!(val & ARIZONA_DRE1R_ENA_MASK)) {
346 			snd_soc_component_update_bits(component,
347 						      ARIZONA_SPARE_TRIGGERS,
348 						      ARIZONA_WS_TRG2,
349 						      ARIZONA_WS_TRG2);
350 			snd_soc_component_update_bits(component,
351 						      ARIZONA_SPARE_TRIGGERS,
352 						      ARIZONA_WS_TRG2, 0);
353 			priv->out_down_delay += 27;
354 		}
355 		break;
356 	default:
357 		break;
358 	}
359 
360 	return 0;
361 }
362 
wm5110_hp_ev(struct snd_soc_dapm_widget * w,struct snd_kcontrol * kcontrol,int event)363 static int wm5110_hp_ev(struct snd_soc_dapm_widget *w,
364 			struct snd_kcontrol *kcontrol, int event)
365 {
366 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
367 	struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
368 
369 	switch (priv->arizona->rev) {
370 	case 0 ... 3:
371 		break;
372 	default:
373 		switch (event) {
374 		case SND_SOC_DAPM_PRE_PMU:
375 			wm5110_hp_pre_enable(w);
376 			break;
377 		case SND_SOC_DAPM_PRE_PMD:
378 			wm5110_hp_pre_disable(w);
379 			break;
380 		default:
381 			break;
382 		}
383 		break;
384 	}
385 
386 	return arizona_hp_ev(w, kcontrol, event);
387 }
388 
wm5110_clear_pga_volume(struct arizona * arizona,int output)389 static int wm5110_clear_pga_volume(struct arizona *arizona, int output)
390 {
391 	unsigned int reg = ARIZONA_OUTPUT_PATH_CONFIG_1L + output * 4;
392 	int ret;
393 
394 	ret = regmap_write(arizona->regmap, reg, 0x80);
395 	if (ret)
396 		dev_err(arizona->dev, "Failed to clear PGA (0x%x): %d\n",
397 			reg, ret);
398 
399 	return ret;
400 }
401 
wm5110_put_dre(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)402 static int wm5110_put_dre(struct snd_kcontrol *kcontrol,
403 			  struct snd_ctl_elem_value *ucontrol)
404 {
405 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
406 	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
407 	struct arizona *arizona = dev_get_drvdata(component->dev->parent);
408 	struct soc_mixer_control *mc =
409 		(struct soc_mixer_control *)kcontrol->private_value;
410 	unsigned int ena, dre;
411 	unsigned int mask = (0x1 << mc->shift) | (0x1 << mc->rshift);
412 	unsigned int lnew = (!!ucontrol->value.integer.value[0]) << mc->shift;
413 	unsigned int rnew = (!!ucontrol->value.integer.value[1]) << mc->rshift;
414 	unsigned int lold, rold;
415 	unsigned int lena, rena;
416 	bool change = false;
417 	int ret;
418 
419 	snd_soc_dapm_mutex_lock(dapm);
420 
421 	ret = regmap_read(arizona->regmap, ARIZONA_OUTPUT_ENABLES_1, &ena);
422 	if (ret) {
423 		dev_err(arizona->dev, "Failed to read output state: %d\n", ret);
424 		goto err;
425 	}
426 	ret = regmap_read(arizona->regmap, ARIZONA_DRE_ENABLE, &dre);
427 	if (ret) {
428 		dev_err(arizona->dev, "Failed to read DRE state: %d\n", ret);
429 		goto err;
430 	}
431 
432 	lold = dre & (1 << mc->shift);
433 	rold = dre & (1 << mc->rshift);
434 	/* Enables are channel wise swapped from the DRE enables */
435 	lena = ena & (1 << mc->rshift);
436 	rena = ena & (1 << mc->shift);
437 
438 	if ((lena && lnew != lold) || (rena && rnew != rold)) {
439 		dev_err(arizona->dev, "Can't change DRE on active outputs\n");
440 		ret = -EBUSY;
441 		goto err;
442 	}
443 
444 	ret = regmap_update_bits_check(arizona->regmap, ARIZONA_DRE_ENABLE,
445 				       mask, lnew | rnew, &change);
446 	if (ret) {
447 		dev_err(arizona->dev, "Failed to set DRE: %d\n", ret);
448 		goto err;
449 	}
450 
451 	/* Force reset of PGA volumes, if turning DRE off */
452 	if (!lnew && lold)
453 		wm5110_clear_pga_volume(arizona, mc->shift);
454 
455 	if (!rnew && rold)
456 		wm5110_clear_pga_volume(arizona, mc->rshift);
457 
458 	if (change)
459 		ret = 1;
460 
461 err:
462 	snd_soc_dapm_mutex_unlock(dapm);
463 
464 	return ret;
465 }
466 
wm5110_in_pga_get(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)467 static int wm5110_in_pga_get(struct snd_kcontrol *kcontrol,
468 			     struct snd_ctl_elem_value *ucontrol)
469 {
470 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
471 	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
472 	int ret;
473 
474 	/*
475 	 * PGA Volume is also used as part of the enable sequence, so
476 	 * usage of it should be avoided whilst that is running.
477 	 */
478 	snd_soc_dapm_mutex_lock(dapm);
479 
480 	ret = snd_soc_get_volsw_range(kcontrol, ucontrol);
481 
482 	snd_soc_dapm_mutex_unlock(dapm);
483 
484 	return ret;
485 }
486 
wm5110_in_pga_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)487 static int wm5110_in_pga_put(struct snd_kcontrol *kcontrol,
488 			     struct snd_ctl_elem_value *ucontrol)
489 {
490 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
491 	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
492 	int ret;
493 
494 	/*
495 	 * PGA Volume is also used as part of the enable sequence, so
496 	 * usage of it should be avoided whilst that is running.
497 	 */
498 	snd_soc_dapm_mutex_lock(dapm);
499 
500 	ret = snd_soc_put_volsw_range(kcontrol, ucontrol);
501 
502 	snd_soc_dapm_mutex_unlock(dapm);
503 
504 	return ret;
505 }
506 
wm5110_in_analog_ev(struct snd_soc_dapm_widget * w,struct snd_kcontrol * kcontrol,int event)507 static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w,
508 			       struct snd_kcontrol *kcontrol, int event)
509 {
510 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
511 	struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
512 	struct wm5110_priv *wm5110 = snd_soc_component_get_drvdata(component);
513 	struct arizona *arizona = priv->arizona;
514 	unsigned int reg, mask;
515 	struct reg_sequence analog_seq[] = {
516 		{ 0x80, 0x3 },
517 		{ 0x35d, 0 },
518 		{ 0x80, 0x0 },
519 	};
520 
521 	reg = ARIZONA_IN1L_CONTROL + ((w->shift ^ 0x1) * 4);
522 	mask = ARIZONA_IN1L_PGA_VOL_MASK;
523 
524 	switch (event) {
525 	case SND_SOC_DAPM_WILL_PMU:
526 		wm5110->in_value |= 0x3 << ((w->shift ^ 0x1) * 2);
527 		wm5110->in_pre_pending++;
528 		wm5110->in_post_pending++;
529 		return 0;
530 	case SND_SOC_DAPM_PRE_PMU:
531 		wm5110->in_pga_cache[w->shift] = snd_soc_component_read(component, reg);
532 
533 		snd_soc_component_update_bits(component, reg, mask,
534 				    0x40 << ARIZONA_IN1L_PGA_VOL_SHIFT);
535 
536 		wm5110->in_pre_pending--;
537 		if (wm5110->in_pre_pending == 0) {
538 			analog_seq[1].def = wm5110->in_value;
539 			regmap_multi_reg_write_bypassed(arizona->regmap,
540 							analog_seq,
541 							ARRAY_SIZE(analog_seq));
542 
543 			msleep(55);
544 
545 			wm5110->in_value = 0;
546 		}
547 
548 		break;
549 	case SND_SOC_DAPM_POST_PMU:
550 		snd_soc_component_update_bits(component, reg, mask,
551 					      wm5110->in_pga_cache[w->shift]);
552 
553 		wm5110->in_post_pending--;
554 		if (wm5110->in_post_pending == 0)
555 			regmap_multi_reg_write_bypassed(arizona->regmap,
556 							analog_seq,
557 							ARRAY_SIZE(analog_seq));
558 		break;
559 	default:
560 		break;
561 	}
562 
563 	return 0;
564 }
565 
wm5110_in_ev(struct snd_soc_dapm_widget * w,struct snd_kcontrol * kcontrol,int event)566 static int wm5110_in_ev(struct snd_soc_dapm_widget *w,
567 			struct snd_kcontrol *kcontrol, int event)
568 {
569 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
570 	struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
571 	struct arizona *arizona = priv->arizona;
572 
573 	switch (arizona->rev) {
574 	case 0 ... 4:
575 		if (arizona_input_analog(component, w->shift))
576 			wm5110_in_analog_ev(w, kcontrol, event);
577 
578 		break;
579 	default:
580 		break;
581 	}
582 
583 	return arizona_in_ev(w, kcontrol, event);
584 }
585 
586 static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
587 static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
588 static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
589 static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
590 static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
591 
592 #define WM5110_NG_SRC(name, base) \
593 	SOC_SINGLE(name " NG HPOUT1L Switch",  base,  0, 1, 0), \
594 	SOC_SINGLE(name " NG HPOUT1R Switch",  base,  1, 1, 0), \
595 	SOC_SINGLE(name " NG HPOUT2L Switch",  base,  2, 1, 0), \
596 	SOC_SINGLE(name " NG HPOUT2R Switch",  base,  3, 1, 0), \
597 	SOC_SINGLE(name " NG HPOUT3L Switch",  base,  4, 1, 0), \
598 	SOC_SINGLE(name " NG HPOUT3R Switch",  base,  5, 1, 0), \
599 	SOC_SINGLE(name " NG SPKOUTL Switch",  base,  6, 1, 0), \
600 	SOC_SINGLE(name " NG SPKOUTR Switch",  base,  7, 1, 0), \
601 	SOC_SINGLE(name " NG SPKDAT1L Switch", base,  8, 1, 0), \
602 	SOC_SINGLE(name " NG SPKDAT1R Switch", base,  9, 1, 0), \
603 	SOC_SINGLE(name " NG SPKDAT2L Switch", base, 10, 1, 0), \
604 	SOC_SINGLE(name " NG SPKDAT2R Switch", base, 11, 1, 0)
605 
606 #define WM5110_RXANC_INPUT_ROUTES(widget, name) \
607 	{ widget, NULL, name " NG Mux" }, \
608 	{ name " NG Internal", NULL, "RXANC NG Clock" }, \
609 	{ name " NG Internal", NULL, name " Channel" }, \
610 	{ name " NG External", NULL, "RXANC NG External Clock" }, \
611 	{ name " NG External", NULL, name " Channel" }, \
612 	{ name " NG Mux", "None", name " Channel" }, \
613 	{ name " NG Mux", "Internal", name " NG Internal" }, \
614 	{ name " NG Mux", "External", name " NG External" }, \
615 	{ name " Channel", "Left", name " Left Input" }, \
616 	{ name " Channel", "Combine", name " Left Input" }, \
617 	{ name " Channel", "Right", name " Right Input" }, \
618 	{ name " Channel", "Combine", name " Right Input" }, \
619 	{ name " Left Input", "IN1", "IN1L PGA" }, \
620 	{ name " Right Input", "IN1", "IN1R PGA" }, \
621 	{ name " Left Input", "IN2", "IN2L PGA" }, \
622 	{ name " Right Input", "IN2", "IN2R PGA" }, \
623 	{ name " Left Input", "IN3", "IN3L PGA" }, \
624 	{ name " Right Input", "IN3", "IN3R PGA" }, \
625 	{ name " Left Input", "IN4", "IN4L PGA" }, \
626 	{ name " Right Input", "IN4", "IN4R PGA" }
627 
628 #define WM5110_RXANC_OUTPUT_ROUTES(widget, name) \
629 	{ widget, NULL, name " ANC Source" }, \
630 	{ name " ANC Source", "RXANCL", "RXANCL" }, \
631 	{ name " ANC Source", "RXANCR", "RXANCR" }
632 
633 static const struct snd_kcontrol_new wm5110_snd_controls[] = {
634 SOC_ENUM("IN1 OSR", arizona_in_dmic_osr[0]),
635 SOC_ENUM("IN2 OSR", arizona_in_dmic_osr[1]),
636 SOC_ENUM("IN3 OSR", arizona_in_dmic_osr[2]),
637 SOC_ENUM("IN4 OSR", arizona_in_dmic_osr[3]),
638 
639 SOC_SINGLE_RANGE_EXT_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL,
640 			 ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
641 			 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
642 SOC_SINGLE_RANGE_EXT_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL,
643 			 ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
644 			 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
645 SOC_SINGLE_RANGE_EXT_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL,
646 			 ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
647 			 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
648 SOC_SINGLE_RANGE_EXT_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL,
649 			 ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
650 			 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
651 SOC_SINGLE_RANGE_EXT_TLV("IN3L Volume", ARIZONA_IN3L_CONTROL,
652 			 ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
653 			 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
654 SOC_SINGLE_RANGE_EXT_TLV("IN3R Volume", ARIZONA_IN3R_CONTROL,
655 			 ARIZONA_IN3R_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
656 			 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
657 
658 SOC_ENUM("IN HPF Cutoff Frequency", arizona_in_hpf_cut_enum),
659 
660 SOC_SINGLE("IN1L HPF Switch", ARIZONA_IN1L_CONTROL,
661 	   ARIZONA_IN1L_HPF_SHIFT, 1, 0),
662 SOC_SINGLE("IN1R HPF Switch", ARIZONA_IN1R_CONTROL,
663 	   ARIZONA_IN1R_HPF_SHIFT, 1, 0),
664 SOC_SINGLE("IN2L HPF Switch", ARIZONA_IN2L_CONTROL,
665 	   ARIZONA_IN2L_HPF_SHIFT, 1, 0),
666 SOC_SINGLE("IN2R HPF Switch", ARIZONA_IN2R_CONTROL,
667 	   ARIZONA_IN2R_HPF_SHIFT, 1, 0),
668 SOC_SINGLE("IN3L HPF Switch", ARIZONA_IN3L_CONTROL,
669 	   ARIZONA_IN3L_HPF_SHIFT, 1, 0),
670 SOC_SINGLE("IN3R HPF Switch", ARIZONA_IN3R_CONTROL,
671 	   ARIZONA_IN3R_HPF_SHIFT, 1, 0),
672 SOC_SINGLE("IN4L HPF Switch", ARIZONA_IN4L_CONTROL,
673 	   ARIZONA_IN4L_HPF_SHIFT, 1, 0),
674 SOC_SINGLE("IN4R HPF Switch", ARIZONA_IN4R_CONTROL,
675 	   ARIZONA_IN4R_HPF_SHIFT, 1, 0),
676 
677 SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
678 	       ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
679 SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
680 	       ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
681 SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
682 	       ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
683 SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
684 	       ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
685 SOC_SINGLE_TLV("IN3L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L,
686 	       ARIZONA_IN3L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
687 SOC_SINGLE_TLV("IN3R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3R,
688 	       ARIZONA_IN3R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
689 SOC_SINGLE_TLV("IN4L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4L,
690 	       ARIZONA_IN4L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
691 SOC_SINGLE_TLV("IN4R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4R,
692 	       ARIZONA_IN4R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
693 
694 SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
695 SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
696 
697 SND_SOC_BYTES("RXANC Coefficients", ARIZONA_ANC_COEFF_START,
698 	      ARIZONA_ANC_COEFF_END - ARIZONA_ANC_COEFF_START + 1),
699 SND_SOC_BYTES("RXANCL Config", ARIZONA_FCL_FILTER_CONTROL, 1),
700 SND_SOC_BYTES("RXANCL Coefficients", ARIZONA_FCL_COEFF_START,
701 	      ARIZONA_FCL_COEFF_END - ARIZONA_FCL_COEFF_START + 1),
702 SND_SOC_BYTES("RXANCR Config", ARIZONA_FCR_FILTER_CONTROL, 1),
703 SND_SOC_BYTES("RXANCR Coefficients", ARIZONA_FCR_COEFF_START,
704 	      ARIZONA_FCR_COEFF_END - ARIZONA_FCR_COEFF_START + 1),
705 
706 ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
707 ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
708 ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
709 ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
710 
711 ARIZONA_EQ_CONTROL("EQ1 Coefficients", ARIZONA_EQ1_2),
712 SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
713 	       24, 0, eq_tlv),
714 SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
715 	       24, 0, eq_tlv),
716 SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
717 	       24, 0, eq_tlv),
718 SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
719 	       24, 0, eq_tlv),
720 SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
721 	       24, 0, eq_tlv),
722 
723 ARIZONA_EQ_CONTROL("EQ2 Coefficients", ARIZONA_EQ2_2),
724 SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
725 	       24, 0, eq_tlv),
726 SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
727 	       24, 0, eq_tlv),
728 SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
729 	       24, 0, eq_tlv),
730 SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
731 	       24, 0, eq_tlv),
732 SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
733 	       24, 0, eq_tlv),
734 
735 ARIZONA_EQ_CONTROL("EQ3 Coefficients", ARIZONA_EQ3_2),
736 SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
737 	       24, 0, eq_tlv),
738 SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
739 	       24, 0, eq_tlv),
740 SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
741 	       24, 0, eq_tlv),
742 SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
743 	       24, 0, eq_tlv),
744 SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
745 	       24, 0, eq_tlv),
746 
747 ARIZONA_EQ_CONTROL("EQ4 Coefficients", ARIZONA_EQ4_2),
748 SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
749 	       24, 0, eq_tlv),
750 SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
751 	       24, 0, eq_tlv),
752 SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
753 	       24, 0, eq_tlv),
754 SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
755 	       24, 0, eq_tlv),
756 SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
757 	       24, 0, eq_tlv),
758 
759 ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
760 ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
761 ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE),
762 ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE),
763 
764 SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
765 		   ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
766 SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5,
767 		   ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA),
768 
769 ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
770 ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
771 ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
772 ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
773 
774 ARIZONA_LHPF_CONTROL("LHPF1 Coefficients", ARIZONA_HPLPF1_2),
775 ARIZONA_LHPF_CONTROL("LHPF2 Coefficients", ARIZONA_HPLPF2_2),
776 ARIZONA_LHPF_CONTROL("LHPF3 Coefficients", ARIZONA_HPLPF3_2),
777 ARIZONA_LHPF_CONTROL("LHPF4 Coefficients", ARIZONA_HPLPF4_2),
778 
779 SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
780 SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
781 SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
782 SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
783 
784 SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
785 SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
786 SOC_ENUM("ISRC3 FSL", arizona_isrc_fsl[2]),
787 SOC_ENUM("ISRC1 FSH", arizona_isrc_fsh[0]),
788 SOC_ENUM("ISRC2 FSH", arizona_isrc_fsh[1]),
789 SOC_ENUM("ISRC3 FSH", arizona_isrc_fsh[2]),
790 SOC_ENUM("ASRC RATE 1", arizona_asrc_rate1),
791 
792 WM_ADSP2_PRELOAD_SWITCH("DSP1", 1),
793 WM_ADSP2_PRELOAD_SWITCH("DSP2", 2),
794 WM_ADSP2_PRELOAD_SWITCH("DSP3", 3),
795 WM_ADSP2_PRELOAD_SWITCH("DSP4", 4),
796 
797 ARIZONA_MIXER_CONTROLS("DSP1L", ARIZONA_DSP1LMIX_INPUT_1_SOURCE),
798 ARIZONA_MIXER_CONTROLS("DSP1R", ARIZONA_DSP1RMIX_INPUT_1_SOURCE),
799 ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE),
800 ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE),
801 ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE),
802 ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE),
803 ARIZONA_MIXER_CONTROLS("DSP4L", ARIZONA_DSP4LMIX_INPUT_1_SOURCE),
804 ARIZONA_MIXER_CONTROLS("DSP4R", ARIZONA_DSP4RMIX_INPUT_1_SOURCE),
805 
806 ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
807 ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
808 
809 SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
810 	       ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
811 
812 ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
813 ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
814 ARIZONA_MIXER_CONTROLS("HPOUT2L", ARIZONA_OUT2LMIX_INPUT_1_SOURCE),
815 ARIZONA_MIXER_CONTROLS("HPOUT2R", ARIZONA_OUT2RMIX_INPUT_1_SOURCE),
816 ARIZONA_MIXER_CONTROLS("HPOUT3L", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
817 ARIZONA_MIXER_CONTROLS("HPOUT3R", ARIZONA_OUT3RMIX_INPUT_1_SOURCE),
818 ARIZONA_MIXER_CONTROLS("SPKOUTL", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
819 ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE),
820 ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
821 ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
822 ARIZONA_MIXER_CONTROLS("SPKDAT2L", ARIZONA_OUT6LMIX_INPUT_1_SOURCE),
823 ARIZONA_MIXER_CONTROLS("SPKDAT2R", ARIZONA_OUT6RMIX_INPUT_1_SOURCE),
824 
825 SOC_SINGLE("HPOUT1 SC Protect Switch", ARIZONA_HP1_SHORT_CIRCUIT_CTRL,
826 	   ARIZONA_HP1_SC_ENA_SHIFT, 1, 0),
827 SOC_SINGLE("HPOUT2 SC Protect Switch", ARIZONA_HP2_SHORT_CIRCUIT_CTRL,
828 	   ARIZONA_HP2_SC_ENA_SHIFT, 1, 0),
829 SOC_SINGLE("HPOUT3 SC Protect Switch", ARIZONA_HP3_SHORT_CIRCUIT_CTRL,
830 	   ARIZONA_HP3_SC_ENA_SHIFT, 1, 0),
831 
832 SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
833 	   ARIZONA_OUT5_OSR_SHIFT, 1, 0),
834 SOC_SINGLE("SPKDAT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_6L,
835 	   ARIZONA_OUT6_OSR_SHIFT, 1, 0),
836 
837 SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
838 	     ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
839 SOC_DOUBLE_R("HPOUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L,
840 	     ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1),
841 SOC_DOUBLE_R("HPOUT3 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
842 	     ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
843 SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
844 	     ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
845 SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
846 	     ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
847 SOC_DOUBLE_R("SPKDAT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_6L,
848 	     ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_MUTE_SHIFT, 1, 1),
849 
850 SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
851 		 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
852 		 0xbf, 0, digital_tlv),
853 SOC_DOUBLE_R_TLV("HPOUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L,
854 		 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT,
855 		 0xbf, 0, digital_tlv),
856 SOC_DOUBLE_R_TLV("HPOUT3 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
857 		 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_VOL_SHIFT,
858 		 0xbf, 0, digital_tlv),
859 SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
860 		 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_VOL_SHIFT,
861 		 0xbf, 0, digital_tlv),
862 SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
863 		 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
864 		 0xbf, 0, digital_tlv),
865 SOC_DOUBLE_R_TLV("SPKDAT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_6L,
866 		 ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_VOL_SHIFT,
867 		 0xbf, 0, digital_tlv),
868 
869 SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
870 	   ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
871 SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT,
872 	   ARIZONA_SPK2R_MUTE_SHIFT, 1, 1),
873 
874 SOC_DOUBLE_EXT("HPOUT1 DRE Switch", ARIZONA_DRE_ENABLE,
875 	       ARIZONA_DRE1L_ENA_SHIFT, ARIZONA_DRE1R_ENA_SHIFT, 1, 0,
876 	       snd_soc_get_volsw, wm5110_put_dre),
877 SOC_DOUBLE_EXT("HPOUT2 DRE Switch", ARIZONA_DRE_ENABLE,
878 	       ARIZONA_DRE2L_ENA_SHIFT, ARIZONA_DRE2R_ENA_SHIFT, 1, 0,
879 	       snd_soc_get_volsw, wm5110_put_dre),
880 SOC_DOUBLE_EXT("HPOUT3 DRE Switch", ARIZONA_DRE_ENABLE,
881 	       ARIZONA_DRE3L_ENA_SHIFT, ARIZONA_DRE3R_ENA_SHIFT, 1, 0,
882 	       snd_soc_get_volsw, wm5110_put_dre),
883 
884 SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
885 SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
886 
887 SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
888 	   ARIZONA_NGATE_ENA_SHIFT, 1, 0),
889 SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
890 	       ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
891 SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
892 
893 WM5110_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
894 WM5110_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
895 WM5110_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L),
896 WM5110_NG_SRC("HPOUT2R", ARIZONA_NOISE_GATE_SELECT_2R),
897 WM5110_NG_SRC("HPOUT3L", ARIZONA_NOISE_GATE_SELECT_3L),
898 WM5110_NG_SRC("HPOUT3R", ARIZONA_NOISE_GATE_SELECT_3R),
899 WM5110_NG_SRC("SPKOUTL", ARIZONA_NOISE_GATE_SELECT_4L),
900 WM5110_NG_SRC("SPKOUTR", ARIZONA_NOISE_GATE_SELECT_4R),
901 WM5110_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L),
902 WM5110_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R),
903 WM5110_NG_SRC("SPKDAT2L", ARIZONA_NOISE_GATE_SELECT_6L),
904 WM5110_NG_SRC("SPKDAT2R", ARIZONA_NOISE_GATE_SELECT_6R),
905 
906 ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
907 ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
908 ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
909 ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
910 ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
911 ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
912 ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
913 ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
914 
915 ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
916 ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
917 ARIZONA_MIXER_CONTROLS("AIF2TX3", ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE),
918 ARIZONA_MIXER_CONTROLS("AIF2TX4", ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE),
919 ARIZONA_MIXER_CONTROLS("AIF2TX5", ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE),
920 ARIZONA_MIXER_CONTROLS("AIF2TX6", ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE),
921 
922 ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
923 ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
924 
925 ARIZONA_MIXER_CONTROLS("SLIMTX1", ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE),
926 ARIZONA_MIXER_CONTROLS("SLIMTX2", ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE),
927 ARIZONA_MIXER_CONTROLS("SLIMTX3", ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE),
928 ARIZONA_MIXER_CONTROLS("SLIMTX4", ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE),
929 ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
930 ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
931 ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
932 ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
933 
934 WM_ADSP_FW_CONTROL("DSP1", 0),
935 WM_ADSP_FW_CONTROL("DSP2", 1),
936 WM_ADSP_FW_CONTROL("DSP3", 2),
937 WM_ADSP_FW_CONTROL("DSP4", 3),
938 };
939 
940 ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
941 ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
942 ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
943 ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
944 
945 ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
946 ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
947 ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE);
948 ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE);
949 
950 ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
951 ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
952 ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
953 ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
954 
955 ARIZONA_MIXER_ENUMS(DSP1L, ARIZONA_DSP1LMIX_INPUT_1_SOURCE);
956 ARIZONA_MIXER_ENUMS(DSP1R, ARIZONA_DSP1RMIX_INPUT_1_SOURCE);
957 ARIZONA_DSP_AUX_ENUMS(DSP1, ARIZONA_DSP1AUX1MIX_INPUT_1_SOURCE);
958 
959 ARIZONA_MIXER_ENUMS(DSP2L, ARIZONA_DSP2LMIX_INPUT_1_SOURCE);
960 ARIZONA_MIXER_ENUMS(DSP2R, ARIZONA_DSP2RMIX_INPUT_1_SOURCE);
961 ARIZONA_DSP_AUX_ENUMS(DSP2, ARIZONA_DSP2AUX1MIX_INPUT_1_SOURCE);
962 
963 ARIZONA_MIXER_ENUMS(DSP3L, ARIZONA_DSP3LMIX_INPUT_1_SOURCE);
964 ARIZONA_MIXER_ENUMS(DSP3R, ARIZONA_DSP3RMIX_INPUT_1_SOURCE);
965 ARIZONA_DSP_AUX_ENUMS(DSP3, ARIZONA_DSP3AUX1MIX_INPUT_1_SOURCE);
966 
967 ARIZONA_MIXER_ENUMS(DSP4L, ARIZONA_DSP4LMIX_INPUT_1_SOURCE);
968 ARIZONA_MIXER_ENUMS(DSP4R, ARIZONA_DSP4RMIX_INPUT_1_SOURCE);
969 ARIZONA_DSP_AUX_ENUMS(DSP4, ARIZONA_DSP4AUX1MIX_INPUT_1_SOURCE);
970 
971 ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE);
972 ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE);
973 
974 ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
975 ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
976 
977 ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
978 ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
979 ARIZONA_MIXER_ENUMS(OUT2L, ARIZONA_OUT2LMIX_INPUT_1_SOURCE);
980 ARIZONA_MIXER_ENUMS(OUT2R, ARIZONA_OUT2RMIX_INPUT_1_SOURCE);
981 ARIZONA_MIXER_ENUMS(OUT3L, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
982 ARIZONA_MIXER_ENUMS(OUT3R, ARIZONA_OUT3RMIX_INPUT_1_SOURCE);
983 ARIZONA_MIXER_ENUMS(SPKOUTL, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
984 ARIZONA_MIXER_ENUMS(SPKOUTR, ARIZONA_OUT4RMIX_INPUT_1_SOURCE);
985 ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
986 ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
987 ARIZONA_MIXER_ENUMS(SPKDAT2L, ARIZONA_OUT6LMIX_INPUT_1_SOURCE);
988 ARIZONA_MIXER_ENUMS(SPKDAT2R, ARIZONA_OUT6RMIX_INPUT_1_SOURCE);
989 
990 ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
991 ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
992 ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
993 ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
994 ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
995 ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
996 ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
997 ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
998 
999 ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
1000 ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
1001 ARIZONA_MIXER_ENUMS(AIF2TX3, ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE);
1002 ARIZONA_MIXER_ENUMS(AIF2TX4, ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE);
1003 ARIZONA_MIXER_ENUMS(AIF2TX5, ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE);
1004 ARIZONA_MIXER_ENUMS(AIF2TX6, ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE);
1005 
1006 ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
1007 ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
1008 
1009 ARIZONA_MIXER_ENUMS(SLIMTX1, ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE);
1010 ARIZONA_MIXER_ENUMS(SLIMTX2, ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE);
1011 ARIZONA_MIXER_ENUMS(SLIMTX3, ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE);
1012 ARIZONA_MIXER_ENUMS(SLIMTX4, ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE);
1013 ARIZONA_MIXER_ENUMS(SLIMTX5, ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE);
1014 ARIZONA_MIXER_ENUMS(SLIMTX6, ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE);
1015 ARIZONA_MIXER_ENUMS(SLIMTX7, ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE);
1016 ARIZONA_MIXER_ENUMS(SLIMTX8, ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE);
1017 
1018 ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
1019 ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
1020 ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
1021 ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
1022 
1023 ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE);
1024 ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE);
1025 ARIZONA_MUX_ENUMS(ISRC1INT3, ARIZONA_ISRC1INT3MIX_INPUT_1_SOURCE);
1026 ARIZONA_MUX_ENUMS(ISRC1INT4, ARIZONA_ISRC1INT4MIX_INPUT_1_SOURCE);
1027 
1028 ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE);
1029 ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE);
1030 ARIZONA_MUX_ENUMS(ISRC1DEC3, ARIZONA_ISRC1DEC3MIX_INPUT_1_SOURCE);
1031 ARIZONA_MUX_ENUMS(ISRC1DEC4, ARIZONA_ISRC1DEC4MIX_INPUT_1_SOURCE);
1032 
1033 ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE);
1034 ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE);
1035 ARIZONA_MUX_ENUMS(ISRC2INT3, ARIZONA_ISRC2INT3MIX_INPUT_1_SOURCE);
1036 ARIZONA_MUX_ENUMS(ISRC2INT4, ARIZONA_ISRC2INT4MIX_INPUT_1_SOURCE);
1037 
1038 ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE);
1039 ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE);
1040 ARIZONA_MUX_ENUMS(ISRC2DEC3, ARIZONA_ISRC2DEC3MIX_INPUT_1_SOURCE);
1041 ARIZONA_MUX_ENUMS(ISRC2DEC4, ARIZONA_ISRC2DEC4MIX_INPUT_1_SOURCE);
1042 
1043 ARIZONA_MUX_ENUMS(ISRC3INT1, ARIZONA_ISRC3INT1MIX_INPUT_1_SOURCE);
1044 ARIZONA_MUX_ENUMS(ISRC3INT2, ARIZONA_ISRC3INT2MIX_INPUT_1_SOURCE);
1045 ARIZONA_MUX_ENUMS(ISRC3INT3, ARIZONA_ISRC3INT3MIX_INPUT_1_SOURCE);
1046 ARIZONA_MUX_ENUMS(ISRC3INT4, ARIZONA_ISRC3INT4MIX_INPUT_1_SOURCE);
1047 
1048 ARIZONA_MUX_ENUMS(ISRC3DEC1, ARIZONA_ISRC3DEC1MIX_INPUT_1_SOURCE);
1049 ARIZONA_MUX_ENUMS(ISRC3DEC2, ARIZONA_ISRC3DEC2MIX_INPUT_1_SOURCE);
1050 ARIZONA_MUX_ENUMS(ISRC3DEC3, ARIZONA_ISRC3DEC3MIX_INPUT_1_SOURCE);
1051 ARIZONA_MUX_ENUMS(ISRC3DEC4, ARIZONA_ISRC3DEC4MIX_INPUT_1_SOURCE);
1052 
1053 static const char * const wm5110_aec_loopback_texts[] = {
1054 	"HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R",
1055 	"SPKOUTL", "SPKOUTR", "SPKDAT1L", "SPKDAT1R", "SPKDAT2L", "SPKDAT2R",
1056 };
1057 
1058 static const unsigned int wm5110_aec_loopback_values[] = {
1059 	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1060 };
1061 
1062 static const struct soc_enum wm5110_aec_loopback =
1063 	SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
1064 			      ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
1065 			      ARRAY_SIZE(wm5110_aec_loopback_texts),
1066 			      wm5110_aec_loopback_texts,
1067 			      wm5110_aec_loopback_values);
1068 
1069 static const struct snd_kcontrol_new wm5110_aec_loopback_mux =
1070 	SOC_DAPM_ENUM("AEC Loopback", wm5110_aec_loopback);
1071 
1072 static const struct snd_kcontrol_new wm5110_anc_input_mux[] = {
1073 	SOC_DAPM_ENUM("RXANCL Input", arizona_anc_input_src[0]),
1074 	SOC_DAPM_ENUM("RXANCL Channel", arizona_anc_input_src[1]),
1075 	SOC_DAPM_ENUM("RXANCR Input", arizona_anc_input_src[2]),
1076 	SOC_DAPM_ENUM("RXANCR Channel", arizona_anc_input_src[3]),
1077 };
1078 
1079 static const struct snd_kcontrol_new wm5110_anc_ng_mux =
1080 	SOC_DAPM_ENUM("RXANC NG Source", arizona_anc_ng_enum);
1081 
1082 static const struct snd_kcontrol_new wm5110_output_anc_src[] = {
1083 	SOC_DAPM_ENUM("HPOUT1L ANC Source", arizona_output_anc_src[0]),
1084 	SOC_DAPM_ENUM("HPOUT1R ANC Source", arizona_output_anc_src[1]),
1085 	SOC_DAPM_ENUM("HPOUT2L ANC Source", arizona_output_anc_src[2]),
1086 	SOC_DAPM_ENUM("HPOUT2R ANC Source", arizona_output_anc_src[3]),
1087 	SOC_DAPM_ENUM("HPOUT3L ANC Source", arizona_output_anc_src[4]),
1088 	SOC_DAPM_ENUM("HPOUT3R ANC Source", arizona_output_anc_src[5]),
1089 	SOC_DAPM_ENUM("SPKOUTL ANC Source", arizona_output_anc_src[6]),
1090 	SOC_DAPM_ENUM("SPKOUTR ANC Source", arizona_output_anc_src[7]),
1091 	SOC_DAPM_ENUM("SPKDAT1L ANC Source", arizona_output_anc_src[8]),
1092 	SOC_DAPM_ENUM("SPKDAT1R ANC Source", arizona_output_anc_src[9]),
1093 	SOC_DAPM_ENUM("SPKDAT2L ANC Source", arizona_output_anc_src[10]),
1094 	SOC_DAPM_ENUM("SPKDAT2R ANC Source", arizona_output_anc_src[11]),
1095 };
1096 
1097 static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = {
1098 SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
1099 		    0, wm5110_sysclk_ev, SND_SOC_DAPM_POST_PMU |
1100 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
1101 SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
1102 		    ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, arizona_clk_ev,
1103 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
1104 SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
1105 		    ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
1106 SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
1107 		    ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
1108 
1109 SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
1110 SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0, 0),
1111 SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
1112 SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
1113 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0, 0),
1114 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
1115 
1116 SND_SOC_DAPM_SIGGEN("TONE"),
1117 SND_SOC_DAPM_SIGGEN("NOISE"),
1118 SND_SOC_DAPM_SIGGEN("HAPTICS"),
1119 
1120 SND_SOC_DAPM_INPUT("IN1L"),
1121 SND_SOC_DAPM_INPUT("IN1R"),
1122 SND_SOC_DAPM_INPUT("IN2L"),
1123 SND_SOC_DAPM_INPUT("IN2R"),
1124 SND_SOC_DAPM_INPUT("IN3L"),
1125 SND_SOC_DAPM_INPUT("IN3R"),
1126 SND_SOC_DAPM_INPUT("IN4L"),
1127 SND_SOC_DAPM_INPUT("IN4R"),
1128 
1129 SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
1130 SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
1131 
1132 SND_SOC_DAPM_OUTPUT("DSP Voice Trigger"),
1133 
1134 SND_SOC_DAPM_SWITCH("DSP3 Voice Trigger", SND_SOC_NOPM, 2, 0,
1135 		    &arizona_voice_trigger_switch[2]),
1136 
1137 SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
1138 		   0, NULL, 0, wm5110_in_ev,
1139 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1140 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1141 		   SND_SOC_DAPM_WILL_PMU),
1142 SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
1143 		   0, NULL, 0, wm5110_in_ev,
1144 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1145 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1146 		   SND_SOC_DAPM_WILL_PMU),
1147 SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
1148 		   0, NULL, 0, wm5110_in_ev,
1149 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1150 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1151 		   SND_SOC_DAPM_WILL_PMU),
1152 SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
1153 		   0, NULL, 0, wm5110_in_ev,
1154 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1155 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1156 		   SND_SOC_DAPM_WILL_PMU),
1157 SND_SOC_DAPM_PGA_E("IN3L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3L_ENA_SHIFT,
1158 		   0, NULL, 0, wm5110_in_ev,
1159 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1160 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1161 		   SND_SOC_DAPM_WILL_PMU),
1162 SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3R_ENA_SHIFT,
1163 		   0, NULL, 0, wm5110_in_ev,
1164 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1165 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1166 		   SND_SOC_DAPM_WILL_PMU),
1167 SND_SOC_DAPM_PGA_E("IN4L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4L_ENA_SHIFT,
1168 		   0, NULL, 0, arizona_in_ev,
1169 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1170 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
1171 SND_SOC_DAPM_PGA_E("IN4R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4R_ENA_SHIFT,
1172 		   0, NULL, 0, arizona_in_ev,
1173 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1174 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
1175 
1176 SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
1177 		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
1178 SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
1179 		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
1180 SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
1181 		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
1182 
1183 SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
1184 		 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
1185 
1186 SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
1187 		 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
1188 SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
1189 		 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
1190 
1191 SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1,
1192 		 ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0),
1193 
1194 SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
1195 SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
1196 SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
1197 SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
1198 
1199 SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
1200 		 NULL, 0),
1201 SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
1202 		 NULL, 0),
1203 SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0,
1204 		 NULL, 0),
1205 SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0,
1206 		 NULL, 0),
1207 
1208 SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
1209 		 NULL, 0),
1210 SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
1211 		 NULL, 0),
1212 SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
1213 		 NULL, 0),
1214 SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
1215 		 NULL, 0),
1216 
1217 SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
1218 		 0, NULL, 0),
1219 SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
1220 		 0, NULL, 0),
1221 
1222 SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
1223 		 NULL, 0),
1224 SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
1225 		 NULL, 0),
1226 SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
1227 		 NULL, 0),
1228 SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
1229 		 NULL, 0),
1230 
1231 WM_ADSP2("DSP1", 0, wm5110_adsp_power_ev),
1232 WM_ADSP2("DSP2", 1, wm5110_adsp_power_ev),
1233 WM_ADSP2("DSP3", 2, wm5110_adsp_power_ev),
1234 WM_ADSP2("DSP4", 3, wm5110_adsp_power_ev),
1235 
1236 SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3,
1237 		 ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0),
1238 SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3,
1239 		 ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
1240 SND_SOC_DAPM_PGA("ISRC1INT3", ARIZONA_ISRC_1_CTRL_3,
1241 		 ARIZONA_ISRC1_INT2_ENA_SHIFT, 0, NULL, 0),
1242 SND_SOC_DAPM_PGA("ISRC1INT4", ARIZONA_ISRC_1_CTRL_3,
1243 		 ARIZONA_ISRC1_INT3_ENA_SHIFT, 0, NULL, 0),
1244 
1245 SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3,
1246 		 ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0),
1247 SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3,
1248 		 ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
1249 SND_SOC_DAPM_PGA("ISRC1DEC3", ARIZONA_ISRC_1_CTRL_3,
1250 		 ARIZONA_ISRC1_DEC2_ENA_SHIFT, 0, NULL, 0),
1251 SND_SOC_DAPM_PGA("ISRC1DEC4", ARIZONA_ISRC_1_CTRL_3,
1252 		 ARIZONA_ISRC1_DEC3_ENA_SHIFT, 0, NULL, 0),
1253 
1254 SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3,
1255 		 ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0),
1256 SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3,
1257 		 ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
1258 SND_SOC_DAPM_PGA("ISRC2INT3", ARIZONA_ISRC_2_CTRL_3,
1259 		 ARIZONA_ISRC2_INT2_ENA_SHIFT, 0, NULL, 0),
1260 SND_SOC_DAPM_PGA("ISRC2INT4", ARIZONA_ISRC_2_CTRL_3,
1261 		 ARIZONA_ISRC2_INT3_ENA_SHIFT, 0, NULL, 0),
1262 
1263 SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3,
1264 		 ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0),
1265 SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3,
1266 		 ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
1267 SND_SOC_DAPM_PGA("ISRC2DEC3", ARIZONA_ISRC_2_CTRL_3,
1268 		 ARIZONA_ISRC2_DEC2_ENA_SHIFT, 0, NULL, 0),
1269 SND_SOC_DAPM_PGA("ISRC2DEC4", ARIZONA_ISRC_2_CTRL_3,
1270 		 ARIZONA_ISRC2_DEC3_ENA_SHIFT, 0, NULL, 0),
1271 
1272 SND_SOC_DAPM_PGA("ISRC3INT1", ARIZONA_ISRC_3_CTRL_3,
1273 		 ARIZONA_ISRC3_INT0_ENA_SHIFT, 0, NULL, 0),
1274 SND_SOC_DAPM_PGA("ISRC3INT2", ARIZONA_ISRC_3_CTRL_3,
1275 		 ARIZONA_ISRC3_INT1_ENA_SHIFT, 0, NULL, 0),
1276 SND_SOC_DAPM_PGA("ISRC3INT3", ARIZONA_ISRC_3_CTRL_3,
1277 		 ARIZONA_ISRC3_INT2_ENA_SHIFT, 0, NULL, 0),
1278 SND_SOC_DAPM_PGA("ISRC3INT4", ARIZONA_ISRC_3_CTRL_3,
1279 		 ARIZONA_ISRC3_INT3_ENA_SHIFT, 0, NULL, 0),
1280 
1281 SND_SOC_DAPM_PGA("ISRC3DEC1", ARIZONA_ISRC_3_CTRL_3,
1282 		 ARIZONA_ISRC3_DEC0_ENA_SHIFT, 0, NULL, 0),
1283 SND_SOC_DAPM_PGA("ISRC3DEC2", ARIZONA_ISRC_3_CTRL_3,
1284 		 ARIZONA_ISRC3_DEC1_ENA_SHIFT, 0, NULL, 0),
1285 SND_SOC_DAPM_PGA("ISRC3DEC3", ARIZONA_ISRC_3_CTRL_3,
1286 		 ARIZONA_ISRC3_DEC2_ENA_SHIFT, 0, NULL, 0),
1287 SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3,
1288 		 ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0),
1289 
1290 SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
1291 		 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &wm5110_aec_loopback_mux),
1292 
1293 SND_SOC_DAPM_SUPPLY("RXANC NG External Clock", SND_SOC_NOPM,
1294 		    ARIZONA_EXT_NG_SEL_SET_SHIFT, 0, arizona_anc_ev,
1295 		    SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
1296 SND_SOC_DAPM_PGA("RXANCL NG External", SND_SOC_NOPM, 0, 0, NULL, 0),
1297 SND_SOC_DAPM_PGA("RXANCR NG External", SND_SOC_NOPM, 0, 0, NULL, 0),
1298 
1299 SND_SOC_DAPM_SUPPLY("RXANC NG Clock", SND_SOC_NOPM,
1300 		    ARIZONA_CLK_NG_ENA_SET_SHIFT, 0, arizona_anc_ev,
1301 		    SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
1302 SND_SOC_DAPM_PGA("RXANCL NG Internal", SND_SOC_NOPM, 0, 0, NULL, 0),
1303 SND_SOC_DAPM_PGA("RXANCR NG Internal", SND_SOC_NOPM, 0, 0, NULL, 0),
1304 
1305 SND_SOC_DAPM_MUX("RXANCL Left Input", SND_SOC_NOPM, 0, 0,
1306 		 &wm5110_anc_input_mux[0]),
1307 SND_SOC_DAPM_MUX("RXANCL Right Input", SND_SOC_NOPM, 0, 0,
1308 		 &wm5110_anc_input_mux[0]),
1309 SND_SOC_DAPM_MUX("RXANCL Channel", SND_SOC_NOPM, 0, 0,
1310 		 &wm5110_anc_input_mux[1]),
1311 SND_SOC_DAPM_MUX("RXANCL NG Mux", SND_SOC_NOPM, 0, 0, &wm5110_anc_ng_mux),
1312 SND_SOC_DAPM_MUX("RXANCR Left Input", SND_SOC_NOPM, 0, 0,
1313 		 &wm5110_anc_input_mux[2]),
1314 SND_SOC_DAPM_MUX("RXANCR Right Input", SND_SOC_NOPM, 0, 0,
1315 		 &wm5110_anc_input_mux[2]),
1316 SND_SOC_DAPM_MUX("RXANCR Channel", SND_SOC_NOPM, 0, 0,
1317 		 &wm5110_anc_input_mux[3]),
1318 SND_SOC_DAPM_MUX("RXANCR NG Mux", SND_SOC_NOPM, 0, 0, &wm5110_anc_ng_mux),
1319 
1320 SND_SOC_DAPM_PGA_E("RXANCL", SND_SOC_NOPM, ARIZONA_CLK_L_ENA_SET_SHIFT,
1321 		   0, NULL, 0, arizona_anc_ev,
1322 		   SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
1323 SND_SOC_DAPM_PGA_E("RXANCR", SND_SOC_NOPM, ARIZONA_CLK_R_ENA_SET_SHIFT,
1324 		   0, NULL, 0, arizona_anc_ev,
1325 		   SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
1326 
1327 SND_SOC_DAPM_MUX("HPOUT1L ANC Source", SND_SOC_NOPM, 0, 0,
1328 		 &wm5110_output_anc_src[0]),
1329 SND_SOC_DAPM_MUX("HPOUT1R ANC Source", SND_SOC_NOPM, 0, 0,
1330 		 &wm5110_output_anc_src[1]),
1331 SND_SOC_DAPM_MUX("HPOUT2L ANC Source", SND_SOC_NOPM, 0, 0,
1332 		 &wm5110_output_anc_src[2]),
1333 SND_SOC_DAPM_MUX("HPOUT2R ANC Source", SND_SOC_NOPM, 0, 0,
1334 		 &wm5110_output_anc_src[3]),
1335 SND_SOC_DAPM_MUX("HPOUT3L ANC Source", SND_SOC_NOPM, 0, 0,
1336 		 &wm5110_output_anc_src[4]),
1337 SND_SOC_DAPM_MUX("HPOUT3R ANC Source", SND_SOC_NOPM, 0, 0,
1338 		 &wm5110_output_anc_src[5]),
1339 SND_SOC_DAPM_MUX("SPKOUTL ANC Source", SND_SOC_NOPM, 0, 0,
1340 		 &wm5110_output_anc_src[6]),
1341 SND_SOC_DAPM_MUX("SPKOUTR ANC Source", SND_SOC_NOPM, 0, 0,
1342 		 &wm5110_output_anc_src[7]),
1343 SND_SOC_DAPM_MUX("SPKDAT1L ANC Source", SND_SOC_NOPM, 0, 0,
1344 		 &wm5110_output_anc_src[8]),
1345 SND_SOC_DAPM_MUX("SPKDAT1R ANC Source", SND_SOC_NOPM, 0, 0,
1346 		 &wm5110_output_anc_src[9]),
1347 SND_SOC_DAPM_MUX("SPKDAT2L ANC Source", SND_SOC_NOPM, 0, 0,
1348 		 &wm5110_output_anc_src[10]),
1349 SND_SOC_DAPM_MUX("SPKDAT2R ANC Source", SND_SOC_NOPM, 0, 0,
1350 		 &wm5110_output_anc_src[11]),
1351 
1352 SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
1353 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
1354 SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 1,
1355 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
1356 SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 2,
1357 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
1358 SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 3,
1359 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
1360 SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 4,
1361 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
1362 SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 5,
1363 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
1364 SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 6,
1365 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
1366 SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 7,
1367 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
1368 
1369 SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
1370 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
1371 SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 1,
1372 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
1373 SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 2,
1374 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
1375 SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 3,
1376 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
1377 SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 4,
1378 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
1379 SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 5,
1380 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
1381 SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 6,
1382 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
1383 SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 7,
1384 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
1385 
1386 SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
1387 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
1388 SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 1,
1389 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
1390 SND_SOC_DAPM_AIF_OUT("AIF2TX3", NULL, 2,
1391 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX3_ENA_SHIFT, 0),
1392 SND_SOC_DAPM_AIF_OUT("AIF2TX4", NULL, 3,
1393 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX4_ENA_SHIFT, 0),
1394 SND_SOC_DAPM_AIF_OUT("AIF2TX5", NULL, 4,
1395 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX5_ENA_SHIFT, 0),
1396 SND_SOC_DAPM_AIF_OUT("AIF2TX6", NULL, 5,
1397 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX6_ENA_SHIFT, 0),
1398 
1399 SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
1400 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
1401 SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 1,
1402 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
1403 SND_SOC_DAPM_AIF_IN("AIF2RX3", NULL, 2,
1404 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX3_ENA_SHIFT, 0),
1405 SND_SOC_DAPM_AIF_IN("AIF2RX4", NULL, 3,
1406 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX4_ENA_SHIFT, 0),
1407 SND_SOC_DAPM_AIF_IN("AIF2RX5", NULL, 4,
1408 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX5_ENA_SHIFT, 0),
1409 SND_SOC_DAPM_AIF_IN("AIF2RX6", NULL, 5,
1410 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX6_ENA_SHIFT, 0),
1411 
1412 SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0,
1413 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1414 		    ARIZONA_SLIMRX1_ENA_SHIFT, 0),
1415 SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 1,
1416 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1417 		    ARIZONA_SLIMRX2_ENA_SHIFT, 0),
1418 SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 2,
1419 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1420 		    ARIZONA_SLIMRX3_ENA_SHIFT, 0),
1421 SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 3,
1422 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1423 		    ARIZONA_SLIMRX4_ENA_SHIFT, 0),
1424 SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL, 4,
1425 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1426 		    ARIZONA_SLIMRX5_ENA_SHIFT, 0),
1427 SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL, 5,
1428 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1429 		    ARIZONA_SLIMRX6_ENA_SHIFT, 0),
1430 SND_SOC_DAPM_AIF_IN("SLIMRX7", NULL, 6,
1431 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1432 		    ARIZONA_SLIMRX7_ENA_SHIFT, 0),
1433 SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 7,
1434 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1435 		    ARIZONA_SLIMRX8_ENA_SHIFT, 0),
1436 
1437 SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
1438 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1439 		     ARIZONA_SLIMTX1_ENA_SHIFT, 0),
1440 SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 1,
1441 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1442 		     ARIZONA_SLIMTX2_ENA_SHIFT, 0),
1443 SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 2,
1444 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1445 		     ARIZONA_SLIMTX3_ENA_SHIFT, 0),
1446 SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 3,
1447 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1448 		     ARIZONA_SLIMTX4_ENA_SHIFT, 0),
1449 SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 4,
1450 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1451 		     ARIZONA_SLIMTX5_ENA_SHIFT, 0),
1452 SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 5,
1453 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1454 		     ARIZONA_SLIMTX6_ENA_SHIFT, 0),
1455 SND_SOC_DAPM_AIF_OUT("SLIMTX7", NULL, 6,
1456 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1457 		     ARIZONA_SLIMTX7_ENA_SHIFT, 0),
1458 SND_SOC_DAPM_AIF_OUT("SLIMTX8", NULL, 7,
1459 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1460 		     ARIZONA_SLIMTX8_ENA_SHIFT, 0),
1461 
1462 SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
1463 		     ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
1464 SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 1,
1465 		     ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
1466 
1467 SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
1468 		    ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
1469 SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 1,
1470 		    ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
1471 
1472 SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
1473 		   ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, wm5110_hp_ev,
1474 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1475 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
1476 SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
1477 		   ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, wm5110_hp_ev,
1478 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1479 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
1480 SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1,
1481 		   ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1482 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1483 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
1484 SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1,
1485 		   ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1486 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1487 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
1488 SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
1489 		   ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1490 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1491 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
1492 SND_SOC_DAPM_PGA_E("OUT3R", ARIZONA_OUTPUT_ENABLES_1,
1493 		   ARIZONA_OUT3R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1494 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1495 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
1496 SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
1497 		   ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1498 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1499 SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
1500 		   ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1501 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1502 SND_SOC_DAPM_PGA_E("OUT6L", ARIZONA_OUTPUT_ENABLES_1,
1503 		   ARIZONA_OUT6L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1504 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1505 SND_SOC_DAPM_PGA_E("OUT6R", ARIZONA_OUTPUT_ENABLES_1,
1506 		   ARIZONA_OUT6R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1507 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1508 
1509 ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
1510 ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
1511 ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"),
1512 ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"),
1513 
1514 ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
1515 ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
1516 ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"),
1517 ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"),
1518 
1519 ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
1520 ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
1521 ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
1522 ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
1523 
1524 ARIZONA_MIXER_WIDGETS(Mic, "Mic"),
1525 ARIZONA_MIXER_WIDGETS(Noise, "Noise"),
1526 
1527 ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
1528 ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
1529 
1530 ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
1531 ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
1532 ARIZONA_MIXER_WIDGETS(OUT2L, "HPOUT2L"),
1533 ARIZONA_MIXER_WIDGETS(OUT2R, "HPOUT2R"),
1534 ARIZONA_MIXER_WIDGETS(OUT3L, "HPOUT3L"),
1535 ARIZONA_MIXER_WIDGETS(OUT3R, "HPOUT3R"),
1536 ARIZONA_MIXER_WIDGETS(SPKOUTL, "SPKOUTL"),
1537 ARIZONA_MIXER_WIDGETS(SPKOUTR, "SPKOUTR"),
1538 ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
1539 ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
1540 ARIZONA_MIXER_WIDGETS(SPKDAT2L, "SPKDAT2L"),
1541 ARIZONA_MIXER_WIDGETS(SPKDAT2R, "SPKDAT2R"),
1542 
1543 ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
1544 ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
1545 ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
1546 ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
1547 ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
1548 ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
1549 ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
1550 ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
1551 
1552 ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
1553 ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
1554 ARIZONA_MIXER_WIDGETS(AIF2TX3, "AIF2TX3"),
1555 ARIZONA_MIXER_WIDGETS(AIF2TX4, "AIF2TX4"),
1556 ARIZONA_MIXER_WIDGETS(AIF2TX5, "AIF2TX5"),
1557 ARIZONA_MIXER_WIDGETS(AIF2TX6, "AIF2TX6"),
1558 
1559 ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
1560 ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
1561 
1562 ARIZONA_MIXER_WIDGETS(SLIMTX1, "SLIMTX1"),
1563 ARIZONA_MIXER_WIDGETS(SLIMTX2, "SLIMTX2"),
1564 ARIZONA_MIXER_WIDGETS(SLIMTX3, "SLIMTX3"),
1565 ARIZONA_MIXER_WIDGETS(SLIMTX4, "SLIMTX4"),
1566 ARIZONA_MIXER_WIDGETS(SLIMTX5, "SLIMTX5"),
1567 ARIZONA_MIXER_WIDGETS(SLIMTX6, "SLIMTX6"),
1568 ARIZONA_MIXER_WIDGETS(SLIMTX7, "SLIMTX7"),
1569 ARIZONA_MIXER_WIDGETS(SLIMTX8, "SLIMTX8"),
1570 
1571 ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
1572 ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
1573 ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
1574 ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
1575 
1576 ARIZONA_DSP_WIDGETS(DSP1, "DSP1"),
1577 ARIZONA_DSP_WIDGETS(DSP2, "DSP2"),
1578 ARIZONA_DSP_WIDGETS(DSP3, "DSP3"),
1579 ARIZONA_DSP_WIDGETS(DSP4, "DSP4"),
1580 
1581 ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
1582 ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
1583 ARIZONA_MUX_WIDGETS(ISRC1DEC3, "ISRC1DEC3"),
1584 ARIZONA_MUX_WIDGETS(ISRC1DEC4, "ISRC1DEC4"),
1585 
1586 ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
1587 ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
1588 ARIZONA_MUX_WIDGETS(ISRC1INT3, "ISRC1INT3"),
1589 ARIZONA_MUX_WIDGETS(ISRC1INT4, "ISRC1INT4"),
1590 
1591 ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
1592 ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
1593 ARIZONA_MUX_WIDGETS(ISRC2DEC3, "ISRC2DEC3"),
1594 ARIZONA_MUX_WIDGETS(ISRC2DEC4, "ISRC2DEC4"),
1595 
1596 ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
1597 ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
1598 ARIZONA_MUX_WIDGETS(ISRC2INT3, "ISRC2INT3"),
1599 ARIZONA_MUX_WIDGETS(ISRC2INT4, "ISRC2INT4"),
1600 
1601 ARIZONA_MUX_WIDGETS(ISRC3DEC1, "ISRC3DEC1"),
1602 ARIZONA_MUX_WIDGETS(ISRC3DEC2, "ISRC3DEC2"),
1603 ARIZONA_MUX_WIDGETS(ISRC3DEC3, "ISRC3DEC3"),
1604 ARIZONA_MUX_WIDGETS(ISRC3DEC4, "ISRC3DEC4"),
1605 
1606 ARIZONA_MUX_WIDGETS(ISRC3INT1, "ISRC3INT1"),
1607 ARIZONA_MUX_WIDGETS(ISRC3INT2, "ISRC3INT2"),
1608 ARIZONA_MUX_WIDGETS(ISRC3INT3, "ISRC3INT3"),
1609 ARIZONA_MUX_WIDGETS(ISRC3INT4, "ISRC3INT4"),
1610 
1611 SND_SOC_DAPM_OUTPUT("HPOUT1L"),
1612 SND_SOC_DAPM_OUTPUT("HPOUT1R"),
1613 SND_SOC_DAPM_OUTPUT("HPOUT2L"),
1614 SND_SOC_DAPM_OUTPUT("HPOUT2R"),
1615 SND_SOC_DAPM_OUTPUT("HPOUT3L"),
1616 SND_SOC_DAPM_OUTPUT("HPOUT3R"),
1617 SND_SOC_DAPM_OUTPUT("SPKOUTLN"),
1618 SND_SOC_DAPM_OUTPUT("SPKOUTLP"),
1619 SND_SOC_DAPM_OUTPUT("SPKOUTRN"),
1620 SND_SOC_DAPM_OUTPUT("SPKOUTRP"),
1621 SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
1622 SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
1623 SND_SOC_DAPM_OUTPUT("SPKDAT2L"),
1624 SND_SOC_DAPM_OUTPUT("SPKDAT2R"),
1625 
1626 SND_SOC_DAPM_OUTPUT("MICSUPP"),
1627 };
1628 
1629 #define ARIZONA_MIXER_INPUT_ROUTES(name)	\
1630 	{ name, "Noise Generator", "Noise Generator" }, \
1631 	{ name, "Tone Generator 1", "Tone Generator 1" }, \
1632 	{ name, "Tone Generator 2", "Tone Generator 2" }, \
1633 	{ name, "Haptics", "HAPTICS" }, \
1634 	{ name, "AEC", "AEC Loopback" }, \
1635 	{ name, "IN1L", "IN1L PGA" }, \
1636 	{ name, "IN1R", "IN1R PGA" }, \
1637 	{ name, "IN2L", "IN2L PGA" }, \
1638 	{ name, "IN2R", "IN2R PGA" }, \
1639 	{ name, "IN3L", "IN3L PGA" }, \
1640 	{ name, "IN3R", "IN3R PGA" }, \
1641 	{ name, "IN4L", "IN4L PGA" }, \
1642 	{ name, "IN4R", "IN4R PGA" }, \
1643 	{ name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
1644 	{ name, "AIF1RX1", "AIF1RX1" }, \
1645 	{ name, "AIF1RX2", "AIF1RX2" }, \
1646 	{ name, "AIF1RX3", "AIF1RX3" }, \
1647 	{ name, "AIF1RX4", "AIF1RX4" }, \
1648 	{ name, "AIF1RX5", "AIF1RX5" }, \
1649 	{ name, "AIF1RX6", "AIF1RX6" }, \
1650 	{ name, "AIF1RX7", "AIF1RX7" }, \
1651 	{ name, "AIF1RX8", "AIF1RX8" }, \
1652 	{ name, "AIF2RX1", "AIF2RX1" }, \
1653 	{ name, "AIF2RX2", "AIF2RX2" }, \
1654 	{ name, "AIF2RX3", "AIF2RX3" }, \
1655 	{ name, "AIF2RX4", "AIF2RX4" }, \
1656 	{ name, "AIF2RX5", "AIF2RX5" }, \
1657 	{ name, "AIF2RX6", "AIF2RX6" }, \
1658 	{ name, "AIF3RX1", "AIF3RX1" }, \
1659 	{ name, "AIF3RX2", "AIF3RX2" }, \
1660 	{ name, "SLIMRX1", "SLIMRX1" }, \
1661 	{ name, "SLIMRX2", "SLIMRX2" }, \
1662 	{ name, "SLIMRX3", "SLIMRX3" }, \
1663 	{ name, "SLIMRX4", "SLIMRX4" }, \
1664 	{ name, "SLIMRX5", "SLIMRX5" }, \
1665 	{ name, "SLIMRX6", "SLIMRX6" }, \
1666 	{ name, "SLIMRX7", "SLIMRX7" }, \
1667 	{ name, "SLIMRX8", "SLIMRX8" }, \
1668 	{ name, "EQ1", "EQ1" }, \
1669 	{ name, "EQ2", "EQ2" }, \
1670 	{ name, "EQ3", "EQ3" }, \
1671 	{ name, "EQ4", "EQ4" }, \
1672 	{ name, "DRC1L", "DRC1L" }, \
1673 	{ name, "DRC1R", "DRC1R" }, \
1674 	{ name, "DRC2L", "DRC2L" }, \
1675 	{ name, "DRC2R", "DRC2R" }, \
1676 	{ name, "LHPF1", "LHPF1" }, \
1677 	{ name, "LHPF2", "LHPF2" }, \
1678 	{ name, "LHPF3", "LHPF3" }, \
1679 	{ name, "LHPF4", "LHPF4" }, \
1680 	{ name, "ASRC1L", "ASRC1L" }, \
1681 	{ name, "ASRC1R", "ASRC1R" }, \
1682 	{ name, "ASRC2L", "ASRC2L" }, \
1683 	{ name, "ASRC2R", "ASRC2R" }, \
1684 	{ name, "ISRC1DEC1", "ISRC1DEC1" }, \
1685 	{ name, "ISRC1DEC2", "ISRC1DEC2" }, \
1686 	{ name, "ISRC1DEC3", "ISRC1DEC3" }, \
1687 	{ name, "ISRC1DEC4", "ISRC1DEC4" }, \
1688 	{ name, "ISRC1INT1", "ISRC1INT1" }, \
1689 	{ name, "ISRC1INT2", "ISRC1INT2" }, \
1690 	{ name, "ISRC1INT3", "ISRC1INT3" }, \
1691 	{ name, "ISRC1INT4", "ISRC1INT4" }, \
1692 	{ name, "ISRC2DEC1", "ISRC2DEC1" }, \
1693 	{ name, "ISRC2DEC2", "ISRC2DEC2" }, \
1694 	{ name, "ISRC2DEC3", "ISRC2DEC3" }, \
1695 	{ name, "ISRC2DEC4", "ISRC2DEC4" }, \
1696 	{ name, "ISRC2INT1", "ISRC2INT1" }, \
1697 	{ name, "ISRC2INT2", "ISRC2INT2" }, \
1698 	{ name, "ISRC2INT3", "ISRC2INT3" }, \
1699 	{ name, "ISRC2INT4", "ISRC2INT4" }, \
1700 	{ name, "ISRC3DEC1", "ISRC3DEC1" }, \
1701 	{ name, "ISRC3DEC2", "ISRC3DEC2" }, \
1702 	{ name, "ISRC3DEC3", "ISRC3DEC3" }, \
1703 	{ name, "ISRC3DEC4", "ISRC3DEC4" }, \
1704 	{ name, "ISRC3INT1", "ISRC3INT1" }, \
1705 	{ name, "ISRC3INT2", "ISRC3INT2" }, \
1706 	{ name, "ISRC3INT3", "ISRC3INT3" }, \
1707 	{ name, "ISRC3INT4", "ISRC3INT4" }, \
1708 	{ name, "DSP1.1", "DSP1" }, \
1709 	{ name, "DSP1.2", "DSP1" }, \
1710 	{ name, "DSP1.3", "DSP1" }, \
1711 	{ name, "DSP1.4", "DSP1" }, \
1712 	{ name, "DSP1.5", "DSP1" }, \
1713 	{ name, "DSP1.6", "DSP1" }, \
1714 	{ name, "DSP2.1", "DSP2" }, \
1715 	{ name, "DSP2.2", "DSP2" }, \
1716 	{ name, "DSP2.3", "DSP2" }, \
1717 	{ name, "DSP2.4", "DSP2" }, \
1718 	{ name, "DSP2.5", "DSP2" }, \
1719 	{ name, "DSP2.6", "DSP2" }, \
1720 	{ name, "DSP3.1", "DSP3" }, \
1721 	{ name, "DSP3.2", "DSP3" }, \
1722 	{ name, "DSP3.3", "DSP3" }, \
1723 	{ name, "DSP3.4", "DSP3" }, \
1724 	{ name, "DSP3.5", "DSP3" }, \
1725 	{ name, "DSP3.6", "DSP3" }, \
1726 	{ name, "DSP4.1", "DSP4" }, \
1727 	{ name, "DSP4.2", "DSP4" }, \
1728 	{ name, "DSP4.3", "DSP4" }, \
1729 	{ name, "DSP4.4", "DSP4" }, \
1730 	{ name, "DSP4.5", "DSP4" }, \
1731 	{ name, "DSP4.6", "DSP4" }
1732 
1733 static const struct snd_soc_dapm_route wm5110_dapm_routes[] = {
1734 	{ "AIF2 Capture", NULL, "DBVDD2" },
1735 	{ "AIF2 Playback", NULL, "DBVDD2" },
1736 
1737 	{ "AIF3 Capture", NULL, "DBVDD3" },
1738 	{ "AIF3 Playback", NULL, "DBVDD3" },
1739 
1740 	{ "OUT1L", NULL, "CPVDD" },
1741 	{ "OUT1R", NULL, "CPVDD" },
1742 	{ "OUT2L", NULL, "CPVDD" },
1743 	{ "OUT2R", NULL, "CPVDD" },
1744 	{ "OUT3L", NULL, "CPVDD" },
1745 	{ "OUT3R", NULL, "CPVDD" },
1746 
1747 	{ "OUT4L", NULL, "SPKVDDL" },
1748 	{ "OUT4R", NULL, "SPKVDDR" },
1749 
1750 	{ "OUT1L", NULL, "SYSCLK" },
1751 	{ "OUT1R", NULL, "SYSCLK" },
1752 	{ "OUT2L", NULL, "SYSCLK" },
1753 	{ "OUT2R", NULL, "SYSCLK" },
1754 	{ "OUT3L", NULL, "SYSCLK" },
1755 	{ "OUT3R", NULL, "SYSCLK" },
1756 	{ "OUT4L", NULL, "SYSCLK" },
1757 	{ "OUT4R", NULL, "SYSCLK" },
1758 	{ "OUT5L", NULL, "SYSCLK" },
1759 	{ "OUT5R", NULL, "SYSCLK" },
1760 	{ "OUT6L", NULL, "SYSCLK" },
1761 	{ "OUT6R", NULL, "SYSCLK" },
1762 
1763 	{ "IN1L", NULL, "SYSCLK" },
1764 	{ "IN1R", NULL, "SYSCLK" },
1765 	{ "IN2L", NULL, "SYSCLK" },
1766 	{ "IN2R", NULL, "SYSCLK" },
1767 	{ "IN3L", NULL, "SYSCLK" },
1768 	{ "IN3R", NULL, "SYSCLK" },
1769 	{ "IN4L", NULL, "SYSCLK" },
1770 	{ "IN4R", NULL, "SYSCLK" },
1771 
1772 	{ "ASRC1L", NULL, "SYSCLK" },
1773 	{ "ASRC1R", NULL, "SYSCLK" },
1774 	{ "ASRC2L", NULL, "SYSCLK" },
1775 	{ "ASRC2R", NULL, "SYSCLK" },
1776 
1777 	{ "ASRC1L", NULL, "ASYNCCLK" },
1778 	{ "ASRC1R", NULL, "ASYNCCLK" },
1779 	{ "ASRC2L", NULL, "ASYNCCLK" },
1780 	{ "ASRC2R", NULL, "ASYNCCLK" },
1781 
1782 	{ "MICBIAS1", NULL, "MICVDD" },
1783 	{ "MICBIAS2", NULL, "MICVDD" },
1784 	{ "MICBIAS3", NULL, "MICVDD" },
1785 
1786 	{ "Noise Generator", NULL, "SYSCLK" },
1787 	{ "Tone Generator 1", NULL, "SYSCLK" },
1788 	{ "Tone Generator 2", NULL, "SYSCLK" },
1789 
1790 	{ "Noise Generator", NULL, "NOISE" },
1791 	{ "Tone Generator 1", NULL, "TONE" },
1792 	{ "Tone Generator 2", NULL, "TONE" },
1793 
1794 	{ "AIF1 Capture", NULL, "AIF1TX1" },
1795 	{ "AIF1 Capture", NULL, "AIF1TX2" },
1796 	{ "AIF1 Capture", NULL, "AIF1TX3" },
1797 	{ "AIF1 Capture", NULL, "AIF1TX4" },
1798 	{ "AIF1 Capture", NULL, "AIF1TX5" },
1799 	{ "AIF1 Capture", NULL, "AIF1TX6" },
1800 	{ "AIF1 Capture", NULL, "AIF1TX7" },
1801 	{ "AIF1 Capture", NULL, "AIF1TX8" },
1802 
1803 	{ "AIF1RX1", NULL, "AIF1 Playback" },
1804 	{ "AIF1RX2", NULL, "AIF1 Playback" },
1805 	{ "AIF1RX3", NULL, "AIF1 Playback" },
1806 	{ "AIF1RX4", NULL, "AIF1 Playback" },
1807 	{ "AIF1RX5", NULL, "AIF1 Playback" },
1808 	{ "AIF1RX6", NULL, "AIF1 Playback" },
1809 	{ "AIF1RX7", NULL, "AIF1 Playback" },
1810 	{ "AIF1RX8", NULL, "AIF1 Playback" },
1811 
1812 	{ "AIF2 Capture", NULL, "AIF2TX1" },
1813 	{ "AIF2 Capture", NULL, "AIF2TX2" },
1814 	{ "AIF2 Capture", NULL, "AIF2TX3" },
1815 	{ "AIF2 Capture", NULL, "AIF2TX4" },
1816 	{ "AIF2 Capture", NULL, "AIF2TX5" },
1817 	{ "AIF2 Capture", NULL, "AIF2TX6" },
1818 
1819 	{ "AIF2RX1", NULL, "AIF2 Playback" },
1820 	{ "AIF2RX2", NULL, "AIF2 Playback" },
1821 	{ "AIF2RX3", NULL, "AIF2 Playback" },
1822 	{ "AIF2RX4", NULL, "AIF2 Playback" },
1823 	{ "AIF2RX5", NULL, "AIF2 Playback" },
1824 	{ "AIF2RX6", NULL, "AIF2 Playback" },
1825 
1826 	{ "AIF3 Capture", NULL, "AIF3TX1" },
1827 	{ "AIF3 Capture", NULL, "AIF3TX2" },
1828 
1829 	{ "AIF3RX1", NULL, "AIF3 Playback" },
1830 	{ "AIF3RX2", NULL, "AIF3 Playback" },
1831 
1832 	{ "Slim1 Capture", NULL, "SLIMTX1" },
1833 	{ "Slim1 Capture", NULL, "SLIMTX2" },
1834 	{ "Slim1 Capture", NULL, "SLIMTX3" },
1835 	{ "Slim1 Capture", NULL, "SLIMTX4" },
1836 
1837 	{ "SLIMRX1", NULL, "Slim1 Playback" },
1838 	{ "SLIMRX2", NULL, "Slim1 Playback" },
1839 	{ "SLIMRX3", NULL, "Slim1 Playback" },
1840 	{ "SLIMRX4", NULL, "Slim1 Playback" },
1841 
1842 	{ "Slim2 Capture", NULL, "SLIMTX5" },
1843 	{ "Slim2 Capture", NULL, "SLIMTX6" },
1844 
1845 	{ "SLIMRX5", NULL, "Slim2 Playback" },
1846 	{ "SLIMRX6", NULL, "Slim2 Playback" },
1847 
1848 	{ "Slim3 Capture", NULL, "SLIMTX7" },
1849 	{ "Slim3 Capture", NULL, "SLIMTX8" },
1850 
1851 	{ "SLIMRX7", NULL, "Slim3 Playback" },
1852 	{ "SLIMRX8", NULL, "Slim3 Playback" },
1853 
1854 	{ "AIF1 Playback", NULL, "SYSCLK" },
1855 	{ "AIF2 Playback", NULL, "SYSCLK" },
1856 	{ "AIF3 Playback", NULL, "SYSCLK" },
1857 	{ "Slim1 Playback", NULL, "SYSCLK" },
1858 	{ "Slim2 Playback", NULL, "SYSCLK" },
1859 	{ "Slim3 Playback", NULL, "SYSCLK" },
1860 
1861 	{ "AIF1 Capture", NULL, "SYSCLK" },
1862 	{ "AIF2 Capture", NULL, "SYSCLK" },
1863 	{ "AIF3 Capture", NULL, "SYSCLK" },
1864 	{ "Slim1 Capture", NULL, "SYSCLK" },
1865 	{ "Slim2 Capture", NULL, "SYSCLK" },
1866 	{ "Slim3 Capture", NULL, "SYSCLK" },
1867 
1868 	{ "Voice Control DSP", NULL, "DSP3" },
1869 
1870 	{ "Audio Trace DSP", NULL, "DSP1" },
1871 
1872 	{ "IN1L PGA", NULL, "IN1L" },
1873 	{ "IN1R PGA", NULL, "IN1R" },
1874 
1875 	{ "IN2L PGA", NULL, "IN2L" },
1876 	{ "IN2R PGA", NULL, "IN2R" },
1877 
1878 	{ "IN3L PGA", NULL, "IN3L" },
1879 	{ "IN3R PGA", NULL, "IN3R" },
1880 
1881 	{ "IN4L PGA", NULL, "IN4L" },
1882 	{ "IN4R PGA", NULL, "IN4R" },
1883 
1884 	ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
1885 	ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
1886 	ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"),
1887 	ARIZONA_MIXER_ROUTES("OUT2R", "HPOUT2R"),
1888 	ARIZONA_MIXER_ROUTES("OUT3L", "HPOUT3L"),
1889 	ARIZONA_MIXER_ROUTES("OUT3R", "HPOUT3R"),
1890 
1891 	ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUTL"),
1892 	ARIZONA_MIXER_ROUTES("OUT4R", "SPKOUTR"),
1893 	ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
1894 	ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
1895 	ARIZONA_MIXER_ROUTES("OUT6L", "SPKDAT2L"),
1896 	ARIZONA_MIXER_ROUTES("OUT6R", "SPKDAT2R"),
1897 
1898 	ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
1899 	ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
1900 
1901 	ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
1902 	ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
1903 	ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
1904 	ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
1905 	ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
1906 	ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
1907 	ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
1908 	ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
1909 
1910 	ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
1911 	ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
1912 	ARIZONA_MIXER_ROUTES("AIF2TX3", "AIF2TX3"),
1913 	ARIZONA_MIXER_ROUTES("AIF2TX4", "AIF2TX4"),
1914 	ARIZONA_MIXER_ROUTES("AIF2TX5", "AIF2TX5"),
1915 	ARIZONA_MIXER_ROUTES("AIF2TX6", "AIF2TX6"),
1916 
1917 	ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
1918 	ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
1919 
1920 	ARIZONA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
1921 	ARIZONA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
1922 	ARIZONA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
1923 	ARIZONA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
1924 	ARIZONA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
1925 	ARIZONA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
1926 	ARIZONA_MIXER_ROUTES("SLIMTX7", "SLIMTX7"),
1927 	ARIZONA_MIXER_ROUTES("SLIMTX8", "SLIMTX8"),
1928 
1929 	ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
1930 	ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
1931 	ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
1932 	ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
1933 
1934 	ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
1935 	ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
1936 	ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"),
1937 	ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"),
1938 
1939 	ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
1940 	ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
1941 	ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
1942 	ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
1943 
1944 	ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Noise"),
1945 	ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Mic"),
1946 
1947 	ARIZONA_MUX_ROUTES("ASRC1L", "ASRC1L"),
1948 	ARIZONA_MUX_ROUTES("ASRC1R", "ASRC1R"),
1949 	ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"),
1950 	ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"),
1951 
1952 	ARIZONA_DSP_ROUTES("DSP1"),
1953 	ARIZONA_DSP_ROUTES("DSP2"),
1954 	ARIZONA_DSP_ROUTES("DSP3"),
1955 	ARIZONA_DSP_ROUTES("DSP4"),
1956 
1957 	ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
1958 	ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
1959 	ARIZONA_MUX_ROUTES("ISRC1INT3", "ISRC1INT3"),
1960 	ARIZONA_MUX_ROUTES("ISRC1INT4", "ISRC1INT4"),
1961 
1962 	ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
1963 	ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
1964 	ARIZONA_MUX_ROUTES("ISRC1DEC3", "ISRC1DEC3"),
1965 	ARIZONA_MUX_ROUTES("ISRC1DEC4", "ISRC1DEC4"),
1966 
1967 	ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
1968 	ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
1969 	ARIZONA_MUX_ROUTES("ISRC2INT3", "ISRC2INT3"),
1970 	ARIZONA_MUX_ROUTES("ISRC2INT4", "ISRC2INT4"),
1971 
1972 	ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
1973 	ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
1974 	ARIZONA_MUX_ROUTES("ISRC2DEC3", "ISRC2DEC3"),
1975 	ARIZONA_MUX_ROUTES("ISRC2DEC4", "ISRC2DEC4"),
1976 
1977 	ARIZONA_MUX_ROUTES("ISRC3INT1", "ISRC3INT1"),
1978 	ARIZONA_MUX_ROUTES("ISRC3INT2", "ISRC3INT2"),
1979 	ARIZONA_MUX_ROUTES("ISRC3INT3", "ISRC3INT3"),
1980 	ARIZONA_MUX_ROUTES("ISRC3INT4", "ISRC3INT4"),
1981 
1982 	ARIZONA_MUX_ROUTES("ISRC3DEC1", "ISRC3DEC1"),
1983 	ARIZONA_MUX_ROUTES("ISRC3DEC2", "ISRC3DEC2"),
1984 	ARIZONA_MUX_ROUTES("ISRC3DEC3", "ISRC3DEC3"),
1985 	ARIZONA_MUX_ROUTES("ISRC3DEC4", "ISRC3DEC4"),
1986 
1987 	{ "AEC Loopback", "HPOUT1L", "OUT1L" },
1988 	{ "AEC Loopback", "HPOUT1R", "OUT1R" },
1989 	{ "HPOUT1L", NULL, "OUT1L" },
1990 	{ "HPOUT1R", NULL, "OUT1R" },
1991 
1992 	{ "AEC Loopback", "HPOUT2L", "OUT2L" },
1993 	{ "AEC Loopback", "HPOUT2R", "OUT2R" },
1994 	{ "HPOUT2L", NULL, "OUT2L" },
1995 	{ "HPOUT2R", NULL, "OUT2R" },
1996 
1997 	{ "AEC Loopback", "HPOUT3L", "OUT3L" },
1998 	{ "AEC Loopback", "HPOUT3R", "OUT3R" },
1999 	{ "HPOUT3L", NULL, "OUT3L" },
2000 	{ "HPOUT3R", NULL, "OUT3R" },
2001 
2002 	{ "AEC Loopback", "SPKOUTL", "OUT4L" },
2003 	{ "SPKOUTLN", NULL, "OUT4L" },
2004 	{ "SPKOUTLP", NULL, "OUT4L" },
2005 
2006 	{ "AEC Loopback", "SPKOUTR", "OUT4R" },
2007 	{ "SPKOUTRN", NULL, "OUT4R" },
2008 	{ "SPKOUTRP", NULL, "OUT4R" },
2009 
2010 	{ "AEC Loopback", "SPKDAT1L", "OUT5L" },
2011 	{ "AEC Loopback", "SPKDAT1R", "OUT5R" },
2012 	{ "SPKDAT1L", NULL, "OUT5L" },
2013 	{ "SPKDAT1R", NULL, "OUT5R" },
2014 
2015 	{ "AEC Loopback", "SPKDAT2L", "OUT6L" },
2016 	{ "AEC Loopback", "SPKDAT2R", "OUT6R" },
2017 	{ "SPKDAT2L", NULL, "OUT6L" },
2018 	{ "SPKDAT2R", NULL, "OUT6R" },
2019 
2020 	WM5110_RXANC_INPUT_ROUTES("RXANCL", "RXANCL"),
2021 	WM5110_RXANC_INPUT_ROUTES("RXANCR", "RXANCR"),
2022 
2023 	WM5110_RXANC_OUTPUT_ROUTES("OUT1L", "HPOUT1L"),
2024 	WM5110_RXANC_OUTPUT_ROUTES("OUT1R", "HPOUT1R"),
2025 	WM5110_RXANC_OUTPUT_ROUTES("OUT2L", "HPOUT2L"),
2026 	WM5110_RXANC_OUTPUT_ROUTES("OUT2R", "HPOUT2R"),
2027 	WM5110_RXANC_OUTPUT_ROUTES("OUT3L", "HPOUT3L"),
2028 	WM5110_RXANC_OUTPUT_ROUTES("OUT3R", "HPOUT3R"),
2029 	WM5110_RXANC_OUTPUT_ROUTES("OUT4L", "SPKOUTL"),
2030 	WM5110_RXANC_OUTPUT_ROUTES("OUT4R", "SPKOUTR"),
2031 	WM5110_RXANC_OUTPUT_ROUTES("OUT5L", "SPKDAT1L"),
2032 	WM5110_RXANC_OUTPUT_ROUTES("OUT5R", "SPKDAT1R"),
2033 	WM5110_RXANC_OUTPUT_ROUTES("OUT6L", "SPKDAT2L"),
2034 	WM5110_RXANC_OUTPUT_ROUTES("OUT6R", "SPKDAT2R"),
2035 
2036 	{ "MICSUPP", NULL, "SYSCLK" },
2037 
2038 	{ "DRC1 Signal Activity", NULL, "SYSCLK" },
2039 	{ "DRC2 Signal Activity", NULL, "SYSCLK" },
2040 	{ "DRC1 Signal Activity", NULL, "DRC1L" },
2041 	{ "DRC1 Signal Activity", NULL, "DRC1R" },
2042 	{ "DRC2 Signal Activity", NULL, "DRC2L" },
2043 	{ "DRC2 Signal Activity", NULL, "DRC2R" },
2044 
2045 	{ "DSP Voice Trigger", NULL, "SYSCLK" },
2046 	{ "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" },
2047 	{ "DSP3 Voice Trigger", "Switch", "DSP3" },
2048 };
2049 
wm5110_set_fll(struct snd_soc_component * component,int fll_id,int source,unsigned int Fref,unsigned int Fout)2050 static int wm5110_set_fll(struct snd_soc_component *component, int fll_id,
2051 			  int source, unsigned int Fref, unsigned int Fout)
2052 {
2053 	struct wm5110_priv *wm5110 = snd_soc_component_get_drvdata(component);
2054 
2055 	switch (fll_id) {
2056 	case WM5110_FLL1:
2057 		return arizona_set_fll(&wm5110->fll[0], source, Fref, Fout);
2058 	case WM5110_FLL2:
2059 		return arizona_set_fll(&wm5110->fll[1], source, Fref, Fout);
2060 	case WM5110_FLL1_REFCLK:
2061 		return arizona_set_fll_refclk(&wm5110->fll[0], source, Fref,
2062 					      Fout);
2063 	case WM5110_FLL2_REFCLK:
2064 		return arizona_set_fll_refclk(&wm5110->fll[1], source, Fref,
2065 					      Fout);
2066 	default:
2067 		return -EINVAL;
2068 	}
2069 }
2070 
2071 #define WM5110_RATES SNDRV_PCM_RATE_KNOT
2072 
2073 #define WM5110_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
2074 			SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
2075 
2076 static const struct snd_soc_dai_ops wm5110_dai_ops = {
2077 	.compress_new = snd_soc_new_compress,
2078 };
2079 
2080 static struct snd_soc_dai_driver wm5110_dai[] = {
2081 	{
2082 		.name = "wm5110-aif1",
2083 		.id = 1,
2084 		.base = ARIZONA_AIF1_BCLK_CTRL,
2085 		.playback = {
2086 			.stream_name = "AIF1 Playback",
2087 			.channels_min = 1,
2088 			.channels_max = 8,
2089 			.rates = WM5110_RATES,
2090 			.formats = WM5110_FORMATS,
2091 		},
2092 		.capture = {
2093 			 .stream_name = "AIF1 Capture",
2094 			 .channels_min = 1,
2095 			 .channels_max = 8,
2096 			 .rates = WM5110_RATES,
2097 			 .formats = WM5110_FORMATS,
2098 		 },
2099 		.ops = &arizona_dai_ops,
2100 		.symmetric_rate = 1,
2101 		.symmetric_sample_bits = 1,
2102 	},
2103 	{
2104 		.name = "wm5110-aif2",
2105 		.id = 2,
2106 		.base = ARIZONA_AIF2_BCLK_CTRL,
2107 		.playback = {
2108 			.stream_name = "AIF2 Playback",
2109 			.channels_min = 1,
2110 			.channels_max = 6,
2111 			.rates = WM5110_RATES,
2112 			.formats = WM5110_FORMATS,
2113 		},
2114 		.capture = {
2115 			 .stream_name = "AIF2 Capture",
2116 			 .channels_min = 1,
2117 			 .channels_max = 6,
2118 			 .rates = WM5110_RATES,
2119 			 .formats = WM5110_FORMATS,
2120 		 },
2121 		.ops = &arizona_dai_ops,
2122 		.symmetric_rate = 1,
2123 		.symmetric_sample_bits = 1,
2124 	},
2125 	{
2126 		.name = "wm5110-aif3",
2127 		.id = 3,
2128 		.base = ARIZONA_AIF3_BCLK_CTRL,
2129 		.playback = {
2130 			.stream_name = "AIF3 Playback",
2131 			.channels_min = 1,
2132 			.channels_max = 2,
2133 			.rates = WM5110_RATES,
2134 			.formats = WM5110_FORMATS,
2135 		},
2136 		.capture = {
2137 			 .stream_name = "AIF3 Capture",
2138 			 .channels_min = 1,
2139 			 .channels_max = 2,
2140 			 .rates = WM5110_RATES,
2141 			 .formats = WM5110_FORMATS,
2142 		 },
2143 		.ops = &arizona_dai_ops,
2144 		.symmetric_rate = 1,
2145 		.symmetric_sample_bits = 1,
2146 	},
2147 	{
2148 		.name = "wm5110-slim1",
2149 		.id = 4,
2150 		.playback = {
2151 			.stream_name = "Slim1 Playback",
2152 			.channels_min = 1,
2153 			.channels_max = 4,
2154 			.rates = WM5110_RATES,
2155 			.formats = WM5110_FORMATS,
2156 		},
2157 		.capture = {
2158 			 .stream_name = "Slim1 Capture",
2159 			 .channels_min = 1,
2160 			 .channels_max = 4,
2161 			 .rates = WM5110_RATES,
2162 			 .formats = WM5110_FORMATS,
2163 		 },
2164 		.ops = &arizona_simple_dai_ops,
2165 	},
2166 	{
2167 		.name = "wm5110-slim2",
2168 		.id = 5,
2169 		.playback = {
2170 			.stream_name = "Slim2 Playback",
2171 			.channels_min = 1,
2172 			.channels_max = 2,
2173 			.rates = WM5110_RATES,
2174 			.formats = WM5110_FORMATS,
2175 		},
2176 		.capture = {
2177 			 .stream_name = "Slim2 Capture",
2178 			 .channels_min = 1,
2179 			 .channels_max = 2,
2180 			 .rates = WM5110_RATES,
2181 			 .formats = WM5110_FORMATS,
2182 		 },
2183 		.ops = &arizona_simple_dai_ops,
2184 	},
2185 	{
2186 		.name = "wm5110-slim3",
2187 		.id = 6,
2188 		.playback = {
2189 			.stream_name = "Slim3 Playback",
2190 			.channels_min = 1,
2191 			.channels_max = 2,
2192 			.rates = WM5110_RATES,
2193 			.formats = WM5110_FORMATS,
2194 		},
2195 		.capture = {
2196 			 .stream_name = "Slim3 Capture",
2197 			 .channels_min = 1,
2198 			 .channels_max = 2,
2199 			 .rates = WM5110_RATES,
2200 			 .formats = WM5110_FORMATS,
2201 		 },
2202 		.ops = &arizona_simple_dai_ops,
2203 	},
2204 	{
2205 		.name = "wm5110-cpu-voicectrl",
2206 		.capture = {
2207 			.stream_name = "Voice Control CPU",
2208 			.channels_min = 1,
2209 			.channels_max = 1,
2210 			.rates = WM5110_RATES,
2211 			.formats = WM5110_FORMATS,
2212 		},
2213 		.ops = &wm5110_dai_ops,
2214 	},
2215 	{
2216 		.name = "wm5110-dsp-voicectrl",
2217 		.capture = {
2218 			.stream_name = "Voice Control DSP",
2219 			.channels_min = 1,
2220 			.channels_max = 1,
2221 			.rates = WM5110_RATES,
2222 			.formats = WM5110_FORMATS,
2223 		},
2224 	},
2225 	{
2226 		.name = "wm5110-cpu-trace",
2227 		.capture = {
2228 			.stream_name = "Audio Trace CPU",
2229 			.channels_min = 1,
2230 			.channels_max = 6,
2231 			.rates = WM5110_RATES,
2232 			.formats = WM5110_FORMATS,
2233 		},
2234 		.ops = &wm5110_dai_ops,
2235 	},
2236 	{
2237 		.name = "wm5110-dsp-trace",
2238 		.capture = {
2239 			.stream_name = "Audio Trace DSP",
2240 			.channels_min = 1,
2241 			.channels_max = 6,
2242 			.rates = WM5110_RATES,
2243 			.formats = WM5110_FORMATS,
2244 		},
2245 	},
2246 };
2247 
wm5110_open(struct snd_soc_component * component,struct snd_compr_stream * stream)2248 static int wm5110_open(struct snd_soc_component *component,
2249 		       struct snd_compr_stream *stream)
2250 {
2251 	struct snd_soc_pcm_runtime *rtd = stream->private_data;
2252 	struct wm5110_priv *priv = snd_soc_component_get_drvdata(component);
2253 	struct arizona *arizona = priv->core.arizona;
2254 	int n_adsp;
2255 
2256 	if (strcmp(asoc_rtd_to_codec(rtd, 0)->name, "wm5110-dsp-voicectrl") == 0) {
2257 		n_adsp = 2;
2258 	} else if (strcmp(asoc_rtd_to_codec(rtd, 0)->name, "wm5110-dsp-trace") == 0) {
2259 		n_adsp = 0;
2260 	} else {
2261 		dev_err(arizona->dev,
2262 			"No suitable compressed stream for DAI '%s'\n",
2263 			asoc_rtd_to_codec(rtd, 0)->name);
2264 		return -EINVAL;
2265 	}
2266 
2267 	return wm_adsp_compr_open(&priv->core.adsp[n_adsp], stream);
2268 }
2269 
wm5110_adsp2_irq(int irq,void * data)2270 static irqreturn_t wm5110_adsp2_irq(int irq, void *data)
2271 {
2272 	struct wm5110_priv *priv = data;
2273 	struct arizona *arizona = priv->core.arizona;
2274 	struct arizona_voice_trigger_info info;
2275 	int serviced = 0;
2276 	int i, ret;
2277 
2278 	for (i = 0; i < WM5110_NUM_ADSP; ++i) {
2279 		ret = wm_adsp_compr_handle_irq(&priv->core.adsp[i]);
2280 		if (ret != -ENODEV)
2281 			serviced++;
2282 		if (ret == WM_ADSP_COMPR_VOICE_TRIGGER) {
2283 			info.core = i;
2284 			arizona_call_notifiers(arizona,
2285 					       ARIZONA_NOTIFY_VOICE_TRIGGER,
2286 					       &info);
2287 		}
2288 	}
2289 
2290 	if (!serviced) {
2291 		dev_err(arizona->dev, "Spurious compressed data IRQ\n");
2292 		return IRQ_NONE;
2293 	}
2294 
2295 	return IRQ_HANDLED;
2296 }
2297 
wm5110_component_probe(struct snd_soc_component * component)2298 static int wm5110_component_probe(struct snd_soc_component *component)
2299 {
2300 	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2301 	struct wm5110_priv *priv = snd_soc_component_get_drvdata(component);
2302 	struct arizona *arizona = priv->core.arizona;
2303 	int i, ret;
2304 
2305 	arizona->dapm = dapm;
2306 	snd_soc_component_init_regmap(component, arizona->regmap);
2307 
2308 	ret = arizona_init_spk(component);
2309 	if (ret < 0)
2310 		return ret;
2311 
2312 	arizona_init_gpio(component);
2313 	arizona_init_mono(component);
2314 
2315 	for (i = 0; i < WM5110_NUM_ADSP; ++i) {
2316 		ret = wm_adsp2_component_probe(&priv->core.adsp[i], component);
2317 		if (ret)
2318 			goto err_adsp2_codec_probe;
2319 	}
2320 
2321 	ret = snd_soc_add_component_controls(component,
2322 					     arizona_adsp2_rate_controls,
2323 					     WM5110_NUM_ADSP);
2324 	if (ret)
2325 		goto err_adsp2_codec_probe;
2326 
2327 	snd_soc_component_disable_pin(component, "HAPTICS");
2328 
2329 	return 0;
2330 
2331 err_adsp2_codec_probe:
2332 	for (--i; i >= 0; --i)
2333 		wm_adsp2_component_remove(&priv->core.adsp[i], component);
2334 
2335 	return ret;
2336 }
2337 
wm5110_component_remove(struct snd_soc_component * component)2338 static void wm5110_component_remove(struct snd_soc_component *component)
2339 {
2340 	struct wm5110_priv *priv = snd_soc_component_get_drvdata(component);
2341 	int i;
2342 
2343 	for (i = 0; i < WM5110_NUM_ADSP; ++i)
2344 		wm_adsp2_component_remove(&priv->core.adsp[i], component);
2345 
2346 	priv->core.arizona->dapm = NULL;
2347 }
2348 
2349 #define WM5110_DIG_VU 0x0200
2350 
2351 static unsigned int wm5110_digital_vu[] = {
2352 	ARIZONA_DAC_DIGITAL_VOLUME_1L,
2353 	ARIZONA_DAC_DIGITAL_VOLUME_1R,
2354 	ARIZONA_DAC_DIGITAL_VOLUME_2L,
2355 	ARIZONA_DAC_DIGITAL_VOLUME_2R,
2356 	ARIZONA_DAC_DIGITAL_VOLUME_3L,
2357 	ARIZONA_DAC_DIGITAL_VOLUME_3R,
2358 	ARIZONA_DAC_DIGITAL_VOLUME_4L,
2359 	ARIZONA_DAC_DIGITAL_VOLUME_4R,
2360 	ARIZONA_DAC_DIGITAL_VOLUME_5L,
2361 	ARIZONA_DAC_DIGITAL_VOLUME_5R,
2362 	ARIZONA_DAC_DIGITAL_VOLUME_6L,
2363 	ARIZONA_DAC_DIGITAL_VOLUME_6R,
2364 };
2365 
2366 static const struct snd_compress_ops wm5110_compress_ops = {
2367 	.open		= wm5110_open,
2368 	.free		= wm_adsp_compr_free,
2369 	.set_params	= wm_adsp_compr_set_params,
2370 	.get_caps	= wm_adsp_compr_get_caps,
2371 	.trigger	= wm_adsp_compr_trigger,
2372 	.pointer	= wm_adsp_compr_pointer,
2373 	.copy		= wm_adsp_compr_copy,
2374 };
2375 
2376 static const struct snd_soc_component_driver soc_component_dev_wm5110 = {
2377 	.probe			= wm5110_component_probe,
2378 	.remove			= wm5110_component_remove,
2379 	.set_sysclk		= arizona_set_sysclk,
2380 	.set_pll		= wm5110_set_fll,
2381 	.set_jack		= arizona_jack_set_jack,
2382 	.name			= DRV_NAME,
2383 	.compress_ops		= &wm5110_compress_ops,
2384 	.controls		= wm5110_snd_controls,
2385 	.num_controls		= ARRAY_SIZE(wm5110_snd_controls),
2386 	.dapm_widgets		= wm5110_dapm_widgets,
2387 	.num_dapm_widgets	= ARRAY_SIZE(wm5110_dapm_widgets),
2388 	.dapm_routes		= wm5110_dapm_routes,
2389 	.num_dapm_routes	= ARRAY_SIZE(wm5110_dapm_routes),
2390 	.use_pmdown_time	= 1,
2391 	.endianness		= 1,
2392 };
2393 
wm5110_probe(struct platform_device * pdev)2394 static int wm5110_probe(struct platform_device *pdev)
2395 {
2396 	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
2397 	struct wm5110_priv *wm5110;
2398 	int i, ret;
2399 
2400 	wm5110 = devm_kzalloc(&pdev->dev, sizeof(struct wm5110_priv),
2401 			      GFP_KERNEL);
2402 	if (wm5110 == NULL)
2403 		return -ENOMEM;
2404 	platform_set_drvdata(pdev, wm5110);
2405 
2406 	if (IS_ENABLED(CONFIG_OF)) {
2407 		if (!dev_get_platdata(arizona->dev)) {
2408 			ret = arizona_of_get_audio_pdata(arizona);
2409 			if (ret < 0)
2410 				return ret;
2411 		}
2412 	}
2413 
2414 	wm5110->core.arizona = arizona;
2415 	wm5110->core.num_inputs = 8;
2416 
2417 	for (i = 0; i < WM5110_NUM_ADSP; i++) {
2418 		wm5110->core.adsp[i].part = "wm5110";
2419 		wm5110->core.adsp[i].cs_dsp.num = i + 1;
2420 		wm5110->core.adsp[i].cs_dsp.type = WMFW_ADSP2;
2421 		wm5110->core.adsp[i].cs_dsp.dev = arizona->dev;
2422 		wm5110->core.adsp[i].cs_dsp.regmap = arizona->regmap;
2423 
2424 		wm5110->core.adsp[i].cs_dsp.base = ARIZONA_DSP1_CONTROL_1
2425 			+ (0x100 * i);
2426 		wm5110->core.adsp[i].cs_dsp.mem = wm5110_dsp_regions[i];
2427 		wm5110->core.adsp[i].cs_dsp.num_mems
2428 			= ARRAY_SIZE(wm5110_dsp1_regions);
2429 
2430 		ret = wm_adsp2_init(&wm5110->core.adsp[i]);
2431 		if (ret != 0)
2432 			return ret;
2433 	}
2434 
2435 	/* This may return -EPROBE_DEFER, so do this early on */
2436 	ret = arizona_jack_codec_dev_probe(&wm5110->core, &pdev->dev);
2437 	if (ret)
2438 		return ret;
2439 
2440 	for (i = 0; i < ARRAY_SIZE(wm5110->fll); i++)
2441 		wm5110->fll[i].vco_mult = 3;
2442 
2443 	arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
2444 			 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
2445 			 &wm5110->fll[0]);
2446 	arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
2447 			 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
2448 			 &wm5110->fll[1]);
2449 
2450 	/* SR2 fixed at 8kHz, SR3 fixed at 16kHz */
2451 	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2,
2452 			   ARIZONA_SAMPLE_RATE_2_MASK, 0x11);
2453 	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3,
2454 			   ARIZONA_SAMPLE_RATE_3_MASK, 0x12);
2455 
2456 	for (i = 0; i < ARRAY_SIZE(wm5110_dai); i++)
2457 		arizona_init_dai(&wm5110->core, i);
2458 
2459 	/* Latch volume update bits */
2460 	for (i = 0; i < ARRAY_SIZE(wm5110_digital_vu); i++)
2461 		regmap_update_bits(arizona->regmap, wm5110_digital_vu[i],
2462 				   WM5110_DIG_VU, WM5110_DIG_VU);
2463 
2464 	pm_runtime_enable(&pdev->dev);
2465 	pm_runtime_idle(&pdev->dev);
2466 
2467 	ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
2468 				  "ADSP2 Compressed IRQ", wm5110_adsp2_irq,
2469 				  wm5110);
2470 	if (ret != 0) {
2471 		dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret);
2472 		goto err_jack_codec_dev;
2473 	}
2474 
2475 	ret = arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 1);
2476 	if (ret != 0)
2477 		dev_warn(&pdev->dev,
2478 			 "Failed to set compressed IRQ as a wake source: %d\n",
2479 			 ret);
2480 
2481 	arizona_init_common(arizona);
2482 
2483 	ret = arizona_init_vol_limit(arizona);
2484 	if (ret < 0)
2485 		goto err_dsp_irq;
2486 	ret = arizona_init_spk_irqs(arizona);
2487 	if (ret < 0)
2488 		goto err_dsp_irq;
2489 
2490 	ret = devm_snd_soc_register_component(&pdev->dev,
2491 					      &soc_component_dev_wm5110,
2492 					      wm5110_dai,
2493 					      ARRAY_SIZE(wm5110_dai));
2494 	if (ret < 0) {
2495 		dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
2496 		goto err_spk_irqs;
2497 	}
2498 
2499 	return ret;
2500 
2501 err_spk_irqs:
2502 	arizona_free_spk_irqs(arizona);
2503 err_dsp_irq:
2504 	arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 0);
2505 	arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, wm5110);
2506 err_jack_codec_dev:
2507 	pm_runtime_disable(&pdev->dev);
2508 	arizona_jack_codec_dev_remove(&wm5110->core);
2509 
2510 	return ret;
2511 }
2512 
wm5110_remove(struct platform_device * pdev)2513 static void wm5110_remove(struct platform_device *pdev)
2514 {
2515 	struct wm5110_priv *wm5110 = platform_get_drvdata(pdev);
2516 	struct arizona *arizona = wm5110->core.arizona;
2517 	int i;
2518 
2519 	pm_runtime_disable(&pdev->dev);
2520 
2521 	for (i = 0; i < WM5110_NUM_ADSP; i++)
2522 		wm_adsp2_remove(&wm5110->core.adsp[i]);
2523 
2524 	arizona_free_spk_irqs(arizona);
2525 
2526 	arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 0);
2527 	arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, wm5110);
2528 
2529 	arizona_jack_codec_dev_remove(&wm5110->core);
2530 }
2531 
2532 static struct platform_driver wm5110_codec_driver = {
2533 	.driver = {
2534 		.name = "wm5110-codec",
2535 	},
2536 	.probe = wm5110_probe,
2537 	.remove_new = wm5110_remove,
2538 };
2539 
2540 module_platform_driver(wm5110_codec_driver);
2541 
2542 MODULE_DESCRIPTION("ASoC WM5110 driver");
2543 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
2544 MODULE_LICENSE("GPL");
2545 MODULE_ALIAS("platform:wm5110-codec");
2546