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