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