ASoC: wm5110: Add AEC loopback support
[~shefty/rdma-dev.git] / sound / soc / codecs / wm5110.c
1 /*
2  * wm5110.c  --  WM5110 ALSA SoC Audio driver
3  *
4  * Copyright 2012 Wolfson Microelectronics plc
5  *
6  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12
13 #include <linux/module.h>
14 #include <linux/moduleparam.h>
15 #include <linux/init.h>
16 #include <linux/delay.h>
17 #include <linux/pm.h>
18 #include <linux/pm_runtime.h>
19 #include <linux/regmap.h>
20 #include <linux/slab.h>
21 #include <sound/core.h>
22 #include <sound/pcm.h>
23 #include <sound/pcm_params.h>
24 #include <sound/soc.h>
25 #include <sound/jack.h>
26 #include <sound/initval.h>
27 #include <sound/tlv.h>
28
29 #include <linux/mfd/arizona/core.h>
30 #include <linux/mfd/arizona/registers.h>
31
32 #include "arizona.h"
33 #include "wm5110.h"
34
35 struct wm5110_priv {
36         struct arizona_priv core;
37         struct arizona_fll fll[2];
38 };
39
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);
44
45 static const struct snd_kcontrol_new wm5110_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),
52 SOC_SINGLE("IN4 High Performance Switch", ARIZONA_IN4L_CONTROL,
53            ARIZONA_IN4_OSR_SHIFT, 1, 0),
54
55 SOC_DOUBLE_R_RANGE_TLV("IN1 Volume", ARIZONA_IN1L_CONTROL,
56                        ARIZONA_IN1R_CONTROL,
57                        ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
58 SOC_DOUBLE_R_RANGE_TLV("IN2 Volume", ARIZONA_IN2L_CONTROL,
59                        ARIZONA_IN2R_CONTROL,
60                        ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
61 SOC_DOUBLE_R_RANGE_TLV("IN3 Volume", ARIZONA_IN3L_CONTROL,
62                        ARIZONA_IN3R_CONTROL,
63                        ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
64
65 SOC_DOUBLE_R("IN1 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_1L,
66              ARIZONA_ADC_DIGITAL_VOLUME_1R, ARIZONA_IN1L_MUTE_SHIFT, 1, 1),
67 SOC_DOUBLE_R("IN2 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_2L,
68              ARIZONA_ADC_DIGITAL_VOLUME_2R, ARIZONA_IN2L_MUTE_SHIFT, 1, 1),
69 SOC_DOUBLE_R("IN3 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_3L,
70              ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_MUTE_SHIFT, 1, 1),
71 SOC_DOUBLE_R("IN4 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_4L,
72              ARIZONA_ADC_DIGITAL_VOLUME_4R, ARIZONA_IN4L_MUTE_SHIFT, 1, 1),
73
74 SOC_DOUBLE_R_TLV("IN1 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
75                  ARIZONA_ADC_DIGITAL_VOLUME_1R, ARIZONA_IN1L_DIG_VOL_SHIFT,
76                  0xbf, 0, digital_tlv),
77 SOC_DOUBLE_R_TLV("IN2 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
78                  ARIZONA_ADC_DIGITAL_VOLUME_2R, ARIZONA_IN2L_DIG_VOL_SHIFT,
79                  0xbf, 0, digital_tlv),
80 SOC_DOUBLE_R_TLV("IN3 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L,
81                  ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_DIG_VOL_SHIFT,
82                  0xbf, 0, digital_tlv),
83 SOC_DOUBLE_R_TLV("IN4 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4L,
84                  ARIZONA_ADC_DIGITAL_VOLUME_4R, ARIZONA_IN4L_DIG_VOL_SHIFT,
85                  0xbf, 0, digital_tlv),
86
87 ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
88 ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
89 ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
90 ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
91
92 SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
93                24, 0, eq_tlv),
94 SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
95                24, 0, eq_tlv),
96 SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
97                24, 0, eq_tlv),
98 SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
99                24, 0, eq_tlv),
100 SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
101                24, 0, eq_tlv),
102
103 SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
104                24, 0, eq_tlv),
105 SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
106                24, 0, eq_tlv),
107 SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
108                24, 0, eq_tlv),
109 SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
110                24, 0, eq_tlv),
111 SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
112                24, 0, eq_tlv),
113
114 SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
115                24, 0, eq_tlv),
116 SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
117                24, 0, eq_tlv),
118 SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
119                24, 0, eq_tlv),
120 SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
121                24, 0, eq_tlv),
122 SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
123                24, 0, eq_tlv),
124
125 SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
126                24, 0, eq_tlv),
127 SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
128                24, 0, eq_tlv),
129 SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
130                24, 0, eq_tlv),
131 SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
132                24, 0, eq_tlv),
133 SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
134                24, 0, eq_tlv),
135
136 ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
137 ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
138 ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE),
139 ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE),
140
141 SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
142                    ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
143 SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5,
144                    ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA),
145
146 ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
147 ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
148 ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
149 ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
150
151 SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
152 SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
153 SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
154 SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
155
156 ARIZONA_MIXER_CONTROLS("DSP1L", ARIZONA_DSP1LMIX_INPUT_1_SOURCE),
157 ARIZONA_MIXER_CONTROLS("DSP1R", ARIZONA_DSP1RMIX_INPUT_1_SOURCE),
158 ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE),
159 ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE),
160 ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE),
161 ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE),
162 ARIZONA_MIXER_CONTROLS("DSP4L", ARIZONA_DSP4LMIX_INPUT_1_SOURCE),
163 ARIZONA_MIXER_CONTROLS("DSP5R", ARIZONA_DSP4RMIX_INPUT_1_SOURCE),
164
165 ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
166 ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
167
168 SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
169                ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
170
171 ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
172 ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
173 ARIZONA_MIXER_CONTROLS("HPOUT2L", ARIZONA_OUT2LMIX_INPUT_1_SOURCE),
174 ARIZONA_MIXER_CONTROLS("HPOUT2R", ARIZONA_OUT2RMIX_INPUT_1_SOURCE),
175 ARIZONA_MIXER_CONTROLS("HPOUT3L", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
176 ARIZONA_MIXER_CONTROLS("HPOUT3R", ARIZONA_OUT3RMIX_INPUT_1_SOURCE),
177 ARIZONA_MIXER_CONTROLS("SPKOUTL", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
178 ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE),
179 ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
180 ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
181 ARIZONA_MIXER_CONTROLS("SPKDAT2L", ARIZONA_OUT6LMIX_INPUT_1_SOURCE),
182 ARIZONA_MIXER_CONTROLS("SPKDAT2R", ARIZONA_OUT6RMIX_INPUT_1_SOURCE),
183
184 SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L,
185            ARIZONA_OUT1_OSR_SHIFT, 1, 0),
186 SOC_SINGLE("OUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L,
187            ARIZONA_OUT2_OSR_SHIFT, 1, 0),
188 SOC_SINGLE("OUT3 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L,
189            ARIZONA_OUT3_OSR_SHIFT, 1, 0),
190 SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L,
191            ARIZONA_OUT4_OSR_SHIFT, 1, 0),
192 SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
193            ARIZONA_OUT5_OSR_SHIFT, 1, 0),
194 SOC_SINGLE("SPKDAT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_6L,
195            ARIZONA_OUT6_OSR_SHIFT, 1, 0),
196
197 SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
198              ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
199 SOC_DOUBLE_R("OUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L,
200              ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1),
201 SOC_DOUBLE_R("OUT3 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
202              ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
203 SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
204              ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
205 SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
206              ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
207 SOC_DOUBLE_R("SPKDAT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_6L,
208              ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_MUTE_SHIFT, 1, 1),
209
210 SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
211                  ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
212                  0xbf, 0, digital_tlv),
213 SOC_DOUBLE_R_TLV("OUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L,
214                  ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT,
215                  0xbf, 0, digital_tlv),
216 SOC_DOUBLE_R_TLV("OUT3 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
217                  ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_VOL_SHIFT,
218                  0xbf, 0, digital_tlv),
219 SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
220                  ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_VOL_SHIFT,
221                  0xbf, 0, digital_tlv),
222 SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
223                  ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
224                  0xbf, 0, digital_tlv),
225 SOC_DOUBLE_R_TLV("SPKDAT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_6L,
226                  ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_VOL_SHIFT,
227                  0xbf, 0, digital_tlv),
228
229 SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L,
230                        ARIZONA_OUTPUT_PATH_CONFIG_1R,
231                        ARIZONA_OUT1L_PGA_VOL_SHIFT,
232                        0x34, 0x40, 0, ana_tlv),
233 SOC_DOUBLE_R_RANGE_TLV("OUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L,
234                        ARIZONA_OUTPUT_PATH_CONFIG_2R,
235                        ARIZONA_OUT2L_PGA_VOL_SHIFT,
236                        0x34, 0x40, 0, ana_tlv),
237 SOC_DOUBLE_R_RANGE_TLV("OUT3 Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L,
238                        ARIZONA_OUTPUT_PATH_CONFIG_3R,
239                        ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv),
240
241 SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
242            ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
243 SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT,
244            ARIZONA_SPK2R_MUTE_SHIFT, 1, 1),
245
246 ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
247 ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
248 ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
249 ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
250 ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
251 ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
252 ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
253 ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
254
255 ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
256 ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
257
258 ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
259 ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
260 };
261
262 ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
263 ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
264 ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
265 ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
266
267 ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
268 ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
269 ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE);
270 ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE);
271
272 ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
273 ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
274 ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
275 ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
276
277 ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE);
278 ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE);
279
280 ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
281 ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
282
283 ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
284 ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
285 ARIZONA_MIXER_ENUMS(OUT2L, ARIZONA_OUT2LMIX_INPUT_1_SOURCE);
286 ARIZONA_MIXER_ENUMS(OUT2R, ARIZONA_OUT2RMIX_INPUT_1_SOURCE);
287 ARIZONA_MIXER_ENUMS(OUT3L, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
288 ARIZONA_MIXER_ENUMS(OUT3R, ARIZONA_OUT3RMIX_INPUT_1_SOURCE);
289 ARIZONA_MIXER_ENUMS(SPKOUTL, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
290 ARIZONA_MIXER_ENUMS(SPKOUTR, ARIZONA_OUT4RMIX_INPUT_1_SOURCE);
291 ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
292 ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
293 ARIZONA_MIXER_ENUMS(SPKDAT2L, ARIZONA_OUT6LMIX_INPUT_1_SOURCE);
294 ARIZONA_MIXER_ENUMS(SPKDAT2R, ARIZONA_OUT6RMIX_INPUT_1_SOURCE);
295
296 ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
297 ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
298 ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
299 ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
300 ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
301 ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
302 ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
303 ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
304
305 ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
306 ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
307
308 ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
309 ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
310
311 ARIZONA_MIXER_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
312 ARIZONA_MIXER_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
313 ARIZONA_MIXER_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
314 ARIZONA_MIXER_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
315
316 static const char *wm5110_aec_loopback_texts[] = {
317         "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R",
318         "SPKOUTL", "SPKOUTR", "SPKDAT1L", "SPKDAT1R", "SPKDAT2L", "SPKDAT2R",
319 };
320
321 static const unsigned int wm5110_aec_loopback_values[] = {
322         0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
323 };
324
325 static const struct soc_enum wm5110_aec_loopback =
326         SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
327                               ARIZONA_AEC_LOOPBACK_SRC_SHIFT,
328                               ARIZONA_AEC_LOOPBACK_SRC_MASK,
329                               ARRAY_SIZE(wm5110_aec_loopback_texts),
330                               wm5110_aec_loopback_texts,
331                               wm5110_aec_loopback_values);
332
333 static const struct snd_kcontrol_new wm5110_aec_loopback_mux =
334         SOC_DAPM_VALUE_ENUM("AEC Loopback", wm5110_aec_loopback);
335
336 static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = {
337 SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
338                     0, NULL, 0),
339 SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
340                     ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
341 SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
342                     ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
343 SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
344                     ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
345
346 SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
347 SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0, 0),
348 SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
349 SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
350 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0, 0),
351 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
352
353 SND_SOC_DAPM_SIGGEN("TONE"),
354 SND_SOC_DAPM_SIGGEN("NOISE"),
355
356 SND_SOC_DAPM_INPUT("IN1L"),
357 SND_SOC_DAPM_INPUT("IN1R"),
358 SND_SOC_DAPM_INPUT("IN2L"),
359 SND_SOC_DAPM_INPUT("IN2R"),
360 SND_SOC_DAPM_INPUT("IN3L"),
361 SND_SOC_DAPM_INPUT("IN3R"),
362 SND_SOC_DAPM_INPUT("IN4L"),
363 SND_SOC_DAPM_INPUT("IN4R"),
364
365 SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
366                    0, NULL, 0, arizona_in_ev,
367                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
368 SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
369                    0, NULL, 0, arizona_in_ev,
370                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
371 SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
372                    0, NULL, 0, arizona_in_ev,
373                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
374 SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
375                    0, NULL, 0, arizona_in_ev,
376                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
377 SND_SOC_DAPM_PGA_E("IN3L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3L_ENA_SHIFT,
378                    0, NULL, 0, arizona_in_ev,
379                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
380 SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3R_ENA_SHIFT,
381                    0, NULL, 0, arizona_in_ev,
382                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
383 SND_SOC_DAPM_PGA_E("IN4L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4L_ENA_SHIFT,
384                    0, NULL, 0, arizona_in_ev,
385                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
386 SND_SOC_DAPM_PGA_E("IN4R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4R_ENA_SHIFT,
387                    0, NULL, 0, arizona_in_ev,
388                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
389
390 SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
391                     ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
392 SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
393                     ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
394 SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
395                     ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
396
397 SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
398                  ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
399
400 SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
401                  ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
402 SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
403                  ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
404
405 SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1,
406                  ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0),
407
408 SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
409 SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
410 SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
411 SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
412
413 SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
414                  NULL, 0),
415 SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
416                  NULL, 0),
417 SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0,
418                  NULL, 0),
419 SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0,
420                  NULL, 0),
421
422 SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
423                  NULL, 0),
424 SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
425                  NULL, 0),
426 SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
427                  NULL, 0),
428 SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
429                  NULL, 0),
430
431 SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
432                  0, NULL, 0),
433 SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
434                  0, NULL, 0),
435
436 SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
437                  NULL, 0),
438 SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
439                  NULL, 0),
440 SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
441                  NULL, 0),
442 SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
443                  NULL, 0),
444
445 SND_SOC_DAPM_VALUE_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
446                        ARIZONA_AEC_LOOPBACK_ENA, 0, &wm5110_aec_loopback_mux),
447
448 SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
449                      ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
450 SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
451                      ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
452 SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
453                      ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
454 SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
455                      ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
456 SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
457                      ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
458 SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
459                      ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
460 SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0,
461                      ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
462 SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0,
463                      ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
464
465 SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
466                     ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
467 SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
468                     ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
469 SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
470                     ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
471 SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
472                     ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
473 SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
474                     ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
475 SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
476                     ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
477 SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0,
478                     ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
479 SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0,
480                     ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
481
482 SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
483                      ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
484 SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
485                      ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
486
487 SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
488                     ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
489 SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
490                     ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
491
492 SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
493                      ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
494 SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0,
495                      ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
496
497 SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
498                     ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
499 SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
500                     ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
501
502 SND_SOC_DAPM_PGA_E("OUT1L", ARIZONA_OUTPUT_ENABLES_1,
503                    ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
504                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
505 SND_SOC_DAPM_PGA_E("OUT1R", ARIZONA_OUTPUT_ENABLES_1,
506                    ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
507                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
508 SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1,
509                    ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
510                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
511 SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1,
512                    ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
513                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
514 SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
515                    ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
516                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
517 SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1,
518                    ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
519                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
520 SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1,
521                    ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
522                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
523 SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
524                    ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
525                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
526 SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
527                    ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
528                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
529 SND_SOC_DAPM_PGA_E("OUT6L", ARIZONA_OUTPUT_ENABLES_1,
530                    ARIZONA_OUT6L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
531                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
532 SND_SOC_DAPM_PGA_E("OUT6R", ARIZONA_OUTPUT_ENABLES_1,
533                    ARIZONA_OUT6R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
534                    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
535
536 ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
537 ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
538 ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"),
539 ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"),
540
541 ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
542 ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
543 ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"),
544 ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"),
545
546 ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
547 ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
548 ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
549 ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
550
551 ARIZONA_MIXER_WIDGETS(Mic, "Mic"),
552 ARIZONA_MIXER_WIDGETS(Noise, "Noise"),
553
554 ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
555 ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
556
557 ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
558 ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
559 ARIZONA_MIXER_WIDGETS(OUT2L, "HPOUT2L"),
560 ARIZONA_MIXER_WIDGETS(OUT2R, "HPOUT2R"),
561 ARIZONA_MIXER_WIDGETS(OUT3L, "HPOUT3L"),
562 ARIZONA_MIXER_WIDGETS(OUT3R, "HPOUT3R"),
563 ARIZONA_MIXER_WIDGETS(SPKOUTL, "SPKOUTL"),
564 ARIZONA_MIXER_WIDGETS(SPKOUTR, "SPKOUTR"),
565 ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
566 ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
567 ARIZONA_MIXER_WIDGETS(SPKDAT2L, "SPKDAT2L"),
568 ARIZONA_MIXER_WIDGETS(SPKDAT2R, "SPKDAT2R"),
569
570 ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
571 ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
572 ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
573 ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
574 ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
575 ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
576 ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
577 ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
578
579 ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
580 ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
581
582 ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
583 ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
584
585 ARIZONA_MIXER_WIDGETS(ASRC1L, "ASRC1L"),
586 ARIZONA_MIXER_WIDGETS(ASRC1R, "ASRC1R"),
587 ARIZONA_MIXER_WIDGETS(ASRC2L, "ASRC2L"),
588 ARIZONA_MIXER_WIDGETS(ASRC2R, "ASRC2R"),
589
590 SND_SOC_DAPM_OUTPUT("HPOUT1L"),
591 SND_SOC_DAPM_OUTPUT("HPOUT1R"),
592 SND_SOC_DAPM_OUTPUT("HPOUT2L"),
593 SND_SOC_DAPM_OUTPUT("HPOUT2R"),
594 SND_SOC_DAPM_OUTPUT("HPOUT3L"),
595 SND_SOC_DAPM_OUTPUT("HPOUT3R"),
596 SND_SOC_DAPM_OUTPUT("SPKOUTLN"),
597 SND_SOC_DAPM_OUTPUT("SPKOUTLP"),
598 SND_SOC_DAPM_OUTPUT("SPKOUTRN"),
599 SND_SOC_DAPM_OUTPUT("SPKOUTRP"),
600 SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
601 SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
602 SND_SOC_DAPM_OUTPUT("SPKDAT2L"),
603 SND_SOC_DAPM_OUTPUT("SPKDAT2R"),
604 };
605
606 #define ARIZONA_MIXER_INPUT_ROUTES(name)        \
607         { name, "Noise Generator", "Noise Generator" }, \
608         { name, "Tone Generator 1", "Tone Generator 1" }, \
609         { name, "Tone Generator 2", "Tone Generator 2" }, \
610         { name, "AEC", "AEC Loopback" }, \
611         { name, "IN1L", "IN1L PGA" }, \
612         { name, "IN1R", "IN1R PGA" }, \
613         { name, "IN2L", "IN2L PGA" }, \
614         { name, "IN2R", "IN2R PGA" }, \
615         { name, "IN3L", "IN3L PGA" }, \
616         { name, "IN3R", "IN3R PGA" }, \
617         { name, "IN4L", "IN4L PGA" }, \
618         { name, "IN4R", "IN4R PGA" }, \
619         { name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
620         { name, "AIF1RX1", "AIF1RX1" }, \
621         { name, "AIF1RX2", "AIF1RX2" }, \
622         { name, "AIF1RX3", "AIF1RX3" }, \
623         { name, "AIF1RX4", "AIF1RX4" }, \
624         { name, "AIF1RX5", "AIF1RX5" }, \
625         { name, "AIF1RX6", "AIF1RX6" }, \
626         { name, "AIF1RX7", "AIF1RX7" }, \
627         { name, "AIF1RX8", "AIF1RX8" }, \
628         { name, "AIF2RX1", "AIF2RX1" }, \
629         { name, "AIF2RX2", "AIF2RX2" }, \
630         { name, "AIF3RX1", "AIF3RX1" }, \
631         { name, "AIF3RX2", "AIF3RX2" }, \
632         { name, "EQ1", "EQ1" }, \
633         { name, "EQ2", "EQ2" }, \
634         { name, "EQ3", "EQ3" }, \
635         { name, "EQ4", "EQ4" }, \
636         { name, "DRC1L", "DRC1L" }, \
637         { name, "DRC1R", "DRC1R" }, \
638         { name, "DRC2L", "DRC2L" }, \
639         { name, "DRC2R", "DRC2R" }, \
640         { name, "LHPF1", "LHPF1" }, \
641         { name, "LHPF2", "LHPF2" }, \
642         { name, "LHPF3", "LHPF3" }, \
643         { name, "LHPF4", "LHPF4" }, \
644         { name, "ASRC1L", "ASRC1L" }, \
645         { name, "ASRC1R", "ASRC1R" }, \
646         { name, "ASRC2L", "ASRC2L" }, \
647         { name, "ASRC2R", "ASRC2R" }
648
649 static const struct snd_soc_dapm_route wm5110_dapm_routes[] = {
650         { "AIF2 Capture", NULL, "DBVDD2" },
651         { "AIF2 Playback", NULL, "DBVDD2" },
652
653         { "AIF3 Capture", NULL, "DBVDD3" },
654         { "AIF3 Playback", NULL, "DBVDD3" },
655
656         { "OUT1L", NULL, "CPVDD" },
657         { "OUT1R", NULL, "CPVDD" },
658         { "OUT2L", NULL, "CPVDD" },
659         { "OUT2R", NULL, "CPVDD" },
660         { "OUT3L", NULL, "CPVDD" },
661
662         { "OUT4L", NULL, "SPKVDDL" },
663         { "OUT4R", NULL, "SPKVDDR" },
664
665         { "OUT1L", NULL, "SYSCLK" },
666         { "OUT1R", NULL, "SYSCLK" },
667         { "OUT2L", NULL, "SYSCLK" },
668         { "OUT2R", NULL, "SYSCLK" },
669         { "OUT3L", NULL, "SYSCLK" },
670         { "OUT4L", NULL, "SYSCLK" },
671         { "OUT4R", NULL, "SYSCLK" },
672         { "OUT5L", NULL, "SYSCLK" },
673         { "OUT5R", NULL, "SYSCLK" },
674         { "OUT6L", NULL, "SYSCLK" },
675         { "OUT6R", NULL, "SYSCLK" },
676
677         { "MICBIAS1", NULL, "MICVDD" },
678         { "MICBIAS2", NULL, "MICVDD" },
679         { "MICBIAS3", NULL, "MICVDD" },
680
681         { "Noise Generator", NULL, "NOISE" },
682         { "Tone Generator 1", NULL, "TONE" },
683         { "Tone Generator 2", NULL, "TONE" },
684
685         { "Mic Mute Mixer", NULL, "Noise Mixer" },
686         { "Mic Mute Mixer", NULL, "Mic Mixer" },
687
688         { "AIF1 Capture", NULL, "AIF1TX1" },
689         { "AIF1 Capture", NULL, "AIF1TX2" },
690         { "AIF1 Capture", NULL, "AIF1TX3" },
691         { "AIF1 Capture", NULL, "AIF1TX4" },
692         { "AIF1 Capture", NULL, "AIF1TX5" },
693         { "AIF1 Capture", NULL, "AIF1TX6" },
694         { "AIF1 Capture", NULL, "AIF1TX7" },
695         { "AIF1 Capture", NULL, "AIF1TX8" },
696
697         { "AIF1RX1", NULL, "AIF1 Playback" },
698         { "AIF1RX2", NULL, "AIF1 Playback" },
699         { "AIF1RX3", NULL, "AIF1 Playback" },
700         { "AIF1RX4", NULL, "AIF1 Playback" },
701         { "AIF1RX5", NULL, "AIF1 Playback" },
702         { "AIF1RX6", NULL, "AIF1 Playback" },
703         { "AIF1RX7", NULL, "AIF1 Playback" },
704         { "AIF1RX8", NULL, "AIF1 Playback" },
705
706         { "AIF2 Capture", NULL, "AIF2TX1" },
707         { "AIF2 Capture", NULL, "AIF2TX2" },
708
709         { "AIF2RX1", NULL, "AIF2 Playback" },
710         { "AIF2RX2", NULL, "AIF2 Playback" },
711
712         { "AIF3 Capture", NULL, "AIF3TX1" },
713         { "AIF3 Capture", NULL, "AIF3TX2" },
714
715         { "AIF3RX1", NULL, "AIF3 Playback" },
716         { "AIF3RX2", NULL, "AIF3 Playback" },
717
718         { "AIF1 Playback", NULL, "SYSCLK" },
719         { "AIF2 Playback", NULL, "SYSCLK" },
720         { "AIF3 Playback", NULL, "SYSCLK" },
721
722         { "AIF1 Capture", NULL, "SYSCLK" },
723         { "AIF2 Capture", NULL, "SYSCLK" },
724         { "AIF3 Capture", NULL, "SYSCLK" },
725
726         { "IN1L PGA", NULL, "IN1L" },
727         { "IN1R PGA", NULL, "IN1R" },
728
729         { "IN2L PGA", NULL, "IN2L" },
730         { "IN2R PGA", NULL, "IN2R" },
731
732         { "IN3L PGA", NULL, "IN3L" },
733         { "IN3R PGA", NULL, "IN3R" },
734
735         { "IN4L PGA", NULL, "IN4L" },
736         { "IN4R PGA", NULL, "IN4R" },
737
738         ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
739         ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
740         ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"),
741         ARIZONA_MIXER_ROUTES("OUT2R", "HPOUT2R"),
742         ARIZONA_MIXER_ROUTES("OUT3L", "HPOUT3L"),
743         ARIZONA_MIXER_ROUTES("OUT3R", "HPOUT3R"),
744
745         ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUTL"),
746         ARIZONA_MIXER_ROUTES("OUT4R", "SPKOUTR"),
747         ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
748         ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
749         ARIZONA_MIXER_ROUTES("OUT6L", "SPKDAT2L"),
750         ARIZONA_MIXER_ROUTES("OUT6R", "SPKDAT2R"),
751
752         ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
753         ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
754
755         ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
756         ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
757         ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
758         ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
759         ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
760         ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
761         ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
762         ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
763
764         ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
765         ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
766
767         ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
768         ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
769
770         ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
771         ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
772         ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
773         ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
774
775         ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
776         ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
777         ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"),
778         ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"),
779
780         ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
781         ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
782         ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
783         ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
784
785         ARIZONA_MIXER_ROUTES("ASRC1L", "ASRC1L"),
786         ARIZONA_MIXER_ROUTES("ASRC1R", "ASRC1R"),
787         ARIZONA_MIXER_ROUTES("ASRC2L", "ASRC2L"),
788         ARIZONA_MIXER_ROUTES("ASRC2R", "ASRC2R"),
789
790         { "HPOUT1L", NULL, "OUT1L" },
791         { "HPOUT1R", NULL, "OUT1R" },
792
793         { "HPOUT2L", NULL, "OUT2L" },
794         { "HPOUT2R", NULL, "OUT2R" },
795
796         { "HPOUT3L", NULL, "OUT3L" },
797         { "HPOUT3R", NULL, "OUT3L" },
798
799         { "SPKOUTLN", NULL, "OUT4L" },
800         { "SPKOUTLP", NULL, "OUT4L" },
801
802         { "SPKOUTRN", NULL, "OUT4R" },
803         { "SPKOUTRP", NULL, "OUT4R" },
804
805         { "SPKDAT1L", NULL, "OUT5L" },
806         { "SPKDAT1R", NULL, "OUT5R" },
807
808         { "SPKDAT2L", NULL, "OUT6L" },
809         { "SPKDAT2R", NULL, "OUT6R" },
810 };
811
812 static int wm5110_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
813                           unsigned int Fref, unsigned int Fout)
814 {
815         struct wm5110_priv *wm5110 = snd_soc_codec_get_drvdata(codec);
816
817         switch (fll_id) {
818         case WM5110_FLL1:
819                 return arizona_set_fll(&wm5110->fll[0], source, Fref, Fout);
820         case WM5110_FLL2:
821                 return arizona_set_fll(&wm5110->fll[1], source, Fref, Fout);
822         default:
823                 return -EINVAL;
824         }
825 }
826
827 #define WM5110_RATES SNDRV_PCM_RATE_8000_192000
828
829 #define WM5110_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
830                         SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
831
832 static struct snd_soc_dai_driver wm5110_dai[] = {
833         {
834                 .name = "wm5110-aif1",
835                 .id = 1,
836                 .base = ARIZONA_AIF1_BCLK_CTRL,
837                 .playback = {
838                         .stream_name = "AIF1 Playback",
839                         .channels_min = 1,
840                         .channels_max = 8,
841                         .rates = WM5110_RATES,
842                         .formats = WM5110_FORMATS,
843                 },
844                 .capture = {
845                          .stream_name = "AIF1 Capture",
846                          .channels_min = 1,
847                          .channels_max = 8,
848                          .rates = WM5110_RATES,
849                          .formats = WM5110_FORMATS,
850                  },
851                 .ops = &arizona_dai_ops,
852                 .symmetric_rates = 1,
853         },
854         {
855                 .name = "wm5110-aif2",
856                 .id = 2,
857                 .base = ARIZONA_AIF2_BCLK_CTRL,
858                 .playback = {
859                         .stream_name = "AIF2 Playback",
860                         .channels_min = 1,
861                         .channels_max = 2,
862                         .rates = WM5110_RATES,
863                         .formats = WM5110_FORMATS,
864                 },
865                 .capture = {
866                          .stream_name = "AIF2 Capture",
867                          .channels_min = 1,
868                          .channels_max = 2,
869                          .rates = WM5110_RATES,
870                          .formats = WM5110_FORMATS,
871                  },
872                 .ops = &arizona_dai_ops,
873                 .symmetric_rates = 1,
874         },
875         {
876                 .name = "wm5110-aif3",
877                 .id = 3,
878                 .base = ARIZONA_AIF3_BCLK_CTRL,
879                 .playback = {
880                         .stream_name = "AIF3 Playback",
881                         .channels_min = 1,
882                         .channels_max = 2,
883                         .rates = WM5110_RATES,
884                         .formats = WM5110_FORMATS,
885                 },
886                 .capture = {
887                          .stream_name = "AIF3 Capture",
888                          .channels_min = 1,
889                          .channels_max = 2,
890                          .rates = WM5110_RATES,
891                          .formats = WM5110_FORMATS,
892                  },
893                 .ops = &arizona_dai_ops,
894                 .symmetric_rates = 1,
895         },
896 };
897
898 static int wm5110_codec_probe(struct snd_soc_codec *codec)
899 {
900         struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
901
902         codec->control_data = priv->core.arizona->regmap;
903         return snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
904 }
905
906 #define WM5110_DIG_VU 0x0200
907
908 static unsigned int wm5110_digital_vu[] = {
909         ARIZONA_ADC_DIGITAL_VOLUME_1L,
910         ARIZONA_ADC_DIGITAL_VOLUME_1R,
911         ARIZONA_ADC_DIGITAL_VOLUME_2L,
912         ARIZONA_ADC_DIGITAL_VOLUME_2R,
913         ARIZONA_ADC_DIGITAL_VOLUME_3L,
914         ARIZONA_ADC_DIGITAL_VOLUME_3R,
915
916         ARIZONA_DAC_DIGITAL_VOLUME_1L,
917         ARIZONA_DAC_DIGITAL_VOLUME_1R,
918         ARIZONA_DAC_DIGITAL_VOLUME_2L,
919         ARIZONA_DAC_DIGITAL_VOLUME_2R,
920         ARIZONA_DAC_DIGITAL_VOLUME_3L,
921         ARIZONA_DAC_DIGITAL_VOLUME_3R,
922         ARIZONA_DAC_DIGITAL_VOLUME_4L,
923         ARIZONA_DAC_DIGITAL_VOLUME_4R,
924         ARIZONA_DAC_DIGITAL_VOLUME_5L,
925         ARIZONA_DAC_DIGITAL_VOLUME_5R,
926 };
927
928 static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
929         .probe = wm5110_codec_probe,
930
931         .idle_bias_off = true,
932
933         .set_sysclk = arizona_set_sysclk,
934         .set_pll = wm5110_set_fll,
935
936         .controls = wm5110_snd_controls,
937         .num_controls = ARRAY_SIZE(wm5110_snd_controls),
938         .dapm_widgets = wm5110_dapm_widgets,
939         .num_dapm_widgets = ARRAY_SIZE(wm5110_dapm_widgets),
940         .dapm_routes = wm5110_dapm_routes,
941         .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes),
942 };
943
944 static int __devinit wm5110_probe(struct platform_device *pdev)
945 {
946         struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
947         struct wm5110_priv *wm5110;
948         int i;
949
950         wm5110 = devm_kzalloc(&pdev->dev, sizeof(struct wm5110_priv),
951                               GFP_KERNEL);
952         if (wm5110 == NULL)
953                 return -ENOMEM;
954         platform_set_drvdata(pdev, wm5110);
955
956         wm5110->core.arizona = arizona;
957
958         for (i = 0; i < ARRAY_SIZE(wm5110->fll); i++)
959                 wm5110->fll[i].vco_mult = 3;
960
961         arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
962                          ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
963                          &wm5110->fll[0]);
964         arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
965                          ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
966                          &wm5110->fll[1]);
967
968         for (i = 0; i < ARRAY_SIZE(wm5110_dai); i++)
969                 arizona_init_dai(&wm5110->core, i);
970
971         /* Latch volume update bits */
972         for (i = 0; i < ARRAY_SIZE(wm5110_digital_vu); i++)
973                 regmap_update_bits(arizona->regmap, wm5110_digital_vu[i],
974                                    WM5110_DIG_VU, WM5110_DIG_VU);
975
976         pm_runtime_enable(&pdev->dev);
977         pm_runtime_idle(&pdev->dev);
978
979         return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110,
980                                       wm5110_dai, ARRAY_SIZE(wm5110_dai));
981 }
982
983 static int __devexit wm5110_remove(struct platform_device *pdev)
984 {
985         snd_soc_unregister_codec(&pdev->dev);
986         pm_runtime_disable(&pdev->dev);
987
988         return 0;
989 }
990
991 static struct platform_driver wm5110_codec_driver = {
992         .driver = {
993                 .name = "wm5110-codec",
994                 .owner = THIS_MODULE,
995         },
996         .probe = wm5110_probe,
997         .remove = __devexit_p(wm5110_remove),
998 };
999
1000 module_platform_driver(wm5110_codec_driver);
1001
1002 MODULE_DESCRIPTION("ASoC WM5110 driver");
1003 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
1004 MODULE_LICENSE("GPL");
1005 MODULE_ALIAS("platform:wm5110-codec");