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