2 * wm5102.c -- WM5102 ALSA SoC Audio driver
4 * Copyright 2012 Wolfson Microelectronics plc
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/module.h>
14 #include <linux/moduleparam.h>
15 #include <linux/init.h>
16 #include <linux/delay.h>
18 #include <linux/pm_runtime.h>
19 #include <linux/regmap.h>
20 #include <linux/slab.h>
21 #include <sound/core.h>
22 #include <sound/pcm.h>
23 #include <sound/pcm_params.h>
24 #include <sound/soc.h>
25 #include <sound/jack.h>
26 #include <sound/initval.h>
27 #include <sound/tlv.h>
29 #include <linux/mfd/arizona/core.h>
30 #include <linux/mfd/arizona/registers.h>
36 struct arizona_priv core
;
37 struct arizona_fll fll
[2];
40 static DECLARE_TLV_DB_SCALE(ana_tlv
, 0, 100, 0);
41 static DECLARE_TLV_DB_SCALE(eq_tlv
, -1200, 100, 0);
42 static DECLARE_TLV_DB_SCALE(digital_tlv
, -6400, 50, 0);
43 static DECLARE_TLV_DB_SCALE(noise_tlv
, 0, 600, 0);
45 static const struct snd_kcontrol_new wm5102_snd_controls
[] = {
46 SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL
,
47 ARIZONA_IN1_OSR_SHIFT
, 1, 0),
48 SOC_SINGLE("IN2 High Performance Switch", ARIZONA_IN2L_CONTROL
,
49 ARIZONA_IN2_OSR_SHIFT
, 1, 0),
50 SOC_SINGLE("IN3 High Performance Switch", ARIZONA_IN3L_CONTROL
,
51 ARIZONA_IN3_OSR_SHIFT
, 1, 0),
53 SOC_DOUBLE_R_RANGE_TLV("IN1 Volume", ARIZONA_IN1L_CONTROL
,
55 ARIZONA_IN1L_PGA_VOL_SHIFT
, 0x40, 0x5f, 0, ana_tlv
),
56 SOC_DOUBLE_R_RANGE_TLV("IN2 Volume", ARIZONA_IN2L_CONTROL
,
58 ARIZONA_IN2L_PGA_VOL_SHIFT
, 0x40, 0x5f, 0, ana_tlv
),
59 SOC_DOUBLE_R_RANGE_TLV("IN3 Volume", ARIZONA_IN3L_CONTROL
,
61 ARIZONA_IN3L_PGA_VOL_SHIFT
, 0x40, 0x5f, 0, ana_tlv
),
63 SOC_DOUBLE_R("IN1 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_1L
,
64 ARIZONA_ADC_DIGITAL_VOLUME_1R
, ARIZONA_IN1L_MUTE_SHIFT
, 1, 1),
65 SOC_DOUBLE_R("IN2 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_2L
,
66 ARIZONA_ADC_DIGITAL_VOLUME_2R
, ARIZONA_IN2L_MUTE_SHIFT
, 1, 1),
67 SOC_DOUBLE_R("IN3 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_3L
,
68 ARIZONA_ADC_DIGITAL_VOLUME_3R
, ARIZONA_IN3L_MUTE_SHIFT
, 1, 1),
70 SOC_DOUBLE_R_TLV("IN1 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L
,
71 ARIZONA_ADC_DIGITAL_VOLUME_1R
, ARIZONA_IN1L_DIG_VOL_SHIFT
,
72 0xbf, 0, digital_tlv
),
73 SOC_DOUBLE_R_TLV("IN2 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L
,
74 ARIZONA_ADC_DIGITAL_VOLUME_2R
, ARIZONA_IN2L_DIG_VOL_SHIFT
,
75 0xbf, 0, digital_tlv
),
76 SOC_DOUBLE_R_TLV("IN3 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L
,
77 ARIZONA_ADC_DIGITAL_VOLUME_3R
, ARIZONA_IN3L_DIG_VOL_SHIFT
,
78 0xbf, 0, digital_tlv
),
80 ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE
),
81 ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE
),
82 ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE
),
83 ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE
),
85 SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1
, ARIZONA_EQ1_B1_GAIN_SHIFT
,
87 SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1
, ARIZONA_EQ1_B2_GAIN_SHIFT
,
89 SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1
, ARIZONA_EQ1_B3_GAIN_SHIFT
,
91 SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2
, ARIZONA_EQ1_B4_GAIN_SHIFT
,
93 SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2
, ARIZONA_EQ1_B5_GAIN_SHIFT
,
96 SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1
, ARIZONA_EQ2_B1_GAIN_SHIFT
,
98 SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1
, ARIZONA_EQ2_B2_GAIN_SHIFT
,
100 SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1
, ARIZONA_EQ2_B3_GAIN_SHIFT
,
102 SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2
, ARIZONA_EQ2_B4_GAIN_SHIFT
,
104 SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2
, ARIZONA_EQ2_B5_GAIN_SHIFT
,
107 SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1
, ARIZONA_EQ3_B1_GAIN_SHIFT
,
109 SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1
, ARIZONA_EQ3_B2_GAIN_SHIFT
,
111 SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1
, ARIZONA_EQ3_B3_GAIN_SHIFT
,
113 SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2
, ARIZONA_EQ3_B4_GAIN_SHIFT
,
115 SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2
, ARIZONA_EQ3_B5_GAIN_SHIFT
,
118 SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1
, ARIZONA_EQ4_B1_GAIN_SHIFT
,
120 SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1
, ARIZONA_EQ4_B2_GAIN_SHIFT
,
122 SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1
, ARIZONA_EQ4_B3_GAIN_SHIFT
,
124 SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2
, ARIZONA_EQ4_B4_GAIN_SHIFT
,
126 SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2
, ARIZONA_EQ4_B5_GAIN_SHIFT
,
129 ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE
),
130 ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE
),
132 SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1
, 5,
133 ARIZONA_DRC1R_ENA
| ARIZONA_DRC1L_ENA
),
135 ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE
),
136 ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE
),
137 ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE
),
138 ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE
),
140 SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode
),
141 SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode
),
142 SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode
),
143 SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode
),
145 ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE
),
146 ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE
),
148 SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR
,
149 ARIZONA_NOISE_GEN_GAIN_SHIFT
, 0x16, 0, noise_tlv
),
151 ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE
),
152 ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE
),
153 ARIZONA_MIXER_CONTROLS("HPOUT2L", ARIZONA_OUT2LMIX_INPUT_1_SOURCE
),
154 ARIZONA_MIXER_CONTROLS("HPOUT2R", ARIZONA_OUT2RMIX_INPUT_1_SOURCE
),
155 ARIZONA_MIXER_CONTROLS("EPOUT", ARIZONA_OUT3LMIX_INPUT_1_SOURCE
),
156 ARIZONA_MIXER_CONTROLS("SPKOUTL", ARIZONA_OUT4LMIX_INPUT_1_SOURCE
),
157 ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE
),
158 ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE
),
159 ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE
),
161 SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L
,
162 ARIZONA_OUT1_OSR_SHIFT
, 1, 0),
163 SOC_SINGLE("OUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L
,
164 ARIZONA_OUT2_OSR_SHIFT
, 1, 0),
165 SOC_SINGLE("EPOUT High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L
,
166 ARIZONA_OUT3_OSR_SHIFT
, 1, 0),
167 SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L
,
168 ARIZONA_OUT4_OSR_SHIFT
, 1, 0),
169 SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L
,
170 ARIZONA_OUT5_OSR_SHIFT
, 1, 0),
172 SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L
,
173 ARIZONA_DAC_DIGITAL_VOLUME_1R
, ARIZONA_OUT1L_MUTE_SHIFT
, 1, 1),
174 SOC_DOUBLE_R("OUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L
,
175 ARIZONA_DAC_DIGITAL_VOLUME_2R
, ARIZONA_OUT2L_MUTE_SHIFT
, 1, 1),
176 SOC_SINGLE("EPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L
,
177 ARIZONA_OUT3L_MUTE_SHIFT
, 1, 1),
178 SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L
,
179 ARIZONA_DAC_DIGITAL_VOLUME_4R
, ARIZONA_OUT4L_MUTE_SHIFT
, 1, 1),
180 SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L
,
181 ARIZONA_DAC_DIGITAL_VOLUME_5R
, ARIZONA_OUT5L_MUTE_SHIFT
, 1, 1),
183 SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L
,
184 ARIZONA_DAC_DIGITAL_VOLUME_1R
, ARIZONA_OUT1L_VOL_SHIFT
,
185 0xbf, 0, digital_tlv
),
186 SOC_DOUBLE_R_TLV("OUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L
,
187 ARIZONA_DAC_DIGITAL_VOLUME_2R
, ARIZONA_OUT2L_VOL_SHIFT
,
188 0xbf, 0, digital_tlv
),
189 SOC_SINGLE_TLV("EPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L
,
190 ARIZONA_OUT3L_VOL_SHIFT
, 0xbf, 0, digital_tlv
),
191 SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L
,
192 ARIZONA_DAC_DIGITAL_VOLUME_4R
, ARIZONA_OUT4L_VOL_SHIFT
,
193 0xbf, 0, digital_tlv
),
194 SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L
,
195 ARIZONA_DAC_DIGITAL_VOLUME_5R
, ARIZONA_OUT5L_VOL_SHIFT
,
196 0xbf, 0, digital_tlv
),
198 SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L
,
199 ARIZONA_OUTPUT_PATH_CONFIG_1R
,
200 ARIZONA_OUT1L_PGA_VOL_SHIFT
,
201 0x34, 0x40, 0, ana_tlv
),
202 SOC_DOUBLE_R_RANGE_TLV("OUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L
,
203 ARIZONA_OUTPUT_PATH_CONFIG_2R
,
204 ARIZONA_OUT2L_PGA_VOL_SHIFT
,
205 0x34, 0x40, 0, ana_tlv
),
206 SOC_SINGLE_RANGE_TLV("EPOUT Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L
,
207 ARIZONA_OUT3L_PGA_VOL_SHIFT
, 0x34, 0x40, 0, ana_tlv
),
209 SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1
, ARIZONA_SPK1L_MUTE_SHIFT
,
210 ARIZONA_SPK1R_MUTE_SHIFT
, 1, 1),
212 ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE
),
213 ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE
),
214 ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE
),
215 ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE
),
216 ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE
),
217 ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE
),
218 ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE
),
219 ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE
),
221 ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE
),
222 ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE
),
224 ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE
),
225 ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE
),
228 ARIZONA_MIXER_ENUMS(EQ1
, ARIZONA_EQ1MIX_INPUT_1_SOURCE
);
229 ARIZONA_MIXER_ENUMS(EQ2
, ARIZONA_EQ2MIX_INPUT_1_SOURCE
);
230 ARIZONA_MIXER_ENUMS(EQ3
, ARIZONA_EQ3MIX_INPUT_1_SOURCE
);
231 ARIZONA_MIXER_ENUMS(EQ4
, ARIZONA_EQ4MIX_INPUT_1_SOURCE
);
233 ARIZONA_MIXER_ENUMS(DRC1L
, ARIZONA_DRC1LMIX_INPUT_1_SOURCE
);
234 ARIZONA_MIXER_ENUMS(DRC1R
, ARIZONA_DRC1RMIX_INPUT_1_SOURCE
);
236 ARIZONA_MIXER_ENUMS(LHPF1
, ARIZONA_HPLP1MIX_INPUT_1_SOURCE
);
237 ARIZONA_MIXER_ENUMS(LHPF2
, ARIZONA_HPLP2MIX_INPUT_1_SOURCE
);
238 ARIZONA_MIXER_ENUMS(LHPF3
, ARIZONA_HPLP3MIX_INPUT_1_SOURCE
);
239 ARIZONA_MIXER_ENUMS(LHPF4
, ARIZONA_HPLP4MIX_INPUT_1_SOURCE
);
241 ARIZONA_MIXER_ENUMS(Mic
, ARIZONA_MICMIX_INPUT_1_SOURCE
);
242 ARIZONA_MIXER_ENUMS(Noise
, ARIZONA_NOISEMIX_INPUT_1_SOURCE
);
244 ARIZONA_MIXER_ENUMS(PWM1
, ARIZONA_PWM1MIX_INPUT_1_SOURCE
);
245 ARIZONA_MIXER_ENUMS(PWM2
, ARIZONA_PWM2MIX_INPUT_1_SOURCE
);
247 ARIZONA_MIXER_ENUMS(OUT1L
, ARIZONA_OUT1LMIX_INPUT_1_SOURCE
);
248 ARIZONA_MIXER_ENUMS(OUT1R
, ARIZONA_OUT1RMIX_INPUT_1_SOURCE
);
249 ARIZONA_MIXER_ENUMS(OUT2L
, ARIZONA_OUT2LMIX_INPUT_1_SOURCE
);
250 ARIZONA_MIXER_ENUMS(OUT2R
, ARIZONA_OUT2RMIX_INPUT_1_SOURCE
);
251 ARIZONA_MIXER_ENUMS(OUT3
, ARIZONA_OUT3LMIX_INPUT_1_SOURCE
);
252 ARIZONA_MIXER_ENUMS(SPKOUTL
, ARIZONA_OUT4LMIX_INPUT_1_SOURCE
);
253 ARIZONA_MIXER_ENUMS(SPKOUTR
, ARIZONA_OUT4RMIX_INPUT_1_SOURCE
);
254 ARIZONA_MIXER_ENUMS(SPKDAT1L
, ARIZONA_OUT5LMIX_INPUT_1_SOURCE
);
255 ARIZONA_MIXER_ENUMS(SPKDAT1R
, ARIZONA_OUT5RMIX_INPUT_1_SOURCE
);
257 ARIZONA_MIXER_ENUMS(AIF1TX1
, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE
);
258 ARIZONA_MIXER_ENUMS(AIF1TX2
, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE
);
259 ARIZONA_MIXER_ENUMS(AIF1TX3
, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE
);
260 ARIZONA_MIXER_ENUMS(AIF1TX4
, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE
);
261 ARIZONA_MIXER_ENUMS(AIF1TX5
, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE
);
262 ARIZONA_MIXER_ENUMS(AIF1TX6
, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE
);
263 ARIZONA_MIXER_ENUMS(AIF1TX7
, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE
);
264 ARIZONA_MIXER_ENUMS(AIF1TX8
, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE
);
266 ARIZONA_MIXER_ENUMS(AIF2TX1
, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE
);
267 ARIZONA_MIXER_ENUMS(AIF2TX2
, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE
);
269 ARIZONA_MIXER_ENUMS(AIF3TX1
, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE
);
270 ARIZONA_MIXER_ENUMS(AIF3TX2
, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE
);
272 ARIZONA_MIXER_ENUMS(ASRC1L
, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE
);
273 ARIZONA_MIXER_ENUMS(ASRC1R
, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE
);
274 ARIZONA_MIXER_ENUMS(ASRC2L
, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE
);
275 ARIZONA_MIXER_ENUMS(ASRC2R
, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE
);
277 static const struct snd_soc_dapm_widget wm5102_dapm_widgets
[] = {
278 SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1
, ARIZONA_SYSCLK_ENA_SHIFT
,
280 SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1
,
281 ARIZONA_ASYNC_CLK_ENA_SHIFT
, 0, NULL
, 0),
283 SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0),
284 SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0),
285 SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20),
286 SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0),
287 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0),
288 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0),
290 SND_SOC_DAPM_SIGGEN("TONE"),
291 SND_SOC_DAPM_SIGGEN("NOISE"),
293 SND_SOC_DAPM_INPUT("IN1L"),
294 SND_SOC_DAPM_INPUT("IN1R"),
295 SND_SOC_DAPM_INPUT("IN2L"),
296 SND_SOC_DAPM_INPUT("IN2R"),
297 SND_SOC_DAPM_INPUT("IN3L"),
298 SND_SOC_DAPM_INPUT("IN3R"),
300 SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES
, ARIZONA_IN1L_ENA_SHIFT
,
301 0, NULL
, 0, arizona_in_ev
,
302 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
303 SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES
, ARIZONA_IN1R_ENA_SHIFT
,
304 0, NULL
, 0, arizona_in_ev
,
305 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
306 SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES
, ARIZONA_IN2L_ENA_SHIFT
,
307 0, NULL
, 0, arizona_in_ev
,
308 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
309 SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES
, ARIZONA_IN2R_ENA_SHIFT
,
310 0, NULL
, 0, arizona_in_ev
,
311 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
312 SND_SOC_DAPM_PGA_E("IN3L PGA", ARIZONA_INPUT_ENABLES
, ARIZONA_IN3L_ENA_SHIFT
,
313 0, NULL
, 0, arizona_in_ev
,
314 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
315 SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES
, ARIZONA_IN3R_ENA_SHIFT
,
316 0, NULL
, 0, arizona_in_ev
,
317 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
319 SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1
,
320 ARIZONA_MICB1_ENA_SHIFT
, 0, NULL
, 0),
321 SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2
,
322 ARIZONA_MICB1_ENA_SHIFT
, 0, NULL
, 0),
323 SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3
,
324 ARIZONA_MICB1_ENA_SHIFT
, 0, NULL
, 0),
326 SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR
,
327 ARIZONA_NOISE_GEN_ENA_SHIFT
, 0, NULL
, 0),
329 SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1
,
330 ARIZONA_TONE1_ENA_SHIFT
, 0, NULL
, 0),
331 SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1
,
332 ARIZONA_TONE2_ENA_SHIFT
, 0, NULL
, 0),
334 SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1
,
335 ARIZONA_MICMUTE_MIX_ENA_SHIFT
, 0, NULL
, 0),
337 SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1
, ARIZONA_EQ1_ENA_SHIFT
, 0, NULL
, 0),
338 SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1
, ARIZONA_EQ2_ENA_SHIFT
, 0, NULL
, 0),
339 SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1
, ARIZONA_EQ3_ENA_SHIFT
, 0, NULL
, 0),
340 SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1
, ARIZONA_EQ4_ENA_SHIFT
, 0, NULL
, 0),
342 SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1
, ARIZONA_DRC1L_ENA_SHIFT
, 0,
344 SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1
, ARIZONA_DRC1R_ENA_SHIFT
, 0,
347 SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1
, ARIZONA_LHPF1_ENA_SHIFT
, 0,
349 SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1
, ARIZONA_LHPF2_ENA_SHIFT
, 0,
351 SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1
, ARIZONA_LHPF3_ENA_SHIFT
, 0,
353 SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1
, ARIZONA_LHPF4_ENA_SHIFT
, 0,
356 SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1
, ARIZONA_PWM1_ENA_SHIFT
,
358 SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1
, ARIZONA_PWM2_ENA_SHIFT
,
361 SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE
, ARIZONA_ASRC1L_ENA_SHIFT
, 0,
363 SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE
, ARIZONA_ASRC1R_ENA_SHIFT
, 0,
365 SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE
, ARIZONA_ASRC2L_ENA_SHIFT
, 0,
367 SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE
, ARIZONA_ASRC2R_ENA_SHIFT
, 0,
370 SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL
, 0,
371 ARIZONA_AIF1_TX_ENABLES
, ARIZONA_AIF1TX1_ENA_SHIFT
, 0),
372 SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL
, 0,
373 ARIZONA_AIF1_TX_ENABLES
, ARIZONA_AIF1TX2_ENA_SHIFT
, 0),
374 SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL
, 0,
375 ARIZONA_AIF1_TX_ENABLES
, ARIZONA_AIF1TX3_ENA_SHIFT
, 0),
376 SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL
, 0,
377 ARIZONA_AIF1_TX_ENABLES
, ARIZONA_AIF1TX4_ENA_SHIFT
, 0),
378 SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL
, 0,
379 ARIZONA_AIF1_TX_ENABLES
, ARIZONA_AIF1TX5_ENA_SHIFT
, 0),
380 SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL
, 0,
381 ARIZONA_AIF1_TX_ENABLES
, ARIZONA_AIF1TX6_ENA_SHIFT
, 0),
382 SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL
, 0,
383 ARIZONA_AIF1_TX_ENABLES
, ARIZONA_AIF1TX7_ENA_SHIFT
, 0),
384 SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL
, 0,
385 ARIZONA_AIF1_TX_ENABLES
, ARIZONA_AIF1TX8_ENA_SHIFT
, 0),
387 SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL
, 0,
388 ARIZONA_AIF1_RX_ENABLES
, ARIZONA_AIF1RX1_ENA_SHIFT
, 0),
389 SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL
, 0,
390 ARIZONA_AIF1_RX_ENABLES
, ARIZONA_AIF1RX2_ENA_SHIFT
, 0),
391 SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL
, 0,
392 ARIZONA_AIF1_RX_ENABLES
, ARIZONA_AIF1RX3_ENA_SHIFT
, 0),
393 SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL
, 0,
394 ARIZONA_AIF1_RX_ENABLES
, ARIZONA_AIF1RX4_ENA_SHIFT
, 0),
395 SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL
, 0,
396 ARIZONA_AIF1_RX_ENABLES
, ARIZONA_AIF1RX5_ENA_SHIFT
, 0),
397 SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL
, 0,
398 ARIZONA_AIF1_RX_ENABLES
, ARIZONA_AIF1RX6_ENA_SHIFT
, 0),
399 SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL
, 0,
400 ARIZONA_AIF1_RX_ENABLES
, ARIZONA_AIF1RX7_ENA_SHIFT
, 0),
401 SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL
, 0,
402 ARIZONA_AIF1_RX_ENABLES
, ARIZONA_AIF1RX8_ENA_SHIFT
, 0),
404 SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL
, 0,
405 ARIZONA_AIF2_TX_ENABLES
, ARIZONA_AIF2TX1_ENA_SHIFT
, 0),
406 SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL
, 0,
407 ARIZONA_AIF2_TX_ENABLES
, ARIZONA_AIF2TX2_ENA_SHIFT
, 0),
409 SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL
, 0,
410 ARIZONA_AIF2_RX_ENABLES
, ARIZONA_AIF2RX1_ENA_SHIFT
, 0),
411 SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL
, 0,
412 ARIZONA_AIF2_RX_ENABLES
, ARIZONA_AIF2RX2_ENA_SHIFT
, 0),
414 SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL
, 0,
415 ARIZONA_AIF3_TX_ENABLES
, ARIZONA_AIF3TX1_ENA_SHIFT
, 0),
416 SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL
, 0,
417 ARIZONA_AIF3_TX_ENABLES
, ARIZONA_AIF3TX2_ENA_SHIFT
, 0),
419 SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL
, 0,
420 ARIZONA_AIF3_RX_ENABLES
, ARIZONA_AIF3RX1_ENA_SHIFT
, 0),
421 SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL
, 0,
422 ARIZONA_AIF3_RX_ENABLES
, ARIZONA_AIF3RX2_ENA_SHIFT
, 0),
424 SND_SOC_DAPM_PGA_E("OUT1L", ARIZONA_OUTPUT_ENABLES_1
,
425 ARIZONA_OUT1L_ENA_SHIFT
, 0, NULL
, 0, arizona_out_ev
,
426 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
427 SND_SOC_DAPM_PGA_E("OUT1R", ARIZONA_OUTPUT_ENABLES_1
,
428 ARIZONA_OUT1R_ENA_SHIFT
, 0, NULL
, 0, arizona_out_ev
,
429 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
430 SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1
,
431 ARIZONA_OUT2L_ENA_SHIFT
, 0, NULL
, 0, arizona_out_ev
,
432 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
433 SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1
,
434 ARIZONA_OUT2R_ENA_SHIFT
, 0, NULL
, 0, arizona_out_ev
,
435 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
436 SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1
,
437 ARIZONA_OUT3L_ENA_SHIFT
, 0, NULL
, 0, arizona_out_ev
,
438 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
439 SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1
,
440 ARIZONA_OUT4L_ENA_SHIFT
, 0, NULL
, 0, arizona_out_ev
,
441 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
442 SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1
,
443 ARIZONA_OUT4R_ENA_SHIFT
, 0, NULL
, 0, arizona_out_ev
,
444 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
445 SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1
,
446 ARIZONA_OUT5L_ENA_SHIFT
, 0, NULL
, 0, arizona_out_ev
,
447 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
448 SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1
,
449 ARIZONA_OUT5R_ENA_SHIFT
, 0, NULL
, 0, arizona_out_ev
,
450 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
452 ARIZONA_MIXER_WIDGETS(EQ1
, "EQ1"),
453 ARIZONA_MIXER_WIDGETS(EQ2
, "EQ2"),
454 ARIZONA_MIXER_WIDGETS(EQ3
, "EQ3"),
455 ARIZONA_MIXER_WIDGETS(EQ4
, "EQ4"),
457 ARIZONA_MIXER_WIDGETS(DRC1L
, "DRC1L"),
458 ARIZONA_MIXER_WIDGETS(DRC1R
, "DRC1R"),
460 ARIZONA_MIXER_WIDGETS(LHPF1
, "LHPF1"),
461 ARIZONA_MIXER_WIDGETS(LHPF2
, "LHPF2"),
462 ARIZONA_MIXER_WIDGETS(LHPF3
, "LHPF3"),
463 ARIZONA_MIXER_WIDGETS(LHPF4
, "LHPF4"),
465 ARIZONA_MIXER_WIDGETS(Mic
, "Mic"),
466 ARIZONA_MIXER_WIDGETS(Noise
, "Noise"),
468 ARIZONA_MIXER_WIDGETS(PWM1
, "PWM1"),
469 ARIZONA_MIXER_WIDGETS(PWM2
, "PWM2"),
471 ARIZONA_MIXER_WIDGETS(OUT1L
, "HPOUT1L"),
472 ARIZONA_MIXER_WIDGETS(OUT1R
, "HPOUT1R"),
473 ARIZONA_MIXER_WIDGETS(OUT2L
, "HPOUT2L"),
474 ARIZONA_MIXER_WIDGETS(OUT2R
, "HPOUT2R"),
475 ARIZONA_MIXER_WIDGETS(OUT3
, "EPOUT"),
476 ARIZONA_MIXER_WIDGETS(SPKOUTL
, "SPKOUTL"),
477 ARIZONA_MIXER_WIDGETS(SPKOUTR
, "SPKOUTR"),
478 ARIZONA_MIXER_WIDGETS(SPKDAT1L
, "SPKDAT1L"),
479 ARIZONA_MIXER_WIDGETS(SPKDAT1R
, "SPKDAT1R"),
481 ARIZONA_MIXER_WIDGETS(AIF1TX1
, "AIF1TX1"),
482 ARIZONA_MIXER_WIDGETS(AIF1TX2
, "AIF1TX2"),
483 ARIZONA_MIXER_WIDGETS(AIF1TX3
, "AIF1TX3"),
484 ARIZONA_MIXER_WIDGETS(AIF1TX4
, "AIF1TX4"),
485 ARIZONA_MIXER_WIDGETS(AIF1TX5
, "AIF1TX5"),
486 ARIZONA_MIXER_WIDGETS(AIF1TX6
, "AIF1TX6"),
487 ARIZONA_MIXER_WIDGETS(AIF1TX7
, "AIF1TX7"),
488 ARIZONA_MIXER_WIDGETS(AIF1TX8
, "AIF1TX8"),
490 ARIZONA_MIXER_WIDGETS(AIF2TX1
, "AIF2TX1"),
491 ARIZONA_MIXER_WIDGETS(AIF2TX2
, "AIF2TX2"),
493 ARIZONA_MIXER_WIDGETS(AIF3TX1
, "AIF3TX1"),
494 ARIZONA_MIXER_WIDGETS(AIF3TX2
, "AIF3TX2"),
496 ARIZONA_MIXER_WIDGETS(ASRC1L
, "ASRC1L"),
497 ARIZONA_MIXER_WIDGETS(ASRC1R
, "ASRC1R"),
498 ARIZONA_MIXER_WIDGETS(ASRC2L
, "ASRC2L"),
499 ARIZONA_MIXER_WIDGETS(ASRC2R
, "ASRC2R"),
501 SND_SOC_DAPM_OUTPUT("HPOUT1L"),
502 SND_SOC_DAPM_OUTPUT("HPOUT1R"),
503 SND_SOC_DAPM_OUTPUT("HPOUT2L"),
504 SND_SOC_DAPM_OUTPUT("HPOUT2R"),
505 SND_SOC_DAPM_OUTPUT("EPOUTN"),
506 SND_SOC_DAPM_OUTPUT("EPOUTP"),
507 SND_SOC_DAPM_OUTPUT("SPKOUTLN"),
508 SND_SOC_DAPM_OUTPUT("SPKOUTLP"),
509 SND_SOC_DAPM_OUTPUT("SPKOUTRN"),
510 SND_SOC_DAPM_OUTPUT("SPKOUTRP"),
511 SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
512 SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
515 #define ARIZONA_MIXER_INPUT_ROUTES(name) \
516 { name, "Noise Generator", "Noise Generator" }, \
517 { name, "Tone Generator 1", "Tone Generator 1" }, \
518 { name, "Tone Generator 2", "Tone Generator 2" }, \
519 { name, "IN1L", "IN1L PGA" }, \
520 { name, "IN1R", "IN1R PGA" }, \
521 { name, "IN2L", "IN2L PGA" }, \
522 { name, "IN2R", "IN2R PGA" }, \
523 { name, "IN3L", "IN3L PGA" }, \
524 { name, "IN3R", "IN3R PGA" }, \
525 { name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
526 { name, "AIF1RX1", "AIF1RX1" }, \
527 { name, "AIF1RX2", "AIF1RX2" }, \
528 { name, "AIF1RX3", "AIF1RX3" }, \
529 { name, "AIF1RX4", "AIF1RX4" }, \
530 { name, "AIF1RX5", "AIF1RX5" }, \
531 { name, "AIF1RX6", "AIF1RX6" }, \
532 { name, "AIF1RX7", "AIF1RX7" }, \
533 { name, "AIF1RX8", "AIF1RX8" }, \
534 { name, "AIF2RX1", "AIF2RX1" }, \
535 { name, "AIF2RX2", "AIF2RX2" }, \
536 { name, "AIF3RX1", "AIF3RX1" }, \
537 { name, "AIF3RX2", "AIF3RX2" }, \
538 { name, "EQ1", "EQ1" }, \
539 { name, "EQ2", "EQ2" }, \
540 { name, "EQ3", "EQ3" }, \
541 { name, "EQ4", "EQ4" }, \
542 { name, "DRC1L", "DRC1L" }, \
543 { name, "DRC1R", "DRC1R" }, \
544 { name, "LHPF1", "LHPF1" }, \
545 { name, "LHPF2", "LHPF2" }, \
546 { name, "LHPF3", "LHPF3" }, \
547 { name, "LHPF4", "LHPF4" }, \
548 { name, "ASRC1L", "ASRC1L" }, \
549 { name, "ASRC1R", "ASRC1R" }, \
550 { name, "ASRC2L", "ASRC2L" }, \
551 { name, "ASRC2R", "ASRC2R" }
553 static const struct snd_soc_dapm_route wm5102_dapm_routes
[] = {
554 { "AIF2 Capture", NULL
, "DBVDD2" },
555 { "AIF2 Playback", NULL
, "DBVDD2" },
557 { "AIF3 Capture", NULL
, "DBVDD3" },
558 { "AIF3 Playback", NULL
, "DBVDD3" },
560 { "OUT1L", NULL
, "CPVDD" },
561 { "OUT1R", NULL
, "CPVDD" },
562 { "OUT2L", NULL
, "CPVDD" },
563 { "OUT2R", NULL
, "CPVDD" },
564 { "OUT3L", NULL
, "CPVDD" },
566 { "OUT4L", NULL
, "SPKVDDL" },
567 { "OUT4R", NULL
, "SPKVDDR" },
569 { "OUT1L", NULL
, "SYSCLK" },
570 { "OUT1R", NULL
, "SYSCLK" },
571 { "OUT2L", NULL
, "SYSCLK" },
572 { "OUT2R", NULL
, "SYSCLK" },
573 { "OUT3L", NULL
, "SYSCLK" },
574 { "OUT4L", NULL
, "SYSCLK" },
575 { "OUT4R", NULL
, "SYSCLK" },
576 { "OUT5L", NULL
, "SYSCLK" },
577 { "OUT5R", NULL
, "SYSCLK" },
579 { "MICBIAS1", NULL
, "MICVDD" },
580 { "MICBIAS2", NULL
, "MICVDD" },
581 { "MICBIAS3", NULL
, "MICVDD" },
583 { "Noise Generator", NULL
, "NOISE" },
584 { "Tone Generator 1", NULL
, "TONE" },
585 { "Tone Generator 2", NULL
, "TONE" },
587 { "Mic Mute Mixer", NULL
, "Noise Mixer" },
588 { "Mic Mute Mixer", NULL
, "Mic Mixer" },
590 { "AIF1 Capture", NULL
, "AIF1TX1" },
591 { "AIF1 Capture", NULL
, "AIF1TX2" },
592 { "AIF1 Capture", NULL
, "AIF1TX3" },
593 { "AIF1 Capture", NULL
, "AIF1TX4" },
594 { "AIF1 Capture", NULL
, "AIF1TX5" },
595 { "AIF1 Capture", NULL
, "AIF1TX6" },
596 { "AIF1 Capture", NULL
, "AIF1TX7" },
597 { "AIF1 Capture", NULL
, "AIF1TX8" },
599 { "AIF1RX1", NULL
, "AIF1 Playback" },
600 { "AIF1RX2", NULL
, "AIF1 Playback" },
601 { "AIF1RX3", NULL
, "AIF1 Playback" },
602 { "AIF1RX4", NULL
, "AIF1 Playback" },
603 { "AIF1RX5", NULL
, "AIF1 Playback" },
604 { "AIF1RX6", NULL
, "AIF1 Playback" },
605 { "AIF1RX7", NULL
, "AIF1 Playback" },
606 { "AIF1RX8", NULL
, "AIF1 Playback" },
608 { "AIF2 Capture", NULL
, "AIF2TX1" },
609 { "AIF2 Capture", NULL
, "AIF2TX2" },
611 { "AIF2RX1", NULL
, "AIF2 Playback" },
612 { "AIF2RX2", NULL
, "AIF2 Playback" },
614 { "AIF3 Capture", NULL
, "AIF3TX1" },
615 { "AIF3 Capture", NULL
, "AIF3TX2" },
617 { "AIF3RX1", NULL
, "AIF3 Playback" },
618 { "AIF3RX2", NULL
, "AIF3 Playback" },
620 { "AIF1 Playback", NULL
, "SYSCLK" },
621 { "AIF2 Playback", NULL
, "SYSCLK" },
622 { "AIF3 Playback", NULL
, "SYSCLK" },
624 { "AIF1 Capture", NULL
, "SYSCLK" },
625 { "AIF2 Capture", NULL
, "SYSCLK" },
626 { "AIF3 Capture", NULL
, "SYSCLK" },
628 { "IN1L PGA", NULL
, "IN1L" },
629 { "IN1R PGA", NULL
, "IN1R" },
631 { "IN2L PGA", NULL
, "IN2L" },
632 { "IN2R PGA", NULL
, "IN2R" },
634 { "IN3L PGA", NULL
, "IN3L" },
635 { "IN3R PGA", NULL
, "IN3R" },
637 ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
638 ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
639 ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"),
640 ARIZONA_MIXER_ROUTES("OUT2R", "HPOUT2R"),
641 ARIZONA_MIXER_ROUTES("OUT3L", "EPOUT"),
643 ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUTL"),
644 ARIZONA_MIXER_ROUTES("OUT4R", "SPKOUTR"),
645 ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
646 ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
648 ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
649 ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
651 ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
652 ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
653 ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
654 ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
655 ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
656 ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
657 ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
658 ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
660 ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
661 ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
663 ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
664 ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
666 ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
667 ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
668 ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
669 ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
671 ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
672 ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
674 ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
675 ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
676 ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
677 ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
679 ARIZONA_MIXER_ROUTES("ASRC1L", "ASRC1L"),
680 ARIZONA_MIXER_ROUTES("ASRC1R", "ASRC1R"),
681 ARIZONA_MIXER_ROUTES("ASRC2L", "ASRC2L"),
682 ARIZONA_MIXER_ROUTES("ASRC2R", "ASRC2R"),
684 { "HPOUT1L", NULL
, "OUT1L" },
685 { "HPOUT1R", NULL
, "OUT1R" },
687 { "HPOUT2L", NULL
, "OUT2L" },
688 { "HPOUT2R", NULL
, "OUT2R" },
690 { "EPOUTN", NULL
, "OUT3L" },
691 { "EPOUTP", NULL
, "OUT3L" },
693 { "SPKOUTLN", NULL
, "OUT4L" },
694 { "SPKOUTLP", NULL
, "OUT4L" },
696 { "SPKOUTRN", NULL
, "OUT4R" },
697 { "SPKOUTRP", NULL
, "OUT4R" },
699 { "SPKDAT1L", NULL
, "OUT5L" },
700 { "SPKDAT1R", NULL
, "OUT5R" },
703 static int wm5102_set_fll(struct snd_soc_codec
*codec
, int fll_id
, int source
,
704 unsigned int Fref
, unsigned int Fout
)
706 struct wm5102_priv
*wm5102
= snd_soc_codec_get_drvdata(codec
);
710 return arizona_set_fll(&wm5102
->fll
[0], source
, Fref
, Fout
);
712 return arizona_set_fll(&wm5102
->fll
[1], source
, Fref
, Fout
);
718 #define WM5102_RATES SNDRV_PCM_RATE_8000_192000
720 #define WM5102_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
721 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
723 static struct snd_soc_dai_driver wm5102_dai
[] = {
725 .name
= "wm5102-aif1",
727 .base
= ARIZONA_AIF1_BCLK_CTRL
,
729 .stream_name
= "AIF1 Playback",
732 .rates
= WM5102_RATES
,
733 .formats
= WM5102_FORMATS
,
736 .stream_name
= "AIF1 Capture",
739 .rates
= WM5102_RATES
,
740 .formats
= WM5102_FORMATS
,
742 .ops
= &arizona_dai_ops
,
743 .symmetric_rates
= 1,
746 .name
= "wm5102-aif2",
748 .base
= ARIZONA_AIF2_BCLK_CTRL
,
750 .stream_name
= "AIF2 Playback",
753 .rates
= WM5102_RATES
,
754 .formats
= WM5102_FORMATS
,
757 .stream_name
= "AIF2 Capture",
760 .rates
= WM5102_RATES
,
761 .formats
= WM5102_FORMATS
,
763 .ops
= &arizona_dai_ops
,
764 .symmetric_rates
= 1,
767 .name
= "wm5102-aif3",
769 .base
= ARIZONA_AIF3_BCLK_CTRL
,
771 .stream_name
= "AIF3 Playback",
774 .rates
= WM5102_RATES
,
775 .formats
= WM5102_FORMATS
,
778 .stream_name
= "AIF3 Capture",
781 .rates
= WM5102_RATES
,
782 .formats
= WM5102_FORMATS
,
784 .ops
= &arizona_dai_ops
,
785 .symmetric_rates
= 1,
789 static int wm5102_codec_probe(struct snd_soc_codec
*codec
)
791 struct wm5102_priv
*priv
= snd_soc_codec_get_drvdata(codec
);
793 codec
->control_data
= priv
->core
.arizona
->regmap
;
794 return snd_soc_codec_set_cache_io(codec
, 32, 16, SND_SOC_REGMAP
);
797 #define WM5102_DIG_VU 0x0200
799 static unsigned int wm5102_digital_vu
[] = {
800 ARIZONA_ADC_DIGITAL_VOLUME_1L
,
801 ARIZONA_ADC_DIGITAL_VOLUME_1R
,
802 ARIZONA_ADC_DIGITAL_VOLUME_2L
,
803 ARIZONA_ADC_DIGITAL_VOLUME_2R
,
804 ARIZONA_ADC_DIGITAL_VOLUME_3L
,
805 ARIZONA_ADC_DIGITAL_VOLUME_3R
,
807 ARIZONA_DAC_DIGITAL_VOLUME_1L
,
808 ARIZONA_DAC_DIGITAL_VOLUME_1R
,
809 ARIZONA_DAC_DIGITAL_VOLUME_2L
,
810 ARIZONA_DAC_DIGITAL_VOLUME_2R
,
811 ARIZONA_DAC_DIGITAL_VOLUME_3L
,
812 ARIZONA_DAC_DIGITAL_VOLUME_3R
,
813 ARIZONA_DAC_DIGITAL_VOLUME_4L
,
814 ARIZONA_DAC_DIGITAL_VOLUME_4R
,
815 ARIZONA_DAC_DIGITAL_VOLUME_5L
,
816 ARIZONA_DAC_DIGITAL_VOLUME_5R
,
819 static struct snd_soc_codec_driver soc_codec_dev_wm5102
= {
820 .probe
= wm5102_codec_probe
,
822 .idle_bias_off
= true,
824 .set_sysclk
= arizona_set_sysclk
,
825 .set_pll
= wm5102_set_fll
,
827 .controls
= wm5102_snd_controls
,
828 .num_controls
= ARRAY_SIZE(wm5102_snd_controls
),
829 .dapm_widgets
= wm5102_dapm_widgets
,
830 .num_dapm_widgets
= ARRAY_SIZE(wm5102_dapm_widgets
),
831 .dapm_routes
= wm5102_dapm_routes
,
832 .num_dapm_routes
= ARRAY_SIZE(wm5102_dapm_routes
),
835 static int __devinit
wm5102_probe(struct platform_device
*pdev
)
837 struct arizona
*arizona
= dev_get_drvdata(pdev
->dev
.parent
);
838 struct wm5102_priv
*wm5102
;
841 wm5102
= devm_kzalloc(&pdev
->dev
, sizeof(struct wm5102_priv
),
845 platform_set_drvdata(pdev
, wm5102
);
847 wm5102
->core
.arizona
= arizona
;
849 for (i
= 0; i
< ARRAY_SIZE(wm5102
->fll
); i
++)
850 wm5102
->fll
[i
].vco_mult
= 1;
852 arizona_init_fll(arizona
, 1, ARIZONA_FLL1_CONTROL_1
- 1,
853 ARIZONA_IRQ_FLL1_LOCK
, ARIZONA_IRQ_FLL1_CLOCK_OK
,
855 arizona_init_fll(arizona
, 2, ARIZONA_FLL2_CONTROL_1
- 1,
856 ARIZONA_IRQ_FLL2_LOCK
, ARIZONA_IRQ_FLL2_CLOCK_OK
,
859 for (i
= 0; i
< ARRAY_SIZE(wm5102_dai
); i
++)
860 arizona_init_dai(&wm5102
->core
, i
);
862 /* Latch volume update bits */
863 for (i
= 0; i
< ARRAY_SIZE(wm5102_digital_vu
); i
++)
864 regmap_update_bits(arizona
->regmap
, wm5102_digital_vu
[i
],
865 WM5102_DIG_VU
, WM5102_DIG_VU
);
867 pm_runtime_enable(&pdev
->dev
);
868 pm_runtime_idle(&pdev
->dev
);
870 return snd_soc_register_codec(&pdev
->dev
, &soc_codec_dev_wm5102
,
871 wm5102_dai
, ARRAY_SIZE(wm5102_dai
));
874 static int __devexit
wm5102_remove(struct platform_device
*pdev
)
876 snd_soc_unregister_codec(&pdev
->dev
);
877 pm_runtime_disable(&pdev
->dev
);
882 static struct platform_driver wm5102_codec_driver
= {
884 .name
= "wm5102-codec",
885 .owner
= THIS_MODULE
,
887 .probe
= wm5102_probe
,
888 .remove
= __devexit_p(wm5102_remove
),
891 module_platform_driver(wm5102_codec_driver
);
893 MODULE_DESCRIPTION("ASoC WM5102 driver");
894 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
895 MODULE_LICENSE("GPL");
896 MODULE_ALIAS("platform:wm5102-codec");