xref: /openbmc/linux/sound/soc/codecs/cs47l92.c (revision 39f555fb)
1 // SPDX-License-Identifier: GPL-2.0-only
2 //
3 // ALSA SoC Audio driver for CS47L92 codec
4 //
5 // Copyright (C) 2016-2019 Cirrus Logic, Inc. and
6 //                         Cirrus Logic International Semiconductor Ltd.
7 //
8 
9 #include <linux/module.h>
10 #include <linux/moduleparam.h>
11 #include <linux/device.h>
12 #include <linux/delay.h>
13 #include <linux/init.h>
14 #include <linux/pm.h>
15 #include <linux/pm_runtime.h>
16 #include <linux/regmap.h>
17 #include <sound/core.h>
18 #include <sound/pcm.h>
19 #include <sound/pcm_params.h>
20 #include <sound/soc.h>
21 #include <sound/tlv.h>
22 
23 #include <linux/irqchip/irq-madera.h>
24 #include <linux/mfd/madera/core.h>
25 #include <linux/mfd/madera/registers.h>
26 
27 #include "madera.h"
28 #include "wm_adsp.h"
29 
30 #define CS47L92_NUM_ADSP	1
31 #define CS47L92_MONO_OUTPUTS	3
32 
33 #define DRV_NAME "cs47l92-codec"
34 
35 struct cs47l92 {
36 	struct madera_priv core;
37 	struct madera_fll fll[2];
38 };
39 
40 static const struct cs_dsp_region cs47l92_dsp1_regions[] = {
41 	{ .type = WMFW_ADSP2_PM, .base = 0x080000 },
42 	{ .type = WMFW_ADSP2_ZM, .base = 0x0e0000 },
43 	{ .type = WMFW_ADSP2_XM, .base = 0x0a0000 },
44 	{ .type = WMFW_ADSP2_YM, .base = 0x0c0000 },
45 };
46 
47 static const char * const cs47l92_outdemux_texts[] = {
48 	"HPOUT3",
49 	"HPOUT4",
50 };
51 
52 static int cs47l92_put_demux(struct snd_kcontrol *kcontrol,
53 			     struct snd_ctl_elem_value *ucontrol)
54 {
55 	struct snd_soc_component *component =
56 		snd_soc_dapm_kcontrol_component(kcontrol);
57 	struct snd_soc_dapm_context *dapm =
58 		snd_soc_component_get_dapm(component);
59 	struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component);
60 	struct madera_priv *priv = &cs47l92->core;
61 	struct madera *madera = priv->madera;
62 	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
63 	unsigned int ep_sel, mux, change, cur;
64 	bool out_mono;
65 	int ret;
66 
67 	if (ucontrol->value.enumerated.item[0] > e->items - 1)
68 		return -EINVAL;
69 
70 	mux = ucontrol->value.enumerated.item[0];
71 
72 	snd_soc_dapm_mutex_lock(dapm);
73 
74 	ep_sel = mux << e->shift_l;
75 
76 	change = snd_soc_component_test_bits(component, MADERA_OUTPUT_ENABLES_1,
77 					     MADERA_EP_SEL_MASK,
78 					     ep_sel);
79 	if (!change)
80 		goto end;
81 
82 	ret = regmap_read(madera->regmap, MADERA_OUTPUT_ENABLES_1, &cur);
83 	if (ret != 0)
84 		dev_warn(madera->dev, "Failed to read outputs: %d\n", ret);
85 
86 	/* EP_SEL should not be modified while HPOUT3 or 4 is enabled */
87 	ret = regmap_update_bits(madera->regmap, MADERA_OUTPUT_ENABLES_1,
88 				 MADERA_OUT3L_ENA | MADERA_OUT3R_ENA, 0);
89 	if (ret)
90 		dev_warn(madera->dev, "Failed to disable outputs: %d\n", ret);
91 
92 	usleep_range(2000, 3000); /* wait for wseq to complete */
93 
94 	ret = regmap_update_bits(madera->regmap, MADERA_OUTPUT_ENABLES_1,
95 				 MADERA_EP_SEL, ep_sel);
96 	if (ret) {
97 		dev_err(madera->dev, "Failed to set OUT3 demux: %d\n", ret);
98 	} else {
99 		out_mono = madera->pdata.codec.out_mono[2 + mux];
100 
101 		ret = madera_set_output_mode(component, 3, out_mono);
102 		if (ret < 0)
103 			dev_warn(madera->dev,
104 				 "Failed to set output mode: %d\n", ret);
105 	}
106 
107 	ret = regmap_update_bits(madera->regmap, MADERA_OUTPUT_ENABLES_1,
108 				 MADERA_OUT3L_ENA | MADERA_OUT3R_ENA, cur);
109 	if (ret) {
110 		dev_warn(madera->dev, "Failed to restore outputs: %d\n", ret);
111 	} else {
112 		/* wait for wseq */
113 		if (cur & (MADERA_OUT3L_ENA | MADERA_OUT3R_ENA))
114 			msleep(34); /* enable delay */
115 		else
116 			usleep_range(2000, 3000); /* disable delay */
117 	}
118 
119 end:
120 	snd_soc_dapm_mutex_unlock(dapm);
121 
122 	ret = snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);
123 	if (ret < 0) {
124 		dev_err(madera->dev, "Failed to update demux power state: %d\n", ret);
125 		return ret;
126 	}
127 
128 	return change;
129 }
130 
131 static SOC_ENUM_SINGLE_DECL(cs47l92_outdemux_enum,
132 			    MADERA_OUTPUT_ENABLES_1,
133 			    MADERA_EP_SEL_SHIFT,
134 			    cs47l92_outdemux_texts);
135 
136 static const struct snd_kcontrol_new cs47l92_outdemux =
137 	SOC_DAPM_ENUM_EXT("OUT3 Demux", cs47l92_outdemux_enum,
138 			  snd_soc_dapm_get_enum_double, cs47l92_put_demux);
139 
140 static int cs47l92_adsp_power_ev(struct snd_soc_dapm_widget *w,
141 				 struct snd_kcontrol *kcontrol,
142 				 int event)
143 {
144 	struct snd_soc_component *component =
145 		snd_soc_dapm_to_component(w->dapm);
146 	struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component);
147 	struct madera_priv *priv = &cs47l92->core;
148 	struct madera *madera = priv->madera;
149 	unsigned int freq;
150 	int ret;
151 
152 	ret = regmap_read(madera->regmap, MADERA_DSP_CLOCK_2, &freq);
153 	if (ret != 0) {
154 		dev_err(madera->dev,
155 			"Failed to read MADERA_DSP_CLOCK_2: %d\n", ret);
156 		return ret;
157 	}
158 
159 	switch (event) {
160 	case SND_SOC_DAPM_PRE_PMU:
161 		ret = madera_set_adsp_clk(&cs47l92->core, w->shift, freq);
162 		if (ret)
163 			return ret;
164 		break;
165 	default:
166 		break;
167 	}
168 
169 	return wm_adsp_early_event(w, kcontrol, event);
170 }
171 
172 static int cs47l92_outclk_ev(struct snd_soc_dapm_widget *w,
173 			     struct snd_kcontrol *kcontrol,
174 			     int event)
175 {
176 	struct snd_soc_component *component =
177 		snd_soc_dapm_to_component(w->dapm);
178 	struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component);
179 	struct madera_priv *priv = &cs47l92->core;
180 	struct madera *madera = priv->madera;
181 	unsigned int val;
182 	int ret;
183 
184 	ret = regmap_read(madera->regmap, MADERA_OUTPUT_RATE_1, &val);
185 	if (ret) {
186 		dev_err(madera->dev, "Failed to read OUTCLK source: %d\n", ret);
187 		return ret;
188 	}
189 
190 	val &= MADERA_OUT_CLK_SRC_MASK;
191 
192 	switch (val) {
193 	case MADERA_OUTCLK_MCLK1:
194 	case MADERA_OUTCLK_MCLK2:
195 	case MADERA_OUTCLK_MCLK3:
196 		val -= (MADERA_OUTCLK_MCLK1 - MADERA_MCLK1);
197 
198 		switch (event) {
199 		case SND_SOC_DAPM_PRE_PMU:
200 			ret = clk_prepare_enable(madera->mclk[val].clk);
201 			if (ret)
202 				return ret;
203 			break;
204 		case SND_SOC_DAPM_POST_PMD:
205 			clk_disable_unprepare(madera->mclk[val].clk);
206 			break;
207 		default:
208 			break;
209 		}
210 		break;
211 	default:
212 		break;
213 	}
214 
215 	return madera_domain_clk_ev(w, kcontrol, event);
216 }
217 
218 #define CS47L92_NG_SRC(name, base) \
219 	SOC_SINGLE(name " NG HPOUT1L Switch",  base,  0, 1, 0), \
220 	SOC_SINGLE(name " NG HPOUT1R Switch",  base,  1, 1, 0), \
221 	SOC_SINGLE(name " NG HPOUT2L Switch",  base,  2, 1, 0), \
222 	SOC_SINGLE(name " NG HPOUT2R Switch",  base,  3, 1, 0), \
223 	SOC_SINGLE(name " NG HPOUT3L Switch",  base,  4, 1, 0), \
224 	SOC_SINGLE(name " NG HPOUT3R Switch",  base,  5, 1, 0), \
225 	SOC_SINGLE(name " NG SPKDAT1L Switch", base,  8, 1, 0), \
226 	SOC_SINGLE(name " NG SPKDAT1R Switch", base,  9, 1, 0)
227 
228 static const struct snd_kcontrol_new cs47l92_snd_controls[] = {
229 SOC_ENUM("IN1 OSR", madera_in_dmic_osr[0]),
230 SOC_ENUM("IN2 OSR", madera_in_dmic_osr[1]),
231 SOC_ENUM("IN3 OSR", madera_in_dmic_osr[2]),
232 SOC_ENUM("IN4 OSR", madera_in_dmic_osr[3]),
233 
234 SOC_SINGLE_RANGE_TLV("IN1L Volume", MADERA_IN1L_CONTROL,
235 		     MADERA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, madera_ana_tlv),
236 SOC_SINGLE_RANGE_TLV("IN1R Volume", MADERA_IN1R_CONTROL,
237 		     MADERA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, madera_ana_tlv),
238 SOC_SINGLE_RANGE_TLV("IN2L Volume", MADERA_IN2L_CONTROL,
239 		     MADERA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, madera_ana_tlv),
240 SOC_SINGLE_RANGE_TLV("IN2R Volume", MADERA_IN2R_CONTROL,
241 		     MADERA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, madera_ana_tlv),
242 
243 SOC_ENUM("IN HPF Cutoff Frequency", madera_in_hpf_cut_enum),
244 
245 SOC_SINGLE_EXT("IN1L LP Switch", MADERA_ADC_DIGITAL_VOLUME_1L,
246 	       MADERA_IN1L_LP_MODE_SHIFT, 1, 0,
247 	       snd_soc_get_volsw, madera_lp_mode_put),
248 SOC_SINGLE_EXT("IN1R LP Switch", MADERA_ADC_DIGITAL_VOLUME_1R,
249 	       MADERA_IN1L_LP_MODE_SHIFT, 1, 0,
250 	       snd_soc_get_volsw, madera_lp_mode_put),
251 SOC_SINGLE_EXT("IN2L LP Switch", MADERA_ADC_DIGITAL_VOLUME_2L,
252 	       MADERA_IN1L_LP_MODE_SHIFT, 1, 0,
253 	       snd_soc_get_volsw, madera_lp_mode_put),
254 SOC_SINGLE_EXT("IN2R LP Switch", MADERA_ADC_DIGITAL_VOLUME_2R,
255 	       MADERA_IN1L_LP_MODE_SHIFT, 1, 0,
256 	       snd_soc_get_volsw, madera_lp_mode_put),
257 
258 SOC_SINGLE("IN1L HPF Switch", MADERA_IN1L_CONTROL,
259 	   MADERA_IN1L_HPF_SHIFT, 1, 0),
260 SOC_SINGLE("IN1R HPF Switch", MADERA_IN1R_CONTROL,
261 	   MADERA_IN1R_HPF_SHIFT, 1, 0),
262 SOC_SINGLE("IN2L HPF Switch", MADERA_IN2L_CONTROL,
263 	   MADERA_IN2L_HPF_SHIFT, 1, 0),
264 SOC_SINGLE("IN2R HPF Switch", MADERA_IN2R_CONTROL,
265 	   MADERA_IN2R_HPF_SHIFT, 1, 0),
266 SOC_SINGLE("IN3L HPF Switch", MADERA_IN3L_CONTROL,
267 	   MADERA_IN3L_HPF_SHIFT, 1, 0),
268 SOC_SINGLE("IN3R HPF Switch", MADERA_IN3R_CONTROL,
269 	   MADERA_IN3R_HPF_SHIFT, 1, 0),
270 SOC_SINGLE("IN4L HPF Switch", MADERA_IN4L_CONTROL,
271 	   MADERA_IN4L_HPF_SHIFT, 1, 0),
272 SOC_SINGLE("IN4R HPF Switch", MADERA_IN4R_CONTROL,
273 	   MADERA_IN4R_HPF_SHIFT, 1, 0),
274 
275 SOC_SINGLE_TLV("IN1L Digital Volume", MADERA_ADC_DIGITAL_VOLUME_1L,
276 	       MADERA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, madera_digital_tlv),
277 SOC_SINGLE_TLV("IN1R Digital Volume", MADERA_ADC_DIGITAL_VOLUME_1R,
278 	       MADERA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, madera_digital_tlv),
279 SOC_SINGLE_TLV("IN2L Digital Volume", MADERA_ADC_DIGITAL_VOLUME_2L,
280 	       MADERA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, madera_digital_tlv),
281 SOC_SINGLE_TLV("IN2R Digital Volume", MADERA_ADC_DIGITAL_VOLUME_2R,
282 	       MADERA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, madera_digital_tlv),
283 SOC_SINGLE_TLV("IN3L Digital Volume", MADERA_ADC_DIGITAL_VOLUME_3L,
284 	       MADERA_IN3L_DIG_VOL_SHIFT, 0xbf, 0, madera_digital_tlv),
285 SOC_SINGLE_TLV("IN3R Digital Volume", MADERA_ADC_DIGITAL_VOLUME_3R,
286 	       MADERA_IN3R_DIG_VOL_SHIFT, 0xbf, 0, madera_digital_tlv),
287 SOC_SINGLE_TLV("IN4L Digital Volume", MADERA_ADC_DIGITAL_VOLUME_4L,
288 	       MADERA_IN4L_DIG_VOL_SHIFT, 0xbf, 0, madera_digital_tlv),
289 SOC_SINGLE_TLV("IN4R Digital Volume", MADERA_ADC_DIGITAL_VOLUME_4R,
290 	       MADERA_IN4R_DIG_VOL_SHIFT, 0xbf, 0, madera_digital_tlv),
291 
292 SOC_ENUM("Input Ramp Up", madera_in_vi_ramp),
293 SOC_ENUM("Input Ramp Down", madera_in_vd_ramp),
294 
295 MADERA_MIXER_CONTROLS("EQ1", MADERA_EQ1MIX_INPUT_1_SOURCE),
296 MADERA_MIXER_CONTROLS("EQ2", MADERA_EQ2MIX_INPUT_1_SOURCE),
297 MADERA_MIXER_CONTROLS("EQ3", MADERA_EQ3MIX_INPUT_1_SOURCE),
298 MADERA_MIXER_CONTROLS("EQ4", MADERA_EQ4MIX_INPUT_1_SOURCE),
299 
300 MADERA_EQ_CONTROL("EQ1 Coefficients", MADERA_EQ1_2),
301 SOC_SINGLE_TLV("EQ1 B1 Volume", MADERA_EQ1_1, MADERA_EQ1_B1_GAIN_SHIFT,
302 	       24, 0, madera_eq_tlv),
303 SOC_SINGLE_TLV("EQ1 B2 Volume", MADERA_EQ1_1, MADERA_EQ1_B2_GAIN_SHIFT,
304 	       24, 0, madera_eq_tlv),
305 SOC_SINGLE_TLV("EQ1 B3 Volume", MADERA_EQ1_1, MADERA_EQ1_B3_GAIN_SHIFT,
306 	       24, 0, madera_eq_tlv),
307 SOC_SINGLE_TLV("EQ1 B4 Volume", MADERA_EQ1_2, MADERA_EQ1_B4_GAIN_SHIFT,
308 	       24, 0, madera_eq_tlv),
309 SOC_SINGLE_TLV("EQ1 B5 Volume", MADERA_EQ1_2, MADERA_EQ1_B5_GAIN_SHIFT,
310 	       24, 0, madera_eq_tlv),
311 
312 MADERA_EQ_CONTROL("EQ2 Coefficients", MADERA_EQ2_2),
313 SOC_SINGLE_TLV("EQ2 B1 Volume", MADERA_EQ2_1, MADERA_EQ2_B1_GAIN_SHIFT,
314 	       24, 0, madera_eq_tlv),
315 SOC_SINGLE_TLV("EQ2 B2 Volume", MADERA_EQ2_1, MADERA_EQ2_B2_GAIN_SHIFT,
316 	       24, 0, madera_eq_tlv),
317 SOC_SINGLE_TLV("EQ2 B3 Volume", MADERA_EQ2_1, MADERA_EQ2_B3_GAIN_SHIFT,
318 	       24, 0, madera_eq_tlv),
319 SOC_SINGLE_TLV("EQ2 B4 Volume", MADERA_EQ2_2, MADERA_EQ2_B4_GAIN_SHIFT,
320 	       24, 0, madera_eq_tlv),
321 SOC_SINGLE_TLV("EQ2 B5 Volume", MADERA_EQ2_2, MADERA_EQ2_B5_GAIN_SHIFT,
322 	       24, 0, madera_eq_tlv),
323 
324 MADERA_EQ_CONTROL("EQ3 Coefficients", MADERA_EQ3_2),
325 SOC_SINGLE_TLV("EQ3 B1 Volume", MADERA_EQ3_1, MADERA_EQ3_B1_GAIN_SHIFT,
326 	       24, 0, madera_eq_tlv),
327 SOC_SINGLE_TLV("EQ3 B2 Volume", MADERA_EQ3_1, MADERA_EQ3_B2_GAIN_SHIFT,
328 	       24, 0, madera_eq_tlv),
329 SOC_SINGLE_TLV("EQ3 B3 Volume", MADERA_EQ3_1, MADERA_EQ3_B3_GAIN_SHIFT,
330 	       24, 0, madera_eq_tlv),
331 SOC_SINGLE_TLV("EQ3 B4 Volume", MADERA_EQ3_2, MADERA_EQ3_B4_GAIN_SHIFT,
332 	       24, 0, madera_eq_tlv),
333 SOC_SINGLE_TLV("EQ3 B5 Volume", MADERA_EQ3_2, MADERA_EQ3_B5_GAIN_SHIFT,
334 	       24, 0, madera_eq_tlv),
335 
336 MADERA_EQ_CONTROL("EQ4 Coefficients", MADERA_EQ4_2),
337 SOC_SINGLE_TLV("EQ4 B1 Volume", MADERA_EQ4_1, MADERA_EQ4_B1_GAIN_SHIFT,
338 	       24, 0, madera_eq_tlv),
339 SOC_SINGLE_TLV("EQ4 B2 Volume", MADERA_EQ4_1, MADERA_EQ4_B2_GAIN_SHIFT,
340 	       24, 0, madera_eq_tlv),
341 SOC_SINGLE_TLV("EQ4 B3 Volume", MADERA_EQ4_1, MADERA_EQ4_B3_GAIN_SHIFT,
342 	       24, 0, madera_eq_tlv),
343 SOC_SINGLE_TLV("EQ4 B4 Volume", MADERA_EQ4_2, MADERA_EQ4_B4_GAIN_SHIFT,
344 	       24, 0, madera_eq_tlv),
345 SOC_SINGLE_TLV("EQ4 B5 Volume", MADERA_EQ4_2, MADERA_EQ4_B5_GAIN_SHIFT,
346 	       24, 0, madera_eq_tlv),
347 
348 SOC_SINGLE("DAC High Performance Mode Switch", MADERA_OUTPUT_RATE_1,
349 	   MADERA_CP_DAC_MODE_SHIFT, 1, 0),
350 
351 MADERA_MIXER_CONTROLS("DRC1L", MADERA_DRC1LMIX_INPUT_1_SOURCE),
352 MADERA_MIXER_CONTROLS("DRC1R", MADERA_DRC1RMIX_INPUT_1_SOURCE),
353 MADERA_MIXER_CONTROLS("DRC2L", MADERA_DRC2LMIX_INPUT_1_SOURCE),
354 MADERA_MIXER_CONTROLS("DRC2R", MADERA_DRC2RMIX_INPUT_1_SOURCE),
355 
356 SND_SOC_BYTES_MASK("DRC1", MADERA_DRC1_CTRL1, 5,
357 		   MADERA_DRC1R_ENA | MADERA_DRC1L_ENA),
358 SND_SOC_BYTES_MASK("DRC2", MADERA_DRC2_CTRL1, 5,
359 		   MADERA_DRC2R_ENA | MADERA_DRC2L_ENA),
360 
361 MADERA_MIXER_CONTROLS("LHPF1", MADERA_HPLP1MIX_INPUT_1_SOURCE),
362 MADERA_MIXER_CONTROLS("LHPF2", MADERA_HPLP2MIX_INPUT_1_SOURCE),
363 MADERA_MIXER_CONTROLS("LHPF3", MADERA_HPLP3MIX_INPUT_1_SOURCE),
364 MADERA_MIXER_CONTROLS("LHPF4", MADERA_HPLP4MIX_INPUT_1_SOURCE),
365 
366 MADERA_LHPF_CONTROL("LHPF1 Coefficients", MADERA_HPLPF1_2),
367 MADERA_LHPF_CONTROL("LHPF2 Coefficients", MADERA_HPLPF2_2),
368 MADERA_LHPF_CONTROL("LHPF3 Coefficients", MADERA_HPLPF3_2),
369 MADERA_LHPF_CONTROL("LHPF4 Coefficients", MADERA_HPLPF4_2),
370 
371 SOC_ENUM("LHPF1 Mode", madera_lhpf1_mode),
372 SOC_ENUM("LHPF2 Mode", madera_lhpf2_mode),
373 SOC_ENUM("LHPF3 Mode", madera_lhpf3_mode),
374 SOC_ENUM("LHPF4 Mode", madera_lhpf4_mode),
375 
376 MADERA_RATE_ENUM("ISRC1 FSL", madera_isrc_fsl[0]),
377 MADERA_RATE_ENUM("ISRC2 FSL", madera_isrc_fsl[1]),
378 MADERA_RATE_ENUM("ISRC1 FSH", madera_isrc_fsh[0]),
379 MADERA_RATE_ENUM("ISRC2 FSH", madera_isrc_fsh[1]),
380 MADERA_RATE_ENUM("ASRC1 Rate 1", madera_asrc1_bidir_rate[0]),
381 MADERA_RATE_ENUM("ASRC1 Rate 2", madera_asrc1_bidir_rate[1]),
382 
383 WM_ADSP2_PRELOAD_SWITCH("DSP1", 1),
384 
385 MADERA_MIXER_CONTROLS("DSP1L", MADERA_DSP1LMIX_INPUT_1_SOURCE),
386 MADERA_MIXER_CONTROLS("DSP1R", MADERA_DSP1RMIX_INPUT_1_SOURCE),
387 
388 SOC_SINGLE_TLV("Noise Generator Volume", MADERA_COMFORT_NOISE_GENERATOR,
389 	       MADERA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, madera_noise_tlv),
390 
391 MADERA_MIXER_CONTROLS("HPOUT1L", MADERA_OUT1LMIX_INPUT_1_SOURCE),
392 MADERA_MIXER_CONTROLS("HPOUT1R", MADERA_OUT1RMIX_INPUT_1_SOURCE),
393 MADERA_MIXER_CONTROLS("HPOUT2L", MADERA_OUT2LMIX_INPUT_1_SOURCE),
394 MADERA_MIXER_CONTROLS("HPOUT2R", MADERA_OUT2RMIX_INPUT_1_SOURCE),
395 MADERA_MIXER_CONTROLS("HPOUT3L", MADERA_OUT3LMIX_INPUT_1_SOURCE),
396 MADERA_MIXER_CONTROLS("HPOUT3R", MADERA_OUT3RMIX_INPUT_1_SOURCE),
397 MADERA_MIXER_CONTROLS("SPKDAT1L", MADERA_OUT5LMIX_INPUT_1_SOURCE),
398 MADERA_MIXER_CONTROLS("SPKDAT1R", MADERA_OUT5RMIX_INPUT_1_SOURCE),
399 
400 SOC_SINGLE("HPOUT1 SC Protect Switch", MADERA_HP1_SHORT_CIRCUIT_CTRL,
401 	   MADERA_HP1_SC_ENA_SHIFT, 1, 0),
402 SOC_SINGLE("HPOUT2 SC Protect Switch", MADERA_HP2_SHORT_CIRCUIT_CTRL,
403 	   MADERA_HP2_SC_ENA_SHIFT, 1, 0),
404 SOC_SINGLE("HPOUT3 SC Protect Switch", MADERA_HP3_SHORT_CIRCUIT_CTRL,
405 	   MADERA_HP3_SC_ENA_SHIFT, 1, 0),
406 
407 SOC_SINGLE("SPKDAT1 High Performance Switch", MADERA_OUTPUT_PATH_CONFIG_5L,
408 	   MADERA_OUT5_OSR_SHIFT, 1, 0),
409 
410 SOC_DOUBLE_R("HPOUT1 Digital Switch", MADERA_DAC_DIGITAL_VOLUME_1L,
411 	     MADERA_DAC_DIGITAL_VOLUME_1R, MADERA_OUT1L_MUTE_SHIFT, 1, 1),
412 SOC_DOUBLE_R("HPOUT2 Digital Switch", MADERA_DAC_DIGITAL_VOLUME_2L,
413 	     MADERA_DAC_DIGITAL_VOLUME_2R, MADERA_OUT2L_MUTE_SHIFT, 1, 1),
414 SOC_DOUBLE_R("HPOUT3 Digital Switch", MADERA_DAC_DIGITAL_VOLUME_3L,
415 	     MADERA_DAC_DIGITAL_VOLUME_3R, MADERA_OUT3L_MUTE_SHIFT, 1, 1),
416 SOC_DOUBLE_R("SPKDAT1 Digital Switch", MADERA_DAC_DIGITAL_VOLUME_5L,
417 	     MADERA_DAC_DIGITAL_VOLUME_5R, MADERA_OUT5L_MUTE_SHIFT, 1, 1),
418 
419 SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", MADERA_DAC_DIGITAL_VOLUME_1L,
420 		 MADERA_DAC_DIGITAL_VOLUME_1R, MADERA_OUT1L_VOL_SHIFT,
421 		 0xbf, 0, madera_digital_tlv),
422 SOC_DOUBLE_R_TLV("HPOUT2 Digital Volume", MADERA_DAC_DIGITAL_VOLUME_2L,
423 		 MADERA_DAC_DIGITAL_VOLUME_2R, MADERA_OUT2L_VOL_SHIFT,
424 		 0xbf, 0, madera_digital_tlv),
425 SOC_DOUBLE_R_TLV("HPOUT3 Digital Volume", MADERA_DAC_DIGITAL_VOLUME_3L,
426 		 MADERA_DAC_DIGITAL_VOLUME_3R, MADERA_OUT3L_VOL_SHIFT,
427 		 0xbf, 0, madera_digital_tlv),
428 SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", MADERA_DAC_DIGITAL_VOLUME_5L,
429 		 MADERA_DAC_DIGITAL_VOLUME_5R, MADERA_OUT5L_VOL_SHIFT,
430 		 0xbf, 0, madera_digital_tlv),
431 
432 SOC_DOUBLE("SPKDAT1 Switch", MADERA_PDM_SPK1_CTRL_1, MADERA_SPK1L_MUTE_SHIFT,
433 	   MADERA_SPK1R_MUTE_SHIFT, 1, 1),
434 
435 SOC_ENUM("Output Ramp Up", madera_out_vi_ramp),
436 SOC_ENUM("Output Ramp Down", madera_out_vd_ramp),
437 
438 SOC_SINGLE("Noise Gate Switch", MADERA_NOISE_GATE_CONTROL,
439 	   MADERA_NGATE_ENA_SHIFT, 1, 0),
440 SOC_SINGLE_TLV("Noise Gate Threshold Volume", MADERA_NOISE_GATE_CONTROL,
441 	       MADERA_NGATE_THR_SHIFT, 7, 1, madera_ng_tlv),
442 SOC_ENUM("Noise Gate Hold", madera_ng_hold),
443 
444 SOC_ENUM_EXT("DFC1RX Width", madera_dfc_width[0],
445 	     snd_soc_get_enum_double, madera_dfc_put),
446 SOC_ENUM_EXT("DFC1RX Type", madera_dfc_type[0],
447 	     snd_soc_get_enum_double, madera_dfc_put),
448 SOC_ENUM_EXT("DFC1TX Width", madera_dfc_width[1],
449 	     snd_soc_get_enum_double, madera_dfc_put),
450 SOC_ENUM_EXT("DFC1TX Type", madera_dfc_type[1],
451 	     snd_soc_get_enum_double, madera_dfc_put),
452 SOC_ENUM_EXT("DFC2RX Width", madera_dfc_width[2],
453 	     snd_soc_get_enum_double, madera_dfc_put),
454 SOC_ENUM_EXT("DFC2RX Type", madera_dfc_type[2],
455 	     snd_soc_get_enum_double, madera_dfc_put),
456 SOC_ENUM_EXT("DFC2TX Width", madera_dfc_width[3],
457 	     snd_soc_get_enum_double, madera_dfc_put),
458 SOC_ENUM_EXT("DFC2TX Type", madera_dfc_type[3],
459 	     snd_soc_get_enum_double, madera_dfc_put),
460 SOC_ENUM_EXT("DFC3RX Width", madera_dfc_width[4],
461 	     snd_soc_get_enum_double, madera_dfc_put),
462 SOC_ENUM_EXT("DFC3RX Type", madera_dfc_type[4],
463 	     snd_soc_get_enum_double, madera_dfc_put),
464 SOC_ENUM_EXT("DFC3TX Width", madera_dfc_width[5],
465 	     snd_soc_get_enum_double, madera_dfc_put),
466 SOC_ENUM_EXT("DFC3TX Type", madera_dfc_type[5],
467 	     snd_soc_get_enum_double, madera_dfc_put),
468 SOC_ENUM_EXT("DFC4RX Width", madera_dfc_width[6],
469 	     snd_soc_get_enum_double, madera_dfc_put),
470 SOC_ENUM_EXT("DFC4RX Type", madera_dfc_type[6],
471 	     snd_soc_get_enum_double, madera_dfc_put),
472 SOC_ENUM_EXT("DFC4TX Width", madera_dfc_width[7],
473 	     snd_soc_get_enum_double, madera_dfc_put),
474 SOC_ENUM_EXT("DFC4TX Type", madera_dfc_type[7],
475 	     snd_soc_get_enum_double, madera_dfc_put),
476 SOC_ENUM_EXT("DFC5RX Width", madera_dfc_width[8],
477 	     snd_soc_get_enum_double, madera_dfc_put),
478 SOC_ENUM_EXT("DFC5RX Type", madera_dfc_type[8],
479 	     snd_soc_get_enum_double, madera_dfc_put),
480 SOC_ENUM_EXT("DFC5TX Width", madera_dfc_width[9],
481 	     snd_soc_get_enum_double, madera_dfc_put),
482 SOC_ENUM_EXT("DFC5TX Type", madera_dfc_type[9],
483 	     snd_soc_get_enum_double, madera_dfc_put),
484 SOC_ENUM_EXT("DFC6RX Width", madera_dfc_width[10],
485 	     snd_soc_get_enum_double, madera_dfc_put),
486 SOC_ENUM_EXT("DFC6RX Type", madera_dfc_type[10],
487 	     snd_soc_get_enum_double, madera_dfc_put),
488 SOC_ENUM_EXT("DFC6TX Width", madera_dfc_width[11],
489 	     snd_soc_get_enum_double, madera_dfc_put),
490 SOC_ENUM_EXT("DFC6TX Type", madera_dfc_type[11],
491 	     snd_soc_get_enum_double, madera_dfc_put),
492 SOC_ENUM_EXT("DFC7RX Width", madera_dfc_width[12],
493 	     snd_soc_get_enum_double, madera_dfc_put),
494 SOC_ENUM_EXT("DFC7RX Type", madera_dfc_type[12],
495 	     snd_soc_get_enum_double, madera_dfc_put),
496 SOC_ENUM_EXT("DFC7TX Width", madera_dfc_width[13],
497 	     snd_soc_get_enum_double, madera_dfc_put),
498 SOC_ENUM_EXT("DFC7TX Type", madera_dfc_type[13],
499 	     snd_soc_get_enum_double, madera_dfc_put),
500 SOC_ENUM_EXT("DFC8RX Width", madera_dfc_width[14],
501 	     snd_soc_get_enum_double, madera_dfc_put),
502 SOC_ENUM_EXT("DFC8RX Type", madera_dfc_type[14],
503 	     snd_soc_get_enum_double, madera_dfc_put),
504 SOC_ENUM_EXT("DFC8TX Width", madera_dfc_width[15],
505 	     snd_soc_get_enum_double, madera_dfc_put),
506 SOC_ENUM_EXT("DFC8TX Type", madera_dfc_type[15],
507 	     snd_soc_get_enum_double, madera_dfc_put),
508 
509 CS47L92_NG_SRC("HPOUT1L", MADERA_NOISE_GATE_SELECT_1L),
510 CS47L92_NG_SRC("HPOUT1R", MADERA_NOISE_GATE_SELECT_1R),
511 CS47L92_NG_SRC("HPOUT2L", MADERA_NOISE_GATE_SELECT_2L),
512 CS47L92_NG_SRC("HPOUT2R", MADERA_NOISE_GATE_SELECT_2R),
513 CS47L92_NG_SRC("HPOUT3L", MADERA_NOISE_GATE_SELECT_3L),
514 CS47L92_NG_SRC("HPOUT3R", MADERA_NOISE_GATE_SELECT_3R),
515 CS47L92_NG_SRC("SPKDAT1L", MADERA_NOISE_GATE_SELECT_5L),
516 CS47L92_NG_SRC("SPKDAT1R", MADERA_NOISE_GATE_SELECT_5R),
517 
518 MADERA_MIXER_CONTROLS("AIF1TX1", MADERA_AIF1TX1MIX_INPUT_1_SOURCE),
519 MADERA_MIXER_CONTROLS("AIF1TX2", MADERA_AIF1TX2MIX_INPUT_1_SOURCE),
520 MADERA_MIXER_CONTROLS("AIF1TX3", MADERA_AIF1TX3MIX_INPUT_1_SOURCE),
521 MADERA_MIXER_CONTROLS("AIF1TX4", MADERA_AIF1TX4MIX_INPUT_1_SOURCE),
522 MADERA_MIXER_CONTROLS("AIF1TX5", MADERA_AIF1TX5MIX_INPUT_1_SOURCE),
523 MADERA_MIXER_CONTROLS("AIF1TX6", MADERA_AIF1TX6MIX_INPUT_1_SOURCE),
524 MADERA_MIXER_CONTROLS("AIF1TX7", MADERA_AIF1TX7MIX_INPUT_1_SOURCE),
525 MADERA_MIXER_CONTROLS("AIF1TX8", MADERA_AIF1TX8MIX_INPUT_1_SOURCE),
526 
527 MADERA_MIXER_CONTROLS("AIF2TX1", MADERA_AIF2TX1MIX_INPUT_1_SOURCE),
528 MADERA_MIXER_CONTROLS("AIF2TX2", MADERA_AIF2TX2MIX_INPUT_1_SOURCE),
529 MADERA_MIXER_CONTROLS("AIF2TX3", MADERA_AIF2TX3MIX_INPUT_1_SOURCE),
530 MADERA_MIXER_CONTROLS("AIF2TX4", MADERA_AIF2TX4MIX_INPUT_1_SOURCE),
531 MADERA_MIXER_CONTROLS("AIF2TX5", MADERA_AIF2TX5MIX_INPUT_1_SOURCE),
532 MADERA_MIXER_CONTROLS("AIF2TX6", MADERA_AIF2TX6MIX_INPUT_1_SOURCE),
533 MADERA_MIXER_CONTROLS("AIF2TX7", MADERA_AIF2TX7MIX_INPUT_1_SOURCE),
534 MADERA_MIXER_CONTROLS("AIF2TX8", MADERA_AIF2TX8MIX_INPUT_1_SOURCE),
535 
536 MADERA_MIXER_CONTROLS("AIF3TX1", MADERA_AIF3TX1MIX_INPUT_1_SOURCE),
537 MADERA_MIXER_CONTROLS("AIF3TX2", MADERA_AIF3TX2MIX_INPUT_1_SOURCE),
538 MADERA_MIXER_CONTROLS("AIF3TX3", MADERA_AIF3TX3MIX_INPUT_1_SOURCE),
539 MADERA_MIXER_CONTROLS("AIF3TX4", MADERA_AIF3TX4MIX_INPUT_1_SOURCE),
540 
541 MADERA_MIXER_CONTROLS("SLIMTX1", MADERA_SLIMTX1MIX_INPUT_1_SOURCE),
542 MADERA_MIXER_CONTROLS("SLIMTX2", MADERA_SLIMTX2MIX_INPUT_1_SOURCE),
543 MADERA_MIXER_CONTROLS("SLIMTX3", MADERA_SLIMTX3MIX_INPUT_1_SOURCE),
544 MADERA_MIXER_CONTROLS("SLIMTX4", MADERA_SLIMTX4MIX_INPUT_1_SOURCE),
545 MADERA_MIXER_CONTROLS("SLIMTX5", MADERA_SLIMTX5MIX_INPUT_1_SOURCE),
546 MADERA_MIXER_CONTROLS("SLIMTX6", MADERA_SLIMTX6MIX_INPUT_1_SOURCE),
547 MADERA_MIXER_CONTROLS("SLIMTX7", MADERA_SLIMTX7MIX_INPUT_1_SOURCE),
548 MADERA_MIXER_CONTROLS("SLIMTX8", MADERA_SLIMTX8MIX_INPUT_1_SOURCE),
549 
550 MADERA_GAINMUX_CONTROLS("SPDIFTX1", MADERA_SPDIF1TX1MIX_INPUT_1_SOURCE),
551 MADERA_GAINMUX_CONTROLS("SPDIFTX2", MADERA_SPDIF1TX2MIX_INPUT_1_SOURCE),
552 
553 WM_ADSP_FW_CONTROL("DSP1", 0),
554 };
555 
556 MADERA_MIXER_ENUMS(EQ1, MADERA_EQ1MIX_INPUT_1_SOURCE);
557 MADERA_MIXER_ENUMS(EQ2, MADERA_EQ2MIX_INPUT_1_SOURCE);
558 MADERA_MIXER_ENUMS(EQ3, MADERA_EQ3MIX_INPUT_1_SOURCE);
559 MADERA_MIXER_ENUMS(EQ4, MADERA_EQ4MIX_INPUT_1_SOURCE);
560 
561 MADERA_MIXER_ENUMS(DRC1L, MADERA_DRC1LMIX_INPUT_1_SOURCE);
562 MADERA_MIXER_ENUMS(DRC1R, MADERA_DRC1RMIX_INPUT_1_SOURCE);
563 MADERA_MIXER_ENUMS(DRC2L, MADERA_DRC2LMIX_INPUT_1_SOURCE);
564 MADERA_MIXER_ENUMS(DRC2R, MADERA_DRC2RMIX_INPUT_1_SOURCE);
565 
566 MADERA_MIXER_ENUMS(LHPF1, MADERA_HPLP1MIX_INPUT_1_SOURCE);
567 MADERA_MIXER_ENUMS(LHPF2, MADERA_HPLP2MIX_INPUT_1_SOURCE);
568 MADERA_MIXER_ENUMS(LHPF3, MADERA_HPLP3MIX_INPUT_1_SOURCE);
569 MADERA_MIXER_ENUMS(LHPF4, MADERA_HPLP4MIX_INPUT_1_SOURCE);
570 
571 MADERA_MIXER_ENUMS(DSP1L, MADERA_DSP1LMIX_INPUT_1_SOURCE);
572 MADERA_MIXER_ENUMS(DSP1R, MADERA_DSP1RMIX_INPUT_1_SOURCE);
573 MADERA_DSP_AUX_ENUMS(DSP1, MADERA_DSP1AUX1MIX_INPUT_1_SOURCE);
574 
575 MADERA_MIXER_ENUMS(PWM1, MADERA_PWM1MIX_INPUT_1_SOURCE);
576 MADERA_MIXER_ENUMS(PWM2, MADERA_PWM2MIX_INPUT_1_SOURCE);
577 
578 MADERA_MIXER_ENUMS(OUT1L, MADERA_OUT1LMIX_INPUT_1_SOURCE);
579 MADERA_MIXER_ENUMS(OUT1R, MADERA_OUT1RMIX_INPUT_1_SOURCE);
580 MADERA_MIXER_ENUMS(OUT2L, MADERA_OUT2LMIX_INPUT_1_SOURCE);
581 MADERA_MIXER_ENUMS(OUT2R, MADERA_OUT2RMIX_INPUT_1_SOURCE);
582 MADERA_MIXER_ENUMS(OUT3L, MADERA_OUT3LMIX_INPUT_1_SOURCE);
583 MADERA_MIXER_ENUMS(OUT3R, MADERA_OUT3RMIX_INPUT_1_SOURCE);
584 MADERA_MIXER_ENUMS(SPKDAT1L, MADERA_OUT5LMIX_INPUT_1_SOURCE);
585 MADERA_MIXER_ENUMS(SPKDAT1R, MADERA_OUT5RMIX_INPUT_1_SOURCE);
586 
587 MADERA_MIXER_ENUMS(AIF1TX1, MADERA_AIF1TX1MIX_INPUT_1_SOURCE);
588 MADERA_MIXER_ENUMS(AIF1TX2, MADERA_AIF1TX2MIX_INPUT_1_SOURCE);
589 MADERA_MIXER_ENUMS(AIF1TX3, MADERA_AIF1TX3MIX_INPUT_1_SOURCE);
590 MADERA_MIXER_ENUMS(AIF1TX4, MADERA_AIF1TX4MIX_INPUT_1_SOURCE);
591 MADERA_MIXER_ENUMS(AIF1TX5, MADERA_AIF1TX5MIX_INPUT_1_SOURCE);
592 MADERA_MIXER_ENUMS(AIF1TX6, MADERA_AIF1TX6MIX_INPUT_1_SOURCE);
593 MADERA_MIXER_ENUMS(AIF1TX7, MADERA_AIF1TX7MIX_INPUT_1_SOURCE);
594 MADERA_MIXER_ENUMS(AIF1TX8, MADERA_AIF1TX8MIX_INPUT_1_SOURCE);
595 
596 MADERA_MIXER_ENUMS(AIF2TX1, MADERA_AIF2TX1MIX_INPUT_1_SOURCE);
597 MADERA_MIXER_ENUMS(AIF2TX2, MADERA_AIF2TX2MIX_INPUT_1_SOURCE);
598 MADERA_MIXER_ENUMS(AIF2TX3, MADERA_AIF2TX3MIX_INPUT_1_SOURCE);
599 MADERA_MIXER_ENUMS(AIF2TX4, MADERA_AIF2TX4MIX_INPUT_1_SOURCE);
600 MADERA_MIXER_ENUMS(AIF2TX5, MADERA_AIF2TX5MIX_INPUT_1_SOURCE);
601 MADERA_MIXER_ENUMS(AIF2TX6, MADERA_AIF2TX6MIX_INPUT_1_SOURCE);
602 MADERA_MIXER_ENUMS(AIF2TX7, MADERA_AIF2TX7MIX_INPUT_1_SOURCE);
603 MADERA_MIXER_ENUMS(AIF2TX8, MADERA_AIF2TX8MIX_INPUT_1_SOURCE);
604 
605 MADERA_MIXER_ENUMS(AIF3TX1, MADERA_AIF3TX1MIX_INPUT_1_SOURCE);
606 MADERA_MIXER_ENUMS(AIF3TX2, MADERA_AIF3TX2MIX_INPUT_1_SOURCE);
607 MADERA_MIXER_ENUMS(AIF3TX3, MADERA_AIF3TX3MIX_INPUT_1_SOURCE);
608 MADERA_MIXER_ENUMS(AIF3TX4, MADERA_AIF3TX4MIX_INPUT_1_SOURCE);
609 
610 MADERA_MIXER_ENUMS(SLIMTX1, MADERA_SLIMTX1MIX_INPUT_1_SOURCE);
611 MADERA_MIXER_ENUMS(SLIMTX2, MADERA_SLIMTX2MIX_INPUT_1_SOURCE);
612 MADERA_MIXER_ENUMS(SLIMTX3, MADERA_SLIMTX3MIX_INPUT_1_SOURCE);
613 MADERA_MIXER_ENUMS(SLIMTX4, MADERA_SLIMTX4MIX_INPUT_1_SOURCE);
614 MADERA_MIXER_ENUMS(SLIMTX5, MADERA_SLIMTX5MIX_INPUT_1_SOURCE);
615 MADERA_MIXER_ENUMS(SLIMTX6, MADERA_SLIMTX6MIX_INPUT_1_SOURCE);
616 MADERA_MIXER_ENUMS(SLIMTX7, MADERA_SLIMTX7MIX_INPUT_1_SOURCE);
617 MADERA_MIXER_ENUMS(SLIMTX8, MADERA_SLIMTX8MIX_INPUT_1_SOURCE);
618 
619 MADERA_MUX_ENUMS(SPD1TX1, MADERA_SPDIF1TX1MIX_INPUT_1_SOURCE);
620 MADERA_MUX_ENUMS(SPD1TX2, MADERA_SPDIF1TX2MIX_INPUT_1_SOURCE);
621 
622 MADERA_MUX_ENUMS(ASRC1IN1L, MADERA_ASRC1_1LMIX_INPUT_1_SOURCE);
623 MADERA_MUX_ENUMS(ASRC1IN1R, MADERA_ASRC1_1RMIX_INPUT_1_SOURCE);
624 MADERA_MUX_ENUMS(ASRC1IN2L, MADERA_ASRC1_2LMIX_INPUT_1_SOURCE);
625 MADERA_MUX_ENUMS(ASRC1IN2R, MADERA_ASRC1_2RMIX_INPUT_1_SOURCE);
626 
627 MADERA_MUX_ENUMS(ISRC1INT1, MADERA_ISRC1INT1MIX_INPUT_1_SOURCE);
628 MADERA_MUX_ENUMS(ISRC1INT2, MADERA_ISRC1INT2MIX_INPUT_1_SOURCE);
629 
630 MADERA_MUX_ENUMS(ISRC1DEC1, MADERA_ISRC1DEC1MIX_INPUT_1_SOURCE);
631 MADERA_MUX_ENUMS(ISRC1DEC2, MADERA_ISRC1DEC2MIX_INPUT_1_SOURCE);
632 
633 MADERA_MUX_ENUMS(ISRC2INT1, MADERA_ISRC2INT1MIX_INPUT_1_SOURCE);
634 MADERA_MUX_ENUMS(ISRC2INT2, MADERA_ISRC2INT2MIX_INPUT_1_SOURCE);
635 
636 MADERA_MUX_ENUMS(ISRC2DEC1, MADERA_ISRC2DEC1MIX_INPUT_1_SOURCE);
637 MADERA_MUX_ENUMS(ISRC2DEC2, MADERA_ISRC2DEC2MIX_INPUT_1_SOURCE);
638 
639 MADERA_MUX_ENUMS(DFC1, MADERA_DFC1MIX_INPUT_1_SOURCE);
640 MADERA_MUX_ENUMS(DFC2, MADERA_DFC2MIX_INPUT_1_SOURCE);
641 MADERA_MUX_ENUMS(DFC3, MADERA_DFC3MIX_INPUT_1_SOURCE);
642 MADERA_MUX_ENUMS(DFC4, MADERA_DFC4MIX_INPUT_1_SOURCE);
643 MADERA_MUX_ENUMS(DFC5, MADERA_DFC5MIX_INPUT_1_SOURCE);
644 MADERA_MUX_ENUMS(DFC6, MADERA_DFC6MIX_INPUT_1_SOURCE);
645 MADERA_MUX_ENUMS(DFC7, MADERA_DFC7MIX_INPUT_1_SOURCE);
646 MADERA_MUX_ENUMS(DFC8, MADERA_DFC8MIX_INPUT_1_SOURCE);
647 
648 static const char * const cs47l92_aec_loopback_texts[] = {
649 	"HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R",
650 	"SPKDAT1L", "SPKDAT1R",
651 };
652 
653 static const unsigned int cs47l92_aec_loopback_values[] = {
654 	0, 1, 2, 3, 4, 5, 8, 9
655 };
656 
657 static const struct soc_enum cs47l92_aec_loopback =
658 	SOC_VALUE_ENUM_SINGLE(MADERA_DAC_AEC_CONTROL_1,
659 			      MADERA_AEC1_LOOPBACK_SRC_SHIFT, 0xf,
660 			      ARRAY_SIZE(cs47l92_aec_loopback_texts),
661 			      cs47l92_aec_loopback_texts,
662 			      cs47l92_aec_loopback_values);
663 
664 static const struct snd_kcontrol_new cs47l92_aec_loopback_mux =
665 	SOC_DAPM_ENUM("AEC1 Loopback", cs47l92_aec_loopback);
666 
667 static const struct snd_soc_dapm_widget cs47l92_dapm_widgets[] = {
668 SND_SOC_DAPM_SUPPLY("SYSCLK", MADERA_SYSTEM_CLOCK_1, MADERA_SYSCLK_ENA_SHIFT,
669 		    0, madera_sysclk_ev,
670 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
671 		    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
672 SND_SOC_DAPM_SUPPLY("ASYNCCLK", MADERA_ASYNC_CLOCK_1,
673 		    MADERA_ASYNC_CLK_ENA_SHIFT, 0, madera_clk_ev,
674 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
675 SND_SOC_DAPM_SUPPLY("OPCLK", MADERA_OUTPUT_SYSTEM_CLOCK,
676 		    MADERA_OPCLK_ENA_SHIFT, 0, NULL, 0),
677 SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", MADERA_OUTPUT_ASYNC_CLOCK,
678 		    MADERA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
679 SND_SOC_DAPM_SUPPLY("DSPCLK", MADERA_DSP_CLOCK_1, MADERA_DSP_CLK_ENA_SHIFT,
680 		    0, madera_clk_ev,
681 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
682 
683 SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD1", 20, 0),
684 SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD2", 20, 0),
685 SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
686 
687 SND_SOC_DAPM_SUPPLY("MICBIAS1", MADERA_MIC_BIAS_CTRL_1,
688 		    MADERA_MICB1_ENA_SHIFT, 0, NULL, 0),
689 SND_SOC_DAPM_SUPPLY("MICBIAS2", MADERA_MIC_BIAS_CTRL_2,
690 		    MADERA_MICB1_ENA_SHIFT, 0, NULL, 0),
691 
692 SND_SOC_DAPM_SUPPLY("MICBIAS1A", MADERA_MIC_BIAS_CTRL_5,
693 		    MADERA_MICB1A_ENA_SHIFT, 0, NULL, 0),
694 SND_SOC_DAPM_SUPPLY("MICBIAS1B", MADERA_MIC_BIAS_CTRL_5,
695 		    MADERA_MICB1B_ENA_SHIFT, 0, NULL, 0),
696 SND_SOC_DAPM_SUPPLY("MICBIAS1C", MADERA_MIC_BIAS_CTRL_5,
697 		    MADERA_MICB1C_ENA_SHIFT, 0, NULL, 0),
698 SND_SOC_DAPM_SUPPLY("MICBIAS1D", MADERA_MIC_BIAS_CTRL_5,
699 		    MADERA_MICB1D_ENA_SHIFT, 0, NULL, 0),
700 
701 SND_SOC_DAPM_SUPPLY("MICBIAS2A", MADERA_MIC_BIAS_CTRL_6,
702 		    MADERA_MICB2A_ENA_SHIFT, 0, NULL, 0),
703 SND_SOC_DAPM_SUPPLY("MICBIAS2B", MADERA_MIC_BIAS_CTRL_6,
704 		    MADERA_MICB2B_ENA_SHIFT, 0, NULL, 0),
705 
706 SND_SOC_DAPM_SUPPLY("FXCLK", SND_SOC_NOPM,
707 		    MADERA_DOM_GRP_FX, 0,
708 		    madera_domain_clk_ev,
709 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
710 SND_SOC_DAPM_SUPPLY("ASRC1CLK", SND_SOC_NOPM,
711 		    MADERA_DOM_GRP_ASRC1, 0,
712 		    madera_domain_clk_ev,
713 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
714 SND_SOC_DAPM_SUPPLY("ISRC1CLK", SND_SOC_NOPM,
715 		    MADERA_DOM_GRP_ISRC1, 0,
716 		    madera_domain_clk_ev,
717 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
718 SND_SOC_DAPM_SUPPLY("ISRC2CLK", SND_SOC_NOPM,
719 		    MADERA_DOM_GRP_ISRC2, 0,
720 		    madera_domain_clk_ev,
721 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
722 SND_SOC_DAPM_SUPPLY("OUTCLK", SND_SOC_NOPM,
723 		    MADERA_DOM_GRP_OUT, 0,
724 		    cs47l92_outclk_ev,
725 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
726 SND_SOC_DAPM_SUPPLY("SPDCLK", SND_SOC_NOPM,
727 		    MADERA_DOM_GRP_SPD, 0,
728 		    madera_domain_clk_ev,
729 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
730 SND_SOC_DAPM_SUPPLY("DSP1CLK", SND_SOC_NOPM,
731 		    MADERA_DOM_GRP_DSP1, 0,
732 		    madera_domain_clk_ev,
733 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
734 SND_SOC_DAPM_SUPPLY("AIF1TXCLK", SND_SOC_NOPM,
735 		    MADERA_DOM_GRP_AIF1, 0,
736 		    madera_domain_clk_ev,
737 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
738 SND_SOC_DAPM_SUPPLY("AIF2TXCLK", SND_SOC_NOPM,
739 		    MADERA_DOM_GRP_AIF2, 0,
740 		    madera_domain_clk_ev,
741 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
742 SND_SOC_DAPM_SUPPLY("AIF3TXCLK", SND_SOC_NOPM,
743 		    MADERA_DOM_GRP_AIF3, 0,
744 		    madera_domain_clk_ev,
745 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
746 SND_SOC_DAPM_SUPPLY("SLIMBUSCLK", SND_SOC_NOPM,
747 		    MADERA_DOM_GRP_SLIMBUS, 0,
748 		    madera_domain_clk_ev,
749 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
750 SND_SOC_DAPM_SUPPLY("PWMCLK", SND_SOC_NOPM,
751 		    MADERA_DOM_GRP_PWM, 0,
752 		    madera_domain_clk_ev,
753 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
754 SND_SOC_DAPM_SUPPLY("DFCCLK", SND_SOC_NOPM,
755 		    MADERA_DOM_GRP_DFC, 0,
756 		    madera_domain_clk_ev,
757 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
758 
759 SND_SOC_DAPM_SIGGEN("TONE"),
760 SND_SOC_DAPM_SIGGEN("NOISE"),
761 
762 SND_SOC_DAPM_INPUT("IN1ALN"),
763 SND_SOC_DAPM_INPUT("IN1ALP"),
764 SND_SOC_DAPM_INPUT("IN1BLN"),
765 SND_SOC_DAPM_INPUT("IN1BLP"),
766 SND_SOC_DAPM_INPUT("IN1ARN"),
767 SND_SOC_DAPM_INPUT("IN1ARP"),
768 SND_SOC_DAPM_INPUT("IN1BR"),
769 SND_SOC_DAPM_INPUT("IN2ALN"),
770 SND_SOC_DAPM_INPUT("IN2ALP"),
771 SND_SOC_DAPM_INPUT("IN2BL"),
772 SND_SOC_DAPM_INPUT("IN2ARN"),
773 SND_SOC_DAPM_INPUT("IN2ARP"),
774 SND_SOC_DAPM_INPUT("IN2BR"),
775 
776 SND_SOC_DAPM_MUX("IN1L Analog Mux", SND_SOC_NOPM, 0, 0, &madera_inmux[0]),
777 SND_SOC_DAPM_MUX("IN1R Analog Mux", SND_SOC_NOPM, 0, 0, &madera_inmux[1]),
778 SND_SOC_DAPM_MUX("IN2L Analog Mux", SND_SOC_NOPM, 0, 0, &madera_inmux[2]),
779 SND_SOC_DAPM_MUX("IN2R Analog Mux", SND_SOC_NOPM, 0, 0, &madera_inmux[3]),
780 
781 SND_SOC_DAPM_MUX("IN1L Mode", SND_SOC_NOPM, 0, 0, &madera_inmode[0]),
782 SND_SOC_DAPM_MUX("IN1R Mode", SND_SOC_NOPM, 0, 0, &madera_inmode[0]),
783 
784 SND_SOC_DAPM_MUX("IN2L Mode", SND_SOC_NOPM, 0, 0, &madera_inmode[1]),
785 SND_SOC_DAPM_MUX("IN2R Mode", SND_SOC_NOPM, 0, 0, &madera_inmode[1]),
786 
787 SND_SOC_DAPM_DEMUX("OUT3 Demux", SND_SOC_NOPM, 0, 0, &cs47l92_outdemux),
788 SND_SOC_DAPM_MUX("OUT3 Mono Mux", SND_SOC_NOPM, 0, 0, &cs47l92_outdemux),
789 
790 SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
791 SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
792 
793 SND_SOC_DAPM_PGA("PWM1 Driver", MADERA_PWM_DRIVE_1, MADERA_PWM1_ENA_SHIFT,
794 		 0, NULL, 0),
795 SND_SOC_DAPM_PGA("PWM2 Driver", MADERA_PWM_DRIVE_1, MADERA_PWM2_ENA_SHIFT,
796 		 0, NULL, 0),
797 
798 SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
799 		     MADERA_AIF1_TX_ENABLES, MADERA_AIF1TX1_ENA_SHIFT, 0),
800 SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 1,
801 		     MADERA_AIF1_TX_ENABLES, MADERA_AIF1TX2_ENA_SHIFT, 0),
802 SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 2,
803 		     MADERA_AIF1_TX_ENABLES, MADERA_AIF1TX3_ENA_SHIFT, 0),
804 SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 3,
805 		     MADERA_AIF1_TX_ENABLES, MADERA_AIF1TX4_ENA_SHIFT, 0),
806 SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 4,
807 		     MADERA_AIF1_TX_ENABLES, MADERA_AIF1TX5_ENA_SHIFT, 0),
808 SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 5,
809 		     MADERA_AIF1_TX_ENABLES, MADERA_AIF1TX6_ENA_SHIFT, 0),
810 SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 6,
811 		     MADERA_AIF1_TX_ENABLES, MADERA_AIF1TX7_ENA_SHIFT, 0),
812 SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 7,
813 		     MADERA_AIF1_TX_ENABLES, MADERA_AIF1TX8_ENA_SHIFT, 0),
814 
815 SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
816 		     MADERA_AIF2_TX_ENABLES, MADERA_AIF2TX1_ENA_SHIFT, 0),
817 SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 1,
818 		     MADERA_AIF2_TX_ENABLES, MADERA_AIF2TX2_ENA_SHIFT, 0),
819 SND_SOC_DAPM_AIF_OUT("AIF2TX3", NULL, 2,
820 		     MADERA_AIF2_TX_ENABLES, MADERA_AIF2TX3_ENA_SHIFT, 0),
821 SND_SOC_DAPM_AIF_OUT("AIF2TX4", NULL, 3,
822 		     MADERA_AIF2_TX_ENABLES, MADERA_AIF2TX4_ENA_SHIFT, 0),
823 SND_SOC_DAPM_AIF_OUT("AIF2TX5", NULL, 4,
824 		     MADERA_AIF2_TX_ENABLES, MADERA_AIF2TX5_ENA_SHIFT, 0),
825 SND_SOC_DAPM_AIF_OUT("AIF2TX6", NULL, 5,
826 		     MADERA_AIF2_TX_ENABLES, MADERA_AIF2TX6_ENA_SHIFT, 0),
827 SND_SOC_DAPM_AIF_OUT("AIF2TX7", NULL, 6,
828 		     MADERA_AIF2_TX_ENABLES, MADERA_AIF2TX7_ENA_SHIFT, 0),
829 SND_SOC_DAPM_AIF_OUT("AIF2TX8", NULL, 7,
830 		     MADERA_AIF2_TX_ENABLES, MADERA_AIF2TX8_ENA_SHIFT, 0),
831 
832 SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
833 		     MADERA_SLIMBUS_TX_CHANNEL_ENABLE,
834 		     MADERA_SLIMTX1_ENA_SHIFT, 0),
835 SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 1,
836 		     MADERA_SLIMBUS_TX_CHANNEL_ENABLE,
837 		     MADERA_SLIMTX2_ENA_SHIFT, 0),
838 SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 2,
839 		     MADERA_SLIMBUS_TX_CHANNEL_ENABLE,
840 		     MADERA_SLIMTX3_ENA_SHIFT, 0),
841 SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 3,
842 		     MADERA_SLIMBUS_TX_CHANNEL_ENABLE,
843 		     MADERA_SLIMTX4_ENA_SHIFT, 0),
844 SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 4,
845 		     MADERA_SLIMBUS_TX_CHANNEL_ENABLE,
846 		     MADERA_SLIMTX5_ENA_SHIFT, 0),
847 SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 5,
848 		     MADERA_SLIMBUS_TX_CHANNEL_ENABLE,
849 		     MADERA_SLIMTX6_ENA_SHIFT, 0),
850 SND_SOC_DAPM_AIF_OUT("SLIMTX7", NULL, 6,
851 		     MADERA_SLIMBUS_TX_CHANNEL_ENABLE,
852 		     MADERA_SLIMTX7_ENA_SHIFT, 0),
853 SND_SOC_DAPM_AIF_OUT("SLIMTX8", NULL, 7,
854 		     MADERA_SLIMBUS_TX_CHANNEL_ENABLE,
855 		     MADERA_SLIMTX8_ENA_SHIFT, 0),
856 
857 SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
858 		     MADERA_AIF3_TX_ENABLES, MADERA_AIF3TX1_ENA_SHIFT, 0),
859 SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 1,
860 		     MADERA_AIF3_TX_ENABLES, MADERA_AIF3TX2_ENA_SHIFT, 0),
861 SND_SOC_DAPM_AIF_OUT("AIF3TX3", NULL, 2,
862 		     MADERA_AIF3_TX_ENABLES, MADERA_AIF3TX3_ENA_SHIFT, 0),
863 SND_SOC_DAPM_AIF_OUT("AIF3TX4", NULL, 3,
864 		     MADERA_AIF3_TX_ENABLES, MADERA_AIF3TX4_ENA_SHIFT, 0),
865 
866 SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
867 		   MADERA_OUT1L_ENA_SHIFT, 0, NULL, 0, madera_hp_ev,
868 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
869 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
870 SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
871 		   MADERA_OUT1R_ENA_SHIFT, 0, NULL, 0, madera_hp_ev,
872 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
873 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
874 SND_SOC_DAPM_PGA_E("OUT2L", SND_SOC_NOPM,
875 		   MADERA_OUT2L_ENA_SHIFT, 0, NULL, 0, madera_hp_ev,
876 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
877 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
878 SND_SOC_DAPM_PGA_E("OUT2R", SND_SOC_NOPM,
879 		   MADERA_OUT2R_ENA_SHIFT, 0, NULL, 0, madera_hp_ev,
880 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
881 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
882 SND_SOC_DAPM_PGA_E("OUT3L", MADERA_OUTPUT_ENABLES_1,
883 		   MADERA_OUT3L_ENA_SHIFT, 0, NULL, 0, madera_out_ev,
884 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
885 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
886 SND_SOC_DAPM_PGA_E("OUT3R", MADERA_OUTPUT_ENABLES_1,
887 		   MADERA_OUT3R_ENA_SHIFT, 0, NULL, 0, madera_out_ev,
888 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
889 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
890 SND_SOC_DAPM_PGA_E("OUT5L", MADERA_OUTPUT_ENABLES_1,
891 		   MADERA_OUT5L_ENA_SHIFT, 0, NULL, 0, madera_out_ev,
892 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
893 SND_SOC_DAPM_PGA_E("OUT5R", MADERA_OUTPUT_ENABLES_1,
894 		   MADERA_OUT5R_ENA_SHIFT, 0, NULL, 0, madera_out_ev,
895 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
896 
897 SND_SOC_DAPM_PGA("SPD1TX1", MADERA_SPD1_TX_CONTROL,
898 		 MADERA_SPD1_VAL1_SHIFT, 0, NULL, 0),
899 SND_SOC_DAPM_PGA("SPD1TX2", MADERA_SPD1_TX_CONTROL,
900 		 MADERA_SPD1_VAL2_SHIFT, 0, NULL, 0),
901 SND_SOC_DAPM_OUT_DRV("SPD1", MADERA_SPD1_TX_CONTROL,
902 		     MADERA_SPD1_ENA_SHIFT, 0, NULL, 0),
903 
904 /*
905  * mux_in widgets : arranged in the order of sources
906  * specified in MADERA_MIXER_INPUT_ROUTES
907  */
908 
909 SND_SOC_DAPM_PGA("Noise Generator", MADERA_COMFORT_NOISE_GENERATOR,
910 		 MADERA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
911 
912 SND_SOC_DAPM_PGA("Tone Generator 1", MADERA_TONE_GENERATOR_1,
913 		 MADERA_TONE1_ENA_SHIFT, 0, NULL, 0),
914 SND_SOC_DAPM_PGA("Tone Generator 2", MADERA_TONE_GENERATOR_1,
915 		 MADERA_TONE2_ENA_SHIFT, 0, NULL, 0),
916 
917 SND_SOC_DAPM_SIGGEN("HAPTICS"),
918 
919 SND_SOC_DAPM_MUX("AEC1 Loopback", MADERA_DAC_AEC_CONTROL_1,
920 		 MADERA_AEC1_LOOPBACK_ENA_SHIFT, 0,
921 		 &cs47l92_aec_loopback_mux),
922 
923 SND_SOC_DAPM_PGA_E("IN1L", MADERA_INPUT_ENABLES, MADERA_IN1L_ENA_SHIFT,
924 		   0, NULL, 0, madera_in_ev,
925 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
926 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
927 SND_SOC_DAPM_PGA_E("IN1R", MADERA_INPUT_ENABLES, MADERA_IN1R_ENA_SHIFT,
928 		   0, NULL, 0, madera_in_ev,
929 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
930 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
931 SND_SOC_DAPM_PGA_E("IN2L", MADERA_INPUT_ENABLES, MADERA_IN2L_ENA_SHIFT,
932 		   0, NULL, 0, madera_in_ev,
933 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
934 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
935 SND_SOC_DAPM_PGA_E("IN2R", MADERA_INPUT_ENABLES, MADERA_IN2R_ENA_SHIFT,
936 		   0, NULL, 0, madera_in_ev,
937 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
938 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
939 SND_SOC_DAPM_PGA_E("IN3L", MADERA_INPUT_ENABLES, MADERA_IN3L_ENA_SHIFT,
940 		   0, NULL, 0, madera_in_ev,
941 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
942 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
943 SND_SOC_DAPM_PGA_E("IN3R", MADERA_INPUT_ENABLES, MADERA_IN3R_ENA_SHIFT,
944 		   0, NULL, 0, madera_in_ev,
945 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
946 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
947 SND_SOC_DAPM_PGA_E("IN4L", MADERA_INPUT_ENABLES, MADERA_IN4L_ENA_SHIFT,
948 		   0, NULL, 0, madera_in_ev,
949 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
950 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
951 SND_SOC_DAPM_PGA_E("IN4R", MADERA_INPUT_ENABLES, MADERA_IN4R_ENA_SHIFT,
952 		   0, NULL, 0, madera_in_ev,
953 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
954 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
955 
956 SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
957 		    MADERA_AIF1_RX_ENABLES, MADERA_AIF1RX1_ENA_SHIFT, 0),
958 SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 1,
959 		    MADERA_AIF1_RX_ENABLES, MADERA_AIF1RX2_ENA_SHIFT, 0),
960 SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 2,
961 		    MADERA_AIF1_RX_ENABLES, MADERA_AIF1RX3_ENA_SHIFT, 0),
962 SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 3,
963 		    MADERA_AIF1_RX_ENABLES, MADERA_AIF1RX4_ENA_SHIFT, 0),
964 SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 4,
965 		    MADERA_AIF1_RX_ENABLES, MADERA_AIF1RX5_ENA_SHIFT, 0),
966 SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 5,
967 		    MADERA_AIF1_RX_ENABLES, MADERA_AIF1RX6_ENA_SHIFT, 0),
968 SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 6,
969 		    MADERA_AIF1_RX_ENABLES, MADERA_AIF1RX7_ENA_SHIFT, 0),
970 SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 7,
971 		    MADERA_AIF1_RX_ENABLES, MADERA_AIF1RX8_ENA_SHIFT, 0),
972 
973 SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
974 		    MADERA_AIF2_RX_ENABLES, MADERA_AIF2RX1_ENA_SHIFT, 0),
975 SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 1,
976 		    MADERA_AIF2_RX_ENABLES, MADERA_AIF2RX2_ENA_SHIFT, 0),
977 SND_SOC_DAPM_AIF_IN("AIF2RX3", NULL, 2,
978 		    MADERA_AIF2_RX_ENABLES, MADERA_AIF2RX3_ENA_SHIFT, 0),
979 SND_SOC_DAPM_AIF_IN("AIF2RX4", NULL, 3,
980 		    MADERA_AIF2_RX_ENABLES, MADERA_AIF2RX4_ENA_SHIFT, 0),
981 SND_SOC_DAPM_AIF_IN("AIF2RX5", NULL, 4,
982 		    MADERA_AIF2_RX_ENABLES, MADERA_AIF2RX5_ENA_SHIFT, 0),
983 SND_SOC_DAPM_AIF_IN("AIF2RX6", NULL, 5,
984 		    MADERA_AIF2_RX_ENABLES, MADERA_AIF2RX6_ENA_SHIFT, 0),
985 SND_SOC_DAPM_AIF_IN("AIF2RX7", NULL, 6,
986 		    MADERA_AIF2_RX_ENABLES, MADERA_AIF2RX7_ENA_SHIFT, 0),
987 SND_SOC_DAPM_AIF_IN("AIF2RX8", NULL, 7,
988 		    MADERA_AIF2_RX_ENABLES, MADERA_AIF2RX8_ENA_SHIFT, 0),
989 
990 SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
991 		    MADERA_AIF3_RX_ENABLES, MADERA_AIF3RX1_ENA_SHIFT, 0),
992 SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 1,
993 		    MADERA_AIF3_RX_ENABLES, MADERA_AIF3RX2_ENA_SHIFT, 0),
994 SND_SOC_DAPM_AIF_IN("AIF3RX3", NULL, 2,
995 		    MADERA_AIF3_RX_ENABLES, MADERA_AIF3RX3_ENA_SHIFT, 0),
996 SND_SOC_DAPM_AIF_IN("AIF3RX4", NULL, 3,
997 		    MADERA_AIF3_RX_ENABLES, MADERA_AIF3RX4_ENA_SHIFT, 0),
998 
999 SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0, MADERA_SLIMBUS_RX_CHANNEL_ENABLE,
1000 		    MADERA_SLIMRX1_ENA_SHIFT, 0),
1001 SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 1, MADERA_SLIMBUS_RX_CHANNEL_ENABLE,
1002 		    MADERA_SLIMRX2_ENA_SHIFT, 0),
1003 SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 2, MADERA_SLIMBUS_RX_CHANNEL_ENABLE,
1004 		    MADERA_SLIMRX3_ENA_SHIFT, 0),
1005 SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 3, MADERA_SLIMBUS_RX_CHANNEL_ENABLE,
1006 		    MADERA_SLIMRX4_ENA_SHIFT, 0),
1007 SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL, 4, MADERA_SLIMBUS_RX_CHANNEL_ENABLE,
1008 		    MADERA_SLIMRX5_ENA_SHIFT, 0),
1009 SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL, 5, MADERA_SLIMBUS_RX_CHANNEL_ENABLE,
1010 		    MADERA_SLIMRX6_ENA_SHIFT, 0),
1011 SND_SOC_DAPM_AIF_IN("SLIMRX7", NULL, 6, MADERA_SLIMBUS_RX_CHANNEL_ENABLE,
1012 		    MADERA_SLIMRX7_ENA_SHIFT, 0),
1013 SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 7, MADERA_SLIMBUS_RX_CHANNEL_ENABLE,
1014 		    MADERA_SLIMRX8_ENA_SHIFT, 0),
1015 
1016 SND_SOC_DAPM_PGA("EQ1", MADERA_EQ1_1, MADERA_EQ1_ENA_SHIFT, 0, NULL, 0),
1017 SND_SOC_DAPM_PGA("EQ2", MADERA_EQ2_1, MADERA_EQ2_ENA_SHIFT, 0, NULL, 0),
1018 SND_SOC_DAPM_PGA("EQ3", MADERA_EQ3_1, MADERA_EQ3_ENA_SHIFT, 0, NULL, 0),
1019 SND_SOC_DAPM_PGA("EQ4", MADERA_EQ4_1, MADERA_EQ4_ENA_SHIFT, 0, NULL, 0),
1020 
1021 SND_SOC_DAPM_PGA("DRC1L", MADERA_DRC1_CTRL1, MADERA_DRC1L_ENA_SHIFT, 0,
1022 		 NULL, 0),
1023 SND_SOC_DAPM_PGA("DRC1R", MADERA_DRC1_CTRL1, MADERA_DRC1R_ENA_SHIFT, 0,
1024 		 NULL, 0),
1025 SND_SOC_DAPM_PGA("DRC2L", MADERA_DRC2_CTRL1, MADERA_DRC2L_ENA_SHIFT, 0,
1026 		 NULL, 0),
1027 SND_SOC_DAPM_PGA("DRC2R", MADERA_DRC2_CTRL1, MADERA_DRC2R_ENA_SHIFT, 0,
1028 		 NULL, 0),
1029 
1030 SND_SOC_DAPM_PGA("LHPF1", MADERA_HPLPF1_1, MADERA_LHPF1_ENA_SHIFT, 0,
1031 		 NULL, 0),
1032 SND_SOC_DAPM_PGA("LHPF2", MADERA_HPLPF2_1, MADERA_LHPF2_ENA_SHIFT, 0,
1033 		 NULL, 0),
1034 SND_SOC_DAPM_PGA("LHPF3", MADERA_HPLPF3_1, MADERA_LHPF3_ENA_SHIFT, 0,
1035 		 NULL, 0),
1036 SND_SOC_DAPM_PGA("LHPF4", MADERA_HPLPF4_1, MADERA_LHPF4_ENA_SHIFT, 0,
1037 		 NULL, 0),
1038 
1039 SND_SOC_DAPM_PGA("ASRC1IN1L", MADERA_ASRC1_ENABLE,
1040 		 MADERA_ASRC1_IN1L_ENA_SHIFT, 0, NULL, 0),
1041 SND_SOC_DAPM_PGA("ASRC1IN1R", MADERA_ASRC1_ENABLE,
1042 		 MADERA_ASRC1_IN1R_ENA_SHIFT, 0, NULL, 0),
1043 SND_SOC_DAPM_PGA("ASRC1IN2L", MADERA_ASRC1_ENABLE,
1044 		 MADERA_ASRC1_IN2L_ENA_SHIFT, 0, NULL, 0),
1045 SND_SOC_DAPM_PGA("ASRC1IN2R", MADERA_ASRC1_ENABLE,
1046 		 MADERA_ASRC1_IN2R_ENA_SHIFT, 0, NULL, 0),
1047 
1048 SND_SOC_DAPM_PGA("ISRC1DEC1", MADERA_ISRC_1_CTRL_3,
1049 		 MADERA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
1050 SND_SOC_DAPM_PGA("ISRC1DEC2", MADERA_ISRC_1_CTRL_3,
1051 		 MADERA_ISRC1_DEC2_ENA_SHIFT, 0, NULL, 0),
1052 
1053 SND_SOC_DAPM_PGA("ISRC1INT1", MADERA_ISRC_1_CTRL_3,
1054 		 MADERA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
1055 SND_SOC_DAPM_PGA("ISRC1INT2", MADERA_ISRC_1_CTRL_3,
1056 		 MADERA_ISRC1_INT2_ENA_SHIFT, 0, NULL, 0),
1057 
1058 SND_SOC_DAPM_PGA("ISRC2DEC1", MADERA_ISRC_2_CTRL_3,
1059 		 MADERA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
1060 SND_SOC_DAPM_PGA("ISRC2DEC2", MADERA_ISRC_2_CTRL_3,
1061 		 MADERA_ISRC2_DEC2_ENA_SHIFT, 0, NULL, 0),
1062 
1063 SND_SOC_DAPM_PGA("ISRC2INT1", MADERA_ISRC_2_CTRL_3,
1064 		 MADERA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
1065 SND_SOC_DAPM_PGA("ISRC2INT2", MADERA_ISRC_2_CTRL_3,
1066 		 MADERA_ISRC2_INT2_ENA_SHIFT, 0, NULL, 0),
1067 
1068 WM_ADSP2("DSP1", 0, cs47l92_adsp_power_ev),
1069 
1070 /* end of ordered widget list */
1071 
1072 SND_SOC_DAPM_PGA("DFC1", MADERA_DFC1_CTRL, MADERA_DFC1_ENA_SHIFT, 0, NULL, 0),
1073 SND_SOC_DAPM_PGA("DFC2", MADERA_DFC2_CTRL, MADERA_DFC1_ENA_SHIFT, 0, NULL, 0),
1074 SND_SOC_DAPM_PGA("DFC3", MADERA_DFC3_CTRL, MADERA_DFC1_ENA_SHIFT, 0, NULL, 0),
1075 SND_SOC_DAPM_PGA("DFC4", MADERA_DFC4_CTRL, MADERA_DFC1_ENA_SHIFT, 0, NULL, 0),
1076 SND_SOC_DAPM_PGA("DFC5", MADERA_DFC5_CTRL, MADERA_DFC1_ENA_SHIFT, 0, NULL, 0),
1077 SND_SOC_DAPM_PGA("DFC6", MADERA_DFC6_CTRL, MADERA_DFC1_ENA_SHIFT, 0, NULL, 0),
1078 SND_SOC_DAPM_PGA("DFC7", MADERA_DFC7_CTRL, MADERA_DFC1_ENA_SHIFT, 0, NULL, 0),
1079 SND_SOC_DAPM_PGA("DFC8", MADERA_DFC8_CTRL, MADERA_DFC1_ENA_SHIFT, 0, NULL, 0),
1080 
1081 MADERA_MIXER_WIDGETS(EQ1, "EQ1"),
1082 MADERA_MIXER_WIDGETS(EQ2, "EQ2"),
1083 MADERA_MIXER_WIDGETS(EQ3, "EQ3"),
1084 MADERA_MIXER_WIDGETS(EQ4, "EQ4"),
1085 
1086 MADERA_MIXER_WIDGETS(DRC1L, "DRC1L"),
1087 MADERA_MIXER_WIDGETS(DRC1R, "DRC1R"),
1088 MADERA_MIXER_WIDGETS(DRC2L, "DRC2L"),
1089 MADERA_MIXER_WIDGETS(DRC2R, "DRC2R"),
1090 
1091 SND_SOC_DAPM_SWITCH("DRC1 Activity Output", SND_SOC_NOPM, 0, 0,
1092 		    &madera_drc_activity_output_mux[0]),
1093 SND_SOC_DAPM_SWITCH("DRC2 Activity Output", SND_SOC_NOPM, 0, 0,
1094 		    &madera_drc_activity_output_mux[1]),
1095 
1096 MADERA_MIXER_WIDGETS(LHPF1, "LHPF1"),
1097 MADERA_MIXER_WIDGETS(LHPF2, "LHPF2"),
1098 MADERA_MIXER_WIDGETS(LHPF3, "LHPF3"),
1099 MADERA_MIXER_WIDGETS(LHPF4, "LHPF4"),
1100 
1101 MADERA_MIXER_WIDGETS(PWM1, "PWM1"),
1102 MADERA_MIXER_WIDGETS(PWM2, "PWM2"),
1103 
1104 MADERA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
1105 MADERA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
1106 MADERA_MIXER_WIDGETS(OUT2L, "HPOUT2L"),
1107 MADERA_MIXER_WIDGETS(OUT2R, "HPOUT2R"),
1108 MADERA_MIXER_WIDGETS(OUT3L, "HPOUT3L"),
1109 MADERA_MIXER_WIDGETS(OUT3R, "HPOUT3R"),
1110 MADERA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
1111 MADERA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
1112 
1113 MADERA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
1114 MADERA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
1115 MADERA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
1116 MADERA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
1117 MADERA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
1118 MADERA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
1119 MADERA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
1120 MADERA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
1121 
1122 MADERA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
1123 MADERA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
1124 MADERA_MIXER_WIDGETS(AIF2TX3, "AIF2TX3"),
1125 MADERA_MIXER_WIDGETS(AIF2TX4, "AIF2TX4"),
1126 MADERA_MIXER_WIDGETS(AIF2TX5, "AIF2TX5"),
1127 MADERA_MIXER_WIDGETS(AIF2TX6, "AIF2TX6"),
1128 MADERA_MIXER_WIDGETS(AIF2TX7, "AIF2TX7"),
1129 MADERA_MIXER_WIDGETS(AIF2TX8, "AIF2TX8"),
1130 
1131 MADERA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
1132 MADERA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
1133 MADERA_MIXER_WIDGETS(AIF3TX3, "AIF3TX3"),
1134 MADERA_MIXER_WIDGETS(AIF3TX4, "AIF3TX4"),
1135 
1136 MADERA_MIXER_WIDGETS(SLIMTX1, "SLIMTX1"),
1137 MADERA_MIXER_WIDGETS(SLIMTX2, "SLIMTX2"),
1138 MADERA_MIXER_WIDGETS(SLIMTX3, "SLIMTX3"),
1139 MADERA_MIXER_WIDGETS(SLIMTX4, "SLIMTX4"),
1140 MADERA_MIXER_WIDGETS(SLIMTX5, "SLIMTX5"),
1141 MADERA_MIXER_WIDGETS(SLIMTX6, "SLIMTX6"),
1142 MADERA_MIXER_WIDGETS(SLIMTX7, "SLIMTX7"),
1143 MADERA_MIXER_WIDGETS(SLIMTX8, "SLIMTX8"),
1144 
1145 MADERA_MUX_WIDGETS(SPD1TX1, "SPDIFTX1"),
1146 MADERA_MUX_WIDGETS(SPD1TX2, "SPDIFTX2"),
1147 
1148 MADERA_MUX_WIDGETS(ASRC1IN1L, "ASRC1IN1L"),
1149 MADERA_MUX_WIDGETS(ASRC1IN1R, "ASRC1IN1R"),
1150 MADERA_MUX_WIDGETS(ASRC1IN2L, "ASRC1IN2L"),
1151 MADERA_MUX_WIDGETS(ASRC1IN2R, "ASRC1IN2R"),
1152 
1153 MADERA_DSP_WIDGETS(DSP1, "DSP1"),
1154 
1155 MADERA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
1156 MADERA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
1157 
1158 MADERA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
1159 MADERA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
1160 
1161 MADERA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
1162 MADERA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
1163 
1164 MADERA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
1165 MADERA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
1166 
1167 MADERA_MUX_WIDGETS(DFC1, "DFC1"),
1168 MADERA_MUX_WIDGETS(DFC2, "DFC2"),
1169 MADERA_MUX_WIDGETS(DFC3, "DFC3"),
1170 MADERA_MUX_WIDGETS(DFC4, "DFC4"),
1171 MADERA_MUX_WIDGETS(DFC5, "DFC5"),
1172 MADERA_MUX_WIDGETS(DFC6, "DFC6"),
1173 MADERA_MUX_WIDGETS(DFC7, "DFC7"),
1174 MADERA_MUX_WIDGETS(DFC8, "DFC8"),
1175 
1176 SND_SOC_DAPM_OUTPUT("HPOUT1L"),
1177 SND_SOC_DAPM_OUTPUT("HPOUT1R"),
1178 SND_SOC_DAPM_OUTPUT("HPOUT2L"),
1179 SND_SOC_DAPM_OUTPUT("HPOUT2R"),
1180 SND_SOC_DAPM_OUTPUT("HPOUT3L"),
1181 SND_SOC_DAPM_OUTPUT("HPOUT3R"),
1182 SND_SOC_DAPM_OUTPUT("HPOUT4L"),
1183 SND_SOC_DAPM_OUTPUT("HPOUT4R"),
1184 SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
1185 SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
1186 SND_SOC_DAPM_OUTPUT("SPDIF1"),
1187 
1188 SND_SOC_DAPM_OUTPUT("MICSUPP"),
1189 };
1190 
1191 #define MADERA_MIXER_INPUT_ROUTES(name)	\
1192 	{ name, "Noise Generator", "Noise Generator" }, \
1193 	{ name, "Tone Generator 1", "Tone Generator 1" }, \
1194 	{ name, "Tone Generator 2", "Tone Generator 2" }, \
1195 	{ name, "Haptics", "HAPTICS" }, \
1196 	{ name, "AEC1", "AEC1 Loopback" }, \
1197 	{ name, "IN1L", "IN1L" }, \
1198 	{ name, "IN1R", "IN1R" }, \
1199 	{ name, "IN2L", "IN2L" }, \
1200 	{ name, "IN2R", "IN2R" }, \
1201 	{ name, "IN3L", "IN3L" }, \
1202 	{ name, "IN3R", "IN3R" }, \
1203 	{ name, "IN4L", "IN4L" }, \
1204 	{ name, "IN4R", "IN4R" }, \
1205 	{ name, "AIF1RX1", "AIF1RX1" }, \
1206 	{ name, "AIF1RX2", "AIF1RX2" }, \
1207 	{ name, "AIF1RX3", "AIF1RX3" }, \
1208 	{ name, "AIF1RX4", "AIF1RX4" }, \
1209 	{ name, "AIF1RX5", "AIF1RX5" }, \
1210 	{ name, "AIF1RX6", "AIF1RX6" }, \
1211 	{ name, "AIF1RX7", "AIF1RX7" }, \
1212 	{ name, "AIF1RX8", "AIF1RX8" }, \
1213 	{ name, "AIF2RX1", "AIF2RX1" }, \
1214 	{ name, "AIF2RX2", "AIF2RX2" }, \
1215 	{ name, "AIF2RX3", "AIF2RX3" }, \
1216 	{ name, "AIF2RX4", "AIF2RX4" }, \
1217 	{ name, "AIF2RX5", "AIF2RX5" }, \
1218 	{ name, "AIF2RX6", "AIF2RX6" }, \
1219 	{ name, "AIF2RX7", "AIF2RX7" }, \
1220 	{ name, "AIF2RX8", "AIF2RX8" }, \
1221 	{ name, "AIF3RX1", "AIF3RX1" }, \
1222 	{ name, "AIF3RX2", "AIF3RX2" }, \
1223 	{ name, "AIF3RX3", "AIF3RX3" }, \
1224 	{ name, "AIF3RX4", "AIF3RX4" }, \
1225 	{ name, "SLIMRX1", "SLIMRX1" }, \
1226 	{ name, "SLIMRX2", "SLIMRX2" }, \
1227 	{ name, "SLIMRX3", "SLIMRX3" }, \
1228 	{ name, "SLIMRX4", "SLIMRX4" }, \
1229 	{ name, "SLIMRX5", "SLIMRX5" }, \
1230 	{ name, "SLIMRX6", "SLIMRX6" }, \
1231 	{ name, "SLIMRX7", "SLIMRX7" }, \
1232 	{ name, "SLIMRX8", "SLIMRX8" }, \
1233 	{ name, "EQ1", "EQ1" }, \
1234 	{ name, "EQ2", "EQ2" }, \
1235 	{ name, "EQ3", "EQ3" }, \
1236 	{ name, "EQ4", "EQ4" }, \
1237 	{ name, "DRC1L", "DRC1L" }, \
1238 	{ name, "DRC1R", "DRC1R" }, \
1239 	{ name, "DRC2L", "DRC2L" }, \
1240 	{ name, "DRC2R", "DRC2R" }, \
1241 	{ name, "LHPF1", "LHPF1" }, \
1242 	{ name, "LHPF2", "LHPF2" }, \
1243 	{ name, "LHPF3", "LHPF3" }, \
1244 	{ name, "LHPF4", "LHPF4" }, \
1245 	{ name, "ASRC1IN1L", "ASRC1IN1L" }, \
1246 	{ name, "ASRC1IN1R", "ASRC1IN1R" }, \
1247 	{ name, "ASRC1IN2L", "ASRC1IN2L" }, \
1248 	{ name, "ASRC1IN2R", "ASRC1IN2R" }, \
1249 	{ name, "ISRC1DEC1", "ISRC1DEC1" }, \
1250 	{ name, "ISRC1DEC2", "ISRC1DEC2" }, \
1251 	{ name, "ISRC1INT1", "ISRC1INT1" }, \
1252 	{ name, "ISRC1INT2", "ISRC1INT2" }, \
1253 	{ name, "ISRC2DEC1", "ISRC2DEC1" }, \
1254 	{ name, "ISRC2DEC2", "ISRC2DEC2" }, \
1255 	{ name, "ISRC2INT1", "ISRC2INT1" }, \
1256 	{ name, "ISRC2INT2", "ISRC2INT2" }, \
1257 	{ name, "DSP1.1", "DSP1" }, \
1258 	{ name, "DSP1.2", "DSP1" }, \
1259 	{ name, "DSP1.3", "DSP1" }, \
1260 	{ name, "DSP1.4", "DSP1" }, \
1261 	{ name, "DSP1.5", "DSP1" }, \
1262 	{ name, "DSP1.6", "DSP1" }, \
1263 	{ name, "DFC1", "DFC1" }, \
1264 	{ name, "DFC2", "DFC2" }, \
1265 	{ name, "DFC3", "DFC3" }, \
1266 	{ name, "DFC4", "DFC4" }, \
1267 	{ name, "DFC5", "DFC5" }, \
1268 	{ name, "DFC6", "DFC6" }, \
1269 	{ name, "DFC7", "DFC7" }, \
1270 	{ name, "DFC8", "DFC8" }
1271 
1272 static const struct snd_soc_dapm_route cs47l92_dapm_routes[] = {
1273 	/* Internal clock domains */
1274 	{ "EQ1", NULL, "FXCLK" },
1275 	{ "EQ2", NULL, "FXCLK" },
1276 	{ "EQ3", NULL, "FXCLK" },
1277 	{ "EQ4", NULL, "FXCLK" },
1278 	{ "DRC1L", NULL, "FXCLK" },
1279 	{ "DRC1R", NULL, "FXCLK" },
1280 	{ "DRC2L", NULL, "FXCLK" },
1281 	{ "DRC2R", NULL, "FXCLK" },
1282 	{ "LHPF1", NULL, "FXCLK" },
1283 	{ "LHPF2", NULL, "FXCLK" },
1284 	{ "LHPF3", NULL, "FXCLK" },
1285 	{ "LHPF4", NULL, "FXCLK" },
1286 	{ "PWM1 Mixer", NULL, "PWMCLK" },
1287 	{ "PWM2 Mixer", NULL, "PWMCLK" },
1288 	{ "OUT1L", NULL, "OUTCLK" },
1289 	{ "OUT1R", NULL, "OUTCLK" },
1290 	{ "OUT2L", NULL, "OUTCLK" },
1291 	{ "OUT2R", NULL, "OUTCLK" },
1292 	{ "OUT3L", NULL, "OUTCLK" },
1293 	{ "OUT3R", NULL, "OUTCLK" },
1294 	{ "OUT5L", NULL, "OUTCLK" },
1295 	{ "OUT5R", NULL, "OUTCLK" },
1296 	{ "AIF1TX1", NULL, "AIF1TXCLK" },
1297 	{ "AIF1TX2", NULL, "AIF1TXCLK" },
1298 	{ "AIF1TX3", NULL, "AIF1TXCLK" },
1299 	{ "AIF1TX4", NULL, "AIF1TXCLK" },
1300 	{ "AIF1TX5", NULL, "AIF1TXCLK" },
1301 	{ "AIF1TX6", NULL, "AIF1TXCLK" },
1302 	{ "AIF1TX7", NULL, "AIF1TXCLK" },
1303 	{ "AIF1TX8", NULL, "AIF1TXCLK" },
1304 	{ "AIF2TX1", NULL, "AIF2TXCLK" },
1305 	{ "AIF2TX2", NULL, "AIF2TXCLK" },
1306 	{ "AIF2TX3", NULL, "AIF2TXCLK" },
1307 	{ "AIF2TX4", NULL, "AIF2TXCLK" },
1308 	{ "AIF2TX5", NULL, "AIF2TXCLK" },
1309 	{ "AIF2TX6", NULL, "AIF2TXCLK" },
1310 	{ "AIF2TX7", NULL, "AIF2TXCLK" },
1311 	{ "AIF2TX8", NULL, "AIF2TXCLK" },
1312 	{ "AIF3TX1", NULL, "AIF3TXCLK" },
1313 	{ "AIF3TX2", NULL, "AIF3TXCLK" },
1314 	{ "AIF3TX3", NULL, "AIF3TXCLK" },
1315 	{ "AIF3TX4", NULL, "AIF3TXCLK" },
1316 	{ "SLIMTX1", NULL, "SLIMBUSCLK" },
1317 	{ "SLIMTX2", NULL, "SLIMBUSCLK" },
1318 	{ "SLIMTX3", NULL, "SLIMBUSCLK" },
1319 	{ "SLIMTX4", NULL, "SLIMBUSCLK" },
1320 	{ "SLIMTX5", NULL, "SLIMBUSCLK" },
1321 	{ "SLIMTX6", NULL, "SLIMBUSCLK" },
1322 	{ "SLIMTX7", NULL, "SLIMBUSCLK" },
1323 	{ "SLIMTX8", NULL, "SLIMBUSCLK" },
1324 	{ "SPD1TX1", NULL, "SPDCLK" },
1325 	{ "SPD1TX2", NULL, "SPDCLK" },
1326 	{ "DSP1", NULL, "DSP1CLK" },
1327 	{ "ISRC1DEC1", NULL, "ISRC1CLK" },
1328 	{ "ISRC1DEC2", NULL, "ISRC1CLK" },
1329 	{ "ISRC1INT1", NULL, "ISRC1CLK" },
1330 	{ "ISRC1INT2", NULL, "ISRC1CLK" },
1331 	{ "ISRC2DEC1", NULL, "ISRC2CLK" },
1332 	{ "ISRC2DEC2", NULL, "ISRC2CLK" },
1333 	{ "ISRC2INT1", NULL, "ISRC2CLK" },
1334 	{ "ISRC2INT2", NULL, "ISRC2CLK" },
1335 	{ "ASRC1IN1L", NULL, "ASRC1CLK" },
1336 	{ "ASRC1IN1R", NULL, "ASRC1CLK" },
1337 	{ "ASRC1IN2L", NULL, "ASRC1CLK" },
1338 	{ "ASRC1IN2R", NULL, "ASRC1CLK" },
1339 	{ "DFC1", NULL, "DFCCLK" },
1340 	{ "DFC2", NULL, "DFCCLK" },
1341 	{ "DFC3", NULL, "DFCCLK" },
1342 	{ "DFC4", NULL, "DFCCLK" },
1343 	{ "DFC5", NULL, "DFCCLK" },
1344 	{ "DFC6", NULL, "DFCCLK" },
1345 	{ "DFC7", NULL, "DFCCLK" },
1346 	{ "DFC8", NULL, "DFCCLK" },
1347 
1348 	{ "OUT1L", NULL, "CPVDD1" },
1349 	{ "OUT1L", NULL, "CPVDD2" },
1350 	{ "OUT1R", NULL, "CPVDD1" },
1351 	{ "OUT1R", NULL, "CPVDD2" },
1352 	{ "OUT2L", NULL, "CPVDD1" },
1353 	{ "OUT2L", NULL, "CPVDD2" },
1354 	{ "OUT2R", NULL, "CPVDD1" },
1355 	{ "OUT2R", NULL, "CPVDD2" },
1356 	{ "OUT3L", NULL, "CPVDD1" },
1357 	{ "OUT3L", NULL, "CPVDD2" },
1358 	{ "OUT3R", NULL, "CPVDD1" },
1359 	{ "OUT3R", NULL, "CPVDD2" },
1360 
1361 	{ "OUT1L", NULL, "SYSCLK" },
1362 	{ "OUT1R", NULL, "SYSCLK" },
1363 	{ "OUT2L", NULL, "SYSCLK" },
1364 	{ "OUT2R", NULL, "SYSCLK" },
1365 	{ "OUT3L", NULL, "SYSCLK" },
1366 	{ "OUT3R", NULL, "SYSCLK" },
1367 	{ "OUT5L", NULL, "SYSCLK" },
1368 	{ "OUT5R", NULL, "SYSCLK" },
1369 
1370 	{ "SPD1", NULL, "SYSCLK" },
1371 	{ "SPD1", NULL, "SPD1TX1" },
1372 	{ "SPD1", NULL, "SPD1TX2" },
1373 
1374 	{ "IN1L", NULL, "SYSCLK" },
1375 	{ "IN1R", NULL, "SYSCLK" },
1376 	{ "IN2L", NULL, "SYSCLK" },
1377 	{ "IN2R", NULL, "SYSCLK" },
1378 	{ "IN3L", NULL, "SYSCLK" },
1379 	{ "IN3R", NULL, "SYSCLK" },
1380 	{ "IN4L", NULL, "SYSCLK" },
1381 	{ "IN4R", NULL, "SYSCLK" },
1382 
1383 	{ "ASRC1IN1L", NULL, "SYSCLK" },
1384 	{ "ASRC1IN1R", NULL, "SYSCLK" },
1385 	{ "ASRC1IN2L", NULL, "SYSCLK" },
1386 	{ "ASRC1IN2R", NULL, "SYSCLK" },
1387 
1388 	{ "ASRC1IN1L", NULL, "ASYNCCLK" },
1389 	{ "ASRC1IN1R", NULL, "ASYNCCLK" },
1390 	{ "ASRC1IN2L", NULL, "ASYNCCLK" },
1391 	{ "ASRC1IN2R", NULL, "ASYNCCLK" },
1392 
1393 	{ "MICBIAS1", NULL, "MICVDD" },
1394 	{ "MICBIAS2", NULL, "MICVDD" },
1395 
1396 	{ "MICBIAS1A", NULL, "MICBIAS1" },
1397 	{ "MICBIAS1B", NULL, "MICBIAS1" },
1398 	{ "MICBIAS1C", NULL, "MICBIAS1" },
1399 	{ "MICBIAS1D", NULL, "MICBIAS1" },
1400 
1401 	{ "MICBIAS2A", NULL, "MICBIAS2" },
1402 	{ "MICBIAS2B", NULL, "MICBIAS2" },
1403 
1404 	{ "Noise Generator", NULL, "SYSCLK" },
1405 	{ "Tone Generator 1", NULL, "SYSCLK" },
1406 	{ "Tone Generator 2", NULL, "SYSCLK" },
1407 
1408 	{ "Noise Generator", NULL, "NOISE" },
1409 	{ "Tone Generator 1", NULL, "TONE" },
1410 	{ "Tone Generator 2", NULL, "TONE" },
1411 
1412 	{ "AIF1 Capture", NULL, "AIF1TX1" },
1413 	{ "AIF1 Capture", NULL, "AIF1TX2" },
1414 	{ "AIF1 Capture", NULL, "AIF1TX3" },
1415 	{ "AIF1 Capture", NULL, "AIF1TX4" },
1416 	{ "AIF1 Capture", NULL, "AIF1TX5" },
1417 	{ "AIF1 Capture", NULL, "AIF1TX6" },
1418 	{ "AIF1 Capture", NULL, "AIF1TX7" },
1419 	{ "AIF1 Capture", NULL, "AIF1TX8" },
1420 
1421 	{ "AIF1RX1", NULL, "AIF1 Playback" },
1422 	{ "AIF1RX2", NULL, "AIF1 Playback" },
1423 	{ "AIF1RX3", NULL, "AIF1 Playback" },
1424 	{ "AIF1RX4", NULL, "AIF1 Playback" },
1425 	{ "AIF1RX5", NULL, "AIF1 Playback" },
1426 	{ "AIF1RX6", NULL, "AIF1 Playback" },
1427 	{ "AIF1RX7", NULL, "AIF1 Playback" },
1428 	{ "AIF1RX8", NULL, "AIF1 Playback" },
1429 
1430 	{ "AIF2 Capture", NULL, "AIF2TX1" },
1431 	{ "AIF2 Capture", NULL, "AIF2TX2" },
1432 	{ "AIF2 Capture", NULL, "AIF2TX3" },
1433 	{ "AIF2 Capture", NULL, "AIF2TX4" },
1434 	{ "AIF2 Capture", NULL, "AIF2TX5" },
1435 	{ "AIF2 Capture", NULL, "AIF2TX6" },
1436 	{ "AIF2 Capture", NULL, "AIF2TX7" },
1437 	{ "AIF2 Capture", NULL, "AIF2TX8" },
1438 
1439 	{ "AIF2RX1", NULL, "AIF2 Playback" },
1440 	{ "AIF2RX2", NULL, "AIF2 Playback" },
1441 	{ "AIF2RX3", NULL, "AIF2 Playback" },
1442 	{ "AIF2RX4", NULL, "AIF2 Playback" },
1443 	{ "AIF2RX5", NULL, "AIF2 Playback" },
1444 	{ "AIF2RX6", NULL, "AIF2 Playback" },
1445 	{ "AIF2RX7", NULL, "AIF2 Playback" },
1446 	{ "AIF2RX8", NULL, "AIF2 Playback" },
1447 
1448 	{ "AIF3 Capture", NULL, "AIF3TX1" },
1449 	{ "AIF3 Capture", NULL, "AIF3TX2" },
1450 	{ "AIF3 Capture", NULL, "AIF3TX3" },
1451 	{ "AIF3 Capture", NULL, "AIF3TX4" },
1452 
1453 	{ "AIF3RX1", NULL, "AIF3 Playback" },
1454 	{ "AIF3RX2", NULL, "AIF3 Playback" },
1455 	{ "AIF3RX3", NULL, "AIF3 Playback" },
1456 	{ "AIF3RX4", NULL, "AIF3 Playback" },
1457 
1458 	{ "Slim1 Capture", NULL, "SLIMTX1" },
1459 	{ "Slim1 Capture", NULL, "SLIMTX2" },
1460 	{ "Slim1 Capture", NULL, "SLIMTX3" },
1461 	{ "Slim1 Capture", NULL, "SLIMTX4" },
1462 
1463 	{ "SLIMRX1", NULL, "Slim1 Playback" },
1464 	{ "SLIMRX2", NULL, "Slim1 Playback" },
1465 	{ "SLIMRX3", NULL, "Slim1 Playback" },
1466 	{ "SLIMRX4", NULL, "Slim1 Playback" },
1467 
1468 	{ "Slim2 Capture", NULL, "SLIMTX5" },
1469 	{ "Slim2 Capture", NULL, "SLIMTX6" },
1470 
1471 	{ "SLIMRX5", NULL, "Slim2 Playback" },
1472 	{ "SLIMRX6", NULL, "Slim2 Playback" },
1473 
1474 	{ "Slim3 Capture", NULL, "SLIMTX7" },
1475 	{ "Slim3 Capture", NULL, "SLIMTX8" },
1476 
1477 	{ "SLIMRX7", NULL, "Slim3 Playback" },
1478 	{ "SLIMRX8", NULL, "Slim3 Playback" },
1479 
1480 	{ "AIF1 Playback", NULL, "SYSCLK" },
1481 	{ "AIF2 Playback", NULL, "SYSCLK" },
1482 	{ "AIF3 Playback", NULL, "SYSCLK" },
1483 	{ "Slim1 Playback", NULL, "SYSCLK" },
1484 	{ "Slim2 Playback", NULL, "SYSCLK" },
1485 	{ "Slim3 Playback", NULL, "SYSCLK" },
1486 
1487 	{ "AIF1 Capture", NULL, "SYSCLK" },
1488 	{ "AIF2 Capture", NULL, "SYSCLK" },
1489 	{ "AIF3 Capture", NULL, "SYSCLK" },
1490 	{ "Slim1 Capture", NULL, "SYSCLK" },
1491 	{ "Slim2 Capture", NULL, "SYSCLK" },
1492 	{ "Slim3 Capture", NULL, "SYSCLK" },
1493 
1494 	{ "Audio Trace DSP", NULL, "DSP1" },
1495 
1496 	{ "IN1L Analog Mux", "A", "IN1ALN" },
1497 	{ "IN1L Analog Mux", "A", "IN1ALP" },
1498 	{ "IN1L Analog Mux", "B", "IN1BLN" },
1499 	{ "IN1L Analog Mux", "B", "IN1BLP" },
1500 	{ "IN1R Analog Mux", "A", "IN1ARN" },
1501 	{ "IN1R Analog Mux", "A", "IN1ARP" },
1502 	{ "IN1R Analog Mux", "B", "IN1BR" },
1503 	{ "IN1R Analog Mux", "B", "IN1ALN" },
1504 
1505 	{ "IN1L Mode", "Analog", "IN1L Analog Mux" },
1506 	{ "IN1R Mode", "Analog", "IN1R Analog Mux" },
1507 
1508 	{ "IN1L Mode", "Digital", "IN1ALN" },
1509 	{ "IN1L Mode", "Digital", "IN1ALP" },
1510 	{ "IN1R Mode", "Digital", "IN1ALN" },
1511 	{ "IN1R Mode", "Digital", "IN1ALP" },
1512 
1513 	{ "IN1L", NULL, "IN1L Mode" },
1514 	{ "IN1R", NULL, "IN1R Mode" },
1515 
1516 	{ "IN2L Analog Mux", "A", "IN2ALN" },
1517 	{ "IN2L Analog Mux", "A", "IN2ALP" },
1518 	{ "IN2L Analog Mux", "B", "IN2ALN" },
1519 	{ "IN2L Analog Mux", "B", "IN2BL" },
1520 	{ "IN2R Analog Mux", "A", "IN2ARN" },
1521 	{ "IN2R Analog Mux", "A", "IN2ARP" },
1522 	{ "IN2R Analog Mux", "B", "IN2ARN" },
1523 	{ "IN2R Analog Mux", "B", "IN2BR" },
1524 
1525 	{ "IN2L Mode", "Analog", "IN2L Analog Mux" },
1526 	{ "IN2R Mode", "Analog", "IN2R Analog Mux" },
1527 
1528 	{ "IN2L Mode", "Digital", "IN2ALN" },
1529 	{ "IN2L Mode", "Digital", "IN2ALP" },
1530 	{ "IN2R Mode", "Digital", "IN2ALN" },
1531 	{ "IN2R Mode", "Digital", "IN2ALP" },
1532 
1533 	{ "IN2L", NULL, "IN2L Mode" },
1534 	{ "IN2R", NULL, "IN2R Mode" },
1535 
1536 	{ "IN3L", NULL, "IN1ARN" },
1537 	{ "IN3L", NULL, "IN1ARP" },
1538 	{ "IN3R", NULL, "IN1ARN" },
1539 	{ "IN3R", NULL, "IN1ARP" },
1540 
1541 	{ "IN4L", NULL, "IN2ARN" },
1542 	{ "IN4L", NULL, "IN2ARP" },
1543 	{ "IN4R", NULL, "IN2ARN" },
1544 	{ "IN4R", NULL, "IN2ARP" },
1545 
1546 	MADERA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
1547 	MADERA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
1548 	MADERA_MIXER_ROUTES("OUT2L", "HPOUT2L"),
1549 	MADERA_MIXER_ROUTES("OUT2R", "HPOUT2R"),
1550 	MADERA_MIXER_ROUTES("OUT3L", "HPOUT3L"),
1551 	MADERA_MIXER_ROUTES("OUT3R", "HPOUT3R"),
1552 
1553 	MADERA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
1554 	MADERA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
1555 
1556 	MADERA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
1557 	MADERA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
1558 
1559 	MADERA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
1560 	MADERA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
1561 	MADERA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
1562 	MADERA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
1563 	MADERA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
1564 	MADERA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
1565 	MADERA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
1566 	MADERA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
1567 
1568 	MADERA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
1569 	MADERA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
1570 	MADERA_MIXER_ROUTES("AIF2TX3", "AIF2TX3"),
1571 	MADERA_MIXER_ROUTES("AIF2TX4", "AIF2TX4"),
1572 	MADERA_MIXER_ROUTES("AIF2TX5", "AIF2TX5"),
1573 	MADERA_MIXER_ROUTES("AIF2TX6", "AIF2TX6"),
1574 	MADERA_MIXER_ROUTES("AIF2TX7", "AIF2TX7"),
1575 	MADERA_MIXER_ROUTES("AIF2TX8", "AIF2TX8"),
1576 
1577 	MADERA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
1578 	MADERA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
1579 	MADERA_MIXER_ROUTES("AIF3TX3", "AIF3TX3"),
1580 	MADERA_MIXER_ROUTES("AIF3TX4", "AIF3TX4"),
1581 
1582 	MADERA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
1583 	MADERA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
1584 	MADERA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
1585 	MADERA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
1586 	MADERA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
1587 	MADERA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
1588 	MADERA_MIXER_ROUTES("SLIMTX7", "SLIMTX7"),
1589 	MADERA_MIXER_ROUTES("SLIMTX8", "SLIMTX8"),
1590 
1591 	MADERA_MUX_ROUTES("SPD1TX1", "SPDIFTX1"),
1592 	MADERA_MUX_ROUTES("SPD1TX2", "SPDIFTX2"),
1593 
1594 	MADERA_MIXER_ROUTES("EQ1", "EQ1"),
1595 	MADERA_MIXER_ROUTES("EQ2", "EQ2"),
1596 	MADERA_MIXER_ROUTES("EQ3", "EQ3"),
1597 	MADERA_MIXER_ROUTES("EQ4", "EQ4"),
1598 
1599 	MADERA_MIXER_ROUTES("DRC1L", "DRC1L"),
1600 	MADERA_MIXER_ROUTES("DRC1R", "DRC1R"),
1601 	MADERA_MIXER_ROUTES("DRC2L", "DRC2L"),
1602 	MADERA_MIXER_ROUTES("DRC2R", "DRC2R"),
1603 
1604 	MADERA_MIXER_ROUTES("LHPF1", "LHPF1"),
1605 	MADERA_MIXER_ROUTES("LHPF2", "LHPF2"),
1606 	MADERA_MIXER_ROUTES("LHPF3", "LHPF3"),
1607 	MADERA_MIXER_ROUTES("LHPF4", "LHPF4"),
1608 
1609 	MADERA_MUX_ROUTES("ASRC1IN1L", "ASRC1IN1L"),
1610 	MADERA_MUX_ROUTES("ASRC1IN1R", "ASRC1IN1R"),
1611 	MADERA_MUX_ROUTES("ASRC1IN2L", "ASRC1IN2L"),
1612 	MADERA_MUX_ROUTES("ASRC1IN2R", "ASRC1IN2R"),
1613 
1614 	MADERA_DSP_ROUTES("DSP1"),
1615 
1616 	MADERA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
1617 	MADERA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
1618 
1619 	MADERA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
1620 	MADERA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
1621 
1622 	MADERA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
1623 	MADERA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
1624 
1625 	MADERA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
1626 	MADERA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
1627 
1628 	{ "AEC1 Loopback", "HPOUT1L", "OUT1L" },
1629 	{ "AEC1 Loopback", "HPOUT1R", "OUT1R" },
1630 	{ "HPOUT1L", NULL, "OUT1L" },
1631 	{ "HPOUT1R", NULL, "OUT1R" },
1632 
1633 	{ "AEC1 Loopback", "HPOUT2L", "OUT2L" },
1634 	{ "AEC1 Loopback", "HPOUT2R", "OUT2R" },
1635 	{ "HPOUT2L", NULL, "OUT2L" },
1636 	{ "HPOUT2R", NULL, "OUT2R" },
1637 
1638 	{ "AEC1 Loopback", "HPOUT3L", "OUT3L" },
1639 	{ "AEC1 Loopback", "HPOUT3R", "OUT3R" },
1640 	{ "OUT3 Demux", NULL, "OUT3L" },
1641 	{ "OUT3 Demux", NULL, "OUT3R" },
1642 
1643 	{ "OUT3R", NULL, "OUT3 Mono Mux" },
1644 
1645 	{ "HPOUT3L", "HPOUT3", "OUT3 Demux" },
1646 	{ "HPOUT3R", "HPOUT3", "OUT3 Demux" },
1647 	{ "HPOUT4L", "HPOUT4", "OUT3 Demux" },
1648 	{ "HPOUT4R", "HPOUT4", "OUT3 Demux" },
1649 
1650 	{ "AEC1 Loopback", "SPKDAT1L", "OUT5L" },
1651 	{ "AEC1 Loopback", "SPKDAT1R", "OUT5R" },
1652 	{ "SPKDAT1L", NULL, "OUT5L" },
1653 	{ "SPKDAT1R", NULL, "OUT5R" },
1654 
1655 	{ "SPDIF1", NULL, "SPD1" },
1656 
1657 	{ "MICSUPP", NULL, "SYSCLK" },
1658 
1659 	{ "DRC1 Signal Activity", NULL, "DRC1 Activity Output" },
1660 	{ "DRC2 Signal Activity", NULL, "DRC2 Activity Output" },
1661 	{ "DRC1 Activity Output", "Switch", "DRC1L" },
1662 	{ "DRC1 Activity Output", "Switch", "DRC1R" },
1663 	{ "DRC2 Activity Output", "Switch", "DRC2L" },
1664 	{ "DRC2 Activity Output", "Switch", "DRC2R" },
1665 
1666 	MADERA_MUX_ROUTES("DFC1", "DFC1"),
1667 	MADERA_MUX_ROUTES("DFC2", "DFC2"),
1668 	MADERA_MUX_ROUTES("DFC3", "DFC3"),
1669 	MADERA_MUX_ROUTES("DFC4", "DFC4"),
1670 	MADERA_MUX_ROUTES("DFC5", "DFC5"),
1671 	MADERA_MUX_ROUTES("DFC6", "DFC6"),
1672 	MADERA_MUX_ROUTES("DFC7", "DFC7"),
1673 	MADERA_MUX_ROUTES("DFC8", "DFC8"),
1674 };
1675 
1676 static int cs47l92_set_fll(struct snd_soc_component *component, int fll_id,
1677 			   int source, unsigned int fref, unsigned int fout)
1678 {
1679 	struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component);
1680 
1681 	switch (fll_id) {
1682 	case MADERA_FLL1_REFCLK:
1683 		return madera_fllhj_set_refclk(&cs47l92->fll[0], source, fref,
1684 					       fout);
1685 	case MADERA_FLL2_REFCLK:
1686 		return madera_fllhj_set_refclk(&cs47l92->fll[1], source, fref,
1687 					       fout);
1688 	default:
1689 		return -EINVAL;
1690 	}
1691 }
1692 
1693 static const struct snd_soc_dai_ops cs47l92_dai_ops = {
1694 	.compress_new = snd_soc_new_compress,
1695 };
1696 
1697 static struct snd_soc_dai_driver cs47l92_dai[] = {
1698 	{
1699 		.name = "cs47l92-aif1",
1700 		.id = 1,
1701 		.base = MADERA_AIF1_BCLK_CTRL,
1702 		.playback = {
1703 			.stream_name = "AIF1 Playback",
1704 			.channels_min = 1,
1705 			.channels_max = 8,
1706 			.rates = MADERA_RATES,
1707 			.formats = MADERA_FORMATS,
1708 		},
1709 		.capture = {
1710 			.stream_name = "AIF1 Capture",
1711 			.channels_min = 1,
1712 			.channels_max = 8,
1713 			.rates = MADERA_RATES,
1714 			.formats = MADERA_FORMATS,
1715 		 },
1716 		.ops = &madera_dai_ops,
1717 		.symmetric_rate = 1,
1718 		.symmetric_sample_bits = 1,
1719 	},
1720 	{
1721 		.name = "cs47l92-aif2",
1722 		.id = 2,
1723 		.base = MADERA_AIF2_BCLK_CTRL,
1724 		.playback = {
1725 			.stream_name = "AIF2 Playback",
1726 			.channels_min = 1,
1727 			.channels_max = 8,
1728 			.rates = MADERA_RATES,
1729 			.formats = MADERA_FORMATS,
1730 		},
1731 		.capture = {
1732 			.stream_name = "AIF2 Capture",
1733 			.channels_min = 1,
1734 			.channels_max = 8,
1735 			.rates = MADERA_RATES,
1736 			.formats = MADERA_FORMATS,
1737 		 },
1738 		.ops = &madera_dai_ops,
1739 		.symmetric_rate = 1,
1740 		.symmetric_sample_bits = 1,
1741 	},
1742 	{
1743 		.name = "cs47l92-aif3",
1744 		.id = 3,
1745 		.base = MADERA_AIF3_BCLK_CTRL,
1746 		.playback = {
1747 			.stream_name = "AIF3 Playback",
1748 			.channels_min = 1,
1749 			.channels_max = 4,
1750 			.rates = MADERA_RATES,
1751 			.formats = MADERA_FORMATS,
1752 		},
1753 		.capture = {
1754 			.stream_name = "AIF3 Capture",
1755 			.channels_min = 1,
1756 			.channels_max = 4,
1757 			.rates = MADERA_RATES,
1758 			.formats = MADERA_FORMATS,
1759 		 },
1760 		.ops = &madera_dai_ops,
1761 		.symmetric_rate = 1,
1762 		.symmetric_sample_bits = 1,
1763 	},
1764 	{
1765 		.name = "cs47l92-slim1",
1766 		.id = 5,
1767 		.playback = {
1768 			.stream_name = "Slim1 Playback",
1769 			.channels_min = 1,
1770 			.channels_max = 4,
1771 			.rates = MADERA_RATES,
1772 			.formats = MADERA_FORMATS,
1773 		},
1774 		.capture = {
1775 			.stream_name = "Slim1 Capture",
1776 			.channels_min = 1,
1777 			.channels_max = 4,
1778 			.rates = MADERA_RATES,
1779 			.formats = MADERA_FORMATS,
1780 		 },
1781 		.ops = &madera_simple_dai_ops,
1782 	},
1783 	{
1784 		.name = "cs47l92-slim2",
1785 		.id = 6,
1786 		.playback = {
1787 			.stream_name = "Slim2 Playback",
1788 			.channels_min = 1,
1789 			.channels_max = 2,
1790 			.rates = MADERA_RATES,
1791 			.formats = MADERA_FORMATS,
1792 		},
1793 		.capture = {
1794 			.stream_name = "Slim2 Capture",
1795 			.channels_min = 1,
1796 			.channels_max = 2,
1797 			.rates = MADERA_RATES,
1798 			.formats = MADERA_FORMATS,
1799 		 },
1800 		.ops = &madera_simple_dai_ops,
1801 	},
1802 	{
1803 		.name = "cs47l92-slim3",
1804 		.id = 7,
1805 		.playback = {
1806 			.stream_name = "Slim3 Playback",
1807 			.channels_min = 1,
1808 			.channels_max = 2,
1809 			.rates = MADERA_RATES,
1810 			.formats = MADERA_FORMATS,
1811 		},
1812 		.capture = {
1813 			.stream_name = "Slim3 Capture",
1814 			.channels_min = 1,
1815 			.channels_max = 2,
1816 			.rates = MADERA_RATES,
1817 			.formats = MADERA_FORMATS,
1818 		 },
1819 		.ops = &madera_simple_dai_ops,
1820 	},
1821 	{
1822 		.name = "cs47l92-cpu-trace",
1823 		.capture = {
1824 			.stream_name = "Audio Trace CPU",
1825 			.channels_min = 1,
1826 			.channels_max = 2,
1827 			.rates = MADERA_RATES,
1828 			.formats = MADERA_FORMATS,
1829 		},
1830 		.ops = &cs47l92_dai_ops,
1831 	},
1832 	{
1833 		.name = "cs47l92-dsp-trace",
1834 		.capture = {
1835 			.stream_name = "Audio Trace DSP",
1836 			.channels_min = 1,
1837 			.channels_max = 2,
1838 			.rates = MADERA_RATES,
1839 			.formats = MADERA_FORMATS,
1840 		},
1841 	},
1842 };
1843 
1844 static int cs47l92_open(struct snd_soc_component *component,
1845 			struct snd_compr_stream *stream)
1846 {
1847 	struct snd_soc_pcm_runtime *rtd = stream->private_data;
1848 	struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component);
1849 	struct madera_priv *priv = &cs47l92->core;
1850 	struct madera *madera = priv->madera;
1851 	int n_adsp;
1852 
1853 	if (strcmp(asoc_rtd_to_codec(rtd, 0)->name, "cs47l92-dsp-trace") == 0) {
1854 		n_adsp = 0;
1855 	} else {
1856 		dev_err(madera->dev,
1857 			"No suitable compressed stream for DAI '%s'\n",
1858 			asoc_rtd_to_codec(rtd, 0)->name);
1859 		return -EINVAL;
1860 	}
1861 
1862 	return wm_adsp_compr_open(&priv->adsp[n_adsp], stream);
1863 }
1864 
1865 static irqreturn_t cs47l92_adsp2_irq(int irq, void *data)
1866 {
1867 	struct cs47l92 *cs47l92 = data;
1868 	struct madera_priv *priv = &cs47l92->core;
1869 	struct madera *madera = priv->madera;
1870 	int ret;
1871 
1872 	ret = wm_adsp_compr_handle_irq(&priv->adsp[0]);
1873 	if (ret == -ENODEV) {
1874 		dev_err(madera->dev, "Spurious compressed data IRQ\n");
1875 		return IRQ_NONE;
1876 	}
1877 
1878 	return IRQ_HANDLED;
1879 }
1880 
1881 static const struct snd_soc_dapm_route cs47l92_mono_routes[] = {
1882 	{ "OUT1R", NULL, "OUT1L" },
1883 	{ "OUT2R", NULL, "OUT2L" },
1884 	{ "OUT3 Mono Mux", "HPOUT3", "OUT3L" },
1885 	{ "OUT3 Mono Mux", "HPOUT4", "OUT3L" },
1886 };
1887 
1888 static int cs47l92_component_probe(struct snd_soc_component *component)
1889 {
1890 	struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component);
1891 	struct madera *madera = cs47l92->core.madera;
1892 	int ret;
1893 
1894 	snd_soc_component_init_regmap(component, madera->regmap);
1895 
1896 	mutex_lock(&madera->dapm_ptr_lock);
1897 	madera->dapm = snd_soc_component_get_dapm(component);
1898 	mutex_unlock(&madera->dapm_ptr_lock);
1899 
1900 	ret = madera_init_inputs(component);
1901 	if (ret)
1902 		return ret;
1903 
1904 	ret = madera_init_outputs(component, cs47l92_mono_routes,
1905 				  ARRAY_SIZE(cs47l92_mono_routes),
1906 				  CS47L92_MONO_OUTPUTS);
1907 	if (ret)
1908 		return ret;
1909 
1910 	snd_soc_component_disable_pin(component, "HAPTICS");
1911 
1912 	ret = snd_soc_add_component_controls(component,
1913 					     madera_adsp_rate_controls,
1914 					     CS47L92_NUM_ADSP);
1915 	if (ret)
1916 		return ret;
1917 
1918 	return wm_adsp2_component_probe(&cs47l92->core.adsp[0], component);
1919 }
1920 
1921 static void cs47l92_component_remove(struct snd_soc_component *component)
1922 {
1923 	struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component);
1924 	struct madera *madera = cs47l92->core.madera;
1925 
1926 	mutex_lock(&madera->dapm_ptr_lock);
1927 	madera->dapm = NULL;
1928 	mutex_unlock(&madera->dapm_ptr_lock);
1929 
1930 	wm_adsp2_component_remove(&cs47l92->core.adsp[0], component);
1931 }
1932 
1933 #define CS47L92_DIG_VU 0x0200
1934 
1935 static unsigned int cs47l92_digital_vu[] = {
1936 	MADERA_DAC_DIGITAL_VOLUME_1L,
1937 	MADERA_DAC_DIGITAL_VOLUME_1R,
1938 	MADERA_DAC_DIGITAL_VOLUME_2L,
1939 	MADERA_DAC_DIGITAL_VOLUME_2R,
1940 	MADERA_DAC_DIGITAL_VOLUME_3L,
1941 	MADERA_DAC_DIGITAL_VOLUME_3R,
1942 	MADERA_DAC_DIGITAL_VOLUME_5L,
1943 	MADERA_DAC_DIGITAL_VOLUME_5R,
1944 };
1945 
1946 static const struct snd_compress_ops cs47l92_compress_ops = {
1947 	.open = &cs47l92_open,
1948 	.free = &wm_adsp_compr_free,
1949 	.set_params = &wm_adsp_compr_set_params,
1950 	.get_caps = &wm_adsp_compr_get_caps,
1951 	.trigger = &wm_adsp_compr_trigger,
1952 	.pointer = &wm_adsp_compr_pointer,
1953 	.copy = &wm_adsp_compr_copy,
1954 };
1955 
1956 static const struct snd_soc_component_driver soc_component_dev_cs47l92 = {
1957 	.probe			= &cs47l92_component_probe,
1958 	.remove			= &cs47l92_component_remove,
1959 	.set_sysclk		= &madera_set_sysclk,
1960 	.set_pll		= &cs47l92_set_fll,
1961 	.name			= DRV_NAME,
1962 	.compress_ops		= &cs47l92_compress_ops,
1963 	.controls		= cs47l92_snd_controls,
1964 	.num_controls		= ARRAY_SIZE(cs47l92_snd_controls),
1965 	.dapm_widgets		= cs47l92_dapm_widgets,
1966 	.num_dapm_widgets	= ARRAY_SIZE(cs47l92_dapm_widgets),
1967 	.dapm_routes		= cs47l92_dapm_routes,
1968 	.num_dapm_routes	= ARRAY_SIZE(cs47l92_dapm_routes),
1969 	.use_pmdown_time	= 1,
1970 	.endianness		= 1,
1971 };
1972 
1973 static int cs47l92_probe(struct platform_device *pdev)
1974 {
1975 	struct madera *madera = dev_get_drvdata(pdev->dev.parent);
1976 	struct cs47l92 *cs47l92;
1977 	int i, ret;
1978 
1979 	BUILD_BUG_ON(ARRAY_SIZE(cs47l92_dai) > MADERA_MAX_DAI);
1980 
1981 	/* quick exit if Madera irqchip driver hasn't completed probe */
1982 	if (!madera->irq_dev) {
1983 		dev_dbg(&pdev->dev, "irqchip driver not ready\n");
1984 		return -EPROBE_DEFER;
1985 	}
1986 
1987 	cs47l92 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l92), GFP_KERNEL);
1988 	if (!cs47l92)
1989 		return -ENOMEM;
1990 
1991 	platform_set_drvdata(pdev, cs47l92);
1992 
1993 	cs47l92->core.madera = madera;
1994 	cs47l92->core.dev = &pdev->dev;
1995 	cs47l92->core.num_inputs = 8;
1996 
1997 	ret = madera_core_init(&cs47l92->core);
1998 	if (ret)
1999 		return ret;
2000 
2001 	ret = madera_request_irq(madera, MADERA_IRQ_DSP_IRQ1,
2002 				 "ADSP2 Compressed IRQ", cs47l92_adsp2_irq,
2003 				 cs47l92);
2004 	if (ret != 0) {
2005 		dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret);
2006 		goto error_core;
2007 	}
2008 
2009 	ret = madera_set_irq_wake(madera, MADERA_IRQ_DSP_IRQ1, 1);
2010 	if (ret)
2011 		dev_warn(&pdev->dev, "Failed to set DSP IRQ wake: %d\n", ret);
2012 
2013 	cs47l92->core.adsp[0].part = "cs47l92";
2014 	cs47l92->core.adsp[0].cs_dsp.num = 1;
2015 	cs47l92->core.adsp[0].cs_dsp.type = WMFW_ADSP2;
2016 	cs47l92->core.adsp[0].cs_dsp.rev = 2;
2017 	cs47l92->core.adsp[0].cs_dsp.dev = madera->dev;
2018 	cs47l92->core.adsp[0].cs_dsp.regmap = madera->regmap_32bit;
2019 
2020 	cs47l92->core.adsp[0].cs_dsp.base = MADERA_DSP1_CONFIG_1;
2021 	cs47l92->core.adsp[0].cs_dsp.mem = cs47l92_dsp1_regions;
2022 	cs47l92->core.adsp[0].cs_dsp.num_mems = ARRAY_SIZE(cs47l92_dsp1_regions);
2023 
2024 	cs47l92->core.adsp[0].cs_dsp.lock_regions = CS_ADSP2_REGION_1_9;
2025 
2026 	ret = wm_adsp2_init(&cs47l92->core.adsp[0]);
2027 	if (ret != 0)
2028 		goto error_dsp_irq;
2029 
2030 	ret = madera_init_bus_error_irq(&cs47l92->core, 0, wm_adsp2_bus_error);
2031 	if (ret != 0)
2032 		goto error_adsp;
2033 
2034 	madera_init_fll(madera, 1, MADERA_FLL1_CONTROL_1 - 1,
2035 			&cs47l92->fll[0]);
2036 	madera_init_fll(madera, 2, MADERA_FLL2_CONTROL_1 - 1,
2037 			&cs47l92->fll[1]);
2038 
2039 	for (i = 0; i < ARRAY_SIZE(cs47l92_dai); i++)
2040 		madera_init_dai(&cs47l92->core, i);
2041 
2042 	/* Latch volume update bits */
2043 	for (i = 0; i < ARRAY_SIZE(cs47l92_digital_vu); i++)
2044 		regmap_update_bits(madera->regmap, cs47l92_digital_vu[i],
2045 				   CS47L92_DIG_VU, CS47L92_DIG_VU);
2046 
2047 	pm_runtime_enable(&pdev->dev);
2048 	pm_runtime_idle(&pdev->dev);
2049 
2050 	ret = devm_snd_soc_register_component(&pdev->dev,
2051 					      &soc_component_dev_cs47l92,
2052 					      cs47l92_dai,
2053 					      ARRAY_SIZE(cs47l92_dai));
2054 	if (ret < 0) {
2055 		dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
2056 		goto error_pm_runtime;
2057 	}
2058 
2059 	return ret;
2060 
2061 error_pm_runtime:
2062 	pm_runtime_disable(&pdev->dev);
2063 	madera_free_bus_error_irq(&cs47l92->core, 0);
2064 error_adsp:
2065 	wm_adsp2_remove(&cs47l92->core.adsp[0]);
2066 error_dsp_irq:
2067 	madera_set_irq_wake(madera, MADERA_IRQ_DSP_IRQ1, 0);
2068 	madera_free_irq(madera, MADERA_IRQ_DSP_IRQ1, cs47l92);
2069 error_core:
2070 	madera_core_free(&cs47l92->core);
2071 
2072 	return ret;
2073 }
2074 
2075 static void cs47l92_remove(struct platform_device *pdev)
2076 {
2077 	struct cs47l92 *cs47l92 = platform_get_drvdata(pdev);
2078 
2079 	pm_runtime_disable(&pdev->dev);
2080 
2081 	madera_free_bus_error_irq(&cs47l92->core, 0);
2082 	wm_adsp2_remove(&cs47l92->core.adsp[0]);
2083 
2084 	madera_set_irq_wake(cs47l92->core.madera, MADERA_IRQ_DSP_IRQ1, 0);
2085 	madera_free_irq(cs47l92->core.madera, MADERA_IRQ_DSP_IRQ1, cs47l92);
2086 
2087 	madera_core_free(&cs47l92->core);
2088 }
2089 
2090 static struct platform_driver cs47l92_codec_driver = {
2091 	.driver = {
2092 		.name = "cs47l92-codec",
2093 	},
2094 	.probe = &cs47l92_probe,
2095 	.remove_new = cs47l92_remove,
2096 };
2097 
2098 module_platform_driver(cs47l92_codec_driver);
2099 
2100 MODULE_SOFTDEP("pre: madera irq-madera arizona-micsupp");
2101 MODULE_DESCRIPTION("ASoC CS47L92 driver");
2102 MODULE_AUTHOR("Stuart Henderson <stuarth@opensource.cirrus.com>");
2103 MODULE_LICENSE("GPL v2");
2104 MODULE_ALIAS("platform:cs47l92-codec");
2105