blob: ea18e88e0a07ecd8a3b57711066397535387dac1 [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);
Mark Brownbd7fe242012-12-18 13:53:26 +000044static 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)
Mark Brown5c6af632012-07-09 19:09:41 +010059
60static const struct snd_kcontrol_new wm5110_snd_controls[] = {
Charles Keepaxc7f38432013-08-06 17:03:55 +010061SOC_ENUM("IN1 OSR", arizona_in_dmic_osr[0]),
62SOC_ENUM("IN2 OSR", arizona_in_dmic_osr[1]),
63SOC_ENUM("IN3 OSR", arizona_in_dmic_osr[2]),
64SOC_ENUM("IN4 OSR", arizona_in_dmic_osr[3]),
Mark Brown5c6af632012-07-09 19:09:41 +010065
Mark Brown02482da2012-12-14 15:18:30 +090066SOC_SINGLE_RANGE_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL,
67 ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
68SOC_SINGLE_RANGE_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL,
69 ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
70SOC_SINGLE_RANGE_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL,
71 ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
72SOC_SINGLE_RANGE_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL,
73 ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
74SOC_SINGLE_RANGE_TLV("IN3L Volume", ARIZONA_IN3L_CONTROL,
75 ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
76SOC_SINGLE_RANGE_TLV("IN3R Volume", ARIZONA_IN3R_CONTROL,
77 ARIZONA_IN3R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
Mark Brown5c6af632012-07-09 19:09:41 +010078
Charles Keepax254dc322013-11-19 16:04:03 +000079SOC_ENUM("IN HPF Cutoff Frequency", arizona_in_hpf_cut_enum),
80
81SOC_SINGLE("IN1L HPF Switch", ARIZONA_IN1L_CONTROL,
82 ARIZONA_IN1L_HPF_SHIFT, 1, 0),
83SOC_SINGLE("IN1R HPF Switch", ARIZONA_IN1R_CONTROL,
84 ARIZONA_IN1R_HPF_SHIFT, 1, 0),
85SOC_SINGLE("IN2L HPF Switch", ARIZONA_IN2L_CONTROL,
86 ARIZONA_IN2L_HPF_SHIFT, 1, 0),
87SOC_SINGLE("IN2R HPF Switch", ARIZONA_IN2R_CONTROL,
88 ARIZONA_IN2R_HPF_SHIFT, 1, 0),
89SOC_SINGLE("IN3L HPF Switch", ARIZONA_IN3L_CONTROL,
90 ARIZONA_IN3L_HPF_SHIFT, 1, 0),
91SOC_SINGLE("IN3R HPF Switch", ARIZONA_IN3R_CONTROL,
92 ARIZONA_IN3R_HPF_SHIFT, 1, 0),
93SOC_SINGLE("IN4L HPF Switch", ARIZONA_IN4L_CONTROL,
94 ARIZONA_IN4L_HPF_SHIFT, 1, 0),
95SOC_SINGLE("IN4R HPF Switch", ARIZONA_IN4R_CONTROL,
96 ARIZONA_IN4R_HPF_SHIFT, 1, 0),
97
Mark Brown02482da2012-12-14 15:18:30 +090098SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
99 ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
100SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
101 ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
102SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
103 ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
104SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
105 ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
106SOC_SINGLE_TLV("IN3L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L,
107 ARIZONA_IN3L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
108SOC_SINGLE_TLV("IN3R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3R,
109 ARIZONA_IN3R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
110SOC_SINGLE_TLV("IN4L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4L,
111 ARIZONA_IN4L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
112SOC_SINGLE_TLV("IN4R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4R,
113 ARIZONA_IN4R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
Mark Brown5c6af632012-07-09 19:09:41 +0100114
Mark Browna1abfa82012-12-09 12:50:05 +0900115SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
116SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
117
Mark Brown5c6af632012-07-09 19:09:41 +0100118ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
119ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
120ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
121ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
122
Mark Brown56fd4602012-12-05 16:38:12 +0900123SND_SOC_BYTES_MASK("EQ1 Coefficeints", ARIZONA_EQ1_1, 21,
124 ARIZONA_EQ1_ENA_MASK),
125SND_SOC_BYTES_MASK("EQ2 Coefficeints", ARIZONA_EQ2_1, 21,
126 ARIZONA_EQ2_ENA_MASK),
127SND_SOC_BYTES_MASK("EQ3 Coefficeints", ARIZONA_EQ3_1, 21,
128 ARIZONA_EQ3_ENA_MASK),
129SND_SOC_BYTES_MASK("EQ4 Coefficeints", ARIZONA_EQ4_1, 21,
130 ARIZONA_EQ4_ENA_MASK),
131
Mark Brown5c6af632012-07-09 19:09:41 +0100132SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
133 24, 0, eq_tlv),
134SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
135 24, 0, eq_tlv),
136SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
137 24, 0, eq_tlv),
138SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
139 24, 0, eq_tlv),
140SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
141 24, 0, eq_tlv),
142
143SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
144 24, 0, eq_tlv),
145SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
146 24, 0, eq_tlv),
147SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
148 24, 0, eq_tlv),
149SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
150 24, 0, eq_tlv),
151SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
152 24, 0, eq_tlv),
153
154SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
155 24, 0, eq_tlv),
156SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
157 24, 0, eq_tlv),
158SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
159 24, 0, eq_tlv),
160SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
161 24, 0, eq_tlv),
162SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
163 24, 0, eq_tlv),
164
165SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
166 24, 0, eq_tlv),
167SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
168 24, 0, eq_tlv),
169SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
170 24, 0, eq_tlv),
171SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
172 24, 0, eq_tlv),
173SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
174 24, 0, eq_tlv),
175
176ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
177ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
178ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE),
179ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE),
180
181SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
182 ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
183SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5,
184 ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA),
185
186ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
187ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
188ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
189ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
190
Mark Brownd4d1eaa2012-12-05 16:38:30 +0900191SND_SOC_BYTES("LHPF1 Coefficients", ARIZONA_HPLPF1_2, 1),
192SND_SOC_BYTES("LHPF2 Coefficients", ARIZONA_HPLPF2_2, 1),
193SND_SOC_BYTES("LHPF3 Coefficients", ARIZONA_HPLPF3_2, 1),
194SND_SOC_BYTES("LHPF4 Coefficients", ARIZONA_HPLPF4_2, 1),
195
Mark Brown5c6af632012-07-09 19:09:41 +0100196SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
197SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
198SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
199SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
200
Mark Brown35d38892012-08-26 13:50:48 -0700201ARIZONA_MIXER_CONTROLS("DSP1L", ARIZONA_DSP1LMIX_INPUT_1_SOURCE),
202ARIZONA_MIXER_CONTROLS("DSP1R", ARIZONA_DSP1RMIX_INPUT_1_SOURCE),
203ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE),
204ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE),
205ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE),
206ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE),
207ARIZONA_MIXER_CONTROLS("DSP4L", ARIZONA_DSP4LMIX_INPUT_1_SOURCE),
Charles Keepax39d4ecd2013-05-24 11:38:24 +0100208ARIZONA_MIXER_CONTROLS("DSP4R", ARIZONA_DSP4RMIX_INPUT_1_SOURCE),
Mark Brown35d38892012-08-26 13:50:48 -0700209
Mark Brown5c6af632012-07-09 19:09:41 +0100210ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
211ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
212
213SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
214 ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
215
216ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
217ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
218ARIZONA_MIXER_CONTROLS("HPOUT2L", ARIZONA_OUT2LMIX_INPUT_1_SOURCE),
219ARIZONA_MIXER_CONTROLS("HPOUT2R", ARIZONA_OUT2RMIX_INPUT_1_SOURCE),
Mark Brown35d38892012-08-26 13:50:48 -0700220ARIZONA_MIXER_CONTROLS("HPOUT3L", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
221ARIZONA_MIXER_CONTROLS("HPOUT3R", ARIZONA_OUT3RMIX_INPUT_1_SOURCE),
Mark Brown5c6af632012-07-09 19:09:41 +0100222ARIZONA_MIXER_CONTROLS("SPKOUTL", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
223ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE),
224ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
225ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
226ARIZONA_MIXER_CONTROLS("SPKDAT2L", ARIZONA_OUT6LMIX_INPUT_1_SOURCE),
227ARIZONA_MIXER_CONTROLS("SPKDAT2R", ARIZONA_OUT6RMIX_INPUT_1_SOURCE),
228
229SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L,
230 ARIZONA_OUT1_OSR_SHIFT, 1, 0),
Charles Keepax5752ec92013-02-15 10:37:27 +0000231SOC_SINGLE("HPOUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L,
Mark Brown5c6af632012-07-09 19:09:41 +0100232 ARIZONA_OUT2_OSR_SHIFT, 1, 0),
Charles Keepax5752ec92013-02-15 10:37:27 +0000233SOC_SINGLE("HPOUT3 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L,
Mark Brown5c6af632012-07-09 19:09:41 +0100234 ARIZONA_OUT3_OSR_SHIFT, 1, 0),
235SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L,
236 ARIZONA_OUT4_OSR_SHIFT, 1, 0),
237SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
238 ARIZONA_OUT5_OSR_SHIFT, 1, 0),
239SOC_SINGLE("SPKDAT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_6L,
240 ARIZONA_OUT6_OSR_SHIFT, 1, 0),
241
242SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
243 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
Charles Keepax5752ec92013-02-15 10:37:27 +0000244SOC_DOUBLE_R("HPOUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L,
Mark Brown5c6af632012-07-09 19:09:41 +0100245 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1),
Charles Keepax5752ec92013-02-15 10:37:27 +0000246SOC_DOUBLE_R("HPOUT3 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
Mark Brown35d38892012-08-26 13:50:48 -0700247 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
Mark Brown5c6af632012-07-09 19:09:41 +0100248SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
249 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
250SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
251 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
252SOC_DOUBLE_R("SPKDAT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_6L,
253 ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_MUTE_SHIFT, 1, 1),
254
255SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
256 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
257 0xbf, 0, digital_tlv),
Charles Keepax5752ec92013-02-15 10:37:27 +0000258SOC_DOUBLE_R_TLV("HPOUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L,
Mark Brown5c6af632012-07-09 19:09:41 +0100259 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT,
260 0xbf, 0, digital_tlv),
Charles Keepax5752ec92013-02-15 10:37:27 +0000261SOC_DOUBLE_R_TLV("HPOUT3 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
Mark Brown35d38892012-08-26 13:50:48 -0700262 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_VOL_SHIFT,
263 0xbf, 0, digital_tlv),
Mark Brown5c6af632012-07-09 19:09:41 +0100264SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
265 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_VOL_SHIFT,
266 0xbf, 0, digital_tlv),
267SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
268 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
269 0xbf, 0, digital_tlv),
270SOC_DOUBLE_R_TLV("SPKDAT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_6L,
271 ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_VOL_SHIFT,
272 0xbf, 0, digital_tlv),
273
274SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L,
275 ARIZONA_OUTPUT_PATH_CONFIG_1R,
276 ARIZONA_OUT1L_PGA_VOL_SHIFT,
277 0x34, 0x40, 0, ana_tlv),
Charles Keepax5752ec92013-02-15 10:37:27 +0000278SOC_DOUBLE_R_RANGE_TLV("HPOUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L,
Mark Brown5c6af632012-07-09 19:09:41 +0100279 ARIZONA_OUTPUT_PATH_CONFIG_2R,
280 ARIZONA_OUT2L_PGA_VOL_SHIFT,
281 0x34, 0x40, 0, ana_tlv),
Charles Keepax5752ec92013-02-15 10:37:27 +0000282SOC_DOUBLE_R_RANGE_TLV("HPOUT3 Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L,
Mark Brown35d38892012-08-26 13:50:48 -0700283 ARIZONA_OUTPUT_PATH_CONFIG_3R,
284 ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv),
Mark Brown5c6af632012-07-09 19:09:41 +0100285
286SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
287 ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
288SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT,
289 ARIZONA_SPK2R_MUTE_SHIFT, 1, 1),
290
Mark Browna1abfa82012-12-09 12:50:05 +0900291SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
292SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
293
Mark Brownbd7fe242012-12-18 13:53:26 +0000294SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
295 ARIZONA_NGATE_ENA_SHIFT, 1, 0),
296SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
297 ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
298SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
299
300WM5110_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
301WM5110_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
302WM5110_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L),
303WM5110_NG_SRC("HPOUT2R", ARIZONA_NOISE_GATE_SELECT_2R),
304WM5110_NG_SRC("HPOUT3L", ARIZONA_NOISE_GATE_SELECT_3L),
305WM5110_NG_SRC("HPOUT3R", ARIZONA_NOISE_GATE_SELECT_3R),
306WM5110_NG_SRC("SPKOUTL", ARIZONA_NOISE_GATE_SELECT_4L),
307WM5110_NG_SRC("SPKOUTR", ARIZONA_NOISE_GATE_SELECT_4R),
308WM5110_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L),
309WM5110_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R),
310WM5110_NG_SRC("SPKDAT2L", ARIZONA_NOISE_GATE_SELECT_6L),
311WM5110_NG_SRC("SPKDAT2R", ARIZONA_NOISE_GATE_SELECT_6R),
312
Mark Brown5c6af632012-07-09 19:09:41 +0100313ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
314ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
315ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
316ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
317ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
318ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
319ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
320ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
321
322ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
323ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
324
325ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
326ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
Mark Brownd217f902013-05-17 13:29:05 +0100327
328ARIZONA_MIXER_CONTROLS("SLIMTX1", ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE),
329ARIZONA_MIXER_CONTROLS("SLIMTX2", ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE),
330ARIZONA_MIXER_CONTROLS("SLIMTX3", ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE),
331ARIZONA_MIXER_CONTROLS("SLIMTX4", ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE),
332ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
333ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
334ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
335ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
Mark Brown5c6af632012-07-09 19:09:41 +0100336};
337
338ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
339ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
340ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
341ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
342
343ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
344ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
345ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE);
346ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE);
347
348ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
349ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
350ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
351ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
352
353ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE);
354ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE);
355
356ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
357ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
358
359ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
360ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
361ARIZONA_MIXER_ENUMS(OUT2L, ARIZONA_OUT2LMIX_INPUT_1_SOURCE);
362ARIZONA_MIXER_ENUMS(OUT2R, ARIZONA_OUT2RMIX_INPUT_1_SOURCE);
Mark Brown35d38892012-08-26 13:50:48 -0700363ARIZONA_MIXER_ENUMS(OUT3L, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
364ARIZONA_MIXER_ENUMS(OUT3R, ARIZONA_OUT3RMIX_INPUT_1_SOURCE);
Mark Brown5c6af632012-07-09 19:09:41 +0100365ARIZONA_MIXER_ENUMS(SPKOUTL, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
366ARIZONA_MIXER_ENUMS(SPKOUTR, ARIZONA_OUT4RMIX_INPUT_1_SOURCE);
367ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
368ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
369ARIZONA_MIXER_ENUMS(SPKDAT2L, ARIZONA_OUT6LMIX_INPUT_1_SOURCE);
370ARIZONA_MIXER_ENUMS(SPKDAT2R, ARIZONA_OUT6RMIX_INPUT_1_SOURCE);
371
372ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
373ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
374ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
375ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
376ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
377ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
378ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
379ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
380
381ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
382ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
383
384ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
385ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
386
Mark Brownd217f902013-05-17 13:29:05 +0100387ARIZONA_MIXER_ENUMS(SLIMTX1, ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE);
388ARIZONA_MIXER_ENUMS(SLIMTX2, ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE);
389ARIZONA_MIXER_ENUMS(SLIMTX3, ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE);
390ARIZONA_MIXER_ENUMS(SLIMTX4, ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE);
391ARIZONA_MIXER_ENUMS(SLIMTX5, ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE);
392ARIZONA_MIXER_ENUMS(SLIMTX6, ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE);
393ARIZONA_MIXER_ENUMS(SLIMTX7, ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE);
394ARIZONA_MIXER_ENUMS(SLIMTX8, ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE);
395
Charles Keepax5886c742012-11-13 16:40:34 +0000396ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
397ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
398ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
399ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
Mark Brown5c6af632012-07-09 19:09:41 +0100400
Mark Browndac8f1c2012-08-26 13:51:27 -0700401static const char *wm5110_aec_loopback_texts[] = {
402 "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R",
403 "SPKOUTL", "SPKOUTR", "SPKDAT1L", "SPKDAT1R", "SPKDAT2L", "SPKDAT2R",
404};
405
406static const unsigned int wm5110_aec_loopback_values[] = {
407 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
408};
409
410static const struct soc_enum wm5110_aec_loopback =
411 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
Mark Brown7d5cb4f2013-01-11 13:32:00 +0000412 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
Mark Browndac8f1c2012-08-26 13:51:27 -0700413 ARRAY_SIZE(wm5110_aec_loopback_texts),
414 wm5110_aec_loopback_texts,
415 wm5110_aec_loopback_values);
416
417static const struct snd_kcontrol_new wm5110_aec_loopback_mux =
418 SOC_DAPM_VALUE_ENUM("AEC Loopback", wm5110_aec_loopback);
419
Mark Brown5c6af632012-07-09 19:09:41 +0100420static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = {
421SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
422 0, NULL, 0),
423SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
424 ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
Mark Brown94237f82012-08-09 19:14:43 +0100425SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
426 ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
427SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
428 ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
Mark Brown5c6af632012-07-09 19:09:41 +0100429
Mark Brown822b4b82012-09-07 10:54:32 +0800430SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
431SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0, 0),
432SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
Mark Brown76dbd2a2012-09-07 12:58:54 +0800433SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
Mark Brown822b4b82012-09-07 10:54:32 +0800434SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0, 0),
435SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
Mark Brown5c6af632012-07-09 19:09:41 +0100436
437SND_SOC_DAPM_SIGGEN("TONE"),
438SND_SOC_DAPM_SIGGEN("NOISE"),
Mark Brown2f76e682012-11-26 21:18:18 +0000439SND_SOC_DAPM_SIGGEN("HAPTICS"),
Mark Brown5c6af632012-07-09 19:09:41 +0100440
441SND_SOC_DAPM_INPUT("IN1L"),
442SND_SOC_DAPM_INPUT("IN1R"),
443SND_SOC_DAPM_INPUT("IN2L"),
444SND_SOC_DAPM_INPUT("IN2R"),
445SND_SOC_DAPM_INPUT("IN3L"),
446SND_SOC_DAPM_INPUT("IN3R"),
447SND_SOC_DAPM_INPUT("IN4L"),
448SND_SOC_DAPM_INPUT("IN4R"),
449
Charles Keepaxb63144e2013-07-04 08:56:28 +0100450SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
451SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
452
Mark Brown5c6af632012-07-09 19:09:41 +0100453SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
454 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +0000455 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
456 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +0100457SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
458 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +0000459 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
460 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +0100461SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
462 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +0000463 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
464 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +0100465SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
466 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +0000467 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
468 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +0100469SND_SOC_DAPM_PGA_E("IN3L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3L_ENA_SHIFT,
470 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +0000471 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
472 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +0100473SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3R_ENA_SHIFT,
474 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +0000475 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
476 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +0100477SND_SOC_DAPM_PGA_E("IN4L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4L_ENA_SHIFT,
478 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +0000479 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
480 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +0100481SND_SOC_DAPM_PGA_E("IN4R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4R_ENA_SHIFT,
482 0, NULL, 0, arizona_in_ev,
Mark Brownddbce972013-02-15 17:27:22 +0000483 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
484 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +0100485
486SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
487 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
488SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
489 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
490SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
491 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
492
493SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
494 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
495
496SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
497 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
498SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
499 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
500
501SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1,
502 ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0),
503
504SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
505SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
506SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
507SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
508
509SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
510 NULL, 0),
511SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
512 NULL, 0),
513SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0,
514 NULL, 0),
515SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0,
516 NULL, 0),
517
518SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
519 NULL, 0),
520SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
521 NULL, 0),
522SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
523 NULL, 0),
524SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
525 NULL, 0),
526
527SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
528 0, NULL, 0),
529SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
530 0, NULL, 0),
531
532SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
533 NULL, 0),
534SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
535 NULL, 0),
536SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
537 NULL, 0),
538SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
539 NULL, 0),
540
Mark Browndac8f1c2012-08-26 13:51:27 -0700541SND_SOC_DAPM_VALUE_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
Charles Keepaxee4b7c72013-06-05 14:51:30 +0100542 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0,
543 &wm5110_aec_loopback_mux),
Mark Browndac8f1c2012-08-26 13:51:27 -0700544
Mark Brown5c6af632012-07-09 19:09:41 +0100545SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
546 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
547SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
548 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
549SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
550 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
551SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
552 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
553SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
554 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
555SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
556 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
557SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0,
558 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
559SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0,
560 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
561
562SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
563 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
564SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
565 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
566SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
567 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
568SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
569 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
570SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
571 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
572SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
573 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
574SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0,
575 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
576SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0,
577 ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
578
579SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
580 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
581SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
582 ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
583
584SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
585 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
586SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
587 ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
588
Mark Brownd217f902013-05-17 13:29:05 +0100589SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0,
590 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
591 ARIZONA_SLIMRX1_ENA_SHIFT, 0),
592SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 0,
593 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
594 ARIZONA_SLIMRX2_ENA_SHIFT, 0),
595SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 0,
596 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
597 ARIZONA_SLIMRX3_ENA_SHIFT, 0),
598SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 0,
599 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
600 ARIZONA_SLIMRX4_ENA_SHIFT, 0),
601SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL, 0,
602 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
603 ARIZONA_SLIMRX5_ENA_SHIFT, 0),
604SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL, 0,
605 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
606 ARIZONA_SLIMRX6_ENA_SHIFT, 0),
607SND_SOC_DAPM_AIF_IN("SLIMRX7", NULL, 0,
608 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
609 ARIZONA_SLIMRX7_ENA_SHIFT, 0),
610SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 0,
611 ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
612 ARIZONA_SLIMRX8_ENA_SHIFT, 0),
613
614SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
615 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
616 ARIZONA_SLIMTX1_ENA_SHIFT, 0),
617SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 0,
618 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
619 ARIZONA_SLIMTX2_ENA_SHIFT, 0),
620SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 0,
621 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
622 ARIZONA_SLIMTX3_ENA_SHIFT, 0),
623SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 0,
624 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
625 ARIZONA_SLIMTX4_ENA_SHIFT, 0),
626SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 0,
627 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
628 ARIZONA_SLIMTX5_ENA_SHIFT, 0),
629SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 0,
630 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
631 ARIZONA_SLIMTX6_ENA_SHIFT, 0),
632SND_SOC_DAPM_AIF_OUT("SLIMTX7", NULL, 0,
633 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
634 ARIZONA_SLIMTX7_ENA_SHIFT, 0),
635SND_SOC_DAPM_AIF_OUT("SLIMTX8", NULL, 0,
636 ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
637 ARIZONA_SLIMTX8_ENA_SHIFT, 0),
638
Mark Brown5c6af632012-07-09 19:09:41 +0100639SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
640 ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
641SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0,
642 ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
643
644SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
645 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
646SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
647 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
648
Mark Brownf607e312013-02-22 18:36:53 +0000649SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
650 ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
Mark Brown5c6af632012-07-09 19:09:41 +0100651 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
Mark Brownf607e312013-02-22 18:36:53 +0000652SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
653 ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
Mark Brown5c6af632012-07-09 19:09:41 +0100654 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
655SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1,
656 ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
657 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
658SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1,
659 ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
660 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
661SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
662 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
663 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
Mark Brown20bf6912012-09-26 17:52:36 +0100664SND_SOC_DAPM_PGA_E("OUT3R", ARIZONA_OUTPUT_ENABLES_1,
665 ARIZONA_OUT3R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
666 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
Mark Brown5c6af632012-07-09 19:09:41 +0100667SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
668 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
669 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
670SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
671 ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
672 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
673SND_SOC_DAPM_PGA_E("OUT6L", ARIZONA_OUTPUT_ENABLES_1,
674 ARIZONA_OUT6L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
675 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
676SND_SOC_DAPM_PGA_E("OUT6R", ARIZONA_OUTPUT_ENABLES_1,
677 ARIZONA_OUT6R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
678 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
679
680ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
681ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
682ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"),
683ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"),
684
685ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
686ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
687ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"),
688ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"),
689
690ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
691ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
692ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
693ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
694
695ARIZONA_MIXER_WIDGETS(Mic, "Mic"),
696ARIZONA_MIXER_WIDGETS(Noise, "Noise"),
697
698ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
699ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
700
701ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
702ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
703ARIZONA_MIXER_WIDGETS(OUT2L, "HPOUT2L"),
704ARIZONA_MIXER_WIDGETS(OUT2R, "HPOUT2R"),
Mark Brown35d38892012-08-26 13:50:48 -0700705ARIZONA_MIXER_WIDGETS(OUT3L, "HPOUT3L"),
706ARIZONA_MIXER_WIDGETS(OUT3R, "HPOUT3R"),
Mark Brown5c6af632012-07-09 19:09:41 +0100707ARIZONA_MIXER_WIDGETS(SPKOUTL, "SPKOUTL"),
708ARIZONA_MIXER_WIDGETS(SPKOUTR, "SPKOUTR"),
709ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
710ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
711ARIZONA_MIXER_WIDGETS(SPKDAT2L, "SPKDAT2L"),
712ARIZONA_MIXER_WIDGETS(SPKDAT2R, "SPKDAT2R"),
713
714ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
715ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
716ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
717ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
718ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
719ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
720ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
721ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
722
723ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
724ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
725
726ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
727ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
728
Mark Brownd217f902013-05-17 13:29:05 +0100729ARIZONA_MIXER_WIDGETS(SLIMTX1, "SLIMTX1"),
730ARIZONA_MIXER_WIDGETS(SLIMTX2, "SLIMTX2"),
731ARIZONA_MIXER_WIDGETS(SLIMTX3, "SLIMTX3"),
732ARIZONA_MIXER_WIDGETS(SLIMTX4, "SLIMTX4"),
733ARIZONA_MIXER_WIDGETS(SLIMTX5, "SLIMTX5"),
734ARIZONA_MIXER_WIDGETS(SLIMTX6, "SLIMTX6"),
735ARIZONA_MIXER_WIDGETS(SLIMTX7, "SLIMTX7"),
736ARIZONA_MIXER_WIDGETS(SLIMTX8, "SLIMTX8"),
737
Charles Keepax5886c742012-11-13 16:40:34 +0000738ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
739ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
740ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
741ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
Mark Brown5c6af632012-07-09 19:09:41 +0100742
743SND_SOC_DAPM_OUTPUT("HPOUT1L"),
744SND_SOC_DAPM_OUTPUT("HPOUT1R"),
745SND_SOC_DAPM_OUTPUT("HPOUT2L"),
746SND_SOC_DAPM_OUTPUT("HPOUT2R"),
Mark Brown35d38892012-08-26 13:50:48 -0700747SND_SOC_DAPM_OUTPUT("HPOUT3L"),
748SND_SOC_DAPM_OUTPUT("HPOUT3R"),
Mark Brown5c6af632012-07-09 19:09:41 +0100749SND_SOC_DAPM_OUTPUT("SPKOUTLN"),
750SND_SOC_DAPM_OUTPUT("SPKOUTLP"),
751SND_SOC_DAPM_OUTPUT("SPKOUTRN"),
752SND_SOC_DAPM_OUTPUT("SPKOUTRP"),
753SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
754SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
755SND_SOC_DAPM_OUTPUT("SPKDAT2L"),
756SND_SOC_DAPM_OUTPUT("SPKDAT2R"),
Mark Brown57a10a12013-01-10 19:32:33 +0000757
758SND_SOC_DAPM_OUTPUT("MICSUPP"),
Mark Brown5c6af632012-07-09 19:09:41 +0100759};
760
761#define ARIZONA_MIXER_INPUT_ROUTES(name) \
762 { name, "Noise Generator", "Noise Generator" }, \
763 { name, "Tone Generator 1", "Tone Generator 1" }, \
764 { name, "Tone Generator 2", "Tone Generator 2" }, \
Mark Brown2f76e682012-11-26 21:18:18 +0000765 { name, "Haptics", "HAPTICS" }, \
Mark Browndac8f1c2012-08-26 13:51:27 -0700766 { name, "AEC", "AEC Loopback" }, \
Mark Brown5c6af632012-07-09 19:09:41 +0100767 { name, "IN1L", "IN1L PGA" }, \
768 { name, "IN1R", "IN1R PGA" }, \
769 { name, "IN2L", "IN2L PGA" }, \
770 { name, "IN2R", "IN2R PGA" }, \
771 { name, "IN3L", "IN3L PGA" }, \
772 { name, "IN3R", "IN3R PGA" }, \
773 { name, "IN4L", "IN4L PGA" }, \
774 { name, "IN4R", "IN4R PGA" }, \
775 { name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
776 { name, "AIF1RX1", "AIF1RX1" }, \
777 { name, "AIF1RX2", "AIF1RX2" }, \
778 { name, "AIF1RX3", "AIF1RX3" }, \
779 { name, "AIF1RX4", "AIF1RX4" }, \
780 { name, "AIF1RX5", "AIF1RX5" }, \
781 { name, "AIF1RX6", "AIF1RX6" }, \
782 { name, "AIF1RX7", "AIF1RX7" }, \
783 { name, "AIF1RX8", "AIF1RX8" }, \
784 { name, "AIF2RX1", "AIF2RX1" }, \
785 { name, "AIF2RX2", "AIF2RX2" }, \
786 { name, "AIF3RX1", "AIF3RX1" }, \
787 { name, "AIF3RX2", "AIF3RX2" }, \
Mark Brownd217f902013-05-17 13:29:05 +0100788 { name, "SLIMRX1", "SLIMRX1" }, \
789 { name, "SLIMRX2", "SLIMRX2" }, \
790 { name, "SLIMRX3", "SLIMRX3" }, \
791 { name, "SLIMRX4", "SLIMRX4" }, \
792 { name, "SLIMRX5", "SLIMRX5" }, \
793 { name, "SLIMRX6", "SLIMRX6" }, \
794 { name, "SLIMRX7", "SLIMRX7" }, \
795 { name, "SLIMRX8", "SLIMRX8" }, \
Mark Brown5c6af632012-07-09 19:09:41 +0100796 { name, "EQ1", "EQ1" }, \
797 { name, "EQ2", "EQ2" }, \
798 { name, "EQ3", "EQ3" }, \
799 { name, "EQ4", "EQ4" }, \
800 { name, "DRC1L", "DRC1L" }, \
801 { name, "DRC1R", "DRC1R" }, \
802 { name, "DRC2L", "DRC2L" }, \
803 { name, "DRC2R", "DRC2R" }, \
804 { name, "LHPF1", "LHPF1" }, \
805 { name, "LHPF2", "LHPF2" }, \
806 { name, "LHPF3", "LHPF3" }, \
807 { name, "LHPF4", "LHPF4" }, \
808 { name, "ASRC1L", "ASRC1L" }, \
809 { name, "ASRC1R", "ASRC1R" }, \
810 { name, "ASRC2L", "ASRC2L" }, \
811 { name, "ASRC2R", "ASRC2R" }
812
813static const struct snd_soc_dapm_route wm5110_dapm_routes[] = {
814 { "AIF2 Capture", NULL, "DBVDD2" },
815 { "AIF2 Playback", NULL, "DBVDD2" },
816
817 { "AIF3 Capture", NULL, "DBVDD3" },
818 { "AIF3 Playback", NULL, "DBVDD3" },
819
820 { "OUT1L", NULL, "CPVDD" },
821 { "OUT1R", NULL, "CPVDD" },
822 { "OUT2L", NULL, "CPVDD" },
823 { "OUT2R", NULL, "CPVDD" },
824 { "OUT3L", NULL, "CPVDD" },
Mark Brown20bf6912012-09-26 17:52:36 +0100825 { "OUT3R", NULL, "CPVDD" },
Mark Brown5c6af632012-07-09 19:09:41 +0100826
827 { "OUT4L", NULL, "SPKVDDL" },
828 { "OUT4R", NULL, "SPKVDDR" },
829
830 { "OUT1L", NULL, "SYSCLK" },
831 { "OUT1R", NULL, "SYSCLK" },
832 { "OUT2L", NULL, "SYSCLK" },
833 { "OUT2R", NULL, "SYSCLK" },
834 { "OUT3L", NULL, "SYSCLK" },
835 { "OUT4L", NULL, "SYSCLK" },
836 { "OUT4R", NULL, "SYSCLK" },
837 { "OUT5L", NULL, "SYSCLK" },
838 { "OUT5R", NULL, "SYSCLK" },
839 { "OUT6L", NULL, "SYSCLK" },
840 { "OUT6R", NULL, "SYSCLK" },
841
Charles Keepax6dc6a3f2013-06-05 14:51:31 +0100842 { "IN1L", NULL, "SYSCLK" },
843 { "IN1R", NULL, "SYSCLK" },
844 { "IN2L", NULL, "SYSCLK" },
845 { "IN2R", NULL, "SYSCLK" },
846 { "IN3L", NULL, "SYSCLK" },
847 { "IN3R", NULL, "SYSCLK" },
848 { "IN4L", NULL, "SYSCLK" },
849 { "IN4R", NULL, "SYSCLK" },
850
Mark Brown5c6af632012-07-09 19:09:41 +0100851 { "MICBIAS1", NULL, "MICVDD" },
852 { "MICBIAS2", NULL, "MICVDD" },
853 { "MICBIAS3", NULL, "MICVDD" },
854
Charles Keepax6dc6a3f2013-06-05 14:51:31 +0100855 { "Noise Generator", NULL, "SYSCLK" },
856 { "Tone Generator 1", NULL, "SYSCLK" },
857 { "Tone Generator 2", NULL, "SYSCLK" },
858
Mark Brown5c6af632012-07-09 19:09:41 +0100859 { "Noise Generator", NULL, "NOISE" },
860 { "Tone Generator 1", NULL, "TONE" },
861 { "Tone Generator 2", NULL, "TONE" },
862
Mark Brown5c6af632012-07-09 19:09:41 +0100863 { "AIF1 Capture", NULL, "AIF1TX1" },
864 { "AIF1 Capture", NULL, "AIF1TX2" },
865 { "AIF1 Capture", NULL, "AIF1TX3" },
866 { "AIF1 Capture", NULL, "AIF1TX4" },
867 { "AIF1 Capture", NULL, "AIF1TX5" },
868 { "AIF1 Capture", NULL, "AIF1TX6" },
869 { "AIF1 Capture", NULL, "AIF1TX7" },
870 { "AIF1 Capture", NULL, "AIF1TX8" },
871
872 { "AIF1RX1", NULL, "AIF1 Playback" },
873 { "AIF1RX2", NULL, "AIF1 Playback" },
874 { "AIF1RX3", NULL, "AIF1 Playback" },
875 { "AIF1RX4", NULL, "AIF1 Playback" },
876 { "AIF1RX5", NULL, "AIF1 Playback" },
877 { "AIF1RX6", NULL, "AIF1 Playback" },
878 { "AIF1RX7", NULL, "AIF1 Playback" },
879 { "AIF1RX8", NULL, "AIF1 Playback" },
880
881 { "AIF2 Capture", NULL, "AIF2TX1" },
882 { "AIF2 Capture", NULL, "AIF2TX2" },
883
884 { "AIF2RX1", NULL, "AIF2 Playback" },
885 { "AIF2RX2", NULL, "AIF2 Playback" },
886
887 { "AIF3 Capture", NULL, "AIF3TX1" },
888 { "AIF3 Capture", NULL, "AIF3TX2" },
889
890 { "AIF3RX1", NULL, "AIF3 Playback" },
891 { "AIF3RX2", NULL, "AIF3 Playback" },
892
Mark Brownd217f902013-05-17 13:29:05 +0100893 { "Slim1 Capture", NULL, "SLIMTX1" },
894 { "Slim1 Capture", NULL, "SLIMTX2" },
895 { "Slim1 Capture", NULL, "SLIMTX3" },
896 { "Slim1 Capture", NULL, "SLIMTX4" },
897
898 { "SLIMRX1", NULL, "Slim1 Playback" },
899 { "SLIMRX2", NULL, "Slim1 Playback" },
900 { "SLIMRX3", NULL, "Slim1 Playback" },
901 { "SLIMRX4", NULL, "Slim1 Playback" },
902
903 { "Slim2 Capture", NULL, "SLIMTX5" },
904 { "Slim2 Capture", NULL, "SLIMTX6" },
905
906 { "SLIMRX5", NULL, "Slim2 Playback" },
907 { "SLIMRX6", NULL, "Slim2 Playback" },
908
909 { "Slim3 Capture", NULL, "SLIMTX7" },
910 { "Slim3 Capture", NULL, "SLIMTX8" },
911
912 { "SLIMRX7", NULL, "Slim3 Playback" },
913 { "SLIMRX8", NULL, "Slim3 Playback" },
914
Mark Brown5c6af632012-07-09 19:09:41 +0100915 { "AIF1 Playback", NULL, "SYSCLK" },
916 { "AIF2 Playback", NULL, "SYSCLK" },
917 { "AIF3 Playback", NULL, "SYSCLK" },
Mark Brownd217f902013-05-17 13:29:05 +0100918 { "Slim1 Playback", NULL, "SYSCLK" },
919 { "Slim2 Playback", NULL, "SYSCLK" },
920 { "Slim3 Playback", NULL, "SYSCLK" },
Mark Brown5c6af632012-07-09 19:09:41 +0100921
922 { "AIF1 Capture", NULL, "SYSCLK" },
923 { "AIF2 Capture", NULL, "SYSCLK" },
924 { "AIF3 Capture", NULL, "SYSCLK" },
Mark Brownd217f902013-05-17 13:29:05 +0100925 { "Slim1 Capture", NULL, "SYSCLK" },
926 { "Slim2 Capture", NULL, "SYSCLK" },
927 { "Slim3 Capture", NULL, "SYSCLK" },
Mark Brown5c6af632012-07-09 19:09:41 +0100928
Mark Brown17c3f7e2012-08-10 15:40:22 +0100929 { "IN1L PGA", NULL, "IN1L" },
930 { "IN1R PGA", NULL, "IN1R" },
931
932 { "IN2L PGA", NULL, "IN2L" },
933 { "IN2R PGA", NULL, "IN2R" },
934
935 { "IN3L PGA", NULL, "IN3L" },
936 { "IN3R PGA", NULL, "IN3R" },
937
938 { "IN4L PGA", NULL, "IN4L" },
939 { "IN4R PGA", NULL, "IN4R" },
940
Mark Brown5c6af632012-07-09 19:09:41 +0100941 ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
942 ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
943 ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"),
944 ARIZONA_MIXER_ROUTES("OUT2R", "HPOUT2R"),
Mark Brown35d38892012-08-26 13:50:48 -0700945 ARIZONA_MIXER_ROUTES("OUT3L", "HPOUT3L"),
946 ARIZONA_MIXER_ROUTES("OUT3R", "HPOUT3R"),
Mark Brown5c6af632012-07-09 19:09:41 +0100947
948 ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUTL"),
949 ARIZONA_MIXER_ROUTES("OUT4R", "SPKOUTR"),
950 ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
951 ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
952 ARIZONA_MIXER_ROUTES("OUT6L", "SPKDAT2L"),
953 ARIZONA_MIXER_ROUTES("OUT6R", "SPKDAT2R"),
954
955 ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
956 ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
957
958 ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
959 ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
960 ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
961 ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
962 ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
963 ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
964 ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
965 ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
966
967 ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
968 ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
969
970 ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
971 ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
972
Mark Brownd217f902013-05-17 13:29:05 +0100973 ARIZONA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
974 ARIZONA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
975 ARIZONA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
976 ARIZONA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
977 ARIZONA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
978 ARIZONA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
979 ARIZONA_MIXER_ROUTES("SLIMTX7", "SLIMTX7"),
980 ARIZONA_MIXER_ROUTES("SLIMTX8", "SLIMTX8"),
981
Mark Brown5c6af632012-07-09 19:09:41 +0100982 ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
983 ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
984 ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
985 ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
986
987 ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
988 ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
989 ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"),
990 ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"),
991
992 ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
993 ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
994 ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
995 ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
996
Mark Brown66e7aa22013-08-12 23:59:08 +0100997 ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Noise"),
998 ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Mic"),
999
Charles Keepaxe7edb272013-08-12 11:33:32 +01001000 ARIZONA_MUX_ROUTES("ASRC1L", "ASRC1L"),
1001 ARIZONA_MUX_ROUTES("ASRC1R", "ASRC1R"),
1002 ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"),
1003 ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"),
Mark Brown5c6af632012-07-09 19:09:41 +01001004
1005 { "HPOUT1L", NULL, "OUT1L" },
1006 { "HPOUT1R", NULL, "OUT1R" },
1007
1008 { "HPOUT2L", NULL, "OUT2L" },
1009 { "HPOUT2R", NULL, "OUT2R" },
1010
Mark Brown35d38892012-08-26 13:50:48 -07001011 { "HPOUT3L", NULL, "OUT3L" },
1012 { "HPOUT3R", NULL, "OUT3L" },
Mark Brown5c6af632012-07-09 19:09:41 +01001013
1014 { "SPKOUTLN", NULL, "OUT4L" },
1015 { "SPKOUTLP", NULL, "OUT4L" },
1016
1017 { "SPKOUTRN", NULL, "OUT4R" },
1018 { "SPKOUTRP", NULL, "OUT4R" },
1019
1020 { "SPKDAT1L", NULL, "OUT5L" },
1021 { "SPKDAT1R", NULL, "OUT5R" },
1022
1023 { "SPKDAT2L", NULL, "OUT6L" },
1024 { "SPKDAT2R", NULL, "OUT6R" },
Mark Brown57a10a12013-01-10 19:32:33 +00001025
1026 { "MICSUPP", NULL, "SYSCLK" },
Charles Keepaxb63144e2013-07-04 08:56:28 +01001027
1028 { "DRC1 Signal Activity", NULL, "DRC1L" },
1029 { "DRC1 Signal Activity", NULL, "DRC1R" },
1030 { "DRC2 Signal Activity", NULL, "DRC2L" },
1031 { "DRC2 Signal Activity", NULL, "DRC2R" },
Mark Brown5c6af632012-07-09 19:09:41 +01001032};
1033
1034static int wm5110_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
1035 unsigned int Fref, unsigned int Fout)
1036{
1037 struct wm5110_priv *wm5110 = snd_soc_codec_get_drvdata(codec);
1038
1039 switch (fll_id) {
1040 case WM5110_FLL1:
1041 return arizona_set_fll(&wm5110->fll[0], source, Fref, Fout);
1042 case WM5110_FLL2:
1043 return arizona_set_fll(&wm5110->fll[1], source, Fref, Fout);
Charles Keepaxee929a92013-02-20 17:28:40 +00001044 case WM5110_FLL1_REFCLK:
1045 return arizona_set_fll_refclk(&wm5110->fll[0], source, Fref,
1046 Fout);
1047 case WM5110_FLL2_REFCLK:
1048 return arizona_set_fll_refclk(&wm5110->fll[1], source, Fref,
1049 Fout);
Mark Brown5c6af632012-07-09 19:09:41 +01001050 default:
1051 return -EINVAL;
1052 }
1053}
1054
1055#define WM5110_RATES SNDRV_PCM_RATE_8000_192000
1056
1057#define WM5110_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
1058 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
1059
1060static struct snd_soc_dai_driver wm5110_dai[] = {
1061 {
1062 .name = "wm5110-aif1",
1063 .id = 1,
1064 .base = ARIZONA_AIF1_BCLK_CTRL,
1065 .playback = {
1066 .stream_name = "AIF1 Playback",
1067 .channels_min = 1,
1068 .channels_max = 8,
1069 .rates = WM5110_RATES,
1070 .formats = WM5110_FORMATS,
1071 },
1072 .capture = {
1073 .stream_name = "AIF1 Capture",
1074 .channels_min = 1,
1075 .channels_max = 8,
1076 .rates = WM5110_RATES,
1077 .formats = WM5110_FORMATS,
1078 },
1079 .ops = &arizona_dai_ops,
1080 .symmetric_rates = 1,
1081 },
1082 {
1083 .name = "wm5110-aif2",
1084 .id = 2,
1085 .base = ARIZONA_AIF2_BCLK_CTRL,
1086 .playback = {
1087 .stream_name = "AIF2 Playback",
1088 .channels_min = 1,
1089 .channels_max = 2,
1090 .rates = WM5110_RATES,
1091 .formats = WM5110_FORMATS,
1092 },
1093 .capture = {
1094 .stream_name = "AIF2 Capture",
1095 .channels_min = 1,
1096 .channels_max = 2,
1097 .rates = WM5110_RATES,
1098 .formats = WM5110_FORMATS,
1099 },
1100 .ops = &arizona_dai_ops,
1101 .symmetric_rates = 1,
1102 },
1103 {
1104 .name = "wm5110-aif3",
1105 .id = 3,
1106 .base = ARIZONA_AIF3_BCLK_CTRL,
1107 .playback = {
1108 .stream_name = "AIF3 Playback",
1109 .channels_min = 1,
1110 .channels_max = 2,
1111 .rates = WM5110_RATES,
1112 .formats = WM5110_FORMATS,
1113 },
1114 .capture = {
1115 .stream_name = "AIF3 Capture",
1116 .channels_min = 1,
1117 .channels_max = 2,
1118 .rates = WM5110_RATES,
1119 .formats = WM5110_FORMATS,
1120 },
1121 .ops = &arizona_dai_ops,
1122 .symmetric_rates = 1,
1123 },
Mark Brownd217f902013-05-17 13:29:05 +01001124 {
1125 .name = "wm5110-slim1",
1126 .id = 4,
1127 .playback = {
1128 .stream_name = "Slim1 Playback",
1129 .channels_min = 1,
1130 .channels_max = 4,
1131 .rates = WM5110_RATES,
1132 .formats = WM5110_FORMATS,
1133 },
1134 .capture = {
1135 .stream_name = "Slim1 Capture",
1136 .channels_min = 1,
1137 .channels_max = 4,
1138 .rates = WM5110_RATES,
1139 .formats = WM5110_FORMATS,
1140 },
1141 .ops = &arizona_simple_dai_ops,
1142 },
1143 {
1144 .name = "wm5110-slim2",
1145 .id = 5,
1146 .playback = {
1147 .stream_name = "Slim2 Playback",
1148 .channels_min = 1,
1149 .channels_max = 2,
1150 .rates = WM5110_RATES,
1151 .formats = WM5110_FORMATS,
1152 },
1153 .capture = {
1154 .stream_name = "Slim2 Capture",
1155 .channels_min = 1,
1156 .channels_max = 2,
1157 .rates = WM5110_RATES,
1158 .formats = WM5110_FORMATS,
1159 },
1160 .ops = &arizona_simple_dai_ops,
1161 },
1162 {
1163 .name = "wm5110-slim3",
1164 .id = 6,
1165 .playback = {
1166 .stream_name = "Slim3 Playback",
1167 .channels_min = 1,
1168 .channels_max = 2,
1169 .rates = WM5110_RATES,
1170 .formats = WM5110_FORMATS,
1171 },
1172 .capture = {
1173 .stream_name = "Slim3 Capture",
1174 .channels_min = 1,
1175 .channels_max = 2,
1176 .rates = WM5110_RATES,
1177 .formats = WM5110_FORMATS,
1178 },
1179 .ops = &arizona_simple_dai_ops,
1180 },
Mark Brown5c6af632012-07-09 19:09:41 +01001181};
1182
1183static int wm5110_codec_probe(struct snd_soc_codec *codec)
1184{
1185 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
Mark Brown2f76e682012-11-26 21:18:18 +00001186 int ret;
Mark Brown5c6af632012-07-09 19:09:41 +01001187
1188 codec->control_data = priv->core.arizona->regmap;
Mark Brown2f76e682012-11-26 21:18:18 +00001189 priv->core.arizona->dapm = &codec->dapm;
1190
1191 ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
1192 if (ret != 0)
1193 return ret;
1194
Mark Brown62cc4d52013-05-20 11:28:35 -05001195 arizona_init_spk(codec);
Charles Keepaxb63144e2013-07-04 08:56:28 +01001196 arizona_init_gpio(codec);
Mark Brown62cc4d52013-05-20 11:28:35 -05001197
Mark Brown2f76e682012-11-26 21:18:18 +00001198 snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
1199
1200 priv->core.arizona->dapm = &codec->dapm;
1201
1202 return 0;
1203}
1204
1205static int wm5110_codec_remove(struct snd_soc_codec *codec)
1206{
1207 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
1208
1209 priv->core.arizona->dapm = NULL;
1210
1211 return 0;
Mark Brown5c6af632012-07-09 19:09:41 +01001212}
1213
1214#define WM5110_DIG_VU 0x0200
1215
1216static unsigned int wm5110_digital_vu[] = {
Mark Brown5c6af632012-07-09 19:09:41 +01001217 ARIZONA_DAC_DIGITAL_VOLUME_1L,
1218 ARIZONA_DAC_DIGITAL_VOLUME_1R,
1219 ARIZONA_DAC_DIGITAL_VOLUME_2L,
1220 ARIZONA_DAC_DIGITAL_VOLUME_2R,
1221 ARIZONA_DAC_DIGITAL_VOLUME_3L,
1222 ARIZONA_DAC_DIGITAL_VOLUME_3R,
1223 ARIZONA_DAC_DIGITAL_VOLUME_4L,
1224 ARIZONA_DAC_DIGITAL_VOLUME_4R,
1225 ARIZONA_DAC_DIGITAL_VOLUME_5L,
1226 ARIZONA_DAC_DIGITAL_VOLUME_5R,
Charles Keepaxae605032012-09-27 13:21:48 +01001227 ARIZONA_DAC_DIGITAL_VOLUME_6L,
1228 ARIZONA_DAC_DIGITAL_VOLUME_6R,
Mark Brown5c6af632012-07-09 19:09:41 +01001229};
1230
1231static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
1232 .probe = wm5110_codec_probe,
Mark Brown2f76e682012-11-26 21:18:18 +00001233 .remove = wm5110_codec_remove,
Mark Brown5c6af632012-07-09 19:09:41 +01001234
1235 .idle_bias_off = true,
1236
1237 .set_sysclk = arizona_set_sysclk,
1238 .set_pll = wm5110_set_fll,
1239
1240 .controls = wm5110_snd_controls,
1241 .num_controls = ARRAY_SIZE(wm5110_snd_controls),
1242 .dapm_widgets = wm5110_dapm_widgets,
1243 .num_dapm_widgets = ARRAY_SIZE(wm5110_dapm_widgets),
1244 .dapm_routes = wm5110_dapm_routes,
1245 .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes),
1246};
1247
Bill Pemberton7a79e942012-12-07 09:26:37 -05001248static int wm5110_probe(struct platform_device *pdev)
Mark Brown5c6af632012-07-09 19:09:41 +01001249{
1250 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
1251 struct wm5110_priv *wm5110;
1252 int i;
1253
1254 wm5110 = devm_kzalloc(&pdev->dev, sizeof(struct wm5110_priv),
1255 GFP_KERNEL);
1256 if (wm5110 == NULL)
1257 return -ENOMEM;
1258 platform_set_drvdata(pdev, wm5110);
1259
1260 wm5110->core.arizona = arizona;
Mark Brownddbce972013-02-15 17:27:22 +00001261 wm5110->core.num_inputs = 8;
Mark Brown5c6af632012-07-09 19:09:41 +01001262
1263 for (i = 0; i < ARRAY_SIZE(wm5110->fll); i++)
1264 wm5110->fll[i].vco_mult = 3;
1265
1266 arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
1267 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
1268 &wm5110->fll[0]);
1269 arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
1270 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
1271 &wm5110->fll[1]);
1272
1273 for (i = 0; i < ARRAY_SIZE(wm5110_dai); i++)
1274 arizona_init_dai(&wm5110->core, i);
1275
1276 /* Latch volume update bits */
1277 for (i = 0; i < ARRAY_SIZE(wm5110_digital_vu); i++)
1278 regmap_update_bits(arizona->regmap, wm5110_digital_vu[i],
1279 WM5110_DIG_VU, WM5110_DIG_VU);
1280
1281 pm_runtime_enable(&pdev->dev);
1282 pm_runtime_idle(&pdev->dev);
1283
1284 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110,
1285 wm5110_dai, ARRAY_SIZE(wm5110_dai));
1286}
1287
Bill Pemberton7a79e942012-12-07 09:26:37 -05001288static int wm5110_remove(struct platform_device *pdev)
Mark Brown5c6af632012-07-09 19:09:41 +01001289{
1290 snd_soc_unregister_codec(&pdev->dev);
1291 pm_runtime_disable(&pdev->dev);
1292
1293 return 0;
1294}
1295
1296static struct platform_driver wm5110_codec_driver = {
1297 .driver = {
1298 .name = "wm5110-codec",
1299 .owner = THIS_MODULE,
1300 },
1301 .probe = wm5110_probe,
Bill Pemberton7a79e942012-12-07 09:26:37 -05001302 .remove = wm5110_remove,
Mark Brown5c6af632012-07-09 19:09:41 +01001303};
1304
1305module_platform_driver(wm5110_codec_driver);
1306
1307MODULE_DESCRIPTION("ASoC WM5110 driver");
1308MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
1309MODULE_LICENSE("GPL");
1310MODULE_ALIAS("platform:wm5110-codec");