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