blob: fb9835dcd8367cefde27e112a46b535d69bb2141 [file] [log] [blame]
Mark Brown5c6af632012-07-09 19:09:41 +01001/*
2 * wm5110.c -- WM5110 ALSA SoC Audio driver
3 *
4 * Copyright 2012 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/moduleparam.h>
15#include <linux/init.h>
16#include <linux/delay.h>
17#include <linux/pm.h>
18#include <linux/pm_runtime.h>
19#include <linux/regmap.h>
20#include <linux/slab.h>
21#include <sound/core.h>
22#include <sound/pcm.h>
23#include <sound/pcm_params.h>
24#include <sound/soc.h>
25#include <sound/jack.h>
26#include <sound/initval.h>
27#include <sound/tlv.h>
28
29#include <linux/mfd/arizona/core.h>
30#include <linux/mfd/arizona/registers.h>
31
32#include "arizona.h"
Mark Brown9a3e1b82013-11-19 16:04:01 +000033#include "wm_adsp.h"
Mark Brown5c6af632012-07-09 19:09:41 +010034#include "wm5110.h"
35
Mark Brown9a3e1b82013-11-19 16:04:01 +000036#define WM5110_NUM_ADSP 4
37
Kuninori Morimoto0a2b0512018-01-29 02:45:30 +000038#define DRV_NAME "wm5110-codec"
39
Mark Brown5c6af632012-07-09 19:09:41 +010040struct wm5110_priv {
41 struct arizona_priv core;
42 struct arizona_fll fll[2];
Charles Keepaxccaadda2015-09-17 10:45:24 +010043
44 unsigned int in_value;
45 int in_pre_pending;
46 int in_post_pending;
47
48 unsigned int in_pga_cache[6];
Mark Brown5c6af632012-07-09 19:09:41 +010049};
50
Mark Brown9a3e1b82013-11-19 16:04:01 +000051static const struct wm_adsp_region wm5110_dsp1_regions[] = {
52 { .type = WMFW_ADSP2_PM, .base = 0x100000 },
53 { .type = WMFW_ADSP2_ZM, .base = 0x180000 },
54 { .type = WMFW_ADSP2_XM, .base = 0x190000 },
55 { .type = WMFW_ADSP2_YM, .base = 0x1a8000 },
56};
57
58static const struct wm_adsp_region wm5110_dsp2_regions[] = {
59 { .type = WMFW_ADSP2_PM, .base = 0x200000 },
60 { .type = WMFW_ADSP2_ZM, .base = 0x280000 },
61 { .type = WMFW_ADSP2_XM, .base = 0x290000 },
62 { .type = WMFW_ADSP2_YM, .base = 0x2a8000 },
63};
64
65static const struct wm_adsp_region wm5110_dsp3_regions[] = {
66 { .type = WMFW_ADSP2_PM, .base = 0x300000 },
67 { .type = WMFW_ADSP2_ZM, .base = 0x380000 },
68 { .type = WMFW_ADSP2_XM, .base = 0x390000 },
69 { .type = WMFW_ADSP2_YM, .base = 0x3a8000 },
70};
71
72static const struct wm_adsp_region wm5110_dsp4_regions[] = {
73 { .type = WMFW_ADSP2_PM, .base = 0x400000 },
74 { .type = WMFW_ADSP2_ZM, .base = 0x480000 },
75 { .type = WMFW_ADSP2_XM, .base = 0x490000 },
76 { .type = WMFW_ADSP2_YM, .base = 0x4a8000 },
77};
78
79static const struct wm_adsp_region *wm5110_dsp_regions[] = {
80 wm5110_dsp1_regions,
81 wm5110_dsp2_regions,
82 wm5110_dsp3_regions,
83 wm5110_dsp4_regions,
84};
85
Charles Keepaxf69f86b2013-11-19 10:51:29 +000086static const struct reg_default wm5110_sysclk_revd_patch[] = {
87 { 0x3093, 0x1001 },
88 { 0x30E3, 0x1301 },
89 { 0x3133, 0x1201 },
90 { 0x3183, 0x1501 },
91 { 0x31D3, 0x1401 },
Charles Keepax34354792014-01-21 16:27:51 +000092 { 0x0049, 0x01ea },
93 { 0x004a, 0x01f2 },
94 { 0x0057, 0x01e7 },
95 { 0x0058, 0x01fb },
96 { 0x33ce, 0xc4f5 },
97 { 0x33cf, 0x1361 },
98 { 0x33d0, 0x0402 },
99 { 0x33d1, 0x4700 },
100 { 0x33d2, 0x026d },
101 { 0x33d3, 0xff00 },
102 { 0x33d4, 0x026d },
103 { 0x33d5, 0x0101 },
104 { 0x33d6, 0xc4f5 },
105 { 0x33d7, 0x0361 },
106 { 0x33d8, 0x0402 },
107 { 0x33d9, 0x6701 },
108 { 0x33da, 0xc4f5 },
109 { 0x33db, 0x136f },
110 { 0x33dc, 0xc4f5 },
111 { 0x33dd, 0x134f },
112 { 0x33de, 0xc4f5 },
113 { 0x33df, 0x131f },
114 { 0x33e0, 0x026d },
115 { 0x33e1, 0x4f01 },
116 { 0x33e2, 0x026d },
117 { 0x33e3, 0xf100 },
118 { 0x33e4, 0x026d },
119 { 0x33e5, 0x0001 },
120 { 0x33e6, 0xc4f5 },
121 { 0x33e7, 0x0361 },
122 { 0x33e8, 0x0402 },
123 { 0x33e9, 0x6601 },
124 { 0x33ea, 0xc4f5 },
125 { 0x33eb, 0x136f },
126 { 0x33ec, 0xc4f5 },
127 { 0x33ed, 0x134f },
128 { 0x33ee, 0xc4f5 },
129 { 0x33ef, 0x131f },
130 { 0x33f0, 0x026d },
131 { 0x33f1, 0x4e01 },
132 { 0x33f2, 0x026d },
133 { 0x33f3, 0xf000 },
134 { 0x33f6, 0xc4f5 },
135 { 0x33f7, 0x1361 },
136 { 0x33f8, 0x0402 },
137 { 0x33f9, 0x4600 },
138 { 0x33fa, 0x026d },
139 { 0x33fb, 0xfe00 },
Charles Keepaxf69f86b2013-11-19 10:51:29 +0000140};
141
Charles Keepaxd1acd312015-07-07 15:28:14 +0100142static const struct reg_default wm5110_sysclk_reve_patch[] = {
143 { 0x3270, 0xE410 },
144 { 0x3271, 0x3078 },
145 { 0x3272, 0xE410 },
146 { 0x3273, 0x3070 },
147 { 0x3274, 0xE410 },
148 { 0x3275, 0x3066 },
149 { 0x3276, 0xE410 },
150 { 0x3277, 0x3056 },
151 { 0x327A, 0xE414 },
152 { 0x327B, 0x3078 },
153 { 0x327C, 0xE414 },
154 { 0x327D, 0x3070 },
155 { 0x327E, 0xE414 },
156 { 0x327F, 0x3066 },
157 { 0x3280, 0xE414 },
158 { 0x3281, 0x3056 },
159};
160
Charles Keepaxf69f86b2013-11-19 10:51:29 +0000161static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
162 struct snd_kcontrol *kcontrol, int event)
163{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000164 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
165 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
Lars-Peter Clausen055bbe22014-03-01 13:45:32 +0100166 struct regmap *regmap = arizona->regmap;
Charles Keepaxf69f86b2013-11-19 10:51:29 +0000167 const struct reg_default *patch = NULL;
168 int i, patch_size;
169
170 switch (arizona->rev) {
171 case 3:
172 patch = wm5110_sysclk_revd_patch;
173 patch_size = ARRAY_SIZE(wm5110_sysclk_revd_patch);
174 break;
175 default:
Charles Keepaxd1acd312015-07-07 15:28:14 +0100176 patch = wm5110_sysclk_reve_patch;
177 patch_size = ARRAY_SIZE(wm5110_sysclk_reve_patch);
178 break;
Charles Keepaxf69f86b2013-11-19 10:51:29 +0000179 }
180
181 switch (event) {
182 case SND_SOC_DAPM_POST_PMU:
183 if (patch)
184 for (i = 0; i < patch_size; i++)
Mark Brown959e4082013-12-12 00:49:56 +0000185 regmap_write_async(regmap, patch[i].reg,
186 patch[i].def);
Charles Keepaxf69f86b2013-11-19 10:51:29 +0000187 break;
Charles Keepax7a4413d2016-10-21 14:15:57 +0100188 case SND_SOC_DAPM_PRE_PMU:
189 case SND_SOC_DAPM_POST_PMD:
190 return arizona_clk_ev(w, kcontrol, event);
Charles Keepaxf69f86b2013-11-19 10:51:29 +0000191 default:
192 break;
193 }
194
195 return 0;
196}
197
Charles Keepaxd82d7672016-01-21 17:53:02 +0000198static int wm5110_adsp_power_ev(struct snd_soc_dapm_widget *w,
199 struct snd_kcontrol *kcontrol, int event)
200{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000201 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
202 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
Charles Keepaxd82d7672016-01-21 17:53:02 +0000203 unsigned int v;
204 int ret;
205
206 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v);
207 if (ret != 0) {
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000208 dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret);
Charles Keepaxd82d7672016-01-21 17:53:02 +0000209 return ret;
210 }
211
212 v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT;
213
214 return wm_adsp2_early_event(w, kcontrol, event, v);
215}
216
Nariman Poushindc606e052015-07-17 15:11:10 +0100217static const struct reg_sequence wm5110_no_dre_left_enable[] = {
Charles Keepaxd1acd312015-07-07 15:28:14 +0100218 { 0x3024, 0xE410 },
219 { 0x3025, 0x0056 },
220 { 0x301B, 0x0224 },
221 { 0x301F, 0x4263 },
222 { 0x3021, 0x5291 },
223 { 0x3030, 0xE410 },
224 { 0x3031, 0x3066 },
225 { 0x3032, 0xE410 },
226 { 0x3033, 0x3070 },
227 { 0x3034, 0xE410 },
228 { 0x3035, 0x3078 },
229 { 0x3036, 0xE410 },
230 { 0x3037, 0x3080 },
231 { 0x3038, 0xE410 },
232 { 0x3039, 0x3080 },
233};
234
Nariman Poushindc606e052015-07-17 15:11:10 +0100235static const struct reg_sequence wm5110_dre_left_enable[] = {
Charles Keepaxd1acd312015-07-07 15:28:14 +0100236 { 0x3024, 0x0231 },
237 { 0x3025, 0x0B00 },
238 { 0x301B, 0x0227 },
239 { 0x301F, 0x4266 },
240 { 0x3021, 0x5294 },
241 { 0x3030, 0xE231 },
242 { 0x3031, 0x0266 },
243 { 0x3032, 0x8231 },
244 { 0x3033, 0x4B15 },
245 { 0x3034, 0x8231 },
246 { 0x3035, 0x0B15 },
247 { 0x3036, 0xE231 },
248 { 0x3037, 0x5294 },
249 { 0x3038, 0x0231 },
250 { 0x3039, 0x0B00 },
251};
252
Nariman Poushindc606e052015-07-17 15:11:10 +0100253static const struct reg_sequence wm5110_no_dre_right_enable[] = {
Charles Keepaxd1acd312015-07-07 15:28:14 +0100254 { 0x3074, 0xE414 },
255 { 0x3075, 0x0056 },
256 { 0x306B, 0x0224 },
257 { 0x306F, 0x4263 },
258 { 0x3071, 0x5291 },
259 { 0x3080, 0xE414 },
260 { 0x3081, 0x3066 },
261 { 0x3082, 0xE414 },
262 { 0x3083, 0x3070 },
263 { 0x3084, 0xE414 },
264 { 0x3085, 0x3078 },
265 { 0x3086, 0xE414 },
266 { 0x3087, 0x3080 },
267 { 0x3088, 0xE414 },
268 { 0x3089, 0x3080 },
269};
270
Nariman Poushindc606e052015-07-17 15:11:10 +0100271static const struct reg_sequence wm5110_dre_right_enable[] = {
Charles Keepaxd1acd312015-07-07 15:28:14 +0100272 { 0x3074, 0x0231 },
273 { 0x3075, 0x0B00 },
274 { 0x306B, 0x0227 },
275 { 0x306F, 0x4266 },
276 { 0x3071, 0x5294 },
277 { 0x3080, 0xE231 },
278 { 0x3081, 0x0266 },
279 { 0x3082, 0x8231 },
280 { 0x3083, 0x4B17 },
281 { 0x3084, 0x8231 },
282 { 0x3085, 0x0B17 },
283 { 0x3086, 0xE231 },
284 { 0x3087, 0x5294 },
285 { 0x3088, 0x0231 },
286 { 0x3089, 0x0B00 },
287};
288
289static int wm5110_hp_pre_enable(struct snd_soc_dapm_widget *w)
290{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000291 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
292 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
Charles Keepaxd1acd312015-07-07 15:28:14 +0100293 struct arizona *arizona = priv->arizona;
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000294 unsigned int val = snd_soc_component_read32(component, ARIZONA_DRE_ENABLE);
Nariman Poushindc606e052015-07-17 15:11:10 +0100295 const struct reg_sequence *wseq;
Charles Keepaxd1acd312015-07-07 15:28:14 +0100296 int nregs;
297
298 switch (w->shift) {
299 case ARIZONA_OUT1L_ENA_SHIFT:
300 if (val & ARIZONA_DRE1L_ENA_MASK) {
301 wseq = wm5110_dre_left_enable;
302 nregs = ARRAY_SIZE(wm5110_dre_left_enable);
303 } else {
304 wseq = wm5110_no_dre_left_enable;
305 nregs = ARRAY_SIZE(wm5110_no_dre_left_enable);
306 priv->out_up_delay += 10;
307 }
308 break;
309 case ARIZONA_OUT1R_ENA_SHIFT:
310 if (val & ARIZONA_DRE1R_ENA_MASK) {
311 wseq = wm5110_dre_right_enable;
312 nregs = ARRAY_SIZE(wm5110_dre_right_enable);
313 } else {
314 wseq = wm5110_no_dre_right_enable;
315 nregs = ARRAY_SIZE(wm5110_no_dre_right_enable);
316 priv->out_up_delay += 10;
317 }
318 break;
319 default:
320 return 0;
321 }
322
323 return regmap_multi_reg_write(arizona->regmap, wseq, nregs);
324}
325
326static int wm5110_hp_pre_disable(struct snd_soc_dapm_widget *w)
327{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000328 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
329 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
330 unsigned int val = snd_soc_component_read32(component, ARIZONA_DRE_ENABLE);
Charles Keepaxd1acd312015-07-07 15:28:14 +0100331
332 switch (w->shift) {
333 case ARIZONA_OUT1L_ENA_SHIFT:
334 if (!(val & ARIZONA_DRE1L_ENA_MASK)) {
Charles Keepax7dd0f7c2018-02-20 16:08:11 +0000335 snd_soc_component_update_bits(component,
336 ARIZONA_SPARE_TRIGGERS,
337 ARIZONA_WS_TRG1,
338 ARIZONA_WS_TRG1);
339 snd_soc_component_update_bits(component,
340 ARIZONA_SPARE_TRIGGERS,
341 ARIZONA_WS_TRG1, 0);
Charles Keepaxd1acd312015-07-07 15:28:14 +0100342 priv->out_down_delay += 27;
343 }
344 break;
345 case ARIZONA_OUT1R_ENA_SHIFT:
346 if (!(val & ARIZONA_DRE1R_ENA_MASK)) {
Charles Keepax7dd0f7c2018-02-20 16:08:11 +0000347 snd_soc_component_update_bits(component,
348 ARIZONA_SPARE_TRIGGERS,
349 ARIZONA_WS_TRG2,
350 ARIZONA_WS_TRG2);
351 snd_soc_component_update_bits(component,
352 ARIZONA_SPARE_TRIGGERS,
353 ARIZONA_WS_TRG2, 0);
Charles Keepaxd1acd312015-07-07 15:28:14 +0100354 priv->out_down_delay += 27;
355 }
356 break;
357 default:
358 break;
359 }
360
361 return 0;
362}
363
364static int wm5110_hp_ev(struct snd_soc_dapm_widget *w,
365 struct snd_kcontrol *kcontrol, int event)
366{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000367 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
368 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
Charles Keepaxd1acd312015-07-07 15:28:14 +0100369
370 switch (priv->arizona->rev) {
371 case 0 ... 3:
372 break;
373 default:
374 switch (event) {
375 case SND_SOC_DAPM_PRE_PMU:
376 wm5110_hp_pre_enable(w);
377 break;
378 case SND_SOC_DAPM_PRE_PMD:
379 wm5110_hp_pre_disable(w);
380 break;
381 default:
382 break;
383 }
384 break;
385 }
386
387 return arizona_hp_ev(w, kcontrol, event);
388}
389
390static int wm5110_clear_pga_volume(struct arizona *arizona, int output)
391{
Charles Keepax24338722016-01-06 15:15:37 +0000392 unsigned int reg = ARIZONA_OUTPUT_PATH_CONFIG_1L + output * 4;
Charles Keepaxd1acd312015-07-07 15:28:14 +0100393 int ret;
394
Charles Keepax24338722016-01-06 15:15:37 +0000395 ret = regmap_write(arizona->regmap, reg, 0x80);
Charles Keepaxd1acd312015-07-07 15:28:14 +0100396 if (ret)
397 dev_err(arizona->dev, "Failed to clear PGA (0x%x): %d\n",
Charles Keepax24338722016-01-06 15:15:37 +0000398 reg, ret);
Charles Keepaxd1acd312015-07-07 15:28:14 +0100399
400 return ret;
401}
402
403static int wm5110_put_dre(struct snd_kcontrol *kcontrol,
404 struct snd_ctl_elem_value *ucontrol)
405{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000406 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
407 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
408 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
Charles Keepaxd1acd312015-07-07 15:28:14 +0100409 struct soc_mixer_control *mc =
410 (struct soc_mixer_control *)kcontrol->private_value;
411 unsigned int ena, dre;
412 unsigned int mask = (0x1 << mc->shift) | (0x1 << mc->rshift);
413 unsigned int lnew = (!!ucontrol->value.integer.value[0]) << mc->shift;
414 unsigned int rnew = (!!ucontrol->value.integer.value[1]) << mc->rshift;
415 unsigned int lold, rold;
416 unsigned int lena, rena;
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(arizona->regmap, ARIZONA_DRE_ENABLE,
445 mask, lnew | rnew);
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
458err:
459 snd_soc_dapm_mutex_unlock(dapm);
460
461 return ret;
462}
463
Charles Keepaxccaadda2015-09-17 10:45:24 +0100464static int wm5110_in_pga_get(struct snd_kcontrol *kcontrol,
465 struct snd_ctl_elem_value *ucontrol)
466{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000467 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
468 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100469 int ret;
470
471 /*
472 * PGA Volume is also used as part of the enable sequence, so
473 * usage of it should be avoided whilst that is running.
474 */
Charles Keepaxe1166152015-12-29 16:25:14 +0000475 snd_soc_dapm_mutex_lock(dapm);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100476
477 ret = snd_soc_get_volsw_range(kcontrol, ucontrol);
478
Charles Keepaxe1166152015-12-29 16:25:14 +0000479 snd_soc_dapm_mutex_unlock(dapm);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100480
481 return ret;
482}
483
484static int wm5110_in_pga_put(struct snd_kcontrol *kcontrol,
485 struct snd_ctl_elem_value *ucontrol)
486{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000487 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
488 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100489 int ret;
490
491 /*
492 * PGA Volume is also used as part of the enable sequence, so
493 * usage of it should be avoided whilst that is running.
494 */
Charles Keepaxe1166152015-12-29 16:25:14 +0000495 snd_soc_dapm_mutex_lock(dapm);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100496
497 ret = snd_soc_put_volsw_range(kcontrol, ucontrol);
498
Charles Keepaxe1166152015-12-29 16:25:14 +0000499 snd_soc_dapm_mutex_unlock(dapm);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100500
501 return ret;
502}
503
504static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w,
505 struct snd_kcontrol *kcontrol, int event)
506{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000507 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
508 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
509 struct wm5110_priv *wm5110 = snd_soc_component_get_drvdata(component);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100510 struct arizona *arizona = priv->arizona;
511 unsigned int reg, mask;
512 struct reg_sequence analog_seq[] = {
513 { 0x80, 0x3 },
514 { 0x35d, 0 },
515 { 0x80, 0x0 },
516 };
517
518 reg = ARIZONA_IN1L_CONTROL + ((w->shift ^ 0x1) * 4);
519 mask = ARIZONA_IN1L_PGA_VOL_MASK;
520
521 switch (event) {
522 case SND_SOC_DAPM_WILL_PMU:
523 wm5110->in_value |= 0x3 << ((w->shift ^ 0x1) * 2);
524 wm5110->in_pre_pending++;
525 wm5110->in_post_pending++;
526 return 0;
527 case SND_SOC_DAPM_PRE_PMU:
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000528 wm5110->in_pga_cache[w->shift] = snd_soc_component_read32(component, reg);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100529
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000530 snd_soc_component_update_bits(component, reg, mask,
Charles Keepaxccaadda2015-09-17 10:45:24 +0100531 0x40 << ARIZONA_IN1L_PGA_VOL_SHIFT);
532
533 wm5110->in_pre_pending--;
534 if (wm5110->in_pre_pending == 0) {
535 analog_seq[1].def = wm5110->in_value;
536 regmap_multi_reg_write_bypassed(arizona->regmap,
537 analog_seq,
538 ARRAY_SIZE(analog_seq));
539
540 msleep(55);
541
542 wm5110->in_value = 0;
543 }
544
545 break;
546 case SND_SOC_DAPM_POST_PMU:
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000547 snd_soc_component_update_bits(component, reg, mask,
Charles Keepax7dd0f7c2018-02-20 16:08:11 +0000548 wm5110->in_pga_cache[w->shift]);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100549
550 wm5110->in_post_pending--;
551 if (wm5110->in_post_pending == 0)
552 regmap_multi_reg_write_bypassed(arizona->regmap,
553 analog_seq,
554 ARRAY_SIZE(analog_seq));
555 break;
556 default:
557 break;
558 }
559
560 return 0;
561}
562
563static int wm5110_in_ev(struct snd_soc_dapm_widget *w,
564 struct snd_kcontrol *kcontrol, int event)
565{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000566 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
567 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
Charles Keepaxccaadda2015-09-17 10:45:24 +0100568 struct arizona *arizona = priv->arizona;
569
570 switch (arizona->rev) {
571 case 0 ... 4:
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +0000572 if (arizona_input_analog(component, w->shift))
Charles Keepaxccaadda2015-09-17 10:45:24 +0100573 wm5110_in_analog_ev(w, kcontrol, event);
574
575 break;
576 default:
577 break;
578 }
579
580 return arizona_in_ev(w, kcontrol, event);
581}
582
Mark Brown5c6af632012-07-09 19:09:41 +0100583static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
584static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
585static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
Richard Fitzgerald15575ed2015-05-28 14:28:12 +0100586static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
Mark Brownbd7fe242012-12-18 13:53:26 +0000587static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
588
589#define WM5110_NG_SRC(name, base) \
590 SOC_SINGLE(name " NG HPOUT1L Switch", base, 0, 1, 0), \
591 SOC_SINGLE(name " NG HPOUT1R Switch", base, 1, 1, 0), \
592 SOC_SINGLE(name " NG HPOUT2L Switch", base, 2, 1, 0), \
593 SOC_SINGLE(name " NG HPOUT2R Switch", base, 3, 1, 0), \
594 SOC_SINGLE(name " NG HPOUT3L Switch", base, 4, 1, 0), \
595 SOC_SINGLE(name " NG HPOUT3R Switch", base, 5, 1, 0), \
596 SOC_SINGLE(name " NG SPKOUTL Switch", base, 6, 1, 0), \
597 SOC_SINGLE(name " NG SPKOUTR Switch", base, 7, 1, 0), \
598 SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \
599 SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0), \
600 SOC_SINGLE(name " NG SPKDAT2L Switch", base, 10, 1, 0), \
601 SOC_SINGLE(name " NG SPKDAT2R Switch", base, 11, 1, 0)
Mark Brown5c6af632012-07-09 19:09:41 +0100602
Charles Keepaxd1901062015-11-19 16:11:10 +0000603#define WM5110_RXANC_INPUT_ROUTES(widget, name) \
604 { widget, NULL, name " NG Mux" }, \
605 { name " NG Internal", NULL, "RXANC NG Clock" }, \
606 { name " NG Internal", NULL, name " Channel" }, \
607 { name " NG External", NULL, "RXANC NG External Clock" }, \
608 { name " NG External", NULL, name " Channel" }, \
609 { name " NG Mux", "None", name " Channel" }, \
610 { name " NG Mux", "Internal", name " NG Internal" }, \
611 { name " NG Mux", "External", name " NG External" }, \
612 { name " Channel", "Left", name " Left Input" }, \
613 { name " Channel", "Combine", name " Left Input" }, \
614 { name " Channel", "Right", name " Right Input" }, \
615 { name " Channel", "Combine", name " Right Input" }, \
616 { name " Left Input", "IN1", "IN1L PGA" }, \
617 { name " Right Input", "IN1", "IN1R PGA" }, \
618 { name " Left Input", "IN2", "IN2L PGA" }, \
619 { name " Right Input", "IN2", "IN2R PGA" }, \
620 { name " Left Input", "IN3", "IN3L PGA" }, \
621 { name " Right Input", "IN3", "IN3R PGA" }, \
622 { name " Left Input", "IN4", "IN4L PGA" }, \
623 { name " Right Input", "IN4", "IN4R PGA" }
624
625#define WM5110_RXANC_OUTPUT_ROUTES(widget, name) \
626 { widget, NULL, name " ANC Source" }, \
627 { name " ANC Source", "RXANCL", "RXANCL" }, \
628 { name " ANC Source", "RXANCR", "RXANCR" }
629
Mark Brown5c6af632012-07-09 19:09:41 +0100630static const struct snd_kcontrol_new wm5110_snd_controls[] = {
Charles Keepaxc7f38432013-08-06 17:03:55 +0100631SOC_ENUM("IN1 OSR", arizona_in_dmic_osr[0]),
632SOC_ENUM("IN2 OSR", arizona_in_dmic_osr[1]),
633SOC_ENUM("IN3 OSR", arizona_in_dmic_osr[2]),
634SOC_ENUM("IN4 OSR", arizona_in_dmic_osr[3]),
Mark Brown5c6af632012-07-09 19:09:41 +0100635
Charles Keepaxccaadda2015-09-17 10:45:24 +0100636SOC_SINGLE_RANGE_EXT_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL,
637 ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
638 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
639SOC_SINGLE_RANGE_EXT_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL,
640 ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
641 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
642SOC_SINGLE_RANGE_EXT_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL,
643 ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
644 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
645SOC_SINGLE_RANGE_EXT_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL,
646 ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
647 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
648SOC_SINGLE_RANGE_EXT_TLV("IN3L Volume", ARIZONA_IN3L_CONTROL,
649 ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
650 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
651SOC_SINGLE_RANGE_EXT_TLV("IN3R Volume", ARIZONA_IN3R_CONTROL,
652 ARIZONA_IN3R_PGA_VOL_SHIFT, 0x40, 0x5f, 0,
653 wm5110_in_pga_get, wm5110_in_pga_put, ana_tlv),
Mark Brown5c6af632012-07-09 19:09:41 +0100654
Charles Keepax254dc322013-11-19 16:04:03 +0000655SOC_ENUM("IN HPF Cutoff Frequency", arizona_in_hpf_cut_enum),
656
657SOC_SINGLE("IN1L HPF Switch", ARIZONA_IN1L_CONTROL,
658 ARIZONA_IN1L_HPF_SHIFT, 1, 0),
659SOC_SINGLE("IN1R HPF Switch", ARIZONA_IN1R_CONTROL,
660 ARIZONA_IN1R_HPF_SHIFT, 1, 0),
661SOC_SINGLE("IN2L HPF Switch", ARIZONA_IN2L_CONTROL,
662 ARIZONA_IN2L_HPF_SHIFT, 1, 0),
663SOC_SINGLE("IN2R HPF Switch", ARIZONA_IN2R_CONTROL,
664 ARIZONA_IN2R_HPF_SHIFT, 1, 0),
665SOC_SINGLE("IN3L HPF Switch", ARIZONA_IN3L_CONTROL,
666 ARIZONA_IN3L_HPF_SHIFT, 1, 0),
667SOC_SINGLE("IN3R HPF Switch", ARIZONA_IN3R_CONTROL,
668 ARIZONA_IN3R_HPF_SHIFT, 1, 0),
669SOC_SINGLE("IN4L HPF Switch", ARIZONA_IN4L_CONTROL,
670 ARIZONA_IN4L_HPF_SHIFT, 1, 0),
671SOC_SINGLE("IN4R HPF Switch", ARIZONA_IN4R_CONTROL,
672 ARIZONA_IN4R_HPF_SHIFT, 1, 0),
673
Mark Brown02482da2012-12-14 15:18:30 +0900674SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
675 ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
676SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
677 ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
678SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
679 ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
680SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
681 ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
682SOC_SINGLE_TLV("IN3L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L,
683 ARIZONA_IN3L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
684SOC_SINGLE_TLV("IN3R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3R,
685 ARIZONA_IN3R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
686SOC_SINGLE_TLV("IN4L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4L,
687 ARIZONA_IN4L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
688SOC_SINGLE_TLV("IN4R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4R,
689 ARIZONA_IN4R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
Mark Brown5c6af632012-07-09 19:09:41 +0100690
Mark Browna1abfa82012-12-09 12:50:05 +0900691SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
692SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
693
Charles Keepaxd1901062015-11-19 16:11:10 +0000694SND_SOC_BYTES("RXANC Coefficients", ARIZONA_ANC_COEFF_START,
695 ARIZONA_ANC_COEFF_END - ARIZONA_ANC_COEFF_START + 1),
696SND_SOC_BYTES("RXANCL Config", ARIZONA_FCL_FILTER_CONTROL, 1),
697SND_SOC_BYTES("RXANCL Coefficients", ARIZONA_FCL_COEFF_START,
698 ARIZONA_FCL_COEFF_END - ARIZONA_FCL_COEFF_START + 1),
699SND_SOC_BYTES("RXANCR Config", ARIZONA_FCR_FILTER_CONTROL, 1),
700SND_SOC_BYTES("RXANCR Coefficients", ARIZONA_FCR_COEFF_START,
701 ARIZONA_FCR_COEFF_END - ARIZONA_FCR_COEFF_START + 1),
702
Mark Brown5c6af632012-07-09 19:09:41 +0100703ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
704ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
705ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
706ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
707
Charles Keepaxc05d9a82015-06-25 09:35:11 +0100708ARIZONA_EQ_CONTROL("EQ1 Coefficients", ARIZONA_EQ1_2),
Mark Brown5c6af632012-07-09 19:09:41 +0100709SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
710 24, 0, eq_tlv),
711SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
712 24, 0, eq_tlv),
713SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
714 24, 0, eq_tlv),
715SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
716 24, 0, eq_tlv),
717SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
718 24, 0, eq_tlv),
719
Charles Keepaxc05d9a82015-06-25 09:35:11 +0100720ARIZONA_EQ_CONTROL("EQ2 Coefficients", ARIZONA_EQ2_2),
Mark Brown5c6af632012-07-09 19:09:41 +0100721SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
722 24, 0, eq_tlv),
723SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
724 24, 0, eq_tlv),
725SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
726 24, 0, eq_tlv),
727SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
728 24, 0, eq_tlv),
729SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
730 24, 0, eq_tlv),
731
Charles Keepaxc05d9a82015-06-25 09:35:11 +0100732ARIZONA_EQ_CONTROL("EQ3 Coefficients", ARIZONA_EQ3_2),
Mark Brown5c6af632012-07-09 19:09:41 +0100733SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
734 24, 0, eq_tlv),
735SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
736 24, 0, eq_tlv),
737SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
738 24, 0, eq_tlv),
739SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
740 24, 0, eq_tlv),
741SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
742 24, 0, eq_tlv),
743
Charles Keepaxc05d9a82015-06-25 09:35:11 +0100744ARIZONA_EQ_CONTROL("EQ4 Coefficients", ARIZONA_EQ4_2),
Mark Brown5c6af632012-07-09 19:09:41 +0100745SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
746 24, 0, eq_tlv),
747SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
748 24, 0, eq_tlv),
749SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
750 24, 0, eq_tlv),
751SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
752 24, 0, eq_tlv),
753SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
754 24, 0, eq_tlv),
755
756ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
757ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
758ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE),
759ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE),
760
761SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
762 ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
763SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5,
764 ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA),
765
766ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
767ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
768ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
769ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
770
Charles Keepax5f8e6712015-06-25 09:35:12 +0100771ARIZONA_LHPF_CONTROL("LHPF1 Coefficients", ARIZONA_HPLPF1_2),
772ARIZONA_LHPF_CONTROL("LHPF2 Coefficients", ARIZONA_HPLPF2_2),
773ARIZONA_LHPF_CONTROL("LHPF3 Coefficients", ARIZONA_HPLPF3_2),
774ARIZONA_LHPF_CONTROL("LHPF4 Coefficients", ARIZONA_HPLPF4_2),
Mark Brownd4d1eaa2012-12-05 16:38:30 +0900775
Mark Brown5c6af632012-07-09 19:09:41 +0100776SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
777SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
778SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
779SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
780
Lars-Peter Clausen696d3af2014-04-14 21:31:06 +0200781SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
782SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
783SOC_ENUM("ISRC3 FSL", arizona_isrc_fsl[2]),
784SOC_ENUM("ISRC1 FSH", arizona_isrc_fsh[0]),
785SOC_ENUM("ISRC2 FSH", arizona_isrc_fsh[1]),
786SOC_ENUM("ISRC3 FSH", arizona_isrc_fsh[2]),
787SOC_ENUM("ASRC RATE 1", arizona_asrc_rate1),
Charles Keepax0da2e5b2013-11-19 16:04:02 +0000788
Charles Keepaxaf813a62017-01-06 14:24:41 +0000789WM_ADSP2_PRELOAD_SWITCH("DSP1", 1),
790WM_ADSP2_PRELOAD_SWITCH("DSP2", 2),
791WM_ADSP2_PRELOAD_SWITCH("DSP3", 3),
792WM_ADSP2_PRELOAD_SWITCH("DSP4", 4),
793
Mark Brown35d38892012-08-26 13:50:48 -0700794ARIZONA_MIXER_CONTROLS("DSP1L", ARIZONA_DSP1LMIX_INPUT_1_SOURCE),
795ARIZONA_MIXER_CONTROLS("DSP1R", ARIZONA_DSP1RMIX_INPUT_1_SOURCE),
796ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE),
797ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE),
798ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE),
799ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE),
800ARIZONA_MIXER_CONTROLS("DSP4L", ARIZONA_DSP4LMIX_INPUT_1_SOURCE),
Charles Keepax39d4ecd2013-05-24 11:38:24 +0100801ARIZONA_MIXER_CONTROLS("DSP4R", ARIZONA_DSP4RMIX_INPUT_1_SOURCE),
Mark Brown35d38892012-08-26 13:50:48 -0700802
Mark Brown5c6af632012-07-09 19:09:41 +0100803ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
804ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
805
806SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
807 ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
808
809ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
810ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
811ARIZONA_MIXER_CONTROLS("HPOUT2L", ARIZONA_OUT2LMIX_INPUT_1_SOURCE),
812ARIZONA_MIXER_CONTROLS("HPOUT2R", ARIZONA_OUT2RMIX_INPUT_1_SOURCE),
Mark Brown35d38892012-08-26 13:50:48 -0700813ARIZONA_MIXER_CONTROLS("HPOUT3L", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
814ARIZONA_MIXER_CONTROLS("HPOUT3R", ARIZONA_OUT3RMIX_INPUT_1_SOURCE),
Mark Brown5c6af632012-07-09 19:09:41 +0100815ARIZONA_MIXER_CONTROLS("SPKOUTL", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
816ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE),
817ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
818ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
819ARIZONA_MIXER_CONTROLS("SPKDAT2L", ARIZONA_OUT6LMIX_INPUT_1_SOURCE),
820ARIZONA_MIXER_CONTROLS("SPKDAT2R", ARIZONA_OUT6RMIX_INPUT_1_SOURCE),
821
Charles Keepaxafb6d4e2014-01-09 14:29:25 +0000822SOC_SINGLE("HPOUT1 SC Protect Switch", ARIZONA_HP1_SHORT_CIRCUIT_CTRL,
823 ARIZONA_HP1_SC_ENA_SHIFT, 1, 0),
824SOC_SINGLE("HPOUT2 SC Protect Switch", ARIZONA_HP2_SHORT_CIRCUIT_CTRL,
825 ARIZONA_HP2_SC_ENA_SHIFT, 1, 0),
826SOC_SINGLE("HPOUT3 SC Protect Switch", ARIZONA_HP3_SHORT_CIRCUIT_CTRL,
827 ARIZONA_HP3_SC_ENA_SHIFT, 1, 0),
828
Charles Keepax9374f372014-04-05 12:11:48 +0100829SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
830 ARIZONA_OUT5_OSR_SHIFT, 1, 0),
831SOC_SINGLE("SPKDAT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_6L,
832 ARIZONA_OUT6_OSR_SHIFT, 1, 0),
833
Mark Brown5c6af632012-07-09 19:09:41 +0100834SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
835 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
Charles Keepax5752ec92013-02-15 10:37:27 +0000836SOC_DOUBLE_R("HPOUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L,
Mark Brown5c6af632012-07-09 19:09:41 +0100837 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1),
Charles Keepax5752ec92013-02-15 10:37:27 +0000838SOC_DOUBLE_R("HPOUT3 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
Mark Brown35d38892012-08-26 13:50:48 -0700839 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
Mark Brown5c6af632012-07-09 19:09:41 +0100840SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
841 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
842SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
843 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
844SOC_DOUBLE_R("SPKDAT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_6L,
845 ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_MUTE_SHIFT, 1, 1),
846
847SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
848 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
849 0xbf, 0, digital_tlv),
Charles Keepax5752ec92013-02-15 10:37:27 +0000850SOC_DOUBLE_R_TLV("HPOUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L,
Mark Brown5c6af632012-07-09 19:09:41 +0100851 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT,
852 0xbf, 0, digital_tlv),
Charles Keepax5752ec92013-02-15 10:37:27 +0000853SOC_DOUBLE_R_TLV("HPOUT3 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
Mark Brown35d38892012-08-26 13:50:48 -0700854 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_VOL_SHIFT,
855 0xbf, 0, digital_tlv),
Mark Brown5c6af632012-07-09 19:09:41 +0100856SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
857 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_VOL_SHIFT,
858 0xbf, 0, digital_tlv),
859SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
860 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
861 0xbf, 0, digital_tlv),
862SOC_DOUBLE_R_TLV("SPKDAT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_6L,
863 ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_VOL_SHIFT,
864 0xbf, 0, digital_tlv),
865
Mark Brown5c6af632012-07-09 19:09:41 +0100866SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
867 ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
868SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT,
869 ARIZONA_SPK2R_MUTE_SHIFT, 1, 1),
870
Charles Keepaxd1acd312015-07-07 15:28:14 +0100871SOC_DOUBLE_EXT("HPOUT1 DRE Switch", ARIZONA_DRE_ENABLE,
Charles Keepax7dd0f7c2018-02-20 16:08:11 +0000872 ARIZONA_DRE1L_ENA_SHIFT, ARIZONA_DRE1R_ENA_SHIFT, 1, 0,
873 snd_soc_get_volsw, wm5110_put_dre),
Charles Keepaxd1acd312015-07-07 15:28:14 +0100874SOC_DOUBLE_EXT("HPOUT2 DRE Switch", ARIZONA_DRE_ENABLE,
Charles Keepax7dd0f7c2018-02-20 16:08:11 +0000875 ARIZONA_DRE2L_ENA_SHIFT, ARIZONA_DRE2R_ENA_SHIFT, 1, 0,
876 snd_soc_get_volsw, wm5110_put_dre),
Charles Keepaxd1acd312015-07-07 15:28:14 +0100877SOC_DOUBLE_EXT("HPOUT3 DRE Switch", ARIZONA_DRE_ENABLE,
Charles Keepax7dd0f7c2018-02-20 16:08:11 +0000878 ARIZONA_DRE3L_ENA_SHIFT, ARIZONA_DRE3R_ENA_SHIFT, 1, 0,
879 snd_soc_get_volsw, wm5110_put_dre),
Charles Keepaxa4c0d272013-12-19 09:11:02 +0000880
Mark Browna1abfa82012-12-09 12:50:05 +0900881SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
882SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
883
Mark Brownbd7fe242012-12-18 13:53:26 +0000884SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
885 ARIZONA_NGATE_ENA_SHIFT, 1, 0),
886SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
887 ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
888SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
889
890WM5110_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
891WM5110_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
892WM5110_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L),
893WM5110_NG_SRC("HPOUT2R", ARIZONA_NOISE_GATE_SELECT_2R),
894WM5110_NG_SRC("HPOUT3L", ARIZONA_NOISE_GATE_SELECT_3L),
895WM5110_NG_SRC("HPOUT3R", ARIZONA_NOISE_GATE_SELECT_3R),
896WM5110_NG_SRC("SPKOUTL", ARIZONA_NOISE_GATE_SELECT_4L),
897WM5110_NG_SRC("SPKOUTR", ARIZONA_NOISE_GATE_SELECT_4R),
898WM5110_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L),
899WM5110_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R),
900WM5110_NG_SRC("SPKDAT2L", ARIZONA_NOISE_GATE_SELECT_6L),
901WM5110_NG_SRC("SPKDAT2R", ARIZONA_NOISE_GATE_SELECT_6R),
902
Mark Brown5c6af632012-07-09 19:09:41 +0100903ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
904ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
905ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
906ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
907ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
908ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
909ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
910ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
911
912ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
913ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
Richard Fitzgeralde64001e2013-11-20 13:17:07 +0000914ARIZONA_MIXER_CONTROLS("AIF2TX3", ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE),
915ARIZONA_MIXER_CONTROLS("AIF2TX4", ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE),
916ARIZONA_MIXER_CONTROLS("AIF2TX5", ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE),
917ARIZONA_MIXER_CONTROLS("AIF2TX6", ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE),
Mark Brown5c6af632012-07-09 19:09:41 +0100918
919ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
920ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
Mark Brownd217f902013-05-17 13:29:05 +0100921
922ARIZONA_MIXER_CONTROLS("SLIMTX1", ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE),
923ARIZONA_MIXER_CONTROLS("SLIMTX2", ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE),
924ARIZONA_MIXER_CONTROLS("SLIMTX3", ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE),
925ARIZONA_MIXER_CONTROLS("SLIMTX4", ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE),
926ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
927ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
928ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
929ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
Mark Brown5c6af632012-07-09 19:09:41 +0100930};
931
932ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
933ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
934ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
935ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
936
937ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
938ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
939ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE);
940ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE);
941
942ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
943ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
944ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
945ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
946
Mark Brown9a3e1b82013-11-19 16:04:01 +0000947ARIZONA_MIXER_ENUMS(DSP1L, ARIZONA_DSP1LMIX_INPUT_1_SOURCE);
948ARIZONA_MIXER_ENUMS(DSP1R, ARIZONA_DSP1RMIX_INPUT_1_SOURCE);
949ARIZONA_DSP_AUX_ENUMS(DSP1, ARIZONA_DSP1AUX1MIX_INPUT_1_SOURCE);
950
951ARIZONA_MIXER_ENUMS(DSP2L, ARIZONA_DSP2LMIX_INPUT_1_SOURCE);
952ARIZONA_MIXER_ENUMS(DSP2R, ARIZONA_DSP2RMIX_INPUT_1_SOURCE);
953ARIZONA_DSP_AUX_ENUMS(DSP2, ARIZONA_DSP2AUX1MIX_INPUT_1_SOURCE);
954
955ARIZONA_MIXER_ENUMS(DSP3L, ARIZONA_DSP3LMIX_INPUT_1_SOURCE);
956ARIZONA_MIXER_ENUMS(DSP3R, ARIZONA_DSP3RMIX_INPUT_1_SOURCE);
957ARIZONA_DSP_AUX_ENUMS(DSP3, ARIZONA_DSP3AUX1MIX_INPUT_1_SOURCE);
958
959ARIZONA_MIXER_ENUMS(DSP4L, ARIZONA_DSP4LMIX_INPUT_1_SOURCE);
960ARIZONA_MIXER_ENUMS(DSP4R, ARIZONA_DSP4RMIX_INPUT_1_SOURCE);
961ARIZONA_DSP_AUX_ENUMS(DSP4, ARIZONA_DSP4AUX1MIX_INPUT_1_SOURCE);
962
Mark Brown5c6af632012-07-09 19:09:41 +0100963ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE);
964ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE);
965
966ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
967ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
968
969ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
970ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
971ARIZONA_MIXER_ENUMS(OUT2L, ARIZONA_OUT2LMIX_INPUT_1_SOURCE);
972ARIZONA_MIXER_ENUMS(OUT2R, ARIZONA_OUT2RMIX_INPUT_1_SOURCE);
Mark Brown35d38892012-08-26 13:50:48 -0700973ARIZONA_MIXER_ENUMS(OUT3L, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
974ARIZONA_MIXER_ENUMS(OUT3R, ARIZONA_OUT3RMIX_INPUT_1_SOURCE);
Mark Brown5c6af632012-07-09 19:09:41 +0100975ARIZONA_MIXER_ENUMS(SPKOUTL, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
976ARIZONA_MIXER_ENUMS(SPKOUTR, ARIZONA_OUT4RMIX_INPUT_1_SOURCE);
977ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
978ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
979ARIZONA_MIXER_ENUMS(SPKDAT2L, ARIZONA_OUT6LMIX_INPUT_1_SOURCE);
980ARIZONA_MIXER_ENUMS(SPKDAT2R, ARIZONA_OUT6RMIX_INPUT_1_SOURCE);
981
982ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
983ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
984ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
985ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
986ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
987ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
988ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
989ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
990
991ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
992ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
Richard Fitzgeralde64001e2013-11-20 13:17:07 +0000993ARIZONA_MIXER_ENUMS(AIF2TX3, ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE);
994ARIZONA_MIXER_ENUMS(AIF2TX4, ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE);
995ARIZONA_MIXER_ENUMS(AIF2TX5, ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE);
996ARIZONA_MIXER_ENUMS(AIF2TX6, ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE);
Mark Brown5c6af632012-07-09 19:09:41 +0100997
998ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
999ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
1000
Mark Brownd217f902013-05-17 13:29:05 +01001001ARIZONA_MIXER_ENUMS(SLIMTX1, ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE);
1002ARIZONA_MIXER_ENUMS(SLIMTX2, ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE);
1003ARIZONA_MIXER_ENUMS(SLIMTX3, ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE);
1004ARIZONA_MIXER_ENUMS(SLIMTX4, ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE);
1005ARIZONA_MIXER_ENUMS(SLIMTX5, ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE);
1006ARIZONA_MIXER_ENUMS(SLIMTX6, ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE);
1007ARIZONA_MIXER_ENUMS(SLIMTX7, ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE);
1008ARIZONA_MIXER_ENUMS(SLIMTX8, ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE);
1009
Charles Keepax5886c742012-11-13 16:40:34 +00001010ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
1011ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
1012ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
1013ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
Mark Brown5c6af632012-07-09 19:09:41 +01001014
Charles Keepax0da2e5b2013-11-19 16:04:02 +00001015ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE);
1016ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE);
1017ARIZONA_MUX_ENUMS(ISRC1INT3, ARIZONA_ISRC1INT3MIX_INPUT_1_SOURCE);
1018ARIZONA_MUX_ENUMS(ISRC1INT4, ARIZONA_ISRC1INT4MIX_INPUT_1_SOURCE);
1019
1020ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE);
1021ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE);
1022ARIZONA_MUX_ENUMS(ISRC1DEC3, ARIZONA_ISRC1DEC3MIX_INPUT_1_SOURCE);
1023ARIZONA_MUX_ENUMS(ISRC1DEC4, ARIZONA_ISRC1DEC4MIX_INPUT_1_SOURCE);
1024
1025ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE);
1026ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE);
1027ARIZONA_MUX_ENUMS(ISRC2INT3, ARIZONA_ISRC2INT3MIX_INPUT_1_SOURCE);
1028ARIZONA_MUX_ENUMS(ISRC2INT4, ARIZONA_ISRC2INT4MIX_INPUT_1_SOURCE);
1029
1030ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE);
1031ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE);
1032ARIZONA_MUX_ENUMS(ISRC2DEC3, ARIZONA_ISRC2DEC3MIX_INPUT_1_SOURCE);
1033ARIZONA_MUX_ENUMS(ISRC2DEC4, ARIZONA_ISRC2DEC4MIX_INPUT_1_SOURCE);
1034
1035ARIZONA_MUX_ENUMS(ISRC3INT1, ARIZONA_ISRC3INT1MIX_INPUT_1_SOURCE);
1036ARIZONA_MUX_ENUMS(ISRC3INT2, ARIZONA_ISRC3INT2MIX_INPUT_1_SOURCE);
1037ARIZONA_MUX_ENUMS(ISRC3INT3, ARIZONA_ISRC3INT3MIX_INPUT_1_SOURCE);
1038ARIZONA_MUX_ENUMS(ISRC3INT4, ARIZONA_ISRC3INT4MIX_INPUT_1_SOURCE);
1039
1040ARIZONA_MUX_ENUMS(ISRC3DEC1, ARIZONA_ISRC3DEC1MIX_INPUT_1_SOURCE);
1041ARIZONA_MUX_ENUMS(ISRC3DEC2, ARIZONA_ISRC3DEC2MIX_INPUT_1_SOURCE);
1042ARIZONA_MUX_ENUMS(ISRC3DEC3, ARIZONA_ISRC3DEC3MIX_INPUT_1_SOURCE);
1043ARIZONA_MUX_ENUMS(ISRC3DEC4, ARIZONA_ISRC3DEC4MIX_INPUT_1_SOURCE);
1044
Charles Keepax7dd0f7c2018-02-20 16:08:11 +00001045static const char * const wm5110_aec_loopback_texts[] = {
Mark Browndac8f1c2012-08-26 13:51:27 -07001046 "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R",
1047 "SPKOUTL", "SPKOUTR", "SPKDAT1L", "SPKDAT1R", "SPKDAT2L", "SPKDAT2R",
1048};
1049
1050static const unsigned int wm5110_aec_loopback_values[] = {
1051 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1052};
1053
1054static const struct soc_enum wm5110_aec_loopback =
1055 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
Mark Brown7d5cb4f2013-01-11 13:32:00 +00001056 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
Mark Browndac8f1c2012-08-26 13:51:27 -07001057 ARRAY_SIZE(wm5110_aec_loopback_texts),
1058 wm5110_aec_loopback_texts,
1059 wm5110_aec_loopback_values);
1060
1061static const struct snd_kcontrol_new wm5110_aec_loopback_mux =
Lars-Peter Clausen696d3af2014-04-14 21:31:06 +02001062 SOC_DAPM_ENUM("AEC Loopback", wm5110_aec_loopback);
Mark Browndac8f1c2012-08-26 13:51:27 -07001063
Charles Keepaxd1901062015-11-19 16:11:10 +00001064static const struct snd_kcontrol_new wm5110_anc_input_mux[] = {
1065 SOC_DAPM_ENUM("RXANCL Input", arizona_anc_input_src[0]),
1066 SOC_DAPM_ENUM("RXANCL Channel", arizona_anc_input_src[1]),
1067 SOC_DAPM_ENUM("RXANCR Input", arizona_anc_input_src[2]),
1068 SOC_DAPM_ENUM("RXANCR Channel", arizona_anc_input_src[3]),
1069};
1070
1071static const struct snd_kcontrol_new wm5110_anc_ng_mux =
1072 SOC_DAPM_ENUM("RXANC NG Source", arizona_anc_ng_enum);
1073
1074static const struct snd_kcontrol_new wm5110_output_anc_src[] = {
1075 SOC_DAPM_ENUM("HPOUT1L ANC Source", arizona_output_anc_src[0]),
1076 SOC_DAPM_ENUM("HPOUT1R ANC Source", arizona_output_anc_src[1]),
1077 SOC_DAPM_ENUM("HPOUT2L ANC Source", arizona_output_anc_src[2]),
1078 SOC_DAPM_ENUM("HPOUT2R ANC Source", arizona_output_anc_src[3]),
1079 SOC_DAPM_ENUM("HPOUT3L ANC Source", arizona_output_anc_src[4]),
1080 SOC_DAPM_ENUM("HPOUT3R ANC Source", arizona_output_anc_src[5]),
1081 SOC_DAPM_ENUM("SPKOUTL ANC Source", arizona_output_anc_src[6]),
1082 SOC_DAPM_ENUM("SPKOUTR ANC Source", arizona_output_anc_src[7]),
1083 SOC_DAPM_ENUM("SPKDAT1L ANC Source", arizona_output_anc_src[8]),
1084 SOC_DAPM_ENUM("SPKDAT1R ANC Source", arizona_output_anc_src[9]),
1085 SOC_DAPM_ENUM("SPKDAT2L ANC Source", arizona_output_anc_src[10]),
1086 SOC_DAPM_ENUM("SPKDAT2R ANC Source", arizona_output_anc_src[11]),
1087};
1088
Mark Brown5c6af632012-07-09 19:09:41 +01001089static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = {
1090SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
Charles Keepax7a4413d2016-10-21 14:15:57 +01001091 0, wm5110_sysclk_ev, SND_SOC_DAPM_POST_PMU |
1092 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
Mark Brown5c6af632012-07-09 19:09:41 +01001093SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
Charles Keepax7a4413d2016-10-21 14:15:57 +01001094 ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, arizona_clk_ev,
1095 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
Mark Brown94237f82012-08-09 19:14:43 +01001096SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
1097 ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
1098SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
1099 ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
Mark Brown5c6af632012-07-09 19:09:41 +01001100
Mark Brown822b4b82012-09-07 10:54:32 +08001101SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
1102SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0, 0),
1103SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
Mark Brown76dbd2a2012-09-07 12:58:54 +08001104SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
Mark Brown822b4b82012-09-07 10:54:32 +08001105SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0, 0),
1106SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
Mark Brown5c6af632012-07-09 19:09:41 +01001107
1108SND_SOC_DAPM_SIGGEN("TONE"),
1109SND_SOC_DAPM_SIGGEN("NOISE"),
Mark Brown2f76e682012-11-26 21:18:18 +00001110SND_SOC_DAPM_SIGGEN("HAPTICS"),
Mark Brown5c6af632012-07-09 19:09:41 +01001111
1112SND_SOC_DAPM_INPUT("IN1L"),
1113SND_SOC_DAPM_INPUT("IN1R"),
1114SND_SOC_DAPM_INPUT("IN2L"),
1115SND_SOC_DAPM_INPUT("IN2R"),
1116SND_SOC_DAPM_INPUT("IN3L"),
1117SND_SOC_DAPM_INPUT("IN3R"),
1118SND_SOC_DAPM_INPUT("IN4L"),
1119SND_SOC_DAPM_INPUT("IN4R"),
1120
Charles Keepaxb63144e2013-07-04 08:56:28 +01001121SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
1122SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
1123
Charles Keepax97126ce2016-05-13 16:45:16 +01001124SND_SOC_DAPM_OUTPUT("DSP Voice Trigger"),
1125
1126SND_SOC_DAPM_SWITCH("DSP3 Voice Trigger", SND_SOC_NOPM, 2, 0,
1127 &arizona_voice_trigger_switch[2]),
1128
Mark Brown5c6af632012-07-09 19:09:41 +01001129SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
Charles Keepaxccaadda2015-09-17 10:45:24 +01001130 0, NULL, 0, wm5110_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +00001131 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxccaadda2015-09-17 10:45:24 +01001132 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1133 SND_SOC_DAPM_WILL_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001134SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
Charles Keepaxccaadda2015-09-17 10:45:24 +01001135 0, NULL, 0, wm5110_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +00001136 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxccaadda2015-09-17 10:45:24 +01001137 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1138 SND_SOC_DAPM_WILL_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001139SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
Charles Keepaxccaadda2015-09-17 10:45:24 +01001140 0, NULL, 0, wm5110_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +00001141 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxccaadda2015-09-17 10:45:24 +01001142 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1143 SND_SOC_DAPM_WILL_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001144SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
Charles Keepaxccaadda2015-09-17 10:45:24 +01001145 0, NULL, 0, wm5110_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +00001146 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxccaadda2015-09-17 10:45:24 +01001147 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1148 SND_SOC_DAPM_WILL_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001149SND_SOC_DAPM_PGA_E("IN3L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3L_ENA_SHIFT,
Charles Keepaxccaadda2015-09-17 10:45:24 +01001150 0, NULL, 0, wm5110_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +00001151 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxccaadda2015-09-17 10:45:24 +01001152 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1153 SND_SOC_DAPM_WILL_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001154SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3R_ENA_SHIFT,
Charles Keepaxccaadda2015-09-17 10:45:24 +01001155 0, NULL, 0, wm5110_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +00001156 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxccaadda2015-09-17 10:45:24 +01001157 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1158 SND_SOC_DAPM_WILL_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001159SND_SOC_DAPM_PGA_E("IN4L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4L_ENA_SHIFT,
1160 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +00001161 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1162 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001163SND_SOC_DAPM_PGA_E("IN4R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4R_ENA_SHIFT,
1164 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +00001165 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
1166 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001167
1168SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
1169 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
1170SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
1171 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
1172SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
1173 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
1174
1175SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
1176 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
1177
1178SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
1179 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
1180SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
1181 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
1182
1183SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1,
1184 ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0),
1185
1186SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
1187SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
1188SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
1189SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
1190
1191SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
1192 NULL, 0),
1193SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
1194 NULL, 0),
1195SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0,
1196 NULL, 0),
1197SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0,
1198 NULL, 0),
1199
1200SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
1201 NULL, 0),
1202SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
1203 NULL, 0),
1204SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
1205 NULL, 0),
1206SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
1207 NULL, 0),
1208
1209SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
1210 0, NULL, 0),
1211SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
1212 0, NULL, 0),
1213
1214SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
1215 NULL, 0),
1216SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
1217 NULL, 0),
1218SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
1219 NULL, 0),
1220SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
1221 NULL, 0),
1222
Charles Keepaxd82d7672016-01-21 17:53:02 +00001223WM_ADSP2("DSP1", 0, wm5110_adsp_power_ev),
1224WM_ADSP2("DSP2", 1, wm5110_adsp_power_ev),
1225WM_ADSP2("DSP3", 2, wm5110_adsp_power_ev),
1226WM_ADSP2("DSP4", 3, wm5110_adsp_power_ev),
Mark Brown9a3e1b82013-11-19 16:04:01 +00001227
Charles Keepax0da2e5b2013-11-19 16:04:02 +00001228SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3,
1229 ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0),
1230SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3,
1231 ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
1232SND_SOC_DAPM_PGA("ISRC1INT3", ARIZONA_ISRC_1_CTRL_3,
1233 ARIZONA_ISRC1_INT2_ENA_SHIFT, 0, NULL, 0),
1234SND_SOC_DAPM_PGA("ISRC1INT4", ARIZONA_ISRC_1_CTRL_3,
1235 ARIZONA_ISRC1_INT3_ENA_SHIFT, 0, NULL, 0),
1236
1237SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3,
1238 ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0),
1239SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3,
1240 ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
1241SND_SOC_DAPM_PGA("ISRC1DEC3", ARIZONA_ISRC_1_CTRL_3,
1242 ARIZONA_ISRC1_DEC2_ENA_SHIFT, 0, NULL, 0),
1243SND_SOC_DAPM_PGA("ISRC1DEC4", ARIZONA_ISRC_1_CTRL_3,
1244 ARIZONA_ISRC1_DEC3_ENA_SHIFT, 0, NULL, 0),
1245
1246SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3,
1247 ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0),
1248SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3,
1249 ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
1250SND_SOC_DAPM_PGA("ISRC2INT3", ARIZONA_ISRC_2_CTRL_3,
1251 ARIZONA_ISRC2_INT2_ENA_SHIFT, 0, NULL, 0),
1252SND_SOC_DAPM_PGA("ISRC2INT4", ARIZONA_ISRC_2_CTRL_3,
1253 ARIZONA_ISRC2_INT3_ENA_SHIFT, 0, NULL, 0),
1254
1255SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3,
1256 ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0),
1257SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3,
1258 ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
1259SND_SOC_DAPM_PGA("ISRC2DEC3", ARIZONA_ISRC_2_CTRL_3,
1260 ARIZONA_ISRC2_DEC2_ENA_SHIFT, 0, NULL, 0),
1261SND_SOC_DAPM_PGA("ISRC2DEC4", ARIZONA_ISRC_2_CTRL_3,
1262 ARIZONA_ISRC2_DEC3_ENA_SHIFT, 0, NULL, 0),
1263
1264SND_SOC_DAPM_PGA("ISRC3INT1", ARIZONA_ISRC_3_CTRL_3,
1265 ARIZONA_ISRC3_INT0_ENA_SHIFT, 0, NULL, 0),
1266SND_SOC_DAPM_PGA("ISRC3INT2", ARIZONA_ISRC_3_CTRL_3,
1267 ARIZONA_ISRC3_INT1_ENA_SHIFT, 0, NULL, 0),
1268SND_SOC_DAPM_PGA("ISRC3INT3", ARIZONA_ISRC_3_CTRL_3,
1269 ARIZONA_ISRC3_INT2_ENA_SHIFT, 0, NULL, 0),
1270SND_SOC_DAPM_PGA("ISRC3INT4", ARIZONA_ISRC_3_CTRL_3,
1271 ARIZONA_ISRC3_INT3_ENA_SHIFT, 0, NULL, 0),
1272
1273SND_SOC_DAPM_PGA("ISRC3DEC1", ARIZONA_ISRC_3_CTRL_3,
1274 ARIZONA_ISRC3_DEC0_ENA_SHIFT, 0, NULL, 0),
1275SND_SOC_DAPM_PGA("ISRC3DEC2", ARIZONA_ISRC_3_CTRL_3,
1276 ARIZONA_ISRC3_DEC1_ENA_SHIFT, 0, NULL, 0),
1277SND_SOC_DAPM_PGA("ISRC3DEC3", ARIZONA_ISRC_3_CTRL_3,
1278 ARIZONA_ISRC3_DEC2_ENA_SHIFT, 0, NULL, 0),
1279SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3,
1280 ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0),
1281
Lars-Peter Clausen696d3af2014-04-14 21:31:06 +02001282SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
Charles Keepax7dd0f7c2018-02-20 16:08:11 +00001283 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &wm5110_aec_loopback_mux),
Mark Browndac8f1c2012-08-26 13:51:27 -07001284
Charles Keepaxd1901062015-11-19 16:11:10 +00001285SND_SOC_DAPM_SUPPLY("RXANC NG External Clock", SND_SOC_NOPM,
Charles Keepax7dd0f7c2018-02-20 16:08:11 +00001286 ARIZONA_EXT_NG_SEL_SET_SHIFT, 0, arizona_anc_ev,
1287 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
Charles Keepaxd1901062015-11-19 16:11:10 +00001288SND_SOC_DAPM_PGA("RXANCL NG External", SND_SOC_NOPM, 0, 0, NULL, 0),
1289SND_SOC_DAPM_PGA("RXANCR NG External", SND_SOC_NOPM, 0, 0, NULL, 0),
1290
1291SND_SOC_DAPM_SUPPLY("RXANC NG Clock", SND_SOC_NOPM,
Charles Keepax7dd0f7c2018-02-20 16:08:11 +00001292 ARIZONA_CLK_NG_ENA_SET_SHIFT, 0, arizona_anc_ev,
1293 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
Charles Keepaxd1901062015-11-19 16:11:10 +00001294SND_SOC_DAPM_PGA("RXANCL NG Internal", SND_SOC_NOPM, 0, 0, NULL, 0),
1295SND_SOC_DAPM_PGA("RXANCR NG Internal", SND_SOC_NOPM, 0, 0, NULL, 0),
1296
1297SND_SOC_DAPM_MUX("RXANCL Left Input", SND_SOC_NOPM, 0, 0,
1298 &wm5110_anc_input_mux[0]),
1299SND_SOC_DAPM_MUX("RXANCL Right Input", SND_SOC_NOPM, 0, 0,
1300 &wm5110_anc_input_mux[0]),
1301SND_SOC_DAPM_MUX("RXANCL Channel", SND_SOC_NOPM, 0, 0,
1302 &wm5110_anc_input_mux[1]),
1303SND_SOC_DAPM_MUX("RXANCL NG Mux", SND_SOC_NOPM, 0, 0, &wm5110_anc_ng_mux),
1304SND_SOC_DAPM_MUX("RXANCR Left Input", SND_SOC_NOPM, 0, 0,
1305 &wm5110_anc_input_mux[2]),
1306SND_SOC_DAPM_MUX("RXANCR Right Input", SND_SOC_NOPM, 0, 0,
1307 &wm5110_anc_input_mux[2]),
1308SND_SOC_DAPM_MUX("RXANCR Channel", SND_SOC_NOPM, 0, 0,
1309 &wm5110_anc_input_mux[3]),
1310SND_SOC_DAPM_MUX("RXANCR NG Mux", SND_SOC_NOPM, 0, 0, &wm5110_anc_ng_mux),
1311
1312SND_SOC_DAPM_PGA_E("RXANCL", SND_SOC_NOPM, ARIZONA_CLK_L_ENA_SET_SHIFT,
1313 0, NULL, 0, arizona_anc_ev,
1314 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
1315SND_SOC_DAPM_PGA_E("RXANCR", SND_SOC_NOPM, ARIZONA_CLK_R_ENA_SET_SHIFT,
1316 0, NULL, 0, arizona_anc_ev,
1317 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
1318
1319SND_SOC_DAPM_MUX("HPOUT1L ANC Source", SND_SOC_NOPM, 0, 0,
1320 &wm5110_output_anc_src[0]),
1321SND_SOC_DAPM_MUX("HPOUT1R ANC Source", SND_SOC_NOPM, 0, 0,
1322 &wm5110_output_anc_src[1]),
1323SND_SOC_DAPM_MUX("HPOUT2L ANC Source", SND_SOC_NOPM, 0, 0,
1324 &wm5110_output_anc_src[2]),
1325SND_SOC_DAPM_MUX("HPOUT2R ANC Source", SND_SOC_NOPM, 0, 0,
1326 &wm5110_output_anc_src[3]),
1327SND_SOC_DAPM_MUX("HPOUT3L ANC Source", SND_SOC_NOPM, 0, 0,
1328 &wm5110_output_anc_src[4]),
1329SND_SOC_DAPM_MUX("HPOUT3R ANC Source", SND_SOC_NOPM, 0, 0,
1330 &wm5110_output_anc_src[5]),
1331SND_SOC_DAPM_MUX("SPKOUTL ANC Source", SND_SOC_NOPM, 0, 0,
1332 &wm5110_output_anc_src[6]),
1333SND_SOC_DAPM_MUX("SPKOUTR ANC Source", SND_SOC_NOPM, 0, 0,
1334 &wm5110_output_anc_src[7]),
1335SND_SOC_DAPM_MUX("SPKDAT1L ANC Source", SND_SOC_NOPM, 0, 0,
1336 &wm5110_output_anc_src[8]),
1337SND_SOC_DAPM_MUX("SPKDAT1R ANC Source", SND_SOC_NOPM, 0, 0,
1338 &wm5110_output_anc_src[9]),
1339SND_SOC_DAPM_MUX("SPKDAT2L ANC Source", SND_SOC_NOPM, 0, 0,
1340 &wm5110_output_anc_src[10]),
1341SND_SOC_DAPM_MUX("SPKDAT2R ANC Source", SND_SOC_NOPM, 0, 0,
1342 &wm5110_output_anc_src[11]),
1343
Mark Brown5c6af632012-07-09 19:09:41 +01001344SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
1345 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
1346SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
1347 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
1348SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
1349 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
1350SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
1351 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
1352SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
1353 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
1354SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
1355 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
1356SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0,
1357 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
1358SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0,
1359 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
1360
1361SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
1362 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
1363SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
1364 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
1365SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
1366 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
1367SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
1368 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
1369SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
1370 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
1371SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
1372 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
1373SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0,
1374 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
1375SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0,
1376 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
1377
1378SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
1379 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
1380SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
1381 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
Richard Fitzgeralde64001e2013-11-20 13:17:07 +00001382SND_SOC_DAPM_AIF_OUT("AIF2TX3", NULL, 0,
1383 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX3_ENA_SHIFT, 0),
1384SND_SOC_DAPM_AIF_OUT("AIF2TX4", NULL, 0,
1385 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX4_ENA_SHIFT, 0),
1386SND_SOC_DAPM_AIF_OUT("AIF2TX5", NULL, 0,
1387 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX5_ENA_SHIFT, 0),
1388SND_SOC_DAPM_AIF_OUT("AIF2TX6", NULL, 0,
1389 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX6_ENA_SHIFT, 0),
Mark Brown5c6af632012-07-09 19:09:41 +01001390
1391SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
1392 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
1393SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
1394 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
Richard Fitzgeralde64001e2013-11-20 13:17:07 +00001395SND_SOC_DAPM_AIF_IN("AIF2RX3", NULL, 0,
1396 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX3_ENA_SHIFT, 0),
1397SND_SOC_DAPM_AIF_IN("AIF2RX4", NULL, 0,
1398 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX4_ENA_SHIFT, 0),
1399SND_SOC_DAPM_AIF_IN("AIF2RX5", NULL, 0,
1400 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX5_ENA_SHIFT, 0),
1401SND_SOC_DAPM_AIF_IN("AIF2RX6", NULL, 0,
1402 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX6_ENA_SHIFT, 0),
Mark Brown5c6af632012-07-09 19:09:41 +01001403
Mark Brownd217f902013-05-17 13:29:05 +01001404SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0,
1405 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1406 ARIZONA_SLIMRX1_ENA_SHIFT, 0),
1407SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 0,
1408 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1409 ARIZONA_SLIMRX2_ENA_SHIFT, 0),
1410SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 0,
1411 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1412 ARIZONA_SLIMRX3_ENA_SHIFT, 0),
1413SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 0,
1414 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1415 ARIZONA_SLIMRX4_ENA_SHIFT, 0),
1416SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL, 0,
1417 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1418 ARIZONA_SLIMRX5_ENA_SHIFT, 0),
1419SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL, 0,
1420 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1421 ARIZONA_SLIMRX6_ENA_SHIFT, 0),
1422SND_SOC_DAPM_AIF_IN("SLIMRX7", NULL, 0,
1423 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1424 ARIZONA_SLIMRX7_ENA_SHIFT, 0),
1425SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 0,
1426 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
1427 ARIZONA_SLIMRX8_ENA_SHIFT, 0),
1428
1429SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
1430 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1431 ARIZONA_SLIMTX1_ENA_SHIFT, 0),
1432SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 0,
1433 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1434 ARIZONA_SLIMTX2_ENA_SHIFT, 0),
1435SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 0,
1436 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1437 ARIZONA_SLIMTX3_ENA_SHIFT, 0),
1438SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 0,
1439 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1440 ARIZONA_SLIMTX4_ENA_SHIFT, 0),
1441SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 0,
1442 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1443 ARIZONA_SLIMTX5_ENA_SHIFT, 0),
1444SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 0,
1445 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1446 ARIZONA_SLIMTX6_ENA_SHIFT, 0),
1447SND_SOC_DAPM_AIF_OUT("SLIMTX7", NULL, 0,
1448 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1449 ARIZONA_SLIMTX7_ENA_SHIFT, 0),
1450SND_SOC_DAPM_AIF_OUT("SLIMTX8", NULL, 0,
1451 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
1452 ARIZONA_SLIMTX8_ENA_SHIFT, 0),
1453
Mark Brown5c6af632012-07-09 19:09:41 +01001454SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
1455 ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
1456SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0,
1457 ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
1458
1459SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
1460 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
1461SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
1462 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
1463
Mark Brownf607e312013-02-22 18:36:53 +00001464SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
Charles Keepaxd1acd312015-07-07 15:28:14 +01001465 ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, wm5110_hp_ev,
Charles Keepax054e1b42015-01-20 16:31:50 +00001466 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxe1ae5fb2015-01-20 16:31:51 +00001467 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brownf607e312013-02-22 18:36:53 +00001468SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
Charles Keepaxd1acd312015-07-07 15:28:14 +01001469 ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, wm5110_hp_ev,
Charles Keepax054e1b42015-01-20 16:31:50 +00001470 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxe1ae5fb2015-01-20 16:31:51 +00001471 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001472SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1,
1473 ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
Charles Keepax054e1b42015-01-20 16:31:50 +00001474 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxe1ae5fb2015-01-20 16:31:51 +00001475 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001476SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1,
1477 ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
Charles Keepax054e1b42015-01-20 16:31:50 +00001478 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxe1ae5fb2015-01-20 16:31:51 +00001479 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001480SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
1481 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
Charles Keepax054e1b42015-01-20 16:31:50 +00001482 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxe1ae5fb2015-01-20 16:31:51 +00001483 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown20bf6912012-09-26 17:52:36 +01001484SND_SOC_DAPM_PGA_E("OUT3R", ARIZONA_OUTPUT_ENABLES_1,
1485 ARIZONA_OUT3R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
Charles Keepax054e1b42015-01-20 16:31:50 +00001486 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
Charles Keepaxe1ae5fb2015-01-20 16:31:51 +00001487 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +01001488SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
1489 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1490 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1491SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
1492 ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1493 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1494SND_SOC_DAPM_PGA_E("OUT6L", ARIZONA_OUTPUT_ENABLES_1,
1495 ARIZONA_OUT6L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1496 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1497SND_SOC_DAPM_PGA_E("OUT6R", ARIZONA_OUTPUT_ENABLES_1,
1498 ARIZONA_OUT6R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1499 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1500
1501ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
1502ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
1503ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"),
1504ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"),
1505
1506ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
1507ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
1508ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"),
1509ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"),
1510
1511ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
1512ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
1513ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
1514ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
1515
1516ARIZONA_MIXER_WIDGETS(Mic, "Mic"),
1517ARIZONA_MIXER_WIDGETS(Noise, "Noise"),
1518
1519ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
1520ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
1521
1522ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
1523ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
1524ARIZONA_MIXER_WIDGETS(OUT2L, "HPOUT2L"),
1525ARIZONA_MIXER_WIDGETS(OUT2R, "HPOUT2R"),
Mark Brown35d38892012-08-26 13:50:48 -07001526ARIZONA_MIXER_WIDGETS(OUT3L, "HPOUT3L"),
1527ARIZONA_MIXER_WIDGETS(OUT3R, "HPOUT3R"),
Mark Brown5c6af632012-07-09 19:09:41 +01001528ARIZONA_MIXER_WIDGETS(SPKOUTL, "SPKOUTL"),
1529ARIZONA_MIXER_WIDGETS(SPKOUTR, "SPKOUTR"),
1530ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
1531ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
1532ARIZONA_MIXER_WIDGETS(SPKDAT2L, "SPKDAT2L"),
1533ARIZONA_MIXER_WIDGETS(SPKDAT2R, "SPKDAT2R"),
1534
1535ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
1536ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
1537ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
1538ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
1539ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
1540ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
1541ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
1542ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
1543
1544ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
1545ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
Richard Fitzgeralde64001e2013-11-20 13:17:07 +00001546ARIZONA_MIXER_WIDGETS(AIF2TX3, "AIF2TX3"),
1547ARIZONA_MIXER_WIDGETS(AIF2TX4, "AIF2TX4"),
1548ARIZONA_MIXER_WIDGETS(AIF2TX5, "AIF2TX5"),
1549ARIZONA_MIXER_WIDGETS(AIF2TX6, "AIF2TX6"),
Mark Brown5c6af632012-07-09 19:09:41 +01001550
1551ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
1552ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
1553
Mark Brownd217f902013-05-17 13:29:05 +01001554ARIZONA_MIXER_WIDGETS(SLIMTX1, "SLIMTX1"),
1555ARIZONA_MIXER_WIDGETS(SLIMTX2, "SLIMTX2"),
1556ARIZONA_MIXER_WIDGETS(SLIMTX3, "SLIMTX3"),
1557ARIZONA_MIXER_WIDGETS(SLIMTX4, "SLIMTX4"),
1558ARIZONA_MIXER_WIDGETS(SLIMTX5, "SLIMTX5"),
1559ARIZONA_MIXER_WIDGETS(SLIMTX6, "SLIMTX6"),
1560ARIZONA_MIXER_WIDGETS(SLIMTX7, "SLIMTX7"),
1561ARIZONA_MIXER_WIDGETS(SLIMTX8, "SLIMTX8"),
1562
Charles Keepax5886c742012-11-13 16:40:34 +00001563ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
1564ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
1565ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
1566ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
Mark Brown5c6af632012-07-09 19:09:41 +01001567
Mark Brown9a3e1b82013-11-19 16:04:01 +00001568ARIZONA_DSP_WIDGETS(DSP1, "DSP1"),
1569ARIZONA_DSP_WIDGETS(DSP2, "DSP2"),
1570ARIZONA_DSP_WIDGETS(DSP3, "DSP3"),
1571ARIZONA_DSP_WIDGETS(DSP4, "DSP4"),
1572
Charles Keepax0da2e5b2013-11-19 16:04:02 +00001573ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
1574ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
1575ARIZONA_MUX_WIDGETS(ISRC1DEC3, "ISRC1DEC3"),
1576ARIZONA_MUX_WIDGETS(ISRC1DEC4, "ISRC1DEC4"),
1577
1578ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
1579ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
1580ARIZONA_MUX_WIDGETS(ISRC1INT3, "ISRC1INT3"),
1581ARIZONA_MUX_WIDGETS(ISRC1INT4, "ISRC1INT4"),
1582
1583ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
1584ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
1585ARIZONA_MUX_WIDGETS(ISRC2DEC3, "ISRC2DEC3"),
1586ARIZONA_MUX_WIDGETS(ISRC2DEC4, "ISRC2DEC4"),
1587
1588ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
1589ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
1590ARIZONA_MUX_WIDGETS(ISRC2INT3, "ISRC2INT3"),
1591ARIZONA_MUX_WIDGETS(ISRC2INT4, "ISRC2INT4"),
1592
1593ARIZONA_MUX_WIDGETS(ISRC3DEC1, "ISRC3DEC1"),
1594ARIZONA_MUX_WIDGETS(ISRC3DEC2, "ISRC3DEC2"),
1595ARIZONA_MUX_WIDGETS(ISRC3DEC3, "ISRC3DEC3"),
1596ARIZONA_MUX_WIDGETS(ISRC3DEC4, "ISRC3DEC4"),
1597
1598ARIZONA_MUX_WIDGETS(ISRC3INT1, "ISRC3INT1"),
1599ARIZONA_MUX_WIDGETS(ISRC3INT2, "ISRC3INT2"),
1600ARIZONA_MUX_WIDGETS(ISRC3INT3, "ISRC3INT3"),
1601ARIZONA_MUX_WIDGETS(ISRC3INT4, "ISRC3INT4"),
1602
Mark Brown5c6af632012-07-09 19:09:41 +01001603SND_SOC_DAPM_OUTPUT("HPOUT1L"),
1604SND_SOC_DAPM_OUTPUT("HPOUT1R"),
1605SND_SOC_DAPM_OUTPUT("HPOUT2L"),
1606SND_SOC_DAPM_OUTPUT("HPOUT2R"),
Mark Brown35d38892012-08-26 13:50:48 -07001607SND_SOC_DAPM_OUTPUT("HPOUT3L"),
1608SND_SOC_DAPM_OUTPUT("HPOUT3R"),
Mark Brown5c6af632012-07-09 19:09:41 +01001609SND_SOC_DAPM_OUTPUT("SPKOUTLN"),
1610SND_SOC_DAPM_OUTPUT("SPKOUTLP"),
1611SND_SOC_DAPM_OUTPUT("SPKOUTRN"),
1612SND_SOC_DAPM_OUTPUT("SPKOUTRP"),
1613SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
1614SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
1615SND_SOC_DAPM_OUTPUT("SPKDAT2L"),
1616SND_SOC_DAPM_OUTPUT("SPKDAT2R"),
Mark Brown57a10a12013-01-10 19:32:33 +00001617
1618SND_SOC_DAPM_OUTPUT("MICSUPP"),
Mark Brown5c6af632012-07-09 19:09:41 +01001619};
1620
1621#define ARIZONA_MIXER_INPUT_ROUTES(name) \
1622 { name, "Noise Generator", "Noise Generator" }, \
1623 { name, "Tone Generator 1", "Tone Generator 1" }, \
1624 { name, "Tone Generator 2", "Tone Generator 2" }, \
Mark Brown2f76e682012-11-26 21:18:18 +00001625 { name, "Haptics", "HAPTICS" }, \
Mark Browndac8f1c2012-08-26 13:51:27 -07001626 { name, "AEC", "AEC Loopback" }, \
Mark Brown5c6af632012-07-09 19:09:41 +01001627 { name, "IN1L", "IN1L PGA" }, \
1628 { name, "IN1R", "IN1R PGA" }, \
1629 { name, "IN2L", "IN2L PGA" }, \
1630 { name, "IN2R", "IN2R PGA" }, \
1631 { name, "IN3L", "IN3L PGA" }, \
1632 { name, "IN3R", "IN3R PGA" }, \
1633 { name, "IN4L", "IN4L PGA" }, \
1634 { name, "IN4R", "IN4R PGA" }, \
1635 { name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
1636 { name, "AIF1RX1", "AIF1RX1" }, \
1637 { name, "AIF1RX2", "AIF1RX2" }, \
1638 { name, "AIF1RX3", "AIF1RX3" }, \
1639 { name, "AIF1RX4", "AIF1RX4" }, \
1640 { name, "AIF1RX5", "AIF1RX5" }, \
1641 { name, "AIF1RX6", "AIF1RX6" }, \
1642 { name, "AIF1RX7", "AIF1RX7" }, \
1643 { name, "AIF1RX8", "AIF1RX8" }, \
1644 { name, "AIF2RX1", "AIF2RX1" }, \
1645 { name, "AIF2RX2", "AIF2RX2" }, \
Richard Fitzgeralde64001e2013-11-20 13:17:07 +00001646 { name, "AIF2RX3", "AIF2RX3" }, \
1647 { name, "AIF2RX4", "AIF2RX4" }, \
1648 { name, "AIF2RX5", "AIF2RX5" }, \
1649 { name, "AIF2RX6", "AIF2RX6" }, \
Mark Brown5c6af632012-07-09 19:09:41 +01001650 { name, "AIF3RX1", "AIF3RX1" }, \
1651 { name, "AIF3RX2", "AIF3RX2" }, \
Mark Brownd217f902013-05-17 13:29:05 +01001652 { name, "SLIMRX1", "SLIMRX1" }, \
1653 { name, "SLIMRX2", "SLIMRX2" }, \
1654 { name, "SLIMRX3", "SLIMRX3" }, \
1655 { name, "SLIMRX4", "SLIMRX4" }, \
1656 { name, "SLIMRX5", "SLIMRX5" }, \
1657 { name, "SLIMRX6", "SLIMRX6" }, \
1658 { name, "SLIMRX7", "SLIMRX7" }, \
1659 { name, "SLIMRX8", "SLIMRX8" }, \
Mark Brown5c6af632012-07-09 19:09:41 +01001660 { name, "EQ1", "EQ1" }, \
1661 { name, "EQ2", "EQ2" }, \
1662 { name, "EQ3", "EQ3" }, \
1663 { name, "EQ4", "EQ4" }, \
1664 { name, "DRC1L", "DRC1L" }, \
1665 { name, "DRC1R", "DRC1R" }, \
1666 { name, "DRC2L", "DRC2L" }, \
1667 { name, "DRC2R", "DRC2R" }, \
1668 { name, "LHPF1", "LHPF1" }, \
1669 { name, "LHPF2", "LHPF2" }, \
1670 { name, "LHPF3", "LHPF3" }, \
1671 { name, "LHPF4", "LHPF4" }, \
1672 { name, "ASRC1L", "ASRC1L" }, \
1673 { name, "ASRC1R", "ASRC1R" }, \
1674 { name, "ASRC2L", "ASRC2L" }, \
Mark Brown9a3e1b82013-11-19 16:04:01 +00001675 { name, "ASRC2R", "ASRC2R" }, \
Charles Keepax0da2e5b2013-11-19 16:04:02 +00001676 { name, "ISRC1DEC1", "ISRC1DEC1" }, \
1677 { name, "ISRC1DEC2", "ISRC1DEC2" }, \
1678 { name, "ISRC1DEC3", "ISRC1DEC3" }, \
1679 { name, "ISRC1DEC4", "ISRC1DEC4" }, \
1680 { name, "ISRC1INT1", "ISRC1INT1" }, \
1681 { name, "ISRC1INT2", "ISRC1INT2" }, \
1682 { name, "ISRC1INT3", "ISRC1INT3" }, \
1683 { name, "ISRC1INT4", "ISRC1INT4" }, \
1684 { name, "ISRC2DEC1", "ISRC2DEC1" }, \
1685 { name, "ISRC2DEC2", "ISRC2DEC2" }, \
1686 { name, "ISRC2DEC3", "ISRC2DEC3" }, \
1687 { name, "ISRC2DEC4", "ISRC2DEC4" }, \
1688 { name, "ISRC2INT1", "ISRC2INT1" }, \
1689 { name, "ISRC2INT2", "ISRC2INT2" }, \
1690 { name, "ISRC2INT3", "ISRC2INT3" }, \
1691 { name, "ISRC2INT4", "ISRC2INT4" }, \
1692 { name, "ISRC3DEC1", "ISRC3DEC1" }, \
1693 { name, "ISRC3DEC2", "ISRC3DEC2" }, \
1694 { name, "ISRC3DEC3", "ISRC3DEC3" }, \
1695 { name, "ISRC3DEC4", "ISRC3DEC4" }, \
1696 { name, "ISRC3INT1", "ISRC3INT1" }, \
1697 { name, "ISRC3INT2", "ISRC3INT2" }, \
1698 { name, "ISRC3INT3", "ISRC3INT3" }, \
1699 { name, "ISRC3INT4", "ISRC3INT4" }, \
Mark Brown9a3e1b82013-11-19 16:04:01 +00001700 { name, "DSP1.1", "DSP1" }, \
1701 { name, "DSP1.2", "DSP1" }, \
1702 { name, "DSP1.3", "DSP1" }, \
1703 { name, "DSP1.4", "DSP1" }, \
1704 { name, "DSP1.5", "DSP1" }, \
1705 { name, "DSP1.6", "DSP1" }, \
1706 { name, "DSP2.1", "DSP2" }, \
1707 { name, "DSP2.2", "DSP2" }, \
1708 { name, "DSP2.3", "DSP2" }, \
1709 { name, "DSP2.4", "DSP2" }, \
1710 { name, "DSP2.5", "DSP2" }, \
1711 { name, "DSP2.6", "DSP2" }, \
1712 { name, "DSP3.1", "DSP3" }, \
1713 { name, "DSP3.2", "DSP3" }, \
1714 { name, "DSP3.3", "DSP3" }, \
1715 { name, "DSP3.4", "DSP3" }, \
1716 { name, "DSP3.5", "DSP3" }, \
1717 { name, "DSP3.6", "DSP3" }, \
1718 { name, "DSP4.1", "DSP4" }, \
1719 { name, "DSP4.2", "DSP4" }, \
1720 { name, "DSP4.3", "DSP4" }, \
1721 { name, "DSP4.4", "DSP4" }, \
1722 { name, "DSP4.5", "DSP4" }, \
1723 { name, "DSP4.6", "DSP4" }
Mark Brown5c6af632012-07-09 19:09:41 +01001724
1725static const struct snd_soc_dapm_route wm5110_dapm_routes[] = {
1726 { "AIF2 Capture", NULL, "DBVDD2" },
1727 { "AIF2 Playback", NULL, "DBVDD2" },
1728
1729 { "AIF3 Capture", NULL, "DBVDD3" },
1730 { "AIF3 Playback", NULL, "DBVDD3" },
1731
1732 { "OUT1L", NULL, "CPVDD" },
1733 { "OUT1R", NULL, "CPVDD" },
1734 { "OUT2L", NULL, "CPVDD" },
1735 { "OUT2R", NULL, "CPVDD" },
1736 { "OUT3L", NULL, "CPVDD" },
Mark Brown20bf6912012-09-26 17:52:36 +01001737 { "OUT3R", NULL, "CPVDD" },
Mark Brown5c6af632012-07-09 19:09:41 +01001738
1739 { "OUT4L", NULL, "SPKVDDL" },
1740 { "OUT4R", NULL, "SPKVDDR" },
1741
1742 { "OUT1L", NULL, "SYSCLK" },
1743 { "OUT1R", NULL, "SYSCLK" },
1744 { "OUT2L", NULL, "SYSCLK" },
1745 { "OUT2R", NULL, "SYSCLK" },
1746 { "OUT3L", NULL, "SYSCLK" },
Ajit Pandeyd72fea62016-06-13 13:35:15 +01001747 { "OUT3R", NULL, "SYSCLK" },
Mark Brown5c6af632012-07-09 19:09:41 +01001748 { "OUT4L", NULL, "SYSCLK" },
1749 { "OUT4R", NULL, "SYSCLK" },
1750 { "OUT5L", NULL, "SYSCLK" },
1751 { "OUT5R", NULL, "SYSCLK" },
1752 { "OUT6L", NULL, "SYSCLK" },
1753 { "OUT6R", NULL, "SYSCLK" },
1754
Charles Keepax6dc6a3f2013-06-05 14:51:31 +01001755 { "IN1L", NULL, "SYSCLK" },
1756 { "IN1R", NULL, "SYSCLK" },
1757 { "IN2L", NULL, "SYSCLK" },
1758 { "IN2R", NULL, "SYSCLK" },
1759 { "IN3L", NULL, "SYSCLK" },
1760 { "IN3R", NULL, "SYSCLK" },
1761 { "IN4L", NULL, "SYSCLK" },
1762 { "IN4R", NULL, "SYSCLK" },
1763
Charles Keepax19c89192016-08-11 14:42:55 +01001764 { "ASRC1L", NULL, "SYSCLK" },
1765 { "ASRC1R", NULL, "SYSCLK" },
1766 { "ASRC2L", NULL, "SYSCLK" },
1767 { "ASRC2R", NULL, "SYSCLK" },
1768
1769 { "ASRC1L", NULL, "ASYNCCLK" },
1770 { "ASRC1R", NULL, "ASYNCCLK" },
1771 { "ASRC2L", NULL, "ASYNCCLK" },
1772 { "ASRC2R", NULL, "ASYNCCLK" },
1773
Mark Brown5c6af632012-07-09 19:09:41 +01001774 { "MICBIAS1", NULL, "MICVDD" },
1775 { "MICBIAS2", NULL, "MICVDD" },
1776 { "MICBIAS3", NULL, "MICVDD" },
1777
Charles Keepax6dc6a3f2013-06-05 14:51:31 +01001778 { "Noise Generator", NULL, "SYSCLK" },
1779 { "Tone Generator 1", NULL, "SYSCLK" },
1780 { "Tone Generator 2", NULL, "SYSCLK" },
1781
Mark Brown5c6af632012-07-09 19:09:41 +01001782 { "Noise Generator", NULL, "NOISE" },
1783 { "Tone Generator 1", NULL, "TONE" },
1784 { "Tone Generator 2", NULL, "TONE" },
1785
Mark Brown5c6af632012-07-09 19:09:41 +01001786 { "AIF1 Capture", NULL, "AIF1TX1" },
1787 { "AIF1 Capture", NULL, "AIF1TX2" },
1788 { "AIF1 Capture", NULL, "AIF1TX3" },
1789 { "AIF1 Capture", NULL, "AIF1TX4" },
1790 { "AIF1 Capture", NULL, "AIF1TX5" },
1791 { "AIF1 Capture", NULL, "AIF1TX6" },
1792 { "AIF1 Capture", NULL, "AIF1TX7" },
1793 { "AIF1 Capture", NULL, "AIF1TX8" },
1794
1795 { "AIF1RX1", NULL, "AIF1 Playback" },
1796 { "AIF1RX2", NULL, "AIF1 Playback" },
1797 { "AIF1RX3", NULL, "AIF1 Playback" },
1798 { "AIF1RX4", NULL, "AIF1 Playback" },
1799 { "AIF1RX5", NULL, "AIF1 Playback" },
1800 { "AIF1RX6", NULL, "AIF1 Playback" },
1801 { "AIF1RX7", NULL, "AIF1 Playback" },
1802 { "AIF1RX8", NULL, "AIF1 Playback" },
1803
1804 { "AIF2 Capture", NULL, "AIF2TX1" },
1805 { "AIF2 Capture", NULL, "AIF2TX2" },
Richard Fitzgeralde64001e2013-11-20 13:17:07 +00001806 { "AIF2 Capture", NULL, "AIF2TX3" },
1807 { "AIF2 Capture", NULL, "AIF2TX4" },
1808 { "AIF2 Capture", NULL, "AIF2TX5" },
1809 { "AIF2 Capture", NULL, "AIF2TX6" },
Mark Brown5c6af632012-07-09 19:09:41 +01001810
1811 { "AIF2RX1", NULL, "AIF2 Playback" },
1812 { "AIF2RX2", NULL, "AIF2 Playback" },
Richard Fitzgeralde64001e2013-11-20 13:17:07 +00001813 { "AIF2RX3", NULL, "AIF2 Playback" },
1814 { "AIF2RX4", NULL, "AIF2 Playback" },
1815 { "AIF2RX5", NULL, "AIF2 Playback" },
1816 { "AIF2RX6", NULL, "AIF2 Playback" },
Mark Brown5c6af632012-07-09 19:09:41 +01001817
1818 { "AIF3 Capture", NULL, "AIF3TX1" },
1819 { "AIF3 Capture", NULL, "AIF3TX2" },
1820
1821 { "AIF3RX1", NULL, "AIF3 Playback" },
1822 { "AIF3RX2", NULL, "AIF3 Playback" },
1823
Mark Brownd217f902013-05-17 13:29:05 +01001824 { "Slim1 Capture", NULL, "SLIMTX1" },
1825 { "Slim1 Capture", NULL, "SLIMTX2" },
1826 { "Slim1 Capture", NULL, "SLIMTX3" },
1827 { "Slim1 Capture", NULL, "SLIMTX4" },
1828
1829 { "SLIMRX1", NULL, "Slim1 Playback" },
1830 { "SLIMRX2", NULL, "Slim1 Playback" },
1831 { "SLIMRX3", NULL, "Slim1 Playback" },
1832 { "SLIMRX4", NULL, "Slim1 Playback" },
1833
1834 { "Slim2 Capture", NULL, "SLIMTX5" },
1835 { "Slim2 Capture", NULL, "SLIMTX6" },
1836
1837 { "SLIMRX5", NULL, "Slim2 Playback" },
1838 { "SLIMRX6", NULL, "Slim2 Playback" },
1839
1840 { "Slim3 Capture", NULL, "SLIMTX7" },
1841 { "Slim3 Capture", NULL, "SLIMTX8" },
1842
1843 { "SLIMRX7", NULL, "Slim3 Playback" },
1844 { "SLIMRX8", NULL, "Slim3 Playback" },
1845
Mark Brown5c6af632012-07-09 19:09:41 +01001846 { "AIF1 Playback", NULL, "SYSCLK" },
1847 { "AIF2 Playback", NULL, "SYSCLK" },
1848 { "AIF3 Playback", NULL, "SYSCLK" },
Mark Brownd217f902013-05-17 13:29:05 +01001849 { "Slim1 Playback", NULL, "SYSCLK" },
1850 { "Slim2 Playback", NULL, "SYSCLK" },
1851 { "Slim3 Playback", NULL, "SYSCLK" },
Mark Brown5c6af632012-07-09 19:09:41 +01001852
1853 { "AIF1 Capture", NULL, "SYSCLK" },
1854 { "AIF2 Capture", NULL, "SYSCLK" },
1855 { "AIF3 Capture", NULL, "SYSCLK" },
Mark Brownd217f902013-05-17 13:29:05 +01001856 { "Slim1 Capture", NULL, "SYSCLK" },
1857 { "Slim2 Capture", NULL, "SYSCLK" },
1858 { "Slim3 Capture", NULL, "SYSCLK" },
Mark Brown5c6af632012-07-09 19:09:41 +01001859
Charles Keepax1d981e02015-12-15 11:29:42 +00001860 { "Voice Control DSP", NULL, "DSP3" },
Charles Keepax1d981e02015-12-15 11:29:42 +00001861
Charles Keepax31889502016-01-21 17:53:00 +00001862 { "Audio Trace DSP", NULL, "DSP1" },
Charles Keepax31889502016-01-21 17:53:00 +00001863
Mark Brown17c3f7e2012-08-10 15:40:22 +01001864 { "IN1L PGA", NULL, "IN1L" },
1865 { "IN1R PGA", NULL, "IN1R" },
1866
1867 { "IN2L PGA", NULL, "IN2L" },
1868 { "IN2R PGA", NULL, "IN2R" },
1869
1870 { "IN3L PGA", NULL, "IN3L" },
1871 { "IN3R PGA", NULL, "IN3R" },
1872
1873 { "IN4L PGA", NULL, "IN4L" },
1874 { "IN4R PGA", NULL, "IN4R" },
1875
Mark Brown5c6af632012-07-09 19:09:41 +01001876 ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
1877 ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
1878 ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"),
1879 ARIZONA_MIXER_ROUTES("OUT2R", "HPOUT2R"),
Mark Brown35d38892012-08-26 13:50:48 -07001880 ARIZONA_MIXER_ROUTES("OUT3L", "HPOUT3L"),
1881 ARIZONA_MIXER_ROUTES("OUT3R", "HPOUT3R"),
Mark Brown5c6af632012-07-09 19:09:41 +01001882
1883 ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUTL"),
1884 ARIZONA_MIXER_ROUTES("OUT4R", "SPKOUTR"),
1885 ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
1886 ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
1887 ARIZONA_MIXER_ROUTES("OUT6L", "SPKDAT2L"),
1888 ARIZONA_MIXER_ROUTES("OUT6R", "SPKDAT2R"),
1889
1890 ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
1891 ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
1892
1893 ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
1894 ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
1895 ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
1896 ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
1897 ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
1898 ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
1899 ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
1900 ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
1901
1902 ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
1903 ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
Richard Fitzgeralde64001e2013-11-20 13:17:07 +00001904 ARIZONA_MIXER_ROUTES("AIF2TX3", "AIF2TX3"),
1905 ARIZONA_MIXER_ROUTES("AIF2TX4", "AIF2TX4"),
1906 ARIZONA_MIXER_ROUTES("AIF2TX5", "AIF2TX5"),
1907 ARIZONA_MIXER_ROUTES("AIF2TX6", "AIF2TX6"),
Mark Brown5c6af632012-07-09 19:09:41 +01001908
1909 ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
1910 ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
1911
Mark Brownd217f902013-05-17 13:29:05 +01001912 ARIZONA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
1913 ARIZONA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
1914 ARIZONA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
1915 ARIZONA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
1916 ARIZONA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
1917 ARIZONA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
1918 ARIZONA_MIXER_ROUTES("SLIMTX7", "SLIMTX7"),
1919 ARIZONA_MIXER_ROUTES("SLIMTX8", "SLIMTX8"),
1920
Mark Brown5c6af632012-07-09 19:09:41 +01001921 ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
1922 ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
1923 ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
1924 ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
1925
1926 ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
1927 ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
1928 ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"),
1929 ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"),
1930
1931 ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
1932 ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
1933 ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
1934 ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
1935
Mark Brown66e7aa22013-08-12 23:59:08 +01001936 ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Noise"),
1937 ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Mic"),
1938
Charles Keepaxe7edb272013-08-12 11:33:32 +01001939 ARIZONA_MUX_ROUTES("ASRC1L", "ASRC1L"),
1940 ARIZONA_MUX_ROUTES("ASRC1R", "ASRC1R"),
1941 ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"),
1942 ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"),
Mark Brown5c6af632012-07-09 19:09:41 +01001943
Mark Brown9a3e1b82013-11-19 16:04:01 +00001944 ARIZONA_DSP_ROUTES("DSP1"),
1945 ARIZONA_DSP_ROUTES("DSP2"),
1946 ARIZONA_DSP_ROUTES("DSP3"),
1947 ARIZONA_DSP_ROUTES("DSP4"),
1948
Charles Keepax0da2e5b2013-11-19 16:04:02 +00001949 ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
1950 ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
1951 ARIZONA_MUX_ROUTES("ISRC1INT3", "ISRC1INT3"),
1952 ARIZONA_MUX_ROUTES("ISRC1INT4", "ISRC1INT4"),
1953
1954 ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
1955 ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
1956 ARIZONA_MUX_ROUTES("ISRC1DEC3", "ISRC1DEC3"),
1957 ARIZONA_MUX_ROUTES("ISRC1DEC4", "ISRC1DEC4"),
1958
1959 ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
1960 ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
1961 ARIZONA_MUX_ROUTES("ISRC2INT3", "ISRC2INT3"),
1962 ARIZONA_MUX_ROUTES("ISRC2INT4", "ISRC2INT4"),
1963
1964 ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
1965 ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
1966 ARIZONA_MUX_ROUTES("ISRC2DEC3", "ISRC2DEC3"),
1967 ARIZONA_MUX_ROUTES("ISRC2DEC4", "ISRC2DEC4"),
1968
1969 ARIZONA_MUX_ROUTES("ISRC3INT1", "ISRC3INT1"),
1970 ARIZONA_MUX_ROUTES("ISRC3INT2", "ISRC3INT2"),
1971 ARIZONA_MUX_ROUTES("ISRC3INT3", "ISRC3INT3"),
1972 ARIZONA_MUX_ROUTES("ISRC3INT4", "ISRC3INT4"),
1973
1974 ARIZONA_MUX_ROUTES("ISRC3DEC1", "ISRC3DEC1"),
1975 ARIZONA_MUX_ROUTES("ISRC3DEC2", "ISRC3DEC2"),
1976 ARIZONA_MUX_ROUTES("ISRC3DEC3", "ISRC3DEC3"),
1977 ARIZONA_MUX_ROUTES("ISRC3DEC4", "ISRC3DEC4"),
1978
Charles Keepaxa9c9caf2013-10-26 15:31:26 +01001979 { "AEC Loopback", "HPOUT1L", "OUT1L" },
1980 { "AEC Loopback", "HPOUT1R", "OUT1R" },
Mark Brown5c6af632012-07-09 19:09:41 +01001981 { "HPOUT1L", NULL, "OUT1L" },
1982 { "HPOUT1R", NULL, "OUT1R" },
1983
Charles Keepaxa9c9caf2013-10-26 15:31:26 +01001984 { "AEC Loopback", "HPOUT2L", "OUT2L" },
1985 { "AEC Loopback", "HPOUT2R", "OUT2R" },
Mark Brown5c6af632012-07-09 19:09:41 +01001986 { "HPOUT2L", NULL, "OUT2L" },
1987 { "HPOUT2R", NULL, "OUT2R" },
1988
Charles Keepaxa9c9caf2013-10-26 15:31:26 +01001989 { "AEC Loopback", "HPOUT3L", "OUT3L" },
1990 { "AEC Loopback", "HPOUT3R", "OUT3R" },
Mark Brown35d38892012-08-26 13:50:48 -07001991 { "HPOUT3L", NULL, "OUT3L" },
Charles Keepax280484e2013-12-17 13:16:16 +00001992 { "HPOUT3R", NULL, "OUT3R" },
Mark Brown5c6af632012-07-09 19:09:41 +01001993
Charles Keepaxa9c9caf2013-10-26 15:31:26 +01001994 { "AEC Loopback", "SPKOUTL", "OUT4L" },
Mark Brown5c6af632012-07-09 19:09:41 +01001995 { "SPKOUTLN", NULL, "OUT4L" },
1996 { "SPKOUTLP", NULL, "OUT4L" },
1997
Charles Keepaxa9c9caf2013-10-26 15:31:26 +01001998 { "AEC Loopback", "SPKOUTR", "OUT4R" },
Mark Brown5c6af632012-07-09 19:09:41 +01001999 { "SPKOUTRN", NULL, "OUT4R" },
2000 { "SPKOUTRP", NULL, "OUT4R" },
2001
Charles Keepaxa9c9caf2013-10-26 15:31:26 +01002002 { "AEC Loopback", "SPKDAT1L", "OUT5L" },
2003 { "AEC Loopback", "SPKDAT1R", "OUT5R" },
Mark Brown5c6af632012-07-09 19:09:41 +01002004 { "SPKDAT1L", NULL, "OUT5L" },
2005 { "SPKDAT1R", NULL, "OUT5R" },
2006
Charles Keepaxa9c9caf2013-10-26 15:31:26 +01002007 { "AEC Loopback", "SPKDAT2L", "OUT6L" },
2008 { "AEC Loopback", "SPKDAT2R", "OUT6R" },
Mark Brown5c6af632012-07-09 19:09:41 +01002009 { "SPKDAT2L", NULL, "OUT6L" },
2010 { "SPKDAT2R", NULL, "OUT6R" },
Mark Brown57a10a12013-01-10 19:32:33 +00002011
Charles Keepaxd1901062015-11-19 16:11:10 +00002012 WM5110_RXANC_INPUT_ROUTES("RXANCL", "RXANCL"),
2013 WM5110_RXANC_INPUT_ROUTES("RXANCR", "RXANCR"),
2014
2015 WM5110_RXANC_OUTPUT_ROUTES("OUT1L", "HPOUT1L"),
2016 WM5110_RXANC_OUTPUT_ROUTES("OUT1R", "HPOUT1R"),
2017 WM5110_RXANC_OUTPUT_ROUTES("OUT2L", "HPOUT2L"),
2018 WM5110_RXANC_OUTPUT_ROUTES("OUT2R", "HPOUT2R"),
2019 WM5110_RXANC_OUTPUT_ROUTES("OUT3L", "HPOUT3L"),
2020 WM5110_RXANC_OUTPUT_ROUTES("OUT3R", "HPOUT3R"),
2021 WM5110_RXANC_OUTPUT_ROUTES("OUT4L", "SPKOUTL"),
2022 WM5110_RXANC_OUTPUT_ROUTES("OUT4R", "SPKOUTR"),
2023 WM5110_RXANC_OUTPUT_ROUTES("OUT5L", "SPKDAT1L"),
2024 WM5110_RXANC_OUTPUT_ROUTES("OUT5R", "SPKDAT1R"),
2025 WM5110_RXANC_OUTPUT_ROUTES("OUT6L", "SPKDAT2L"),
2026 WM5110_RXANC_OUTPUT_ROUTES("OUT6R", "SPKDAT2R"),
2027
Mark Brown57a10a12013-01-10 19:32:33 +00002028 { "MICSUPP", NULL, "SYSCLK" },
Charles Keepaxb63144e2013-07-04 08:56:28 +01002029
Charles Keepax9fc772e2016-05-13 16:45:15 +01002030 { "DRC1 Signal Activity", NULL, "SYSCLK" },
2031 { "DRC2 Signal Activity", NULL, "SYSCLK" },
Charles Keepaxb63144e2013-07-04 08:56:28 +01002032 { "DRC1 Signal Activity", NULL, "DRC1L" },
2033 { "DRC1 Signal Activity", NULL, "DRC1R" },
2034 { "DRC2 Signal Activity", NULL, "DRC2L" },
2035 { "DRC2 Signal Activity", NULL, "DRC2R" },
Charles Keepax97126ce2016-05-13 16:45:16 +01002036
2037 { "DSP Voice Trigger", NULL, "SYSCLK" },
2038 { "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" },
2039 { "DSP3 Voice Trigger", "Switch", "DSP3" },
Mark Brown5c6af632012-07-09 19:09:41 +01002040};
2041
Charles Keepax7dd0f7c2018-02-20 16:08:11 +00002042static int wm5110_set_fll(struct snd_soc_component *component, int fll_id,
2043 int source, unsigned int Fref, unsigned int Fout)
Mark Brown5c6af632012-07-09 19:09:41 +01002044{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002045 struct wm5110_priv *wm5110 = snd_soc_component_get_drvdata(component);
Mark Brown5c6af632012-07-09 19:09:41 +01002046
2047 switch (fll_id) {
2048 case WM5110_FLL1:
2049 return arizona_set_fll(&wm5110->fll[0], source, Fref, Fout);
2050 case WM5110_FLL2:
2051 return arizona_set_fll(&wm5110->fll[1], source, Fref, Fout);
Charles Keepaxee929a92013-02-20 17:28:40 +00002052 case WM5110_FLL1_REFCLK:
2053 return arizona_set_fll_refclk(&wm5110->fll[0], source, Fref,
2054 Fout);
2055 case WM5110_FLL2_REFCLK:
2056 return arizona_set_fll_refclk(&wm5110->fll[1], source, Fref,
2057 Fout);
Mark Brown5c6af632012-07-09 19:09:41 +01002058 default:
2059 return -EINVAL;
2060 }
2061}
2062
Charles Keepaxd81221f2016-02-04 16:29:01 +00002063#define WM5110_RATES SNDRV_PCM_RATE_KNOT
Mark Brown5c6af632012-07-09 19:09:41 +01002064
2065#define WM5110_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
2066 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
2067
2068static struct snd_soc_dai_driver wm5110_dai[] = {
2069 {
2070 .name = "wm5110-aif1",
2071 .id = 1,
2072 .base = ARIZONA_AIF1_BCLK_CTRL,
2073 .playback = {
2074 .stream_name = "AIF1 Playback",
2075 .channels_min = 1,
2076 .channels_max = 8,
2077 .rates = WM5110_RATES,
2078 .formats = WM5110_FORMATS,
2079 },
2080 .capture = {
2081 .stream_name = "AIF1 Capture",
2082 .channels_min = 1,
2083 .channels_max = 8,
2084 .rates = WM5110_RATES,
2085 .formats = WM5110_FORMATS,
2086 },
2087 .ops = &arizona_dai_ops,
2088 .symmetric_rates = 1,
Richard Fitzgerald3d02cc72014-07-22 11:50:22 +01002089 .symmetric_samplebits = 1,
Mark Brown5c6af632012-07-09 19:09:41 +01002090 },
2091 {
2092 .name = "wm5110-aif2",
2093 .id = 2,
2094 .base = ARIZONA_AIF2_BCLK_CTRL,
2095 .playback = {
2096 .stream_name = "AIF2 Playback",
2097 .channels_min = 1,
Richard Fitzgeralde64001e2013-11-20 13:17:07 +00002098 .channels_max = 6,
Mark Brown5c6af632012-07-09 19:09:41 +01002099 .rates = WM5110_RATES,
2100 .formats = WM5110_FORMATS,
2101 },
2102 .capture = {
2103 .stream_name = "AIF2 Capture",
2104 .channels_min = 1,
Richard Fitzgeralde64001e2013-11-20 13:17:07 +00002105 .channels_max = 6,
Mark Brown5c6af632012-07-09 19:09:41 +01002106 .rates = WM5110_RATES,
2107 .formats = WM5110_FORMATS,
2108 },
2109 .ops = &arizona_dai_ops,
2110 .symmetric_rates = 1,
Richard Fitzgerald3d02cc72014-07-22 11:50:22 +01002111 .symmetric_samplebits = 1,
Mark Brown5c6af632012-07-09 19:09:41 +01002112 },
2113 {
2114 .name = "wm5110-aif3",
2115 .id = 3,
2116 .base = ARIZONA_AIF3_BCLK_CTRL,
2117 .playback = {
2118 .stream_name = "AIF3 Playback",
2119 .channels_min = 1,
2120 .channels_max = 2,
2121 .rates = WM5110_RATES,
2122 .formats = WM5110_FORMATS,
2123 },
2124 .capture = {
2125 .stream_name = "AIF3 Capture",
2126 .channels_min = 1,
2127 .channels_max = 2,
2128 .rates = WM5110_RATES,
2129 .formats = WM5110_FORMATS,
2130 },
2131 .ops = &arizona_dai_ops,
2132 .symmetric_rates = 1,
Richard Fitzgerald3d02cc72014-07-22 11:50:22 +01002133 .symmetric_samplebits = 1,
Mark Brown5c6af632012-07-09 19:09:41 +01002134 },
Mark Brownd217f902013-05-17 13:29:05 +01002135 {
2136 .name = "wm5110-slim1",
2137 .id = 4,
2138 .playback = {
2139 .stream_name = "Slim1 Playback",
2140 .channels_min = 1,
2141 .channels_max = 4,
2142 .rates = WM5110_RATES,
2143 .formats = WM5110_FORMATS,
2144 },
2145 .capture = {
2146 .stream_name = "Slim1 Capture",
2147 .channels_min = 1,
2148 .channels_max = 4,
2149 .rates = WM5110_RATES,
2150 .formats = WM5110_FORMATS,
2151 },
2152 .ops = &arizona_simple_dai_ops,
2153 },
2154 {
2155 .name = "wm5110-slim2",
2156 .id = 5,
2157 .playback = {
2158 .stream_name = "Slim2 Playback",
2159 .channels_min = 1,
2160 .channels_max = 2,
2161 .rates = WM5110_RATES,
2162 .formats = WM5110_FORMATS,
2163 },
2164 .capture = {
2165 .stream_name = "Slim2 Capture",
2166 .channels_min = 1,
2167 .channels_max = 2,
2168 .rates = WM5110_RATES,
2169 .formats = WM5110_FORMATS,
2170 },
2171 .ops = &arizona_simple_dai_ops,
2172 },
2173 {
2174 .name = "wm5110-slim3",
2175 .id = 6,
2176 .playback = {
2177 .stream_name = "Slim3 Playback",
2178 .channels_min = 1,
2179 .channels_max = 2,
2180 .rates = WM5110_RATES,
2181 .formats = WM5110_FORMATS,
2182 },
2183 .capture = {
2184 .stream_name = "Slim3 Capture",
2185 .channels_min = 1,
2186 .channels_max = 2,
2187 .rates = WM5110_RATES,
2188 .formats = WM5110_FORMATS,
2189 },
2190 .ops = &arizona_simple_dai_ops,
2191 },
Charles Keepax1d981e02015-12-15 11:29:42 +00002192 {
2193 .name = "wm5110-cpu-voicectrl",
2194 .capture = {
2195 .stream_name = "Voice Control CPU",
2196 .channels_min = 1,
2197 .channels_max = 1,
2198 .rates = WM5110_RATES,
2199 .formats = WM5110_FORMATS,
2200 },
2201 .compress_new = snd_soc_new_compress,
2202 },
2203 {
2204 .name = "wm5110-dsp-voicectrl",
2205 .capture = {
2206 .stream_name = "Voice Control DSP",
2207 .channels_min = 1,
2208 .channels_max = 1,
2209 .rates = WM5110_RATES,
2210 .formats = WM5110_FORMATS,
2211 },
2212 },
Charles Keepax31889502016-01-21 17:53:00 +00002213 {
2214 .name = "wm5110-cpu-trace",
2215 .capture = {
2216 .stream_name = "Audio Trace CPU",
2217 .channels_min = 1,
2218 .channels_max = 6,
2219 .rates = WM5110_RATES,
2220 .formats = WM5110_FORMATS,
2221 },
2222 .compress_new = snd_soc_new_compress,
2223 },
2224 {
2225 .name = "wm5110-dsp-trace",
2226 .capture = {
2227 .stream_name = "Audio Trace DSP",
2228 .channels_min = 1,
2229 .channels_max = 6,
2230 .rates = WM5110_RATES,
2231 .formats = WM5110_FORMATS,
2232 },
2233 },
Mark Brown5c6af632012-07-09 19:09:41 +01002234};
2235
Charles Keepax406abc92015-12-15 11:29:45 +00002236static int wm5110_open(struct snd_compr_stream *stream)
2237{
2238 struct snd_soc_pcm_runtime *rtd = stream->private_data;
Kuninori Morimoto0a2b0512018-01-29 02:45:30 +00002239 struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
2240 struct wm5110_priv *priv = snd_soc_component_get_drvdata(component);
Charles Keepax406abc92015-12-15 11:29:45 +00002241 struct arizona *arizona = priv->core.arizona;
2242 int n_adsp;
2243
2244 if (strcmp(rtd->codec_dai->name, "wm5110-dsp-voicectrl") == 0) {
2245 n_adsp = 2;
Charles Keepax31889502016-01-21 17:53:00 +00002246 } else if (strcmp(rtd->codec_dai->name, "wm5110-dsp-trace") == 0) {
2247 n_adsp = 0;
Charles Keepax406abc92015-12-15 11:29:45 +00002248 } else {
2249 dev_err(arizona->dev,
2250 "No suitable compressed stream for DAI '%s'\n",
2251 rtd->codec_dai->name);
2252 return -EINVAL;
2253 }
2254
2255 return wm_adsp_compr_open(&priv->core.adsp[n_adsp], stream);
2256}
2257
Charles Keepax565ace42016-01-06 12:33:18 +00002258static irqreturn_t wm5110_adsp2_irq(int irq, void *data)
2259{
Charles Keepax31889502016-01-21 17:53:00 +00002260 struct wm5110_priv *priv = data;
2261 struct arizona *arizona = priv->core.arizona;
Charles Keepax546ad3d2016-05-31 12:44:17 +01002262 struct arizona_voice_trigger_info info;
Charles Keepax31889502016-01-21 17:53:00 +00002263 int serviced = 0;
2264 int i, ret;
Charles Keepax565ace42016-01-06 12:33:18 +00002265
Charles Keepax31889502016-01-21 17:53:00 +00002266 for (i = 0; i < WM5110_NUM_ADSP; ++i) {
2267 ret = wm_adsp_compr_handle_irq(&priv->core.adsp[i]);
2268 if (ret != -ENODEV)
2269 serviced++;
Charles Keepax546ad3d2016-05-31 12:44:17 +01002270 if (ret == WM_ADSP_COMPR_VOICE_TRIGGER) {
2271 info.core = i;
Charles Keepax7baa7e22016-05-13 16:45:19 +01002272 arizona_call_notifiers(arizona,
2273 ARIZONA_NOTIFY_VOICE_TRIGGER,
Charles Keepax546ad3d2016-05-31 12:44:17 +01002274 &info);
2275 }
Charles Keepax31889502016-01-21 17:53:00 +00002276 }
2277
2278 if (!serviced) {
2279 dev_err(arizona->dev, "Spurious compressed data IRQ\n");
Charles Keepax565ace42016-01-06 12:33:18 +00002280 return IRQ_NONE;
Charles Keepax31889502016-01-21 17:53:00 +00002281 }
Charles Keepax565ace42016-01-06 12:33:18 +00002282
2283 return IRQ_HANDLED;
2284}
2285
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002286static int wm5110_component_probe(struct snd_soc_component *component)
Mark Brown5c6af632012-07-09 19:09:41 +01002287{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002288 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2289 struct wm5110_priv *priv = snd_soc_component_get_drvdata(component);
Kuninori Morimoto893d7cb2017-11-28 06:04:45 +00002290 struct arizona *arizona = priv->core.arizona;
Richard Fitzgeraldf5e2ce92015-06-11 11:32:30 +01002291 int i, ret;
Mark Brown5c6af632012-07-09 19:09:41 +01002292
Kuninori Morimoto893d7cb2017-11-28 06:04:45 +00002293 arizona->dapm = dapm;
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002294 snd_soc_component_init_regmap(component, arizona->regmap);
Mark Brown2f76e682012-11-26 21:18:18 +00002295
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002296 ret = arizona_init_spk(component);
Charles Keepaxacff07d2017-01-18 15:27:05 +00002297 if (ret < 0)
2298 return ret;
2299
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002300 arizona_init_gpio(component);
2301 arizona_init_mono(component);
Mark Brown62cc4d52013-05-20 11:28:35 -05002302
Richard Fitzgeraldf5e2ce92015-06-11 11:32:30 +01002303 for (i = 0; i < WM5110_NUM_ADSP; ++i) {
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002304 ret = wm_adsp2_component_probe(&priv->core.adsp[i], component);
Richard Fitzgeraldf5e2ce92015-06-11 11:32:30 +01002305 if (ret)
Charles Keepaxd90c6cc2015-07-10 14:37:25 +01002306 goto err_adsp2_codec_probe;
Richard Fitzgeraldf5e2ce92015-06-11 11:32:30 +01002307 }
Mark Brown9a3e1b82013-11-19 16:04:01 +00002308
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002309 ret = snd_soc_add_component_controls(component,
Charles Keepax7dd0f7c2018-02-20 16:08:11 +00002310 arizona_adsp2_rate_controls,
2311 WM5110_NUM_ADSP);
Richard Fitzgerald336d0442015-06-18 13:43:19 +01002312 if (ret)
Charles Keepaxd90c6cc2015-07-10 14:37:25 +01002313 goto err_adsp2_codec_probe;
Richard Fitzgerald336d0442015-06-18 13:43:19 +01002314
Richard Fitzgerald35f44032016-11-29 15:44:39 +00002315 snd_soc_component_disable_pin(component, "HAPTICS");
Mark Brown2f76e682012-11-26 21:18:18 +00002316
2317 return 0;
Charles Keepaxd90c6cc2015-07-10 14:37:25 +01002318
2319err_adsp2_codec_probe:
2320 for (--i; i >= 0; --i)
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002321 wm_adsp2_component_remove(&priv->core.adsp[i], component);
Charles Keepaxd90c6cc2015-07-10 14:37:25 +01002322
2323 return ret;
Mark Brown2f76e682012-11-26 21:18:18 +00002324}
2325
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002326static void wm5110_component_remove(struct snd_soc_component *component)
Mark Brown2f76e682012-11-26 21:18:18 +00002327{
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002328 struct wm5110_priv *priv = snd_soc_component_get_drvdata(component);
Richard Fitzgeraldf5e2ce92015-06-11 11:32:30 +01002329 int i;
2330
2331 for (i = 0; i < WM5110_NUM_ADSP; ++i)
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002332 wm_adsp2_component_remove(&priv->core.adsp[i], component);
Mark Brown2f76e682012-11-26 21:18:18 +00002333
2334 priv->core.arizona->dapm = NULL;
Mark Brown5c6af632012-07-09 19:09:41 +01002335}
2336
2337#define WM5110_DIG_VU 0x0200
2338
2339static unsigned int wm5110_digital_vu[] = {
Mark Brown5c6af632012-07-09 19:09:41 +01002340 ARIZONA_DAC_DIGITAL_VOLUME_1L,
2341 ARIZONA_DAC_DIGITAL_VOLUME_1R,
2342 ARIZONA_DAC_DIGITAL_VOLUME_2L,
2343 ARIZONA_DAC_DIGITAL_VOLUME_2R,
2344 ARIZONA_DAC_DIGITAL_VOLUME_3L,
2345 ARIZONA_DAC_DIGITAL_VOLUME_3R,
2346 ARIZONA_DAC_DIGITAL_VOLUME_4L,
2347 ARIZONA_DAC_DIGITAL_VOLUME_4R,
2348 ARIZONA_DAC_DIGITAL_VOLUME_5L,
2349 ARIZONA_DAC_DIGITAL_VOLUME_5R,
Charles Keepaxae605032012-09-27 13:21:48 +01002350 ARIZONA_DAC_DIGITAL_VOLUME_6L,
2351 ARIZONA_DAC_DIGITAL_VOLUME_6R,
Mark Brown5c6af632012-07-09 19:09:41 +01002352};
2353
Kuninori Morimoto0a2b0512018-01-29 02:45:30 +00002354static struct snd_compr_ops wm5110_compr_ops = {
2355 .open = wm5110_open,
2356 .free = wm_adsp_compr_free,
2357 .set_params = wm_adsp_compr_set_params,
2358 .get_caps = wm_adsp_compr_get_caps,
2359 .trigger = wm_adsp_compr_trigger,
2360 .pointer = wm_adsp_compr_pointer,
2361 .copy = wm_adsp_compr_copy,
2362};
2363
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002364static const struct snd_soc_component_driver soc_component_dev_wm5110 = {
2365 .probe = wm5110_component_probe,
2366 .remove = wm5110_component_remove,
2367 .set_sysclk = arizona_set_sysclk,
2368 .set_pll = wm5110_set_fll,
2369 .name = DRV_NAME,
2370 .compr_ops = &wm5110_compr_ops,
2371 .controls = wm5110_snd_controls,
2372 .num_controls = ARRAY_SIZE(wm5110_snd_controls),
2373 .dapm_widgets = wm5110_dapm_widgets,
2374 .num_dapm_widgets = ARRAY_SIZE(wm5110_dapm_widgets),
2375 .dapm_routes = wm5110_dapm_routes,
2376 .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes),
2377 .use_pmdown_time = 1,
2378 .endianness = 1,
2379 .non_legacy_dai_naming = 1,
Mark Brown5c6af632012-07-09 19:09:41 +01002380};
2381
Bill Pemberton7a79e942012-12-07 09:26:37 -05002382static int wm5110_probe(struct platform_device *pdev)
Mark Brown5c6af632012-07-09 19:09:41 +01002383{
2384 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
2385 struct wm5110_priv *wm5110;
Mark Brown9a3e1b82013-11-19 16:04:01 +00002386 int i, ret;
Mark Brown5c6af632012-07-09 19:09:41 +01002387
2388 wm5110 = devm_kzalloc(&pdev->dev, sizeof(struct wm5110_priv),
2389 GFP_KERNEL);
2390 if (wm5110 == NULL)
2391 return -ENOMEM;
2392 platform_set_drvdata(pdev, wm5110);
2393
Charles Keepax0a229b12017-09-04 16:41:49 +01002394 if (IS_ENABLED(CONFIG_OF)) {
2395 if (!dev_get_platdata(arizona->dev)) {
2396 ret = arizona_of_get_audio_pdata(arizona);
2397 if (ret < 0)
2398 return ret;
2399 }
2400 }
2401
Mark Brown5c6af632012-07-09 19:09:41 +01002402 wm5110->core.arizona = arizona;
Mark Brownddbce972013-02-15 17:27:22 +00002403 wm5110->core.num_inputs = 8;
Mark Brown5c6af632012-07-09 19:09:41 +01002404
Mark Brown9a3e1b82013-11-19 16:04:01 +00002405 for (i = 0; i < WM5110_NUM_ADSP; i++) {
2406 wm5110->core.adsp[i].part = "wm5110";
2407 wm5110->core.adsp[i].num = i + 1;
2408 wm5110->core.adsp[i].type = WMFW_ADSP2;
2409 wm5110->core.adsp[i].dev = arizona->dev;
2410 wm5110->core.adsp[i].regmap = arizona->regmap;
2411
2412 wm5110->core.adsp[i].base = ARIZONA_DSP1_CONTROL_1
2413 + (0x100 * i);
2414 wm5110->core.adsp[i].mem = wm5110_dsp_regions[i];
2415 wm5110->core.adsp[i].num_mems
2416 = ARRAY_SIZE(wm5110_dsp1_regions);
2417
Richard Fitzgerald81ac58b2015-06-02 11:53:34 +01002418 ret = wm_adsp2_init(&wm5110->core.adsp[i]);
Mark Brown9a3e1b82013-11-19 16:04:01 +00002419 if (ret != 0)
2420 return ret;
2421 }
2422
Mark Brown5c6af632012-07-09 19:09:41 +01002423 for (i = 0; i < ARRAY_SIZE(wm5110->fll); i++)
2424 wm5110->fll[i].vco_mult = 3;
2425
2426 arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
2427 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
2428 &wm5110->fll[0]);
2429 arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
2430 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
2431 &wm5110->fll[1]);
2432
Charles Keepax0da2e5b2013-11-19 16:04:02 +00002433 /* SR2 fixed at 8kHz, SR3 fixed at 16kHz */
2434 regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2,
2435 ARIZONA_SAMPLE_RATE_2_MASK, 0x11);
2436 regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3,
2437 ARIZONA_SAMPLE_RATE_3_MASK, 0x12);
2438
Mark Brown5c6af632012-07-09 19:09:41 +01002439 for (i = 0; i < ARRAY_SIZE(wm5110_dai); i++)
2440 arizona_init_dai(&wm5110->core, i);
2441
2442 /* Latch volume update bits */
2443 for (i = 0; i < ARRAY_SIZE(wm5110_digital_vu); i++)
2444 regmap_update_bits(arizona->regmap, wm5110_digital_vu[i],
2445 WM5110_DIG_VU, WM5110_DIG_VU);
2446
2447 pm_runtime_enable(&pdev->dev);
2448 pm_runtime_idle(&pdev->dev);
2449
Charles Keepax08094922016-10-26 10:59:58 +01002450 ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
2451 "ADSP2 Compressed IRQ", wm5110_adsp2_irq,
2452 wm5110);
2453 if (ret != 0) {
2454 dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret);
2455 return ret;
2456 }
2457
Charles Keepax9e3f9f32017-09-04 16:41:48 +01002458 arizona_init_common(arizona);
2459
Charles Keepax85e7dd32017-09-04 16:41:53 +01002460 ret = arizona_init_vol_limit(arizona);
2461 if (ret < 0)
2462 goto err_dsp_irq;
Charles Keepax31833ea2016-10-26 10:59:57 +01002463 ret = arizona_init_spk_irqs(arizona);
2464 if (ret < 0)
Charles Keepax08094922016-10-26 10:59:58 +01002465 goto err_dsp_irq;
Charles Keepax31833ea2016-10-26 10:59:57 +01002466
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002467 ret = devm_snd_soc_register_component(&pdev->dev,
Charles Keepax7dd0f7c2018-02-20 16:08:11 +00002468 &soc_component_dev_wm5110,
2469 wm5110_dai,
2470 ARRAY_SIZE(wm5110_dai));
Charles Keepax1d981e02015-12-15 11:29:42 +00002471 if (ret < 0) {
Kuninori Morimoto0fe1daa2018-02-13 02:03:12 +00002472 dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
Kuninori Morimoto0a2b0512018-01-29 02:45:30 +00002473 goto err_spk_irqs;
Charles Keepax1d981e02015-12-15 11:29:42 +00002474 }
2475
Charles Keepax1d981e02015-12-15 11:29:42 +00002476 return ret;
Charles Keepax31833ea2016-10-26 10:59:57 +01002477
Charles Keepax31833ea2016-10-26 10:59:57 +01002478err_spk_irqs:
2479 arizona_free_spk_irqs(arizona);
Charles Keepax08094922016-10-26 10:59:58 +01002480err_dsp_irq:
2481 arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, wm5110);
Charles Keepax31833ea2016-10-26 10:59:57 +01002482
2483 return ret;
Mark Brown5c6af632012-07-09 19:09:41 +01002484}
2485
Bill Pemberton7a79e942012-12-07 09:26:37 -05002486static int wm5110_remove(struct platform_device *pdev)
Mark Brown5c6af632012-07-09 19:09:41 +01002487{
Richard Fitzgerald401cf142016-04-27 14:58:28 +01002488 struct wm5110_priv *wm5110 = platform_get_drvdata(pdev);
Charles Keepax31833ea2016-10-26 10:59:57 +01002489 struct arizona *arizona = wm5110->core.arizona;
Richard Fitzgerald401cf142016-04-27 14:58:28 +01002490 int i;
2491
Mark Brown5c6af632012-07-09 19:09:41 +01002492 pm_runtime_disable(&pdev->dev);
2493
Richard Fitzgerald401cf142016-04-27 14:58:28 +01002494 for (i = 0; i < WM5110_NUM_ADSP; i++)
2495 wm_adsp2_remove(&wm5110->core.adsp[i]);
2496
Charles Keepax31833ea2016-10-26 10:59:57 +01002497 arizona_free_spk_irqs(arizona);
2498
Charles Keepax08094922016-10-26 10:59:58 +01002499 arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, wm5110);
2500
Mark Brown5c6af632012-07-09 19:09:41 +01002501 return 0;
2502}
2503
2504static struct platform_driver wm5110_codec_driver = {
2505 .driver = {
2506 .name = "wm5110-codec",
Mark Brown5c6af632012-07-09 19:09:41 +01002507 },
2508 .probe = wm5110_probe,
Bill Pemberton7a79e942012-12-07 09:26:37 -05002509 .remove = wm5110_remove,
Mark Brown5c6af632012-07-09 19:09:41 +01002510};
2511
2512module_platform_driver(wm5110_codec_driver);
2513
2514MODULE_DESCRIPTION("ASoC WM5110 driver");
2515MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
2516MODULE_LICENSE("GPL");
2517MODULE_ALIAS("platform:wm5110-codec");