xref: /linux/sound/soc/codecs/wm8997.c (revision 40843aea5a9bd2c3d7917d086e6d23cb02cc4b39)
1*40843aeaSCharles Keepax /*
2*40843aeaSCharles Keepax  * wm8997.c  --  WM8997 ALSA SoC Audio driver
3*40843aeaSCharles Keepax  *
4*40843aeaSCharles Keepax  * Copyright 2012 Wolfson Microelectronics plc
5*40843aeaSCharles Keepax  *
6*40843aeaSCharles Keepax  * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
7*40843aeaSCharles Keepax  *
8*40843aeaSCharles Keepax  * This program is free software; you can redistribute it and/or modify
9*40843aeaSCharles Keepax  * it under the terms of the GNU General Public License version 2 as
10*40843aeaSCharles Keepax  * published by the Free Software Foundation.
11*40843aeaSCharles Keepax  */
12*40843aeaSCharles Keepax 
13*40843aeaSCharles Keepax #include <linux/module.h>
14*40843aeaSCharles Keepax #include <linux/moduleparam.h>
15*40843aeaSCharles Keepax #include <linux/init.h>
16*40843aeaSCharles Keepax #include <linux/delay.h>
17*40843aeaSCharles Keepax #include <linux/pm.h>
18*40843aeaSCharles Keepax #include <linux/pm_runtime.h>
19*40843aeaSCharles Keepax #include <linux/regmap.h>
20*40843aeaSCharles Keepax #include <linux/slab.h>
21*40843aeaSCharles Keepax #include <sound/core.h>
22*40843aeaSCharles Keepax #include <sound/pcm.h>
23*40843aeaSCharles Keepax #include <sound/pcm_params.h>
24*40843aeaSCharles Keepax #include <sound/soc.h>
25*40843aeaSCharles Keepax #include <sound/jack.h>
26*40843aeaSCharles Keepax #include <sound/initval.h>
27*40843aeaSCharles Keepax #include <sound/tlv.h>
28*40843aeaSCharles Keepax 
29*40843aeaSCharles Keepax #include <linux/mfd/arizona/core.h>
30*40843aeaSCharles Keepax #include <linux/mfd/arizona/registers.h>
31*40843aeaSCharles Keepax 
32*40843aeaSCharles Keepax #include "arizona.h"
33*40843aeaSCharles Keepax #include "wm8997.h"
34*40843aeaSCharles Keepax 
35*40843aeaSCharles Keepax struct wm8997_priv {
36*40843aeaSCharles Keepax 	struct arizona_priv core;
37*40843aeaSCharles Keepax 	struct arizona_fll fll[2];
38*40843aeaSCharles Keepax };
39*40843aeaSCharles Keepax 
40*40843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
41*40843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
42*40843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
43*40843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
44*40843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
45*40843aeaSCharles Keepax 
46*40843aeaSCharles Keepax static const struct reg_default wm8997_sysclk_reva_patch[] = {
47*40843aeaSCharles Keepax 	{ 0x301D, 0x7B15 },
48*40843aeaSCharles Keepax 	{ 0x301B, 0x0050 },
49*40843aeaSCharles Keepax 	{ 0x305D, 0x7B17 },
50*40843aeaSCharles Keepax 	{ 0x305B, 0x0050 },
51*40843aeaSCharles Keepax 	{ 0x3001, 0x08FE },
52*40843aeaSCharles Keepax 	{ 0x3003, 0x00F4 },
53*40843aeaSCharles Keepax 	{ 0x3041, 0x08FF },
54*40843aeaSCharles Keepax 	{ 0x3043, 0x0005 },
55*40843aeaSCharles Keepax 	{ 0x3020, 0x0225 },
56*40843aeaSCharles Keepax 	{ 0x3021, 0x0A00 },
57*40843aeaSCharles Keepax 	{ 0x3022, 0xE24D },
58*40843aeaSCharles Keepax 	{ 0x3023, 0x0800 },
59*40843aeaSCharles Keepax 	{ 0x3024, 0xE24D },
60*40843aeaSCharles Keepax 	{ 0x3025, 0xF000 },
61*40843aeaSCharles Keepax 	{ 0x3060, 0x0226 },
62*40843aeaSCharles Keepax 	{ 0x3061, 0x0A00 },
63*40843aeaSCharles Keepax 	{ 0x3062, 0xE252 },
64*40843aeaSCharles Keepax 	{ 0x3063, 0x0800 },
65*40843aeaSCharles Keepax 	{ 0x3064, 0xE252 },
66*40843aeaSCharles Keepax 	{ 0x3065, 0xF000 },
67*40843aeaSCharles Keepax 	{ 0x3116, 0x022B },
68*40843aeaSCharles Keepax 	{ 0x3117, 0xFA00 },
69*40843aeaSCharles Keepax 	{ 0x3110, 0x246C },
70*40843aeaSCharles Keepax 	{ 0x3111, 0x0A03 },
71*40843aeaSCharles Keepax 	{ 0x3112, 0x246E },
72*40843aeaSCharles Keepax 	{ 0x3113, 0x0A03 },
73*40843aeaSCharles Keepax 	{ 0x3114, 0x2470 },
74*40843aeaSCharles Keepax 	{ 0x3115, 0x0A03 },
75*40843aeaSCharles Keepax 	{ 0x3126, 0x246C },
76*40843aeaSCharles Keepax 	{ 0x3127, 0x0A02 },
77*40843aeaSCharles Keepax 	{ 0x3128, 0x246E },
78*40843aeaSCharles Keepax 	{ 0x3129, 0x0A02 },
79*40843aeaSCharles Keepax 	{ 0x312A, 0x2470 },
80*40843aeaSCharles Keepax 	{ 0x312B, 0xFA02 },
81*40843aeaSCharles Keepax 	{ 0x3125, 0x0800 },
82*40843aeaSCharles Keepax };
83*40843aeaSCharles Keepax 
84*40843aeaSCharles Keepax static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w,
85*40843aeaSCharles Keepax 			    struct snd_kcontrol *kcontrol, int event)
86*40843aeaSCharles Keepax {
87*40843aeaSCharles Keepax 	struct snd_soc_codec *codec = w->codec;
88*40843aeaSCharles Keepax 	struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
89*40843aeaSCharles Keepax 	struct regmap *regmap = codec->control_data;
90*40843aeaSCharles Keepax 	const struct reg_default *patch = NULL;
91*40843aeaSCharles Keepax 	int i, patch_size;
92*40843aeaSCharles Keepax 
93*40843aeaSCharles Keepax 	switch (arizona->rev) {
94*40843aeaSCharles Keepax 	case 0:
95*40843aeaSCharles Keepax 		patch = wm8997_sysclk_reva_patch;
96*40843aeaSCharles Keepax 		patch_size = ARRAY_SIZE(wm8997_sysclk_reva_patch);
97*40843aeaSCharles Keepax 		break;
98*40843aeaSCharles Keepax 	default:
99*40843aeaSCharles Keepax 		break;
100*40843aeaSCharles Keepax 	}
101*40843aeaSCharles Keepax 
102*40843aeaSCharles Keepax 	switch (event) {
103*40843aeaSCharles Keepax 	case SND_SOC_DAPM_POST_PMU:
104*40843aeaSCharles Keepax 		if (patch)
105*40843aeaSCharles Keepax 			for (i = 0; i < patch_size; i++)
106*40843aeaSCharles Keepax 				regmap_write(regmap, patch[i].reg,
107*40843aeaSCharles Keepax 					     patch[i].def);
108*40843aeaSCharles Keepax 		break;
109*40843aeaSCharles Keepax 	default:
110*40843aeaSCharles Keepax 		break;
111*40843aeaSCharles Keepax 	}
112*40843aeaSCharles Keepax 
113*40843aeaSCharles Keepax 	return 0;
114*40843aeaSCharles Keepax }
115*40843aeaSCharles Keepax 
116*40843aeaSCharles Keepax static const char *wm8997_osr_text[] = {
117*40843aeaSCharles Keepax 	"Low power", "Normal", "High performance",
118*40843aeaSCharles Keepax };
119*40843aeaSCharles Keepax 
120*40843aeaSCharles Keepax static const unsigned int wm8997_osr_val[] = {
121*40843aeaSCharles Keepax 	0x0, 0x3, 0x5,
122*40843aeaSCharles Keepax };
123*40843aeaSCharles Keepax 
124*40843aeaSCharles Keepax static const struct soc_enum wm8997_hpout_osr[] = {
125*40843aeaSCharles Keepax 	SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_1L,
126*40843aeaSCharles Keepax 			      ARIZONA_OUT1_OSR_SHIFT, 0x7, 3,
127*40843aeaSCharles Keepax 			      wm8997_osr_text, wm8997_osr_val),
128*40843aeaSCharles Keepax 	SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_3L,
129*40843aeaSCharles Keepax 			      ARIZONA_OUT3_OSR_SHIFT, 0x7, 3,
130*40843aeaSCharles Keepax 			      wm8997_osr_text, wm8997_osr_val),
131*40843aeaSCharles Keepax };
132*40843aeaSCharles Keepax 
133*40843aeaSCharles Keepax #define WM8997_NG_SRC(name, base) \
134*40843aeaSCharles Keepax 	SOC_SINGLE(name " NG HPOUT1L Switch",  base, 0, 1, 0), \
135*40843aeaSCharles Keepax 	SOC_SINGLE(name " NG HPOUT1R Switch",  base, 1, 1, 0), \
136*40843aeaSCharles Keepax 	SOC_SINGLE(name " NG EPOUT Switch",    base, 4, 1, 0), \
137*40843aeaSCharles Keepax 	SOC_SINGLE(name " NG SPKOUT Switch",   base, 6, 1, 0), \
138*40843aeaSCharles Keepax 	SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \
139*40843aeaSCharles Keepax 	SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0)
140*40843aeaSCharles Keepax 
141*40843aeaSCharles Keepax static const struct snd_kcontrol_new wm8997_snd_controls[] = {
142*40843aeaSCharles Keepax SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL,
143*40843aeaSCharles Keepax 	   ARIZONA_IN1_OSR_SHIFT, 1, 0),
144*40843aeaSCharles Keepax SOC_SINGLE("IN2 High Performance Switch", ARIZONA_IN2L_CONTROL,
145*40843aeaSCharles Keepax 	   ARIZONA_IN2_OSR_SHIFT, 1, 0),
146*40843aeaSCharles Keepax 
147*40843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL,
148*40843aeaSCharles Keepax 		     ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
149*40843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL,
150*40843aeaSCharles Keepax 		     ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
151*40843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL,
152*40843aeaSCharles Keepax 		     ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
153*40843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL,
154*40843aeaSCharles Keepax 		     ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
155*40843aeaSCharles Keepax 
156*40843aeaSCharles Keepax SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
157*40843aeaSCharles Keepax 	       ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
158*40843aeaSCharles Keepax SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
159*40843aeaSCharles Keepax 	       ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
160*40843aeaSCharles Keepax SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
161*40843aeaSCharles Keepax 	       ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
162*40843aeaSCharles Keepax SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
163*40843aeaSCharles Keepax 	       ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
164*40843aeaSCharles Keepax 
165*40843aeaSCharles Keepax SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
166*40843aeaSCharles Keepax SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
167*40843aeaSCharles Keepax 
168*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
169*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
170*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
171*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
172*40843aeaSCharles Keepax 
173*40843aeaSCharles Keepax SND_SOC_BYTES_MASK("EQ1 Coefficeints", ARIZONA_EQ1_1, 21,
174*40843aeaSCharles Keepax 		   ARIZONA_EQ1_ENA_MASK),
175*40843aeaSCharles Keepax SND_SOC_BYTES_MASK("EQ2 Coefficeints", ARIZONA_EQ2_1, 21,
176*40843aeaSCharles Keepax 		   ARIZONA_EQ2_ENA_MASK),
177*40843aeaSCharles Keepax SND_SOC_BYTES_MASK("EQ3 Coefficeints", ARIZONA_EQ3_1, 21,
178*40843aeaSCharles Keepax 		   ARIZONA_EQ3_ENA_MASK),
179*40843aeaSCharles Keepax SND_SOC_BYTES_MASK("EQ4 Coefficeints", ARIZONA_EQ4_1, 21,
180*40843aeaSCharles Keepax 		   ARIZONA_EQ4_ENA_MASK),
181*40843aeaSCharles Keepax 
182*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
183*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
184*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
185*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
186*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
187*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
188*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
189*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
190*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
191*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
192*40843aeaSCharles Keepax 
193*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
194*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
195*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
196*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
197*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
198*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
199*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
200*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
201*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
202*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
203*40843aeaSCharles Keepax 
204*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
205*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
206*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
207*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
208*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
209*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
210*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
211*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
212*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
213*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
214*40843aeaSCharles Keepax 
215*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
216*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
217*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
218*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
219*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
220*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
221*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
222*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
223*40843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
224*40843aeaSCharles Keepax 	       24, 0, eq_tlv),
225*40843aeaSCharles Keepax 
226*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
227*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
228*40843aeaSCharles Keepax 
229*40843aeaSCharles Keepax SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
230*40843aeaSCharles Keepax 		   ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
231*40843aeaSCharles Keepax 
232*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
233*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
234*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
235*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
236*40843aeaSCharles Keepax 
237*40843aeaSCharles Keepax SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
238*40843aeaSCharles Keepax SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
239*40843aeaSCharles Keepax SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
240*40843aeaSCharles Keepax SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
241*40843aeaSCharles Keepax 
242*40843aeaSCharles Keepax SND_SOC_BYTES("LHPF1 Coefficients", ARIZONA_HPLPF1_2, 1),
243*40843aeaSCharles Keepax SND_SOC_BYTES("LHPF2 Coefficients", ARIZONA_HPLPF2_2, 1),
244*40843aeaSCharles Keepax SND_SOC_BYTES("LHPF3 Coefficients", ARIZONA_HPLPF3_2, 1),
245*40843aeaSCharles Keepax SND_SOC_BYTES("LHPF4 Coefficients", ARIZONA_HPLPF4_2, 1),
246*40843aeaSCharles Keepax 
247*40843aeaSCharles Keepax SOC_VALUE_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
248*40843aeaSCharles Keepax SOC_VALUE_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
249*40843aeaSCharles Keepax 
250*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
251*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
252*40843aeaSCharles Keepax 
253*40843aeaSCharles Keepax SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
254*40843aeaSCharles Keepax 	       ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
255*40843aeaSCharles Keepax 
256*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
257*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
258*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EPOUT", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
259*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SPKOUT", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
260*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
261*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
262*40843aeaSCharles Keepax 
263*40843aeaSCharles Keepax SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L,
264*40843aeaSCharles Keepax 	   ARIZONA_OUT4_OSR_SHIFT, 1, 0),
265*40843aeaSCharles Keepax SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
266*40843aeaSCharles Keepax 	   ARIZONA_OUT5_OSR_SHIFT, 1, 0),
267*40843aeaSCharles Keepax 
268*40843aeaSCharles Keepax SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
269*40843aeaSCharles Keepax 	     ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
270*40843aeaSCharles Keepax SOC_SINGLE("EPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
271*40843aeaSCharles Keepax 	   ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
272*40843aeaSCharles Keepax SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
273*40843aeaSCharles Keepax 	   ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
274*40843aeaSCharles Keepax SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
275*40843aeaSCharles Keepax 	     ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
276*40843aeaSCharles Keepax 
277*40843aeaSCharles Keepax SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
278*40843aeaSCharles Keepax 		 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
279*40843aeaSCharles Keepax 		 0xbf, 0, digital_tlv),
280*40843aeaSCharles Keepax SOC_SINGLE_TLV("EPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
281*40843aeaSCharles Keepax 	       ARIZONA_OUT3L_VOL_SHIFT, 0xbf, 0, digital_tlv),
282*40843aeaSCharles Keepax SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
283*40843aeaSCharles Keepax 	       ARIZONA_OUT4L_VOL_SHIFT, 0xbf, 0, digital_tlv),
284*40843aeaSCharles Keepax SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
285*40843aeaSCharles Keepax 		 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
286*40843aeaSCharles Keepax 		 0xbf, 0, digital_tlv),
287*40843aeaSCharles Keepax 
288*40843aeaSCharles Keepax SOC_VALUE_ENUM("HPOUT1 OSR", wm8997_hpout_osr[0]),
289*40843aeaSCharles Keepax SOC_VALUE_ENUM("EPOUT OSR", wm8997_hpout_osr[1]),
290*40843aeaSCharles Keepax 
291*40843aeaSCharles Keepax SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
292*40843aeaSCharles Keepax SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
293*40843aeaSCharles Keepax 
294*40843aeaSCharles Keepax SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
295*40843aeaSCharles Keepax 	   ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
296*40843aeaSCharles Keepax 
297*40843aeaSCharles Keepax SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
298*40843aeaSCharles Keepax 	   ARIZONA_NGATE_ENA_SHIFT, 1, 0),
299*40843aeaSCharles Keepax SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
300*40843aeaSCharles Keepax 	       ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
301*40843aeaSCharles Keepax SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
302*40843aeaSCharles Keepax 
303*40843aeaSCharles Keepax WM8997_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
304*40843aeaSCharles Keepax WM8997_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
305*40843aeaSCharles Keepax WM8997_NG_SRC("EPOUT", ARIZONA_NOISE_GATE_SELECT_3L),
306*40843aeaSCharles Keepax WM8997_NG_SRC("SPKOUT", ARIZONA_NOISE_GATE_SELECT_4L),
307*40843aeaSCharles Keepax WM8997_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L),
308*40843aeaSCharles Keepax WM8997_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R),
309*40843aeaSCharles Keepax 
310*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
311*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
312*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
313*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
314*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
315*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
316*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
317*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
318*40843aeaSCharles Keepax 
319*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
320*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
321*40843aeaSCharles Keepax 
322*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX1", ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE),
323*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX2", ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE),
324*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX3", ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE),
325*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX4", ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE),
326*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
327*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
328*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
329*40843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
330*40843aeaSCharles Keepax };
331*40843aeaSCharles Keepax 
332*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
333*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
334*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
335*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
336*40843aeaSCharles Keepax 
337*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
338*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
339*40843aeaSCharles Keepax 
340*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
341*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
342*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
343*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
344*40843aeaSCharles Keepax 
345*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE);
346*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE);
347*40843aeaSCharles Keepax 
348*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
349*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
350*40843aeaSCharles Keepax 
351*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
352*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
353*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(OUT3, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
354*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SPKOUT, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
355*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
356*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
357*40843aeaSCharles Keepax 
358*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
359*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
360*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
361*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
362*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
363*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
364*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
365*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
366*40843aeaSCharles Keepax 
367*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
368*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
369*40843aeaSCharles Keepax 
370*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX1, ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE);
371*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX2, ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE);
372*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX3, ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE);
373*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX4, ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE);
374*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX5, ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE);
375*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX6, ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE);
376*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX7, ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE);
377*40843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX8, ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE);
378*40843aeaSCharles Keepax 
379*40843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE);
380*40843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE);
381*40843aeaSCharles Keepax 
382*40843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE);
383*40843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE);
384*40843aeaSCharles Keepax 
385*40843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE);
386*40843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE);
387*40843aeaSCharles Keepax 
388*40843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE);
389*40843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE);
390*40843aeaSCharles Keepax 
391*40843aeaSCharles Keepax static const char *wm8997_aec_loopback_texts[] = {
392*40843aeaSCharles Keepax 	"HPOUT1L", "HPOUT1R", "EPOUT", "SPKOUT", "SPKDAT1L", "SPKDAT1R",
393*40843aeaSCharles Keepax };
394*40843aeaSCharles Keepax 
395*40843aeaSCharles Keepax static const unsigned int wm8997_aec_loopback_values[] = {
396*40843aeaSCharles Keepax 	0, 1, 4, 6, 8, 9,
397*40843aeaSCharles Keepax };
398*40843aeaSCharles Keepax 
399*40843aeaSCharles Keepax static const struct soc_enum wm8997_aec_loopback =
400*40843aeaSCharles Keepax 	SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
401*40843aeaSCharles Keepax 			      ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
402*40843aeaSCharles Keepax 			      ARRAY_SIZE(wm8997_aec_loopback_texts),
403*40843aeaSCharles Keepax 			      wm8997_aec_loopback_texts,
404*40843aeaSCharles Keepax 			      wm8997_aec_loopback_values);
405*40843aeaSCharles Keepax 
406*40843aeaSCharles Keepax static const struct snd_kcontrol_new wm8997_aec_loopback_mux =
407*40843aeaSCharles Keepax 	SOC_DAPM_VALUE_ENUM("AEC Loopback", wm8997_aec_loopback);
408*40843aeaSCharles Keepax 
409*40843aeaSCharles Keepax static const struct snd_soc_dapm_widget wm8997_dapm_widgets[] = {
410*40843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
411*40843aeaSCharles Keepax 		    0, wm8997_sysclk_ev, SND_SOC_DAPM_POST_PMU),
412*40843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
413*40843aeaSCharles Keepax 		    ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
414*40843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
415*40843aeaSCharles Keepax 		    ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
416*40843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
417*40843aeaSCharles Keepax 		    ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
418*40843aeaSCharles Keepax 
419*40843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
420*40843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
421*40843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
422*40843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDD", 0, 0),
423*40843aeaSCharles Keepax 
424*40843aeaSCharles Keepax SND_SOC_DAPM_SIGGEN("TONE"),
425*40843aeaSCharles Keepax SND_SOC_DAPM_SIGGEN("NOISE"),
426*40843aeaSCharles Keepax SND_SOC_DAPM_SIGGEN("HAPTICS"),
427*40843aeaSCharles Keepax 
428*40843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN1L"),
429*40843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN1R"),
430*40843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN2L"),
431*40843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN2R"),
432*40843aeaSCharles Keepax 
433*40843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
434*40843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
435*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
436*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
437*40843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
438*40843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
439*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
440*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
441*40843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
442*40843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
443*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
444*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
445*40843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
446*40843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
447*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
448*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
449*40843aeaSCharles Keepax 
450*40843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
451*40843aeaSCharles Keepax 		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
452*40843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
453*40843aeaSCharles Keepax 		    ARIZONA_MICB2_ENA_SHIFT, 0, NULL, 0),
454*40843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
455*40843aeaSCharles Keepax 		    ARIZONA_MICB3_ENA_SHIFT, 0, NULL, 0),
456*40843aeaSCharles Keepax 
457*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
458*40843aeaSCharles Keepax 		 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
459*40843aeaSCharles Keepax 
460*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
461*40843aeaSCharles Keepax 		 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
462*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
463*40843aeaSCharles Keepax 		 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
464*40843aeaSCharles Keepax 
465*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1,
466*40843aeaSCharles Keepax 		 ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0),
467*40843aeaSCharles Keepax 
468*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
469*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
470*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
471*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
472*40843aeaSCharles Keepax 
473*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
474*40843aeaSCharles Keepax 		 NULL, 0),
475*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
476*40843aeaSCharles Keepax 		 NULL, 0),
477*40843aeaSCharles Keepax 
478*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
479*40843aeaSCharles Keepax 		 NULL, 0),
480*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
481*40843aeaSCharles Keepax 		 NULL, 0),
482*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
483*40843aeaSCharles Keepax 		 NULL, 0),
484*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
485*40843aeaSCharles Keepax 		 NULL, 0),
486*40843aeaSCharles Keepax 
487*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
488*40843aeaSCharles Keepax 		 0, NULL, 0),
489*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
490*40843aeaSCharles Keepax 		 0, NULL, 0),
491*40843aeaSCharles Keepax 
492*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3,
493*40843aeaSCharles Keepax 		 ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0),
494*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3,
495*40843aeaSCharles Keepax 		 ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
496*40843aeaSCharles Keepax 
497*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3,
498*40843aeaSCharles Keepax 		 ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0),
499*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3,
500*40843aeaSCharles Keepax 		 ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
501*40843aeaSCharles Keepax 
502*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3,
503*40843aeaSCharles Keepax 		 ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0),
504*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3,
505*40843aeaSCharles Keepax 		 ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
506*40843aeaSCharles Keepax 
507*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3,
508*40843aeaSCharles Keepax 		 ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0),
509*40843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3,
510*40843aeaSCharles Keepax 		 ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
511*40843aeaSCharles Keepax 
512*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
513*40843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
514*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
515*40843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
516*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
517*40843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
518*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
519*40843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
520*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
521*40843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
522*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
523*40843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
524*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0,
525*40843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
526*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0,
527*40843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
528*40843aeaSCharles Keepax 
529*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
530*40843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
531*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
532*40843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
533*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
534*40843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
535*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
536*40843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
537*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
538*40843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
539*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
540*40843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
541*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0,
542*40843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
543*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0,
544*40843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
545*40843aeaSCharles Keepax 
546*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
547*40843aeaSCharles Keepax 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
548*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
549*40843aeaSCharles Keepax 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
550*40843aeaSCharles Keepax 
551*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
552*40843aeaSCharles Keepax 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
553*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
554*40843aeaSCharles Keepax 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
555*40843aeaSCharles Keepax 
556*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
557*40843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
558*40843aeaSCharles Keepax 		     ARIZONA_SLIMTX1_ENA_SHIFT, 0),
559*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 0,
560*40843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
561*40843aeaSCharles Keepax 		     ARIZONA_SLIMTX2_ENA_SHIFT, 0),
562*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 0,
563*40843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
564*40843aeaSCharles Keepax 		     ARIZONA_SLIMTX3_ENA_SHIFT, 0),
565*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 0,
566*40843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
567*40843aeaSCharles Keepax 		     ARIZONA_SLIMTX4_ENA_SHIFT, 0),
568*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 0,
569*40843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
570*40843aeaSCharles Keepax 		     ARIZONA_SLIMTX5_ENA_SHIFT, 0),
571*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 0,
572*40843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
573*40843aeaSCharles Keepax 		     ARIZONA_SLIMTX6_ENA_SHIFT, 0),
574*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX7", NULL, 0,
575*40843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
576*40843aeaSCharles Keepax 		     ARIZONA_SLIMTX7_ENA_SHIFT, 0),
577*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX8", NULL, 0,
578*40843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
579*40843aeaSCharles Keepax 		     ARIZONA_SLIMTX8_ENA_SHIFT, 0),
580*40843aeaSCharles Keepax 
581*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0,
582*40843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
583*40843aeaSCharles Keepax 		    ARIZONA_SLIMRX1_ENA_SHIFT, 0),
584*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 0,
585*40843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
586*40843aeaSCharles Keepax 		    ARIZONA_SLIMRX2_ENA_SHIFT, 0),
587*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 0,
588*40843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
589*40843aeaSCharles Keepax 		    ARIZONA_SLIMRX3_ENA_SHIFT, 0),
590*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 0,
591*40843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
592*40843aeaSCharles Keepax 		    ARIZONA_SLIMRX4_ENA_SHIFT, 0),
593*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL, 0,
594*40843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
595*40843aeaSCharles Keepax 		    ARIZONA_SLIMRX5_ENA_SHIFT, 0),
596*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL, 0,
597*40843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
598*40843aeaSCharles Keepax 		    ARIZONA_SLIMRX6_ENA_SHIFT, 0),
599*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX7", NULL, 0,
600*40843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
601*40843aeaSCharles Keepax 		    ARIZONA_SLIMRX7_ENA_SHIFT, 0),
602*40843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 0,
603*40843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
604*40843aeaSCharles Keepax 		    ARIZONA_SLIMRX8_ENA_SHIFT, 0),
605*40843aeaSCharles Keepax 
606*40843aeaSCharles Keepax SND_SOC_DAPM_VALUE_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
607*40843aeaSCharles Keepax 		       ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0,
608*40843aeaSCharles Keepax 		       &wm8997_aec_loopback_mux),
609*40843aeaSCharles Keepax 
610*40843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
611*40843aeaSCharles Keepax 		   ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
612*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
613*40843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
614*40843aeaSCharles Keepax 		   ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
615*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
616*40843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
617*40843aeaSCharles Keepax 		   ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
618*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
619*40843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
620*40843aeaSCharles Keepax 		   ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
621*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
622*40843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
623*40843aeaSCharles Keepax 		   ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
624*40843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
625*40843aeaSCharles Keepax 
626*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
627*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
628*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"),
629*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"),
630*40843aeaSCharles Keepax 
631*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
632*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
633*40843aeaSCharles Keepax 
634*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
635*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
636*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
637*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
638*40843aeaSCharles Keepax 
639*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(Mic, "Mic"),
640*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(Noise, "Noise"),
641*40843aeaSCharles Keepax 
642*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
643*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
644*40843aeaSCharles Keepax 
645*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
646*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
647*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(OUT3, "EPOUT"),
648*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SPKOUT, "SPKOUT"),
649*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
650*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
651*40843aeaSCharles Keepax 
652*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
653*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
654*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
655*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
656*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
657*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
658*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
659*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
660*40843aeaSCharles Keepax 
661*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
662*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
663*40843aeaSCharles Keepax 
664*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX1, "SLIMTX1"),
665*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX2, "SLIMTX2"),
666*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX3, "SLIMTX3"),
667*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX4, "SLIMTX4"),
668*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX5, "SLIMTX5"),
669*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX6, "SLIMTX6"),
670*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX7, "SLIMTX7"),
671*40843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX8, "SLIMTX8"),
672*40843aeaSCharles Keepax 
673*40843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
674*40843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
675*40843aeaSCharles Keepax 
676*40843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
677*40843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
678*40843aeaSCharles Keepax 
679*40843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
680*40843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
681*40843aeaSCharles Keepax 
682*40843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
683*40843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
684*40843aeaSCharles Keepax 
685*40843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("HPOUT1L"),
686*40843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("HPOUT1R"),
687*40843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("EPOUTN"),
688*40843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("EPOUTP"),
689*40843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKOUTN"),
690*40843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKOUTP"),
691*40843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
692*40843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
693*40843aeaSCharles Keepax 
694*40843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("MICSUPP"),
695*40843aeaSCharles Keepax };
696*40843aeaSCharles Keepax 
697*40843aeaSCharles Keepax #define ARIZONA_MIXER_INPUT_ROUTES(name)	\
698*40843aeaSCharles Keepax 	{ name, "Noise Generator", "Noise Generator" }, \
699*40843aeaSCharles Keepax 	{ name, "Tone Generator 1", "Tone Generator 1" }, \
700*40843aeaSCharles Keepax 	{ name, "Tone Generator 2", "Tone Generator 2" }, \
701*40843aeaSCharles Keepax 	{ name, "Haptics", "HAPTICS" }, \
702*40843aeaSCharles Keepax 	{ name, "AEC", "AEC Loopback" }, \
703*40843aeaSCharles Keepax 	{ name, "IN1L", "IN1L PGA" }, \
704*40843aeaSCharles Keepax 	{ name, "IN1R", "IN1R PGA" }, \
705*40843aeaSCharles Keepax 	{ name, "IN2L", "IN2L PGA" }, \
706*40843aeaSCharles Keepax 	{ name, "IN2R", "IN2R PGA" }, \
707*40843aeaSCharles Keepax 	{ name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
708*40843aeaSCharles Keepax 	{ name, "AIF1RX1", "AIF1RX1" }, \
709*40843aeaSCharles Keepax 	{ name, "AIF1RX2", "AIF1RX2" }, \
710*40843aeaSCharles Keepax 	{ name, "AIF1RX3", "AIF1RX3" }, \
711*40843aeaSCharles Keepax 	{ name, "AIF1RX4", "AIF1RX4" }, \
712*40843aeaSCharles Keepax 	{ name, "AIF1RX5", "AIF1RX5" }, \
713*40843aeaSCharles Keepax 	{ name, "AIF1RX6", "AIF1RX6" }, \
714*40843aeaSCharles Keepax 	{ name, "AIF1RX7", "AIF1RX7" }, \
715*40843aeaSCharles Keepax 	{ name, "AIF1RX8", "AIF1RX8" }, \
716*40843aeaSCharles Keepax 	{ name, "AIF2RX1", "AIF2RX1" }, \
717*40843aeaSCharles Keepax 	{ name, "AIF2RX2", "AIF2RX2" }, \
718*40843aeaSCharles Keepax 	{ name, "SLIMRX1", "SLIMRX1" }, \
719*40843aeaSCharles Keepax 	{ name, "SLIMRX2", "SLIMRX2" }, \
720*40843aeaSCharles Keepax 	{ name, "SLIMRX3", "SLIMRX3" }, \
721*40843aeaSCharles Keepax 	{ name, "SLIMRX4", "SLIMRX4" }, \
722*40843aeaSCharles Keepax 	{ name, "SLIMRX5", "SLIMRX5" }, \
723*40843aeaSCharles Keepax 	{ name, "SLIMRX6", "SLIMRX6" }, \
724*40843aeaSCharles Keepax 	{ name, "SLIMRX7", "SLIMRX7" }, \
725*40843aeaSCharles Keepax 	{ name, "SLIMRX8", "SLIMRX8" }, \
726*40843aeaSCharles Keepax 	{ name, "EQ1", "EQ1" }, \
727*40843aeaSCharles Keepax 	{ name, "EQ2", "EQ2" }, \
728*40843aeaSCharles Keepax 	{ name, "EQ3", "EQ3" }, \
729*40843aeaSCharles Keepax 	{ name, "EQ4", "EQ4" }, \
730*40843aeaSCharles Keepax 	{ name, "DRC1L", "DRC1L" }, \
731*40843aeaSCharles Keepax 	{ name, "DRC1R", "DRC1R" }, \
732*40843aeaSCharles Keepax 	{ name, "LHPF1", "LHPF1" }, \
733*40843aeaSCharles Keepax 	{ name, "LHPF2", "LHPF2" }, \
734*40843aeaSCharles Keepax 	{ name, "LHPF3", "LHPF3" }, \
735*40843aeaSCharles Keepax 	{ name, "LHPF4", "LHPF4" }, \
736*40843aeaSCharles Keepax 	{ name, "ISRC1DEC1", "ISRC1DEC1" }, \
737*40843aeaSCharles Keepax 	{ name, "ISRC1DEC2", "ISRC1DEC2" }, \
738*40843aeaSCharles Keepax 	{ name, "ISRC1INT1", "ISRC1INT1" }, \
739*40843aeaSCharles Keepax 	{ name, "ISRC1INT2", "ISRC1INT2" }, \
740*40843aeaSCharles Keepax 	{ name, "ISRC2DEC1", "ISRC2DEC1" }, \
741*40843aeaSCharles Keepax 	{ name, "ISRC2DEC2", "ISRC2DEC2" }, \
742*40843aeaSCharles Keepax 	{ name, "ISRC2INT1", "ISRC2INT1" }, \
743*40843aeaSCharles Keepax 	{ name, "ISRC2INT2", "ISRC2INT2" }
744*40843aeaSCharles Keepax 
745*40843aeaSCharles Keepax static const struct snd_soc_dapm_route wm8997_dapm_routes[] = {
746*40843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "DBVDD2" },
747*40843aeaSCharles Keepax 	{ "AIF2 Playback", NULL, "DBVDD2" },
748*40843aeaSCharles Keepax 
749*40843aeaSCharles Keepax 	{ "OUT1L", NULL, "CPVDD" },
750*40843aeaSCharles Keepax 	{ "OUT1R", NULL, "CPVDD" },
751*40843aeaSCharles Keepax 	{ "OUT3L", NULL, "CPVDD" },
752*40843aeaSCharles Keepax 
753*40843aeaSCharles Keepax 	{ "OUT4L", NULL, "SPKVDD" },
754*40843aeaSCharles Keepax 
755*40843aeaSCharles Keepax 	{ "OUT1L", NULL, "SYSCLK" },
756*40843aeaSCharles Keepax 	{ "OUT1R", NULL, "SYSCLK" },
757*40843aeaSCharles Keepax 	{ "OUT3L", NULL, "SYSCLK" },
758*40843aeaSCharles Keepax 	{ "OUT4L", NULL, "SYSCLK" },
759*40843aeaSCharles Keepax 
760*40843aeaSCharles Keepax 	{ "IN1L", NULL, "SYSCLK" },
761*40843aeaSCharles Keepax 	{ "IN1R", NULL, "SYSCLK" },
762*40843aeaSCharles Keepax 	{ "IN2L", NULL, "SYSCLK" },
763*40843aeaSCharles Keepax 	{ "IN2R", NULL, "SYSCLK" },
764*40843aeaSCharles Keepax 
765*40843aeaSCharles Keepax 	{ "MICBIAS1", NULL, "MICVDD" },
766*40843aeaSCharles Keepax 	{ "MICBIAS2", NULL, "MICVDD" },
767*40843aeaSCharles Keepax 	{ "MICBIAS3", NULL, "MICVDD" },
768*40843aeaSCharles Keepax 
769*40843aeaSCharles Keepax 	{ "Noise Generator", NULL, "SYSCLK" },
770*40843aeaSCharles Keepax 	{ "Tone Generator 1", NULL, "SYSCLK" },
771*40843aeaSCharles Keepax 	{ "Tone Generator 2", NULL, "SYSCLK" },
772*40843aeaSCharles Keepax 
773*40843aeaSCharles Keepax 	{ "Noise Generator", NULL, "NOISE" },
774*40843aeaSCharles Keepax 	{ "Tone Generator 1", NULL, "TONE" },
775*40843aeaSCharles Keepax 	{ "Tone Generator 2", NULL, "TONE" },
776*40843aeaSCharles Keepax 
777*40843aeaSCharles Keepax 	{ "Mic Mute Mixer", NULL, "Noise Mixer" },
778*40843aeaSCharles Keepax 	{ "Mic Mute Mixer", NULL, "Mic Mixer" },
779*40843aeaSCharles Keepax 
780*40843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX1" },
781*40843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX2" },
782*40843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX3" },
783*40843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX4" },
784*40843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX5" },
785*40843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX6" },
786*40843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX7" },
787*40843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX8" },
788*40843aeaSCharles Keepax 
789*40843aeaSCharles Keepax 	{ "AIF1RX1", NULL, "AIF1 Playback" },
790*40843aeaSCharles Keepax 	{ "AIF1RX2", NULL, "AIF1 Playback" },
791*40843aeaSCharles Keepax 	{ "AIF1RX3", NULL, "AIF1 Playback" },
792*40843aeaSCharles Keepax 	{ "AIF1RX4", NULL, "AIF1 Playback" },
793*40843aeaSCharles Keepax 	{ "AIF1RX5", NULL, "AIF1 Playback" },
794*40843aeaSCharles Keepax 	{ "AIF1RX6", NULL, "AIF1 Playback" },
795*40843aeaSCharles Keepax 	{ "AIF1RX7", NULL, "AIF1 Playback" },
796*40843aeaSCharles Keepax 	{ "AIF1RX8", NULL, "AIF1 Playback" },
797*40843aeaSCharles Keepax 
798*40843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "AIF2TX1" },
799*40843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "AIF2TX2" },
800*40843aeaSCharles Keepax 
801*40843aeaSCharles Keepax 	{ "AIF2RX1", NULL, "AIF2 Playback" },
802*40843aeaSCharles Keepax 	{ "AIF2RX2", NULL, "AIF2 Playback" },
803*40843aeaSCharles Keepax 
804*40843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX1" },
805*40843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX2" },
806*40843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX3" },
807*40843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX4" },
808*40843aeaSCharles Keepax 
809*40843aeaSCharles Keepax 	{ "SLIMRX1", NULL, "Slim1 Playback" },
810*40843aeaSCharles Keepax 	{ "SLIMRX2", NULL, "Slim1 Playback" },
811*40843aeaSCharles Keepax 	{ "SLIMRX3", NULL, "Slim1 Playback" },
812*40843aeaSCharles Keepax 	{ "SLIMRX4", NULL, "Slim1 Playback" },
813*40843aeaSCharles Keepax 
814*40843aeaSCharles Keepax 	{ "Slim2 Capture", NULL, "SLIMTX5" },
815*40843aeaSCharles Keepax 	{ "Slim2 Capture", NULL, "SLIMTX6" },
816*40843aeaSCharles Keepax 
817*40843aeaSCharles Keepax 	{ "SLIMRX5", NULL, "Slim2 Playback" },
818*40843aeaSCharles Keepax 	{ "SLIMRX6", NULL, "Slim2 Playback" },
819*40843aeaSCharles Keepax 
820*40843aeaSCharles Keepax 	{ "Slim3 Capture", NULL, "SLIMTX7" },
821*40843aeaSCharles Keepax 	{ "Slim3 Capture", NULL, "SLIMTX8" },
822*40843aeaSCharles Keepax 
823*40843aeaSCharles Keepax 	{ "SLIMRX7", NULL, "Slim3 Playback" },
824*40843aeaSCharles Keepax 	{ "SLIMRX8", NULL, "Slim3 Playback" },
825*40843aeaSCharles Keepax 
826*40843aeaSCharles Keepax 	{ "AIF1 Playback", NULL, "SYSCLK" },
827*40843aeaSCharles Keepax 	{ "AIF2 Playback", NULL, "SYSCLK" },
828*40843aeaSCharles Keepax 	{ "Slim1 Playback", NULL, "SYSCLK" },
829*40843aeaSCharles Keepax 	{ "Slim2 Playback", NULL, "SYSCLK" },
830*40843aeaSCharles Keepax 	{ "Slim3 Playback", NULL, "SYSCLK" },
831*40843aeaSCharles Keepax 
832*40843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "SYSCLK" },
833*40843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "SYSCLK" },
834*40843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SYSCLK" },
835*40843aeaSCharles Keepax 	{ "Slim2 Capture", NULL, "SYSCLK" },
836*40843aeaSCharles Keepax 	{ "Slim3 Capture", NULL, "SYSCLK" },
837*40843aeaSCharles Keepax 
838*40843aeaSCharles Keepax 	{ "IN1L PGA", NULL, "IN1L" },
839*40843aeaSCharles Keepax 	{ "IN1R PGA", NULL, "IN1R" },
840*40843aeaSCharles Keepax 
841*40843aeaSCharles Keepax 	{ "IN2L PGA", NULL, "IN2L" },
842*40843aeaSCharles Keepax 	{ "IN2R PGA", NULL, "IN2R" },
843*40843aeaSCharles Keepax 
844*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
845*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
846*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT3L", "EPOUT"),
847*40843aeaSCharles Keepax 
848*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUT"),
849*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
850*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
851*40843aeaSCharles Keepax 
852*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
853*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
854*40843aeaSCharles Keepax 
855*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
856*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
857*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
858*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
859*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
860*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
861*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
862*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
863*40843aeaSCharles Keepax 
864*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
865*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
866*40843aeaSCharles Keepax 
867*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
868*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
869*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
870*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
871*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
872*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
873*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX7", "SLIMTX7"),
874*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX8", "SLIMTX8"),
875*40843aeaSCharles Keepax 
876*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
877*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
878*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
879*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
880*40843aeaSCharles Keepax 
881*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
882*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
883*40843aeaSCharles Keepax 
884*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
885*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
886*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
887*40843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
888*40843aeaSCharles Keepax 
889*40843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
890*40843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC2INT2"),
891*40843aeaSCharles Keepax 
892*40843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
893*40843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
894*40843aeaSCharles Keepax 
895*40843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
896*40843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
897*40843aeaSCharles Keepax 
898*40843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
899*40843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
900*40843aeaSCharles Keepax 
901*40843aeaSCharles Keepax 	{ "AEC Loopback", "HPOUT1L", "OUT1L" },
902*40843aeaSCharles Keepax 	{ "AEC Loopback", "HPOUT1R", "OUT1R" },
903*40843aeaSCharles Keepax 	{ "HPOUT1L", NULL, "OUT1L" },
904*40843aeaSCharles Keepax 	{ "HPOUT1R", NULL, "OUT1R" },
905*40843aeaSCharles Keepax 
906*40843aeaSCharles Keepax 	{ "AEC Loopback", "EPOUT", "OUT3L" },
907*40843aeaSCharles Keepax 	{ "EPOUTN", NULL, "OUT3L" },
908*40843aeaSCharles Keepax 	{ "EPOUTP", NULL, "OUT3L" },
909*40843aeaSCharles Keepax 
910*40843aeaSCharles Keepax 	{ "AEC Loopback", "SPKOUT", "OUT4L" },
911*40843aeaSCharles Keepax 	{ "SPKOUTN", NULL, "OUT4L" },
912*40843aeaSCharles Keepax 	{ "SPKOUTP", NULL, "OUT4L" },
913*40843aeaSCharles Keepax 
914*40843aeaSCharles Keepax 	{ "AEC Loopback", "SPKDAT1L", "OUT5L" },
915*40843aeaSCharles Keepax 	{ "AEC Loopback", "SPKDAT1R", "OUT5R" },
916*40843aeaSCharles Keepax 	{ "SPKDAT1L", NULL, "OUT5L" },
917*40843aeaSCharles Keepax 	{ "SPKDAT1R", NULL, "OUT5R" },
918*40843aeaSCharles Keepax 
919*40843aeaSCharles Keepax 	{ "MICSUPP", NULL, "SYSCLK" },
920*40843aeaSCharles Keepax };
921*40843aeaSCharles Keepax 
922*40843aeaSCharles Keepax static int wm8997_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
923*40843aeaSCharles Keepax 			  unsigned int Fref, unsigned int Fout)
924*40843aeaSCharles Keepax {
925*40843aeaSCharles Keepax 	struct wm8997_priv *wm8997 = snd_soc_codec_get_drvdata(codec);
926*40843aeaSCharles Keepax 
927*40843aeaSCharles Keepax 	switch (fll_id) {
928*40843aeaSCharles Keepax 	case WM8997_FLL1:
929*40843aeaSCharles Keepax 		return arizona_set_fll(&wm8997->fll[0], source, Fref, Fout);
930*40843aeaSCharles Keepax 	case WM8997_FLL2:
931*40843aeaSCharles Keepax 		return arizona_set_fll(&wm8997->fll[1], source, Fref, Fout);
932*40843aeaSCharles Keepax 	case WM8997_FLL1_REFCLK:
933*40843aeaSCharles Keepax 		return arizona_set_fll_refclk(&wm8997->fll[0], source, Fref,
934*40843aeaSCharles Keepax 					      Fout);
935*40843aeaSCharles Keepax 	case WM8997_FLL2_REFCLK:
936*40843aeaSCharles Keepax 		return arizona_set_fll_refclk(&wm8997->fll[1], source, Fref,
937*40843aeaSCharles Keepax 					      Fout);
938*40843aeaSCharles Keepax 	default:
939*40843aeaSCharles Keepax 		return -EINVAL;
940*40843aeaSCharles Keepax 	}
941*40843aeaSCharles Keepax }
942*40843aeaSCharles Keepax 
943*40843aeaSCharles Keepax #define WM8997_RATES SNDRV_PCM_RATE_8000_192000
944*40843aeaSCharles Keepax 
945*40843aeaSCharles Keepax #define WM8997_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
946*40843aeaSCharles Keepax 			SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
947*40843aeaSCharles Keepax 
948*40843aeaSCharles Keepax static struct snd_soc_dai_driver wm8997_dai[] = {
949*40843aeaSCharles Keepax 	{
950*40843aeaSCharles Keepax 		.name = "wm8997-aif1",
951*40843aeaSCharles Keepax 		.id = 1,
952*40843aeaSCharles Keepax 		.base = ARIZONA_AIF1_BCLK_CTRL,
953*40843aeaSCharles Keepax 		.playback = {
954*40843aeaSCharles Keepax 			.stream_name = "AIF1 Playback",
955*40843aeaSCharles Keepax 			.channels_min = 1,
956*40843aeaSCharles Keepax 			.channels_max = 8,
957*40843aeaSCharles Keepax 			.rates = WM8997_RATES,
958*40843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
959*40843aeaSCharles Keepax 		},
960*40843aeaSCharles Keepax 		.capture = {
961*40843aeaSCharles Keepax 			 .stream_name = "AIF1 Capture",
962*40843aeaSCharles Keepax 			 .channels_min = 1,
963*40843aeaSCharles Keepax 			 .channels_max = 8,
964*40843aeaSCharles Keepax 			 .rates = WM8997_RATES,
965*40843aeaSCharles Keepax 			 .formats = WM8997_FORMATS,
966*40843aeaSCharles Keepax 		 },
967*40843aeaSCharles Keepax 		.ops = &arizona_dai_ops,
968*40843aeaSCharles Keepax 		.symmetric_rates = 1,
969*40843aeaSCharles Keepax 	},
970*40843aeaSCharles Keepax 	{
971*40843aeaSCharles Keepax 		.name = "wm8997-aif2",
972*40843aeaSCharles Keepax 		.id = 2,
973*40843aeaSCharles Keepax 		.base = ARIZONA_AIF2_BCLK_CTRL,
974*40843aeaSCharles Keepax 		.playback = {
975*40843aeaSCharles Keepax 			.stream_name = "AIF2 Playback",
976*40843aeaSCharles Keepax 			.channels_min = 1,
977*40843aeaSCharles Keepax 			.channels_max = 2,
978*40843aeaSCharles Keepax 			.rates = WM8997_RATES,
979*40843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
980*40843aeaSCharles Keepax 		},
981*40843aeaSCharles Keepax 		.capture = {
982*40843aeaSCharles Keepax 			 .stream_name = "AIF2 Capture",
983*40843aeaSCharles Keepax 			 .channels_min = 1,
984*40843aeaSCharles Keepax 			 .channels_max = 2,
985*40843aeaSCharles Keepax 			 .rates = WM8997_RATES,
986*40843aeaSCharles Keepax 			 .formats = WM8997_FORMATS,
987*40843aeaSCharles Keepax 		 },
988*40843aeaSCharles Keepax 		.ops = &arizona_dai_ops,
989*40843aeaSCharles Keepax 		.symmetric_rates = 1,
990*40843aeaSCharles Keepax 	},
991*40843aeaSCharles Keepax 	{
992*40843aeaSCharles Keepax 		.name = "wm8997-slim1",
993*40843aeaSCharles Keepax 		.id = 3,
994*40843aeaSCharles Keepax 		.playback = {
995*40843aeaSCharles Keepax 			.stream_name = "Slim1 Playback",
996*40843aeaSCharles Keepax 			.channels_min = 1,
997*40843aeaSCharles Keepax 			.channels_max = 4,
998*40843aeaSCharles Keepax 			.rates = WM8997_RATES,
999*40843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
1000*40843aeaSCharles Keepax 		},
1001*40843aeaSCharles Keepax 		.capture = {
1002*40843aeaSCharles Keepax 			.stream_name = "Slim1 Capture",
1003*40843aeaSCharles Keepax 			.channels_min = 1,
1004*40843aeaSCharles Keepax 			.channels_max = 4,
1005*40843aeaSCharles Keepax 			.rates = WM8997_RATES,
1006*40843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
1007*40843aeaSCharles Keepax 		},
1008*40843aeaSCharles Keepax 		.ops = &arizona_simple_dai_ops,
1009*40843aeaSCharles Keepax 	},
1010*40843aeaSCharles Keepax 	{
1011*40843aeaSCharles Keepax 		.name = "wm8997-slim2",
1012*40843aeaSCharles Keepax 		.id = 4,
1013*40843aeaSCharles Keepax 		.playback = {
1014*40843aeaSCharles Keepax 			.stream_name = "Slim2 Playback",
1015*40843aeaSCharles Keepax 			.channels_min = 1,
1016*40843aeaSCharles Keepax 			.channels_max = 2,
1017*40843aeaSCharles Keepax 			.rates = WM8997_RATES,
1018*40843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
1019*40843aeaSCharles Keepax 		},
1020*40843aeaSCharles Keepax 		.capture = {
1021*40843aeaSCharles Keepax 			.stream_name = "Slim2 Capture",
1022*40843aeaSCharles Keepax 			.channels_min = 1,
1023*40843aeaSCharles Keepax 			.channels_max = 2,
1024*40843aeaSCharles Keepax 			.rates = WM8997_RATES,
1025*40843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
1026*40843aeaSCharles Keepax 		},
1027*40843aeaSCharles Keepax 		.ops = &arizona_simple_dai_ops,
1028*40843aeaSCharles Keepax 	},
1029*40843aeaSCharles Keepax 	{
1030*40843aeaSCharles Keepax 		.name = "wm8997-slim3",
1031*40843aeaSCharles Keepax 		.id = 5,
1032*40843aeaSCharles Keepax 		.playback = {
1033*40843aeaSCharles Keepax 			.stream_name = "Slim3 Playback",
1034*40843aeaSCharles Keepax 			.channels_min = 1,
1035*40843aeaSCharles Keepax 			.channels_max = 2,
1036*40843aeaSCharles Keepax 			.rates = WM8997_RATES,
1037*40843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
1038*40843aeaSCharles Keepax 		},
1039*40843aeaSCharles Keepax 		.capture = {
1040*40843aeaSCharles Keepax 			.stream_name = "Slim3 Capture",
1041*40843aeaSCharles Keepax 			.channels_min = 1,
1042*40843aeaSCharles Keepax 			.channels_max = 2,
1043*40843aeaSCharles Keepax 			.rates = WM8997_RATES,
1044*40843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
1045*40843aeaSCharles Keepax 		},
1046*40843aeaSCharles Keepax 		.ops = &arizona_simple_dai_ops,
1047*40843aeaSCharles Keepax 	},
1048*40843aeaSCharles Keepax };
1049*40843aeaSCharles Keepax 
1050*40843aeaSCharles Keepax static int wm8997_codec_probe(struct snd_soc_codec *codec)
1051*40843aeaSCharles Keepax {
1052*40843aeaSCharles Keepax 	struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);
1053*40843aeaSCharles Keepax 	int ret;
1054*40843aeaSCharles Keepax 
1055*40843aeaSCharles Keepax 	codec->control_data = priv->core.arizona->regmap;
1056*40843aeaSCharles Keepax 
1057*40843aeaSCharles Keepax 	ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
1058*40843aeaSCharles Keepax 	if (ret != 0)
1059*40843aeaSCharles Keepax 		return ret;
1060*40843aeaSCharles Keepax 
1061*40843aeaSCharles Keepax 	arizona_init_spk(codec);
1062*40843aeaSCharles Keepax 
1063*40843aeaSCharles Keepax 	snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
1064*40843aeaSCharles Keepax 
1065*40843aeaSCharles Keepax 	priv->core.arizona->dapm = &codec->dapm;
1066*40843aeaSCharles Keepax 
1067*40843aeaSCharles Keepax 	return 0;
1068*40843aeaSCharles Keepax }
1069*40843aeaSCharles Keepax 
1070*40843aeaSCharles Keepax static int wm8997_codec_remove(struct snd_soc_codec *codec)
1071*40843aeaSCharles Keepax {
1072*40843aeaSCharles Keepax 	struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);
1073*40843aeaSCharles Keepax 
1074*40843aeaSCharles Keepax 	priv->core.arizona->dapm = NULL;
1075*40843aeaSCharles Keepax 
1076*40843aeaSCharles Keepax 	return 0;
1077*40843aeaSCharles Keepax }
1078*40843aeaSCharles Keepax 
1079*40843aeaSCharles Keepax #define WM8997_DIG_VU 0x0200
1080*40843aeaSCharles Keepax 
1081*40843aeaSCharles Keepax static unsigned int wm8997_digital_vu[] = {
1082*40843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_1L,
1083*40843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_1R,
1084*40843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_3L,
1085*40843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_4L,
1086*40843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_5L,
1087*40843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_5R,
1088*40843aeaSCharles Keepax };
1089*40843aeaSCharles Keepax 
1090*40843aeaSCharles Keepax static struct snd_soc_codec_driver soc_codec_dev_wm8997 = {
1091*40843aeaSCharles Keepax 	.probe = wm8997_codec_probe,
1092*40843aeaSCharles Keepax 	.remove = wm8997_codec_remove,
1093*40843aeaSCharles Keepax 
1094*40843aeaSCharles Keepax 	.idle_bias_off = true,
1095*40843aeaSCharles Keepax 
1096*40843aeaSCharles Keepax 	.set_sysclk = arizona_set_sysclk,
1097*40843aeaSCharles Keepax 	.set_pll = wm8997_set_fll,
1098*40843aeaSCharles Keepax 
1099*40843aeaSCharles Keepax 	.controls = wm8997_snd_controls,
1100*40843aeaSCharles Keepax 	.num_controls = ARRAY_SIZE(wm8997_snd_controls),
1101*40843aeaSCharles Keepax 	.dapm_widgets = wm8997_dapm_widgets,
1102*40843aeaSCharles Keepax 	.num_dapm_widgets = ARRAY_SIZE(wm8997_dapm_widgets),
1103*40843aeaSCharles Keepax 	.dapm_routes = wm8997_dapm_routes,
1104*40843aeaSCharles Keepax 	.num_dapm_routes = ARRAY_SIZE(wm8997_dapm_routes),
1105*40843aeaSCharles Keepax };
1106*40843aeaSCharles Keepax 
1107*40843aeaSCharles Keepax static int wm8997_probe(struct platform_device *pdev)
1108*40843aeaSCharles Keepax {
1109*40843aeaSCharles Keepax 	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
1110*40843aeaSCharles Keepax 	struct wm8997_priv *wm8997;
1111*40843aeaSCharles Keepax 	int i;
1112*40843aeaSCharles Keepax 
1113*40843aeaSCharles Keepax 	wm8997 = devm_kzalloc(&pdev->dev, sizeof(struct wm8997_priv),
1114*40843aeaSCharles Keepax 			      GFP_KERNEL);
1115*40843aeaSCharles Keepax 	if (wm8997 == NULL)
1116*40843aeaSCharles Keepax 		return -ENOMEM;
1117*40843aeaSCharles Keepax 	platform_set_drvdata(pdev, wm8997);
1118*40843aeaSCharles Keepax 
1119*40843aeaSCharles Keepax 	wm8997->core.arizona = arizona;
1120*40843aeaSCharles Keepax 	wm8997->core.num_inputs = 4;
1121*40843aeaSCharles Keepax 
1122*40843aeaSCharles Keepax 	for (i = 0; i < ARRAY_SIZE(wm8997->fll); i++)
1123*40843aeaSCharles Keepax 		wm8997->fll[i].vco_mult = 1;
1124*40843aeaSCharles Keepax 
1125*40843aeaSCharles Keepax 	arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
1126*40843aeaSCharles Keepax 			 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
1127*40843aeaSCharles Keepax 			 &wm8997->fll[0]);
1128*40843aeaSCharles Keepax 	arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
1129*40843aeaSCharles Keepax 			 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
1130*40843aeaSCharles Keepax 			 &wm8997->fll[1]);
1131*40843aeaSCharles Keepax 
1132*40843aeaSCharles Keepax 	/* SR2 fixed at 8kHz, SR3 fixed at 16kHz */
1133*40843aeaSCharles Keepax 	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2,
1134*40843aeaSCharles Keepax 			   ARIZONA_SAMPLE_RATE_2_MASK, 0x11);
1135*40843aeaSCharles Keepax 	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3,
1136*40843aeaSCharles Keepax 			   ARIZONA_SAMPLE_RATE_3_MASK, 0x12);
1137*40843aeaSCharles Keepax 
1138*40843aeaSCharles Keepax 	for (i = 0; i < ARRAY_SIZE(wm8997_dai); i++)
1139*40843aeaSCharles Keepax 		arizona_init_dai(&wm8997->core, i);
1140*40843aeaSCharles Keepax 
1141*40843aeaSCharles Keepax 	/* Latch volume update bits */
1142*40843aeaSCharles Keepax 	for (i = 0; i < ARRAY_SIZE(wm8997_digital_vu); i++)
1143*40843aeaSCharles Keepax 		regmap_update_bits(arizona->regmap, wm8997_digital_vu[i],
1144*40843aeaSCharles Keepax 				   WM8997_DIG_VU, WM8997_DIG_VU);
1145*40843aeaSCharles Keepax 
1146*40843aeaSCharles Keepax 	pm_runtime_enable(&pdev->dev);
1147*40843aeaSCharles Keepax 	pm_runtime_idle(&pdev->dev);
1148*40843aeaSCharles Keepax 
1149*40843aeaSCharles Keepax 	return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8997,
1150*40843aeaSCharles Keepax 				      wm8997_dai, ARRAY_SIZE(wm8997_dai));
1151*40843aeaSCharles Keepax }
1152*40843aeaSCharles Keepax 
1153*40843aeaSCharles Keepax static int wm8997_remove(struct platform_device *pdev)
1154*40843aeaSCharles Keepax {
1155*40843aeaSCharles Keepax 	snd_soc_unregister_codec(&pdev->dev);
1156*40843aeaSCharles Keepax 	pm_runtime_disable(&pdev->dev);
1157*40843aeaSCharles Keepax 
1158*40843aeaSCharles Keepax 	return 0;
1159*40843aeaSCharles Keepax }
1160*40843aeaSCharles Keepax 
1161*40843aeaSCharles Keepax static struct platform_driver wm8997_codec_driver = {
1162*40843aeaSCharles Keepax 	.driver = {
1163*40843aeaSCharles Keepax 		.name = "wm8997-codec",
1164*40843aeaSCharles Keepax 		.owner = THIS_MODULE,
1165*40843aeaSCharles Keepax 	},
1166*40843aeaSCharles Keepax 	.probe = wm8997_probe,
1167*40843aeaSCharles Keepax 	.remove = wm8997_remove,
1168*40843aeaSCharles Keepax };
1169*40843aeaSCharles Keepax 
1170*40843aeaSCharles Keepax module_platform_driver(wm8997_codec_driver);
1171*40843aeaSCharles Keepax 
1172*40843aeaSCharles Keepax MODULE_DESCRIPTION("ASoC WM8997 driver");
1173*40843aeaSCharles Keepax MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
1174*40843aeaSCharles Keepax MODULE_LICENSE("GPL");
1175*40843aeaSCharles Keepax MODULE_ALIAS("platform:wm8997-codec");
1176