1
2
3
4
5
6
7
8
9
10
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"
33#include "wm8998.h"
34
35struct wm8998_priv {
36 struct arizona_priv core;
37 struct arizona_fll fll[2];
38};
39
40static int wm8998_asrc_ev(struct snd_soc_dapm_widget *w,
41 struct snd_kcontrol *kcontrol,
42 int event)
43{
44 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
45 unsigned int val;
46
47 switch (event) {
48 case SND_SOC_DAPM_PRE_PMU:
49 val = snd_soc_component_read32(component, ARIZONA_ASRC_RATE1);
50 val &= ARIZONA_ASRC_RATE1_MASK;
51 val >>= ARIZONA_ASRC_RATE1_SHIFT;
52
53 switch (val) {
54 case 0:
55 case 1:
56 case 2:
57 val = snd_soc_component_read32(component,
58 ARIZONA_SAMPLE_RATE_1 + val);
59 if (val >= 0x11) {
60 dev_warn(component->dev,
61 "Unsupported ASRC rate1 (%s)\n",
62 arizona_sample_rate_val_to_name(val));
63 return -EINVAL;
64 }
65 break;
66 default:
67 dev_err(component->dev,
68 "Illegal ASRC rate1 selector (0x%x)\n",
69 val);
70 return -EINVAL;
71 }
72
73 val = snd_soc_component_read32(component, ARIZONA_ASRC_RATE2);
74 val &= ARIZONA_ASRC_RATE2_MASK;
75 val >>= ARIZONA_ASRC_RATE2_SHIFT;
76
77 switch (val) {
78 case 8:
79 case 9:
80 val -= 0x8;
81 val = snd_soc_component_read32(component,
82 ARIZONA_ASYNC_SAMPLE_RATE_1 + val);
83 if (val >= 0x11) {
84 dev_warn(component->dev,
85 "Unsupported ASRC rate2 (%s)\n",
86 arizona_sample_rate_val_to_name(val));
87 return -EINVAL;
88 }
89 break;
90 default:
91 dev_err(component->dev,
92 "Illegal ASRC rate2 selector (0x%x)\n",
93 val);
94 return -EINVAL;
95 }
96 break;
97 default:
98 return -EINVAL;
99 }
100
101 return 0;
102}
103
104static int wm8998_inmux_put(struct snd_kcontrol *kcontrol,
105 struct snd_ctl_elem_value *ucontrol)
106{
107 struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
108 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
109 struct wm8998_priv *wm8998 = snd_soc_component_get_drvdata(component);
110 struct arizona *arizona = wm8998->core.arizona;
111 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
112 unsigned int mode_reg, mode_index;
113 unsigned int mux, inmode, src_val, mode_val;
114
115 mux = ucontrol->value.enumerated.item[0];
116 if (mux > 1)
117 return -EINVAL;
118
119 switch (e->reg) {
120 case ARIZONA_ADC_DIGITAL_VOLUME_2L:
121 mode_reg = ARIZONA_IN2L_CONTROL;
122 mode_index = 1 + (2 * mux);
123 break;
124 default:
125 mode_reg = ARIZONA_IN1L_CONTROL;
126 mode_index = (2 * mux);
127 break;
128 }
129
130 inmode = arizona->pdata.inmode[mode_index];
131 if (inmode & ARIZONA_INMODE_DMIC)
132 mode_val = 1 << ARIZONA_IN1_MODE_SHIFT;
133 else
134 mode_val = 0;
135
136 src_val = mux << ARIZONA_IN1L_SRC_SHIFT;
137 if (inmode & ARIZONA_INMODE_SE)
138 src_val |= 1 << ARIZONA_IN1L_SRC_SE_SHIFT;
139
140 snd_soc_component_update_bits(component, mode_reg,
141 ARIZONA_IN1_MODE_MASK, mode_val);
142
143 snd_soc_component_update_bits(component, e->reg,
144 ARIZONA_IN1L_SRC_MASK |
145 ARIZONA_IN1L_SRC_SE_MASK,
146 src_val);
147
148 return snd_soc_dapm_mux_update_power(dapm, kcontrol,
149 ucontrol->value.enumerated.item[0],
150 e, NULL);
151}
152
153static const char * const wm8998_inmux_texts[] = {
154 "A",
155 "B",
156};
157
158static SOC_ENUM_SINGLE_DECL(wm8998_in1muxl_enum,
159 ARIZONA_ADC_DIGITAL_VOLUME_1L,
160 ARIZONA_IN1L_SRC_SHIFT,
161 wm8998_inmux_texts);
162
163static SOC_ENUM_SINGLE_DECL(wm8998_in1muxr_enum,
164 ARIZONA_ADC_DIGITAL_VOLUME_1R,
165 ARIZONA_IN1R_SRC_SHIFT,
166 wm8998_inmux_texts);
167
168static SOC_ENUM_SINGLE_DECL(wm8998_in2mux_enum,
169 ARIZONA_ADC_DIGITAL_VOLUME_2L,
170 ARIZONA_IN2L_SRC_SHIFT,
171 wm8998_inmux_texts);
172
173static const struct snd_kcontrol_new wm8998_in1mux[2] = {
174 SOC_DAPM_ENUM_EXT("IN1L Mux", wm8998_in1muxl_enum,
175 snd_soc_dapm_get_enum_double, wm8998_inmux_put),
176 SOC_DAPM_ENUM_EXT("IN1R Mux", wm8998_in1muxr_enum,
177 snd_soc_dapm_get_enum_double, wm8998_inmux_put),
178};
179
180static const struct snd_kcontrol_new wm8998_in2mux =
181 SOC_DAPM_ENUM_EXT("IN2 Mux", wm8998_in2mux_enum,
182 snd_soc_dapm_get_enum_double, wm8998_inmux_put);
183
184static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
185static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
186static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
187static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
188
189#define WM8998_NG_SRC(name, base) \
190 SOC_SINGLE(name " NG HPOUTL Switch", base, 0, 1, 0), \
191 SOC_SINGLE(name " NG HPOUTR Switch", base, 1, 1, 0), \
192 SOC_SINGLE(name " NG LINEOUTL Switch", base, 2, 1, 0), \
193 SOC_SINGLE(name " NG LINEOUTR Switch", base, 3, 1, 0), \
194 SOC_SINGLE(name " NG EPOUT Switch", base, 4, 1, 0), \
195 SOC_SINGLE(name " NG SPKOUTL Switch", base, 6, 1, 0), \
196 SOC_SINGLE(name " NG SPKOUTR Switch", base, 7, 1, 0)
197
198static const struct snd_kcontrol_new wm8998_snd_controls[] = {
199SOC_ENUM("IN1 OSR", arizona_in_dmic_osr[0]),
200SOC_ENUM("IN2 OSR", arizona_in_dmic_osr[1]),
201
202SOC_SINGLE_RANGE_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL,
203 ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
204SOC_SINGLE_RANGE_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL,
205 ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
206SOC_SINGLE_RANGE_TLV("IN2 Volume", ARIZONA_IN2L_CONTROL,
207 ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
208
209SOC_ENUM("IN HPF Cutoff Frequency", arizona_in_hpf_cut_enum),
210
211SOC_SINGLE("IN1L HPF Switch", ARIZONA_IN1L_CONTROL,
212 ARIZONA_IN1L_HPF_SHIFT, 1, 0),
213SOC_SINGLE("IN1R HPF Switch", ARIZONA_IN1R_CONTROL,
214 ARIZONA_IN1R_HPF_SHIFT, 1, 0),
215SOC_SINGLE("IN2 HPF Switch", ARIZONA_IN2L_CONTROL,
216 ARIZONA_IN2L_HPF_SHIFT, 1, 0),
217
218SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
219 ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
220SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
221 ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
222SOC_SINGLE_TLV("IN2 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
223 ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
224
225SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
226SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
227
228ARIZONA_GAINMUX_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
229ARIZONA_GAINMUX_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
230ARIZONA_GAINMUX_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
231ARIZONA_GAINMUX_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
232
233SND_SOC_BYTES("EQ1 Coefficients", ARIZONA_EQ1_3, 19),
234SOC_SINGLE("EQ1 Mode Switch", ARIZONA_EQ1_2, ARIZONA_EQ1_B1_MODE_SHIFT, 1, 0),
235SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
236 24, 0, eq_tlv),
237SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
238 24, 0, eq_tlv),
239SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
240 24, 0, eq_tlv),
241SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
242 24, 0, eq_tlv),
243SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
244 24, 0, eq_tlv),
245
246SND_SOC_BYTES("EQ2 Coefficients", ARIZONA_EQ2_3, 19),
247SOC_SINGLE("EQ2 Mode Switch", ARIZONA_EQ2_2, ARIZONA_EQ2_B1_MODE_SHIFT, 1, 0),
248SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
249 24, 0, eq_tlv),
250SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
251 24, 0, eq_tlv),
252SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
253 24, 0, eq_tlv),
254SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
255 24, 0, eq_tlv),
256SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
257 24, 0, eq_tlv),
258
259SND_SOC_BYTES("EQ3 Coefficients", ARIZONA_EQ3_3, 19),
260SOC_SINGLE("EQ3 Mode Switch", ARIZONA_EQ3_2, ARIZONA_EQ3_B1_MODE_SHIFT, 1, 0),
261SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
262 24, 0, eq_tlv),
263SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
264 24, 0, eq_tlv),
265SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
266 24, 0, eq_tlv),
267SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
268 24, 0, eq_tlv),
269SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
270 24, 0, eq_tlv),
271
272SND_SOC_BYTES("EQ4 Coefficients", ARIZONA_EQ4_3, 19),
273SOC_SINGLE("EQ4 Mode Switch", ARIZONA_EQ4_2, ARIZONA_EQ4_B1_MODE_SHIFT, 1, 0),
274SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
275 24, 0, eq_tlv),
276SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
277 24, 0, eq_tlv),
278SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
279 24, 0, eq_tlv),
280SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
281 24, 0, eq_tlv),
282SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
283 24, 0, eq_tlv),
284
285ARIZONA_GAINMUX_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
286ARIZONA_GAINMUX_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
287
288SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
289 ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
290
291ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
292ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
293ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
294ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
295
296SND_SOC_BYTES("LHPF1 Coefficients", ARIZONA_HPLPF1_2, 1),
297SND_SOC_BYTES("LHPF2 Coefficients", ARIZONA_HPLPF2_2, 1),
298SND_SOC_BYTES("LHPF3 Coefficients", ARIZONA_HPLPF3_2, 1),
299SND_SOC_BYTES("LHPF4 Coefficients", ARIZONA_HPLPF4_2, 1),
300
301SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
302SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
303SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
304SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
305
306SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
307SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
308SOC_ENUM("ISRC1 FSH", arizona_isrc_fsh[0]),
309SOC_ENUM("ISRC2 FSH", arizona_isrc_fsh[1]),
310SOC_ENUM("ASRC RATE 1", arizona_asrc_rate1),
311
312ARIZONA_MIXER_CONTROLS("HPOUTL", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
313ARIZONA_MIXER_CONTROLS("HPOUTR", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
314ARIZONA_MIXER_CONTROLS("LINEOUTL", ARIZONA_OUT2LMIX_INPUT_1_SOURCE),
315ARIZONA_MIXER_CONTROLS("LINEOUTR", ARIZONA_OUT2RMIX_INPUT_1_SOURCE),
316ARIZONA_MIXER_CONTROLS("EPOUT", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
317ARIZONA_MIXER_CONTROLS("SPKOUTL", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
318ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE),
319ARIZONA_MIXER_CONTROLS("SPKDATL", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
320ARIZONA_MIXER_CONTROLS("SPKDATR", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
321
322SOC_DOUBLE_R("HPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
323 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
324SOC_DOUBLE_R("LINEOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L,
325 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1),
326SOC_SINGLE("EPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
327 ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
328SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
329 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
330SOC_DOUBLE_R("SPKDAT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
331 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
332
333SOC_DOUBLE_R_TLV("HPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
334 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
335 0xbf, 0, digital_tlv),
336SOC_DOUBLE_R_TLV("LINEOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L,
337 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT,
338 0xbf, 0, digital_tlv),
339SOC_SINGLE_TLV("EPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
340 ARIZONA_OUT3L_VOL_SHIFT, 0xbf, 0, digital_tlv),
341SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
342 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_VOL_SHIFT,
343 0xbf, 0, digital_tlv),
344SOC_DOUBLE_R_TLV("SPKDAT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
345 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
346 0xbf, 0, digital_tlv),
347
348SOC_DOUBLE("SPKDAT Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
349 ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
350
351SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
352SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
353
354SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
355 ARIZONA_NGATE_ENA_SHIFT, 1, 0),
356SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
357 ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
358SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
359
360WM8998_NG_SRC("HPOUTL", ARIZONA_NOISE_GATE_SELECT_1L),
361WM8998_NG_SRC("HPOUTR", ARIZONA_NOISE_GATE_SELECT_1R),
362WM8998_NG_SRC("LINEOUTL", ARIZONA_NOISE_GATE_SELECT_2L),
363WM8998_NG_SRC("LINEOUTR", ARIZONA_NOISE_GATE_SELECT_2R),
364WM8998_NG_SRC("EPOUT", ARIZONA_NOISE_GATE_SELECT_3L),
365WM8998_NG_SRC("SPKOUTL", ARIZONA_NOISE_GATE_SELECT_4L),
366WM8998_NG_SRC("SPKOUTR", ARIZONA_NOISE_GATE_SELECT_4R),
367WM8998_NG_SRC("SPKDATL", ARIZONA_NOISE_GATE_SELECT_5L),
368WM8998_NG_SRC("SPKDATR", ARIZONA_NOISE_GATE_SELECT_5R),
369
370ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
371ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
372ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
373ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
374ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
375ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
376
377ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
378ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
379ARIZONA_MIXER_CONTROLS("AIF2TX3", ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE),
380ARIZONA_MIXER_CONTROLS("AIF2TX4", ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE),
381ARIZONA_MIXER_CONTROLS("AIF2TX5", ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE),
382ARIZONA_MIXER_CONTROLS("AIF2TX6", ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE),
383
384ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
385ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
386
387ARIZONA_GAINMUX_CONTROLS("SLIMTX1", ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE),
388ARIZONA_GAINMUX_CONTROLS("SLIMTX2", ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE),
389ARIZONA_GAINMUX_CONTROLS("SLIMTX3", ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE),
390ARIZONA_GAINMUX_CONTROLS("SLIMTX4", ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE),
391ARIZONA_GAINMUX_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
392ARIZONA_GAINMUX_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
393
394ARIZONA_GAINMUX_CONTROLS("SPDIFTX1", ARIZONA_SPDIFTX1MIX_INPUT_1_SOURCE),
395ARIZONA_GAINMUX_CONTROLS("SPDIFTX2", ARIZONA_SPDIFTX2MIX_INPUT_1_SOURCE),
396};
397
398ARIZONA_MUX_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
399ARIZONA_MUX_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
400ARIZONA_MUX_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
401ARIZONA_MUX_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
402
403ARIZONA_MUX_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
404ARIZONA_MUX_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
405
406ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
407ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
408ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
409ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
410
411ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
412ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
413
414ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
415ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
416ARIZONA_MIXER_ENUMS(OUT2L, ARIZONA_OUT2LMIX_INPUT_1_SOURCE);
417ARIZONA_MIXER_ENUMS(OUT2R, ARIZONA_OUT2RMIX_INPUT_1_SOURCE);
418ARIZONA_MIXER_ENUMS(OUT3, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
419ARIZONA_MIXER_ENUMS(SPKOUTL, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
420ARIZONA_MIXER_ENUMS(SPKOUTR, ARIZONA_OUT4RMIX_INPUT_1_SOURCE);
421ARIZONA_MIXER_ENUMS(SPKDATL, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
422ARIZONA_MIXER_ENUMS(SPKDATR, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
423
424ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
425ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
426ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
427ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
428ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
429ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
430
431ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
432ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
433ARIZONA_MIXER_ENUMS(AIF2TX3, ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE);
434ARIZONA_MIXER_ENUMS(AIF2TX4, ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE);
435ARIZONA_MIXER_ENUMS(AIF2TX5, ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE);
436ARIZONA_MIXER_ENUMS(AIF2TX6, ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE);
437
438ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
439ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
440
441ARIZONA_MUX_ENUMS(SLIMTX1, ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE);
442ARIZONA_MUX_ENUMS(SLIMTX2, ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE);
443ARIZONA_MUX_ENUMS(SLIMTX3, ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE);
444ARIZONA_MUX_ENUMS(SLIMTX4, ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE);
445ARIZONA_MUX_ENUMS(SLIMTX5, ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE);
446ARIZONA_MUX_ENUMS(SLIMTX6, ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE);
447
448ARIZONA_MUX_ENUMS(SPD1TX1, ARIZONA_SPDIFTX1MIX_INPUT_1_SOURCE);
449ARIZONA_MUX_ENUMS(SPD1TX2, ARIZONA_SPDIFTX2MIX_INPUT_1_SOURCE);
450
451ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
452ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
453ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
454ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
455
456ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE);
457ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE);
458ARIZONA_MUX_ENUMS(ISRC1INT3, ARIZONA_ISRC1INT3MIX_INPUT_1_SOURCE);
459ARIZONA_MUX_ENUMS(ISRC1INT4, ARIZONA_ISRC1INT4MIX_INPUT_1_SOURCE);
460
461ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE);
462ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE);
463ARIZONA_MUX_ENUMS(ISRC1DEC3, ARIZONA_ISRC1DEC3MIX_INPUT_1_SOURCE);
464ARIZONA_MUX_ENUMS(ISRC1DEC4, ARIZONA_ISRC1DEC4MIX_INPUT_1_SOURCE);
465
466ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE);
467ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE);
468
469ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE);
470ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE);
471
472static const char * const wm8998_aec_loopback_texts[] = {
473 "HPOUTL", "HPOUTR", "LINEOUTL", "LINEOUTR", "EPOUT",
474 "SPKOUTL", "SPKOUTR", "SPKDATL", "SPKDATR",
475};
476
477static const unsigned int wm8998_aec_loopback_values[] = {
478 0, 1, 2, 3, 4, 6, 7, 8, 9,
479};
480
481static SOC_VALUE_ENUM_SINGLE_DECL(wm8998_aec1_loopback,
482 ARIZONA_DAC_AEC_CONTROL_1,
483 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
484 wm8998_aec_loopback_texts,
485 wm8998_aec_loopback_values);
486
487static SOC_VALUE_ENUM_SINGLE_DECL(wm8998_aec2_loopback,
488 ARIZONA_DAC_AEC_CONTROL_2,
489 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
490 wm8998_aec_loopback_texts,
491 wm8998_aec_loopback_values);
492
493static const struct snd_kcontrol_new wm8998_aec_loopback_mux[] = {
494 SOC_DAPM_ENUM("AEC1 Loopback", wm8998_aec1_loopback),
495 SOC_DAPM_ENUM("AEC2 Loopback", wm8998_aec2_loopback),
496};
497
498static const struct snd_soc_dapm_widget wm8998_dapm_widgets[] = {
499SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1,
500 ARIZONA_SYSCLK_ENA_SHIFT, 0, arizona_clk_ev,
501 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
502SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
503 ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, arizona_clk_ev,
504 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
505SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
506 ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
507SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
508 ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
509
510SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
511SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0, 0),
512SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
513SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
514SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0, 0),
515SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
516
517SND_SOC_DAPM_SIGGEN("TONE"),
518SND_SOC_DAPM_SIGGEN("HAPTICS"),
519
520SND_SOC_DAPM_INPUT("IN1AL"),
521SND_SOC_DAPM_INPUT("IN1AR"),
522SND_SOC_DAPM_INPUT("IN1BL"),
523SND_SOC_DAPM_INPUT("IN1BR"),
524SND_SOC_DAPM_INPUT("IN2A"),
525SND_SOC_DAPM_INPUT("IN2B"),
526
527SND_SOC_DAPM_MUX("IN1L Mux", SND_SOC_NOPM, 0, 0, &wm8998_in1mux[0]),
528SND_SOC_DAPM_MUX("IN1R Mux", SND_SOC_NOPM, 0, 0, &wm8998_in1mux[1]),
529SND_SOC_DAPM_MUX("IN2 Mux", SND_SOC_NOPM, 0, 0, &wm8998_in2mux),
530
531SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
532
533SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
534 0, NULL, 0, arizona_in_ev,
535 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
536 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
537SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
538 0, NULL, 0, arizona_in_ev,
539 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
540 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
541SND_SOC_DAPM_PGA_E("IN2 PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
542 0, NULL, 0, arizona_in_ev,
543 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
544 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
545
546SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
547 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
548SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
549 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
550SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
551 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
552
553SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
554 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
555SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
556 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
557
558SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
559SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
560SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
561SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
562
563SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
564 NULL, 0),
565SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
566 NULL, 0),
567
568SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
569 NULL, 0),
570SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
571 NULL, 0),
572SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
573 NULL, 0),
574SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
575 NULL, 0),
576
577SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
578 0, NULL, 0),
579SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
580 0, NULL, 0),
581
582SND_SOC_DAPM_PGA_E("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
583 NULL, 0, wm8998_asrc_ev, SND_SOC_DAPM_PRE_PMU),
584SND_SOC_DAPM_PGA_E("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
585 NULL, 0, wm8998_asrc_ev, SND_SOC_DAPM_PRE_PMU),
586SND_SOC_DAPM_PGA_E("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
587 NULL, 0, wm8998_asrc_ev, SND_SOC_DAPM_PRE_PMU),
588SND_SOC_DAPM_PGA_E("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
589 NULL, 0, wm8998_asrc_ev, SND_SOC_DAPM_PRE_PMU),
590
591SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3,
592 ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0),
593SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3,
594 ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
595SND_SOC_DAPM_PGA("ISRC1INT3", ARIZONA_ISRC_1_CTRL_3,
596 ARIZONA_ISRC1_INT2_ENA_SHIFT, 0, NULL, 0),
597SND_SOC_DAPM_PGA("ISRC1INT4", ARIZONA_ISRC_1_CTRL_3,
598 ARIZONA_ISRC1_INT3_ENA_SHIFT, 0, NULL, 0),
599
600SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3,
601 ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0),
602SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3,
603 ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
604SND_SOC_DAPM_PGA("ISRC1DEC3", ARIZONA_ISRC_1_CTRL_3,
605 ARIZONA_ISRC1_DEC2_ENA_SHIFT, 0, NULL, 0),
606SND_SOC_DAPM_PGA("ISRC1DEC4", ARIZONA_ISRC_1_CTRL_3,
607 ARIZONA_ISRC1_DEC3_ENA_SHIFT, 0, NULL, 0),
608
609SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3,
610 ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0),
611SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3,
612 ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
613
614SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3,
615 ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0),
616SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3,
617 ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
618
619SND_SOC_DAPM_MUX("AEC1 Loopback", ARIZONA_DAC_AEC_CONTROL_1,
620 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0,
621 &wm8998_aec_loopback_mux[0]),
622
623SND_SOC_DAPM_MUX("AEC2 Loopback", ARIZONA_DAC_AEC_CONTROL_2,
624 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0,
625 &wm8998_aec_loopback_mux[1]),
626
627SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
628 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
629SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
630 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
631SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
632 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
633SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
634 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
635SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
636 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
637SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
638 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
639
640SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
641 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
642SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
643 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
644SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
645 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
646SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
647 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
648SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
649 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
650SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
651 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
652
653SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
654 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
655SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
656 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
657SND_SOC_DAPM_AIF_OUT("AIF2TX3", NULL, 0,
658 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX3_ENA_SHIFT, 0),
659SND_SOC_DAPM_AIF_OUT("AIF2TX4", NULL, 0,
660 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX4_ENA_SHIFT, 0),
661SND_SOC_DAPM_AIF_OUT("AIF2TX5", NULL, 0,
662 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX5_ENA_SHIFT, 0),
663SND_SOC_DAPM_AIF_OUT("AIF2TX6", NULL, 0,
664 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX6_ENA_SHIFT, 0),
665
666SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
667 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
668SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
669 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
670SND_SOC_DAPM_AIF_IN("AIF2RX3", NULL, 0,
671 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX3_ENA_SHIFT, 0),
672SND_SOC_DAPM_AIF_IN("AIF2RX4", NULL, 0,
673 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX4_ENA_SHIFT, 0),
674SND_SOC_DAPM_AIF_IN("AIF2RX5", NULL, 0,
675 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX5_ENA_SHIFT, 0),
676SND_SOC_DAPM_AIF_IN("AIF2RX6", NULL, 0,
677 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX6_ENA_SHIFT, 0),
678
679SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0,
680 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
681 ARIZONA_SLIMRX1_ENA_SHIFT, 0),
682SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 0,
683 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
684 ARIZONA_SLIMRX2_ENA_SHIFT, 0),
685SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 0,
686 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
687 ARIZONA_SLIMRX3_ENA_SHIFT, 0),
688SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 0,
689 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
690 ARIZONA_SLIMRX4_ENA_SHIFT, 0),
691
692SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
693 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
694 ARIZONA_SLIMTX1_ENA_SHIFT, 0),
695SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 0,
696 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
697 ARIZONA_SLIMTX2_ENA_SHIFT, 0),
698SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 0,
699 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
700 ARIZONA_SLIMTX3_ENA_SHIFT, 0),
701SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 0,
702 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
703 ARIZONA_SLIMTX4_ENA_SHIFT, 0),
704SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 0,
705 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
706 ARIZONA_SLIMTX5_ENA_SHIFT, 0),
707SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 0,
708 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
709 ARIZONA_SLIMTX6_ENA_SHIFT, 0),
710
711SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
712 ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
713SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0,
714 ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
715
716SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
717 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
718SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
719 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
720
721SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
722 ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
723 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
724SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
725 ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
726 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
727SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1,
728 ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
729 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
730SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1,
731 ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
732 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
733SND_SOC_DAPM_PGA_E("OUT3", ARIZONA_OUTPUT_ENABLES_1,
734 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
735 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
736SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
737 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
738 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
739SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
740 ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
741 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
742
743SND_SOC_DAPM_PGA("SPD1TX1", ARIZONA_SPD1_TX_CONTROL,
744 ARIZONA_SPD1_VAL1_SHIFT, 0, NULL, 0),
745SND_SOC_DAPM_PGA("SPD1TX2", ARIZONA_SPD1_TX_CONTROL,
746 ARIZONA_SPD1_VAL2_SHIFT, 0, NULL, 0),
747SND_SOC_DAPM_OUT_DRV("SPD1", ARIZONA_SPD1_TX_CONTROL,
748 ARIZONA_SPD1_ENA_SHIFT, 0, NULL, 0),
749
750ARIZONA_MUX_WIDGETS(EQ1, "EQ1"),
751ARIZONA_MUX_WIDGETS(EQ2, "EQ2"),
752ARIZONA_MUX_WIDGETS(EQ3, "EQ3"),
753ARIZONA_MUX_WIDGETS(EQ4, "EQ4"),
754
755ARIZONA_MUX_WIDGETS(DRC1L, "DRC1L"),
756ARIZONA_MUX_WIDGETS(DRC1R, "DRC1R"),
757
758ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
759ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
760ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
761ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
762
763ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
764ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
765
766ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUTL"),
767ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUTR"),
768ARIZONA_MIXER_WIDGETS(OUT2L, "LINEOUTL"),
769ARIZONA_MIXER_WIDGETS(OUT2R, "LINEOUTR"),
770ARIZONA_MIXER_WIDGETS(OUT3, "EPOUT"),
771ARIZONA_MIXER_WIDGETS(SPKOUTL, "SPKOUTL"),
772ARIZONA_MIXER_WIDGETS(SPKOUTR, "SPKOUTR"),
773ARIZONA_MIXER_WIDGETS(SPKDATL, "SPKDATL"),
774ARIZONA_MIXER_WIDGETS(SPKDATR, "SPKDATR"),
775
776ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
777ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
778ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
779ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
780ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
781ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
782
783ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
784ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
785ARIZONA_MIXER_WIDGETS(AIF2TX3, "AIF2TX3"),
786ARIZONA_MIXER_WIDGETS(AIF2TX4, "AIF2TX4"),
787ARIZONA_MIXER_WIDGETS(AIF2TX5, "AIF2TX5"),
788ARIZONA_MIXER_WIDGETS(AIF2TX6, "AIF2TX6"),
789
790ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
791ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
792
793ARIZONA_MUX_WIDGETS(SLIMTX1, "SLIMTX1"),
794ARIZONA_MUX_WIDGETS(SLIMTX2, "SLIMTX2"),
795ARIZONA_MUX_WIDGETS(SLIMTX3, "SLIMTX3"),
796ARIZONA_MUX_WIDGETS(SLIMTX4, "SLIMTX4"),
797ARIZONA_MUX_WIDGETS(SLIMTX5, "SLIMTX5"),
798ARIZONA_MUX_WIDGETS(SLIMTX6, "SLIMTX6"),
799
800ARIZONA_MUX_WIDGETS(SPD1TX1, "SPDIFTX1"),
801ARIZONA_MUX_WIDGETS(SPD1TX2, "SPDIFTX2"),
802
803ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
804ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
805ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
806ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
807
808ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
809ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
810ARIZONA_MUX_WIDGETS(ISRC1DEC3, "ISRC1DEC3"),
811ARIZONA_MUX_WIDGETS(ISRC1DEC4, "ISRC1DEC4"),
812
813ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
814ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
815ARIZONA_MUX_WIDGETS(ISRC1INT3, "ISRC1INT3"),
816ARIZONA_MUX_WIDGETS(ISRC1INT4, "ISRC1INT4"),
817
818ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
819ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
820
821ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
822ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
823
824SND_SOC_DAPM_OUTPUT("HPOUTL"),
825SND_SOC_DAPM_OUTPUT("HPOUTR"),
826SND_SOC_DAPM_OUTPUT("LINEOUTL"),
827SND_SOC_DAPM_OUTPUT("LINEOUTR"),
828SND_SOC_DAPM_OUTPUT("EPOUT"),
829SND_SOC_DAPM_OUTPUT("SPKOUTLN"),
830SND_SOC_DAPM_OUTPUT("SPKOUTLP"),
831SND_SOC_DAPM_OUTPUT("SPKOUTRN"),
832SND_SOC_DAPM_OUTPUT("SPKOUTRP"),
833SND_SOC_DAPM_OUTPUT("SPKDATL"),
834SND_SOC_DAPM_OUTPUT("SPKDATR"),
835SND_SOC_DAPM_OUTPUT("SPDIF"),
836
837SND_SOC_DAPM_OUTPUT("MICSUPP"),
838};
839
840#define ARIZONA_MIXER_INPUT_ROUTES(name) \
841 { name, "Tone Generator 1", "Tone Generator 1" }, \
842 { name, "Tone Generator 2", "Tone Generator 2" }, \
843 { name, "Haptics", "HAPTICS" }, \
844 { name, "AEC", "AEC1 Loopback" }, \
845 { name, "AEC2", "AEC2 Loopback" }, \
846 { name, "IN1L", "IN1L PGA" }, \
847 { name, "IN1R", "IN1R PGA" }, \
848 { name, "IN2L", "IN2 PGA" }, \
849 { name, "AIF1RX1", "AIF1RX1" }, \
850 { name, "AIF1RX2", "AIF1RX2" }, \
851 { name, "AIF1RX3", "AIF1RX3" }, \
852 { name, "AIF1RX4", "AIF1RX4" }, \
853 { name, "AIF1RX5", "AIF1RX5" }, \
854 { name, "AIF1RX6", "AIF1RX6" }, \
855 { name, "AIF2RX1", "AIF2RX1" }, \
856 { name, "AIF2RX2", "AIF2RX2" }, \
857 { name, "AIF2RX3", "AIF2RX3" }, \
858 { name, "AIF2RX4", "AIF2RX4" }, \
859 { name, "AIF2RX5", "AIF2RX5" }, \
860 { name, "AIF2RX6", "AIF2RX6" }, \
861 { name, "AIF3RX1", "AIF3RX1" }, \
862 { name, "AIF3RX2", "AIF3RX2" }, \
863 { name, "SLIMRX1", "SLIMRX1" }, \
864 { name, "SLIMRX2", "SLIMRX2" }, \
865 { name, "SLIMRX3", "SLIMRX3" }, \
866 { name, "SLIMRX4", "SLIMRX4" }, \
867 { name, "EQ1", "EQ1" }, \
868 { name, "EQ2", "EQ2" }, \
869 { name, "EQ3", "EQ3" }, \
870 { name, "EQ4", "EQ4" }, \
871 { name, "DRC1L", "DRC1L" }, \
872 { name, "DRC1R", "DRC1R" }, \
873 { name, "LHPF1", "LHPF1" }, \
874 { name, "LHPF2", "LHPF2" }, \
875 { name, "LHPF3", "LHPF3" }, \
876 { name, "LHPF4", "LHPF4" }, \
877 { name, "ASRC1L", "ASRC1L" }, \
878 { name, "ASRC1R", "ASRC1R" }, \
879 { name, "ASRC2L", "ASRC2L" }, \
880 { name, "ASRC2R", "ASRC2R" }, \
881 { name, "ISRC1DEC1", "ISRC1DEC1" }, \
882 { name, "ISRC1DEC2", "ISRC1DEC2" }, \
883 { name, "ISRC1DEC3", "ISRC1DEC3" }, \
884 { name, "ISRC1DEC4", "ISRC1DEC4" }, \
885 { name, "ISRC1INT1", "ISRC1INT1" }, \
886 { name, "ISRC1INT2", "ISRC1INT2" }, \
887 { name, "ISRC1INT3", "ISRC1INT3" }, \
888 { name, "ISRC1INT4", "ISRC1INT4" }, \
889 { name, "ISRC2DEC1", "ISRC2DEC1" }, \
890 { name, "ISRC2DEC2", "ISRC2DEC2" }, \
891 { name, "ISRC2INT1", "ISRC2INT1" }, \
892 { name, "ISRC2INT2", "ISRC2INT2" }
893
894static const struct snd_soc_dapm_route wm8998_dapm_routes[] = {
895 { "AIF2 Capture", NULL, "DBVDD2" },
896 { "AIF2 Playback", NULL, "DBVDD2" },
897
898 { "AIF3 Capture", NULL, "DBVDD3" },
899 { "AIF3 Playback", NULL, "DBVDD3" },
900
901 { "OUT1L", NULL, "CPVDD" },
902 { "OUT1R", NULL, "CPVDD" },
903 { "OUT2L", NULL, "CPVDD" },
904 { "OUT2R", NULL, "CPVDD" },
905 { "OUT3", NULL, "CPVDD" },
906
907 { "OUT4L", NULL, "SPKVDDL" },
908 { "OUT4R", NULL, "SPKVDDR" },
909
910 { "OUT1L", NULL, "SYSCLK" },
911 { "OUT1R", NULL, "SYSCLK" },
912 { "OUT2L", NULL, "SYSCLK" },
913 { "OUT2R", NULL, "SYSCLK" },
914 { "OUT3", NULL, "SYSCLK" },
915 { "OUT4L", NULL, "SYSCLK" },
916 { "OUT4R", NULL, "SYSCLK" },
917 { "OUT5L", NULL, "SYSCLK" },
918 { "OUT5R", NULL, "SYSCLK" },
919
920 { "IN1AL", NULL, "SYSCLK" },
921 { "IN1AR", NULL, "SYSCLK" },
922 { "IN1BL", NULL, "SYSCLK" },
923 { "IN1BR", NULL, "SYSCLK" },
924 { "IN2A", NULL, "SYSCLK" },
925 { "IN2B", NULL, "SYSCLK" },
926
927 { "ASRC1L", NULL, "SYSCLK" },
928 { "ASRC1R", NULL, "SYSCLK" },
929 { "ASRC2L", NULL, "SYSCLK" },
930 { "ASRC2R", NULL, "SYSCLK" },
931
932 { "ASRC1L", NULL, "ASYNCCLK" },
933 { "ASRC1R", NULL, "ASYNCCLK" },
934 { "ASRC2L", NULL, "ASYNCCLK" },
935 { "ASRC2R", NULL, "ASYNCCLK" },
936
937 { "SPD1", NULL, "SYSCLK" },
938 { "SPD1", NULL, "SPD1TX1" },
939 { "SPD1", NULL, "SPD1TX2" },
940
941 { "MICBIAS1", NULL, "MICVDD" },
942 { "MICBIAS2", NULL, "MICVDD" },
943 { "MICBIAS3", NULL, "MICVDD" },
944
945 { "Tone Generator 1", NULL, "SYSCLK" },
946 { "Tone Generator 2", NULL, "SYSCLK" },
947
948 { "Tone Generator 1", NULL, "TONE" },
949 { "Tone Generator 2", NULL, "TONE" },
950
951 { "AIF1 Capture", NULL, "AIF1TX1" },
952 { "AIF1 Capture", NULL, "AIF1TX2" },
953 { "AIF1 Capture", NULL, "AIF1TX3" },
954 { "AIF1 Capture", NULL, "AIF1TX4" },
955 { "AIF1 Capture", NULL, "AIF1TX5" },
956 { "AIF1 Capture", NULL, "AIF1TX6" },
957
958 { "AIF1RX1", NULL, "AIF1 Playback" },
959 { "AIF1RX2", NULL, "AIF1 Playback" },
960 { "AIF1RX3", NULL, "AIF1 Playback" },
961 { "AIF1RX4", NULL, "AIF1 Playback" },
962 { "AIF1RX5", NULL, "AIF1 Playback" },
963 { "AIF1RX6", NULL, "AIF1 Playback" },
964
965 { "AIF2 Capture", NULL, "AIF2TX1" },
966 { "AIF2 Capture", NULL, "AIF2TX2" },
967 { "AIF2 Capture", NULL, "AIF2TX3" },
968 { "AIF2 Capture", NULL, "AIF2TX4" },
969 { "AIF2 Capture", NULL, "AIF2TX5" },
970 { "AIF2 Capture", NULL, "AIF2TX6" },
971
972 { "AIF2RX1", NULL, "AIF2 Playback" },
973 { "AIF2RX2", NULL, "AIF2 Playback" },
974 { "AIF2RX3", NULL, "AIF2 Playback" },
975 { "AIF2RX4", NULL, "AIF2 Playback" },
976 { "AIF2RX5", NULL, "AIF2 Playback" },
977 { "AIF2RX6", NULL, "AIF2 Playback" },
978
979 { "AIF3 Capture", NULL, "AIF3TX1" },
980 { "AIF3 Capture", NULL, "AIF3TX2" },
981
982 { "AIF3RX1", NULL, "AIF3 Playback" },
983 { "AIF3RX2", NULL, "AIF3 Playback" },
984
985 { "Slim1 Capture", NULL, "SLIMTX1" },
986 { "Slim1 Capture", NULL, "SLIMTX2" },
987 { "Slim1 Capture", NULL, "SLIMTX3" },
988 { "Slim1 Capture", NULL, "SLIMTX4" },
989
990 { "Slim2 Capture", NULL, "SLIMTX5" },
991 { "Slim2 Capture", NULL, "SLIMTX6" },
992
993 { "SLIMRX1", NULL, "Slim1 Playback" },
994 { "SLIMRX2", NULL, "Slim1 Playback" },
995
996 { "SLIMRX3", NULL, "Slim2 Playback" },
997 { "SLIMRX4", NULL, "Slim2 Playback" },
998
999 { "AIF1 Playback", NULL, "SYSCLK" },
1000 { "AIF2 Playback", NULL, "SYSCLK" },
1001 { "AIF3 Playback", NULL, "SYSCLK" },
1002 { "Slim1 Playback", NULL, "SYSCLK" },
1003 { "Slim2 Playback", NULL, "SYSCLK" },
1004
1005 { "AIF1 Capture", NULL, "SYSCLK" },
1006 { "AIF2 Capture", NULL, "SYSCLK" },
1007 { "AIF3 Capture", NULL, "SYSCLK" },
1008 { "Slim1 Capture", NULL, "SYSCLK" },
1009 { "Slim2 Capture", NULL, "SYSCLK" },
1010
1011 { "IN1L Mux", "A", "IN1AL" },
1012 { "IN1R Mux", "A", "IN1AR" },
1013 { "IN1L Mux", "B", "IN1BL" },
1014 { "IN1R Mux", "B", "IN1BR" },
1015
1016 { "IN2 Mux", "A", "IN2A" },
1017 { "IN2 Mux", "B", "IN2B" },
1018
1019 { "IN1L PGA", NULL, "IN1L Mux" },
1020 { "IN1R PGA", NULL, "IN1R Mux" },
1021 { "IN2 PGA", NULL, "IN2 Mux" },
1022
1023 ARIZONA_MIXER_ROUTES("OUT1L", "HPOUTL"),
1024 ARIZONA_MIXER_ROUTES("OUT1R", "HPOUTR"),
1025 ARIZONA_MIXER_ROUTES("OUT2L", "LINEOUTL"),
1026 ARIZONA_MIXER_ROUTES("OUT2R", "LINEOUTR"),
1027 ARIZONA_MIXER_ROUTES("OUT3", "EPOUT"),
1028
1029 ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUTL"),
1030 ARIZONA_MIXER_ROUTES("OUT4R", "SPKOUTR"),
1031 ARIZONA_MIXER_ROUTES("OUT5L", "SPKDATL"),
1032 ARIZONA_MIXER_ROUTES("OUT5R", "SPKDATR"),
1033
1034 ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
1035 ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
1036
1037 ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
1038 ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
1039 ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
1040 ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
1041 ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
1042 ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
1043
1044 ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
1045 ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
1046 ARIZONA_MIXER_ROUTES("AIF2TX3", "AIF2TX3"),
1047 ARIZONA_MIXER_ROUTES("AIF2TX4", "AIF2TX4"),
1048 ARIZONA_MIXER_ROUTES("AIF2TX5", "AIF2TX5"),
1049 ARIZONA_MIXER_ROUTES("AIF2TX6", "AIF2TX6"),
1050
1051 ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
1052 ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
1053
1054 ARIZONA_MUX_ROUTES("SLIMTX1", "SLIMTX1"),
1055 ARIZONA_MUX_ROUTES("SLIMTX2", "SLIMTX2"),
1056 ARIZONA_MUX_ROUTES("SLIMTX3", "SLIMTX3"),
1057 ARIZONA_MUX_ROUTES("SLIMTX4", "SLIMTX4"),
1058 ARIZONA_MUX_ROUTES("SLIMTX5", "SLIMTX5"),
1059 ARIZONA_MUX_ROUTES("SLIMTX6", "SLIMTX6"),
1060
1061 ARIZONA_MUX_ROUTES("SPD1TX1", "SPDIFTX1"),
1062 ARIZONA_MUX_ROUTES("SPD1TX2", "SPDIFTX2"),
1063
1064 ARIZONA_MUX_ROUTES("EQ1", "EQ1"),
1065 ARIZONA_MUX_ROUTES("EQ2", "EQ2"),
1066 ARIZONA_MUX_ROUTES("EQ3", "EQ3"),
1067 ARIZONA_MUX_ROUTES("EQ4", "EQ4"),
1068
1069 ARIZONA_MUX_ROUTES("DRC1L", "DRC1L"),
1070 ARIZONA_MUX_ROUTES("DRC1R", "DRC1R"),
1071
1072 ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
1073 ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
1074 ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
1075 ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
1076
1077 ARIZONA_MUX_ROUTES("ASRC1L", "ASRC1L"),
1078 ARIZONA_MUX_ROUTES("ASRC1R", "ASRC1R"),
1079 ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"),
1080 ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"),
1081
1082 ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
1083 ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
1084 ARIZONA_MUX_ROUTES("ISRC1INT3", "ISRC1INT3"),
1085 ARIZONA_MUX_ROUTES("ISRC1INT4", "ISRC1INT4"),
1086
1087 ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
1088 ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
1089 ARIZONA_MUX_ROUTES("ISRC1DEC3", "ISRC1DEC3"),
1090 ARIZONA_MUX_ROUTES("ISRC1DEC4", "ISRC1DEC4"),
1091
1092 ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
1093 ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
1094
1095 ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
1096 ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
1097
1098 { "AEC1 Loopback", "HPOUTL", "OUT1L" },
1099 { "AEC1 Loopback", "HPOUTR", "OUT1R" },
1100 { "AEC2 Loopback", "HPOUTL", "OUT1L" },
1101 { "AEC2 Loopback", "HPOUTR", "OUT1R" },
1102 { "HPOUTL", NULL, "OUT1L" },
1103 { "HPOUTR", NULL, "OUT1R" },
1104
1105 { "AEC1 Loopback", "LINEOUTL", "OUT2L" },
1106 { "AEC1 Loopback", "LINEOUTR", "OUT2R" },
1107 { "AEC2 Loopback", "LINEOUTL", "OUT2L" },
1108 { "AEC2 Loopback", "LINEOUTR", "OUT2R" },
1109 { "LINEOUTL", NULL, "OUT2L" },
1110 { "LINEOUTR", NULL, "OUT2R" },
1111
1112 { "AEC1 Loopback", "EPOUT", "OUT3" },
1113 { "AEC2 Loopback", "EPOUT", "OUT3" },
1114 { "EPOUT", NULL, "OUT3" },
1115
1116 { "AEC1 Loopback", "SPKOUTL", "OUT4L" },
1117 { "AEC2 Loopback", "SPKOUTL", "OUT4L" },
1118 { "SPKOUTLN", NULL, "OUT4L" },
1119 { "SPKOUTLP", NULL, "OUT4L" },
1120
1121 { "AEC1 Loopback", "SPKOUTR", "OUT4R" },
1122 { "AEC2 Loopback", "SPKOUTR", "OUT4R" },
1123 { "SPKOUTRN", NULL, "OUT4R" },
1124 { "SPKOUTRP", NULL, "OUT4R" },
1125
1126 { "SPDIF", NULL, "SPD1" },
1127
1128 { "AEC1 Loopback", "SPKDATL", "OUT5L" },
1129 { "AEC1 Loopback", "SPKDATR", "OUT5R" },
1130 { "AEC2 Loopback", "SPKDATL", "OUT5L" },
1131 { "AEC2 Loopback", "SPKDATR", "OUT5R" },
1132 { "SPKDATL", NULL, "OUT5L" },
1133 { "SPKDATR", NULL, "OUT5R" },
1134
1135 { "MICSUPP", NULL, "SYSCLK" },
1136
1137 { "DRC1 Signal Activity", NULL, "SYSCLK" },
1138 { "DRC1 Signal Activity", NULL, "DRC1L" },
1139 { "DRC1 Signal Activity", NULL, "DRC1R" },
1140};
1141
1142#define WM8998_RATES SNDRV_PCM_RATE_KNOT
1143
1144#define WM8998_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
1145 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
1146
1147static struct snd_soc_dai_driver wm8998_dai[] = {
1148 {
1149 .name = "wm8998-aif1",
1150 .id = 1,
1151 .base = ARIZONA_AIF1_BCLK_CTRL,
1152 .playback = {
1153 .stream_name = "AIF1 Playback",
1154 .channels_min = 1,
1155 .channels_max = 6,
1156 .rates = WM8998_RATES,
1157 .formats = WM8998_FORMATS,
1158 },
1159 .capture = {
1160 .stream_name = "AIF1 Capture",
1161 .channels_min = 1,
1162 .channels_max = 6,
1163 .rates = WM8998_RATES,
1164 .formats = WM8998_FORMATS,
1165 },
1166 .ops = &arizona_dai_ops,
1167 .symmetric_rates = 1,
1168 .symmetric_samplebits = 1,
1169 },
1170 {
1171 .name = "wm8998-aif2",
1172 .id = 2,
1173 .base = ARIZONA_AIF2_BCLK_CTRL,
1174 .playback = {
1175 .stream_name = "AIF2 Playback",
1176 .channels_min = 1,
1177 .channels_max = 6,
1178 .rates = WM8998_RATES,
1179 .formats = WM8998_FORMATS,
1180 },
1181 .capture = {
1182 .stream_name = "AIF2 Capture",
1183 .channels_min = 1,
1184 .channels_max = 6,
1185 .rates = WM8998_RATES,
1186 .formats = WM8998_FORMATS,
1187 },
1188 .ops = &arizona_dai_ops,
1189 .symmetric_rates = 1,
1190 .symmetric_samplebits = 1,
1191 },
1192 {
1193 .name = "wm8998-aif3",
1194 .id = 3,
1195 .base = ARIZONA_AIF3_BCLK_CTRL,
1196 .playback = {
1197 .stream_name = "AIF3 Playback",
1198 .channels_min = 1,
1199 .channels_max = 2,
1200 .rates = WM8998_RATES,
1201 .formats = WM8998_FORMATS,
1202 },
1203 .capture = {
1204 .stream_name = "AIF3 Capture",
1205 .channels_min = 1,
1206 .channels_max = 2,
1207 .rates = WM8998_RATES,
1208 .formats = WM8998_FORMATS,
1209 },
1210 .ops = &arizona_dai_ops,
1211 .symmetric_rates = 1,
1212 .symmetric_samplebits = 1,
1213 },
1214 {
1215 .name = "wm8998-slim1",
1216 .id = 4,
1217 .playback = {
1218 .stream_name = "Slim1 Playback",
1219 .channels_min = 1,
1220 .channels_max = 2,
1221 .rates = WM8998_RATES,
1222 .formats = WM8998_FORMATS,
1223 },
1224 .capture = {
1225 .stream_name = "Slim1 Capture",
1226 .channels_min = 1,
1227 .channels_max = 4,
1228 .rates = WM8998_RATES,
1229 .formats = WM8998_FORMATS,
1230 },
1231 .ops = &arizona_simple_dai_ops,
1232 },
1233 {
1234 .name = "wm8998-slim2",
1235 .id = 5,
1236 .playback = {
1237 .stream_name = "Slim2 Playback",
1238 .channels_min = 1,
1239 .channels_max = 2,
1240 .rates = WM8998_RATES,
1241 .formats = WM8998_FORMATS,
1242 },
1243 .capture = {
1244 .stream_name = "Slim2 Capture",
1245 .channels_min = 1,
1246 .channels_max = 2,
1247 .rates = WM8998_RATES,
1248 .formats = WM8998_FORMATS,
1249 },
1250 .ops = &arizona_simple_dai_ops,
1251 },
1252};
1253
1254static int wm8998_set_fll(struct snd_soc_component *component, int fll_id,
1255 int source, unsigned int Fref, unsigned int Fout)
1256{
1257 struct wm8998_priv *wm8998 = snd_soc_component_get_drvdata(component);
1258
1259 switch (fll_id) {
1260 case WM8998_FLL1:
1261 return arizona_set_fll(&wm8998->fll[0], source, Fref, Fout);
1262 case WM8998_FLL2:
1263 return arizona_set_fll(&wm8998->fll[1], source, Fref, Fout);
1264 case WM8998_FLL1_REFCLK:
1265 return arizona_set_fll_refclk(&wm8998->fll[0], source, Fref,
1266 Fout);
1267 case WM8998_FLL2_REFCLK:
1268 return arizona_set_fll_refclk(&wm8998->fll[1], source, Fref,
1269 Fout);
1270 default:
1271 return -EINVAL;
1272 }
1273}
1274
1275static int wm8998_component_probe(struct snd_soc_component *component)
1276{
1277 struct wm8998_priv *priv = snd_soc_component_get_drvdata(component);
1278 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1279 struct arizona *arizona = priv->core.arizona;
1280 int ret;
1281
1282 arizona->dapm = dapm;
1283 snd_soc_component_init_regmap(component, arizona->regmap);
1284
1285 ret = arizona_init_spk(component);
1286 if (ret < 0)
1287 return ret;
1288
1289 arizona_init_gpio(component);
1290
1291 snd_soc_component_disable_pin(component, "HAPTICS");
1292
1293 return 0;
1294}
1295
1296static void wm8998_component_remove(struct snd_soc_component *component)
1297{
1298 struct wm8998_priv *priv = snd_soc_component_get_drvdata(component);
1299
1300 priv->core.arizona->dapm = NULL;
1301}
1302
1303#define WM8998_DIG_VU 0x0200
1304
1305static unsigned int wm8998_digital_vu[] = {
1306 ARIZONA_DAC_DIGITAL_VOLUME_1L,
1307 ARIZONA_DAC_DIGITAL_VOLUME_1R,
1308 ARIZONA_DAC_DIGITAL_VOLUME_2L,
1309 ARIZONA_DAC_DIGITAL_VOLUME_2R,
1310 ARIZONA_DAC_DIGITAL_VOLUME_3L,
1311 ARIZONA_DAC_DIGITAL_VOLUME_4L,
1312 ARIZONA_DAC_DIGITAL_VOLUME_4R,
1313 ARIZONA_DAC_DIGITAL_VOLUME_5L,
1314 ARIZONA_DAC_DIGITAL_VOLUME_5R,
1315};
1316
1317static const struct snd_soc_component_driver soc_component_dev_wm8998 = {
1318 .probe = wm8998_component_probe,
1319 .remove = wm8998_component_remove,
1320 .set_sysclk = arizona_set_sysclk,
1321 .set_pll = wm8998_set_fll,
1322 .controls = wm8998_snd_controls,
1323 .num_controls = ARRAY_SIZE(wm8998_snd_controls),
1324 .dapm_widgets = wm8998_dapm_widgets,
1325 .num_dapm_widgets = ARRAY_SIZE(wm8998_dapm_widgets),
1326 .dapm_routes = wm8998_dapm_routes,
1327 .num_dapm_routes = ARRAY_SIZE(wm8998_dapm_routes),
1328 .use_pmdown_time = 1,
1329 .endianness = 1,
1330 .non_legacy_dai_naming = 1,
1331};
1332
1333static int wm8998_probe(struct platform_device *pdev)
1334{
1335 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
1336 struct wm8998_priv *wm8998;
1337 int i, ret;
1338
1339 wm8998 = devm_kzalloc(&pdev->dev, sizeof(struct wm8998_priv),
1340 GFP_KERNEL);
1341 if (!wm8998)
1342 return -ENOMEM;
1343 platform_set_drvdata(pdev, wm8998);
1344
1345 if (IS_ENABLED(CONFIG_OF)) {
1346 if (!dev_get_platdata(arizona->dev)) {
1347 ret = arizona_of_get_audio_pdata(arizona);
1348 if (ret < 0)
1349 return ret;
1350 }
1351 }
1352
1353 wm8998->core.arizona = arizona;
1354 wm8998->core.num_inputs = 3;
1355
1356 for (i = 0; i < ARRAY_SIZE(wm8998->fll); i++)
1357 wm8998->fll[i].vco_mult = 1;
1358
1359 arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
1360 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
1361 &wm8998->fll[0]);
1362 arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
1363 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
1364 &wm8998->fll[1]);
1365
1366 for (i = 0; i < ARRAY_SIZE(wm8998_dai); i++)
1367 arizona_init_dai(&wm8998->core, i);
1368
1369
1370 for (i = 0; i < ARRAY_SIZE(wm8998_digital_vu); i++)
1371 regmap_update_bits(arizona->regmap, wm8998_digital_vu[i],
1372 WM8998_DIG_VU, WM8998_DIG_VU);
1373
1374 pm_runtime_enable(&pdev->dev);
1375 pm_runtime_idle(&pdev->dev);
1376
1377 arizona_init_common(arizona);
1378
1379 ret = arizona_init_spk_irqs(arizona);
1380 if (ret < 0)
1381 return ret;
1382
1383 ret = devm_snd_soc_register_component(&pdev->dev,
1384 &soc_component_dev_wm8998,
1385 wm8998_dai,
1386 ARRAY_SIZE(wm8998_dai));
1387 if (ret < 0) {
1388 dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
1389 goto err_spk_irqs;
1390 }
1391
1392 return ret;
1393
1394err_spk_irqs:
1395 arizona_free_spk_irqs(arizona);
1396
1397 return ret;
1398}
1399
1400static int wm8998_remove(struct platform_device *pdev)
1401{
1402 struct wm8998_priv *wm8998 = platform_get_drvdata(pdev);
1403 struct arizona *arizona = wm8998->core.arizona;
1404
1405 pm_runtime_disable(&pdev->dev);
1406
1407 arizona_free_spk_irqs(arizona);
1408
1409 return 0;
1410}
1411
1412static struct platform_driver wm8998_codec_driver = {
1413 .driver = {
1414 .name = "wm8998-codec",
1415 },
1416 .probe = wm8998_probe,
1417 .remove = wm8998_remove,
1418};
1419
1420module_platform_driver(wm8998_codec_driver);
1421
1422MODULE_DESCRIPTION("ASoC WM8998 driver");
1423MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.wolfsonmicro.com>");
1424MODULE_LICENSE("GPL v2");
1425MODULE_ALIAS("platform:wm8998-codec");
1426