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