1 // SPDX-License-Identifier: GPL-2.0-only
3 // ALSA SoC Audio driver for CS47L15 codec
5 // Copyright (C) 2016-2019 Cirrus Logic, Inc. and
6 // Cirrus Logic International Semiconductor Ltd.
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>
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>
23 #include <linux/irqchip/irq-madera.h>
24 #include <linux/mfd/madera/core.h>
25 #include <linux/mfd/madera/registers.h>
30 #define CS47L15_NUM_ADSP 1
31 #define CS47L15_MONO_OUTPUTS 1
33 /* Mid-mode registers */
34 #define CS47L15_ADC_INT_BIAS_MASK 0x3800
35 #define CS47L15_ADC_INT_BIAS_SHIFT 11
36 #define CS47L15_PGA_BIAS_SEL_MASK 0x03
37 #define CS47L15_PGA_BIAS_SEL_SHIFT 0
39 #define DRV_NAME "cs47l15-codec"
42 struct madera_priv core
;
43 struct madera_fll fll
[2];
48 static const struct wm_adsp_region cs47l15_dsp1_regions
[] = {
49 { .type
= WMFW_ADSP2_PM
, .base
= 0x080000 },
50 { .type
= WMFW_ADSP2_ZM
, .base
= 0x0e0000 },
51 { .type
= WMFW_ADSP2_XM
, .base
= 0x0a0000 },
52 { .type
= WMFW_ADSP2_YM
, .base
= 0x0c0000 },
55 static const char * const cs47l15_outdemux_texts
[] = {
60 static SOC_ENUM_SINGLE_DECL(cs47l15_outdemux_enum
, SND_SOC_NOPM
, 0,
61 cs47l15_outdemux_texts
);
63 static const struct snd_kcontrol_new cs47l15_outdemux
=
64 SOC_DAPM_ENUM_EXT("HPOUT1 Demux", cs47l15_outdemux_enum
,
65 madera_out1_demux_get
, madera_out1_demux_put
);
67 static int cs47l15_adsp_power_ev(struct snd_soc_dapm_widget
*w
,
68 struct snd_kcontrol
*kcontrol
,
71 struct snd_soc_component
*component
=
72 snd_soc_dapm_to_component(w
->dapm
);
73 struct cs47l15
*cs47l15
= snd_soc_component_get_drvdata(component
);
74 struct madera_priv
*priv
= &cs47l15
->core
;
75 struct madera
*madera
= priv
->madera
;
79 ret
= regmap_read(madera
->regmap
, MADERA_DSP_CLOCK_2
, &freq
);
82 "Failed to read MADERA_DSP_CLOCK_2: %d\n", ret
);
87 case SND_SOC_DAPM_PRE_PMU
:
88 ret
= madera_set_adsp_clk(&cs47l15
->core
, w
->shift
, freq
);
96 return wm_adsp_early_event(w
, kcontrol
, event
);
99 #define CS47L15_NG_SRC(name, base) \
100 SOC_SINGLE(name " NG HPOUT1L Switch", base, 0, 1, 0), \
101 SOC_SINGLE(name " NG HPOUT1R Switch", base, 1, 1, 0), \
102 SOC_SINGLE(name " NG SPKOUTL Switch", base, 6, 1, 0), \
103 SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \
104 SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0)
106 static int cs47l15_in1_adc_get(struct snd_kcontrol
*kcontrol
,
107 struct snd_ctl_elem_value
*ucontrol
)
109 struct snd_soc_component
*component
=
110 snd_soc_kcontrol_component(kcontrol
);
111 struct cs47l15
*cs47l15
= snd_soc_component_get_drvdata(component
);
113 ucontrol
->value
.integer
.value
[0] = !!cs47l15
->in1_lp_mode
;
118 static int cs47l15_in1_adc_put(struct snd_kcontrol
*kcontrol
,
119 struct snd_ctl_elem_value
*ucontrol
)
121 struct snd_soc_component
*component
=
122 snd_soc_kcontrol_component(kcontrol
);
123 struct cs47l15
*cs47l15
= snd_soc_component_get_drvdata(component
);
125 switch (ucontrol
->value
.integer
.value
[0]) {
127 /* Set IN1 to normal mode */
128 snd_soc_component_update_bits(component
, MADERA_DMIC1L_CONTROL
,
130 5 << MADERA_IN1_OSR_SHIFT
);
131 snd_soc_component_update_bits(component
, CS47L15_ADC_INT_BIAS
,
132 CS47L15_ADC_INT_BIAS_MASK
,
133 4 << CS47L15_ADC_INT_BIAS_SHIFT
);
134 snd_soc_component_update_bits(component
, CS47L15_PGA_BIAS_SEL
,
135 CS47L15_PGA_BIAS_SEL_MASK
, 0);
136 cs47l15
->in1_lp_mode
= false;
139 /* Set IN1 to LP mode */
140 snd_soc_component_update_bits(component
, MADERA_DMIC1L_CONTROL
,
142 4 << MADERA_IN1_OSR_SHIFT
);
143 snd_soc_component_update_bits(component
, CS47L15_ADC_INT_BIAS
,
144 CS47L15_ADC_INT_BIAS_MASK
,
145 1 << CS47L15_ADC_INT_BIAS_SHIFT
);
146 snd_soc_component_update_bits(component
, CS47L15_PGA_BIAS_SEL
,
147 CS47L15_PGA_BIAS_SEL_MASK
,
148 3 << CS47L15_PGA_BIAS_SEL_SHIFT
);
149 cs47l15
->in1_lp_mode
= true;
156 static const struct snd_kcontrol_new cs47l15_snd_controls
[] = {
157 SOC_ENUM("IN1 OSR", madera_in_dmic_osr
[0]),
158 SOC_ENUM("IN2 OSR", madera_in_dmic_osr
[1]),
160 SOC_SINGLE_RANGE_TLV("IN1L Volume", MADERA_IN1L_CONTROL
,
161 MADERA_IN1L_PGA_VOL_SHIFT
, 0x40, 0x5f, 0, madera_ana_tlv
),
162 SOC_SINGLE_RANGE_TLV("IN1R Volume", MADERA_IN1R_CONTROL
,
163 MADERA_IN1R_PGA_VOL_SHIFT
, 0x40, 0x5f, 0, madera_ana_tlv
),
165 SOC_ENUM("IN HPF Cutoff Frequency", madera_in_hpf_cut_enum
),
167 SOC_SINGLE("IN1L HPF Switch", MADERA_IN1L_CONTROL
, MADERA_IN1L_HPF_SHIFT
, 1, 0),
168 SOC_SINGLE("IN1R HPF Switch", MADERA_IN1R_CONTROL
, MADERA_IN1R_HPF_SHIFT
, 1, 0),
169 SOC_SINGLE("IN2L HPF Switch", MADERA_IN2L_CONTROL
, MADERA_IN2L_HPF_SHIFT
, 1, 0),
170 SOC_SINGLE("IN2R HPF Switch", MADERA_IN2R_CONTROL
, MADERA_IN2R_HPF_SHIFT
, 1, 0),
172 SOC_SINGLE_TLV("IN1L Digital Volume", MADERA_ADC_DIGITAL_VOLUME_1L
,
173 MADERA_IN1L_DIG_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
174 SOC_SINGLE_TLV("IN1R Digital Volume", MADERA_ADC_DIGITAL_VOLUME_1R
,
175 MADERA_IN1R_DIG_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
176 SOC_SINGLE_TLV("IN2L Digital Volume", MADERA_ADC_DIGITAL_VOLUME_2L
,
177 MADERA_IN2L_DIG_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
178 SOC_SINGLE_TLV("IN2R Digital Volume", MADERA_ADC_DIGITAL_VOLUME_2R
,
179 MADERA_IN2R_DIG_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
181 SOC_ENUM("Input Ramp Up", madera_in_vi_ramp
),
182 SOC_ENUM("Input Ramp Down", madera_in_vd_ramp
),
184 MADERA_MIXER_CONTROLS("EQ1", MADERA_EQ1MIX_INPUT_1_SOURCE
),
185 MADERA_MIXER_CONTROLS("EQ2", MADERA_EQ2MIX_INPUT_1_SOURCE
),
186 MADERA_MIXER_CONTROLS("EQ3", MADERA_EQ3MIX_INPUT_1_SOURCE
),
187 MADERA_MIXER_CONTROLS("EQ4", MADERA_EQ4MIX_INPUT_1_SOURCE
),
189 MADERA_EQ_CONTROL("EQ1 Coefficients", MADERA_EQ1_2
),
190 SOC_SINGLE_TLV("EQ1 B1 Volume", MADERA_EQ1_1
, MADERA_EQ1_B1_GAIN_SHIFT
,
191 24, 0, madera_eq_tlv
),
192 SOC_SINGLE_TLV("EQ1 B2 Volume", MADERA_EQ1_1
, MADERA_EQ1_B2_GAIN_SHIFT
,
193 24, 0, madera_eq_tlv
),
194 SOC_SINGLE_TLV("EQ1 B3 Volume", MADERA_EQ1_1
, MADERA_EQ1_B3_GAIN_SHIFT
,
195 24, 0, madera_eq_tlv
),
196 SOC_SINGLE_TLV("EQ1 B4 Volume", MADERA_EQ1_2
, MADERA_EQ1_B4_GAIN_SHIFT
,
197 24, 0, madera_eq_tlv
),
198 SOC_SINGLE_TLV("EQ1 B5 Volume", MADERA_EQ1_2
, MADERA_EQ1_B5_GAIN_SHIFT
,
199 24, 0, madera_eq_tlv
),
201 MADERA_EQ_CONTROL("EQ2 Coefficients", MADERA_EQ2_2
),
202 SOC_SINGLE_TLV("EQ2 B1 Volume", MADERA_EQ2_1
, MADERA_EQ2_B1_GAIN_SHIFT
,
203 24, 0, madera_eq_tlv
),
204 SOC_SINGLE_TLV("EQ2 B2 Volume", MADERA_EQ2_1
, MADERA_EQ2_B2_GAIN_SHIFT
,
205 24, 0, madera_eq_tlv
),
206 SOC_SINGLE_TLV("EQ2 B3 Volume", MADERA_EQ2_1
, MADERA_EQ2_B3_GAIN_SHIFT
,
207 24, 0, madera_eq_tlv
),
208 SOC_SINGLE_TLV("EQ2 B4 Volume", MADERA_EQ2_2
, MADERA_EQ2_B4_GAIN_SHIFT
,
209 24, 0, madera_eq_tlv
),
210 SOC_SINGLE_TLV("EQ2 B5 Volume", MADERA_EQ2_2
, MADERA_EQ2_B5_GAIN_SHIFT
,
211 24, 0, madera_eq_tlv
),
213 MADERA_EQ_CONTROL("EQ3 Coefficients", MADERA_EQ3_2
),
214 SOC_SINGLE_TLV("EQ3 B1 Volume", MADERA_EQ3_1
, MADERA_EQ3_B1_GAIN_SHIFT
,
215 24, 0, madera_eq_tlv
),
216 SOC_SINGLE_TLV("EQ3 B2 Volume", MADERA_EQ3_1
, MADERA_EQ3_B2_GAIN_SHIFT
,
217 24, 0, madera_eq_tlv
),
218 SOC_SINGLE_TLV("EQ3 B3 Volume", MADERA_EQ3_1
, MADERA_EQ3_B3_GAIN_SHIFT
,
219 24, 0, madera_eq_tlv
),
220 SOC_SINGLE_TLV("EQ3 B4 Volume", MADERA_EQ3_2
, MADERA_EQ3_B4_GAIN_SHIFT
,
221 24, 0, madera_eq_tlv
),
222 SOC_SINGLE_TLV("EQ3 B5 Volume", MADERA_EQ3_2
, MADERA_EQ3_B5_GAIN_SHIFT
,
223 24, 0, madera_eq_tlv
),
225 MADERA_EQ_CONTROL("EQ4 Coefficients", MADERA_EQ4_2
),
226 SOC_SINGLE_TLV("EQ4 B1 Volume", MADERA_EQ4_1
, MADERA_EQ4_B1_GAIN_SHIFT
,
227 24, 0, madera_eq_tlv
),
228 SOC_SINGLE_TLV("EQ4 B2 Volume", MADERA_EQ4_1
, MADERA_EQ4_B2_GAIN_SHIFT
,
229 24, 0, madera_eq_tlv
),
230 SOC_SINGLE_TLV("EQ4 B3 Volume", MADERA_EQ4_1
, MADERA_EQ4_B3_GAIN_SHIFT
,
231 24, 0, madera_eq_tlv
),
232 SOC_SINGLE_TLV("EQ4 B4 Volume", MADERA_EQ4_2
, MADERA_EQ4_B4_GAIN_SHIFT
,
233 24, 0, madera_eq_tlv
),
234 SOC_SINGLE_TLV("EQ4 B5 Volume", MADERA_EQ4_2
, MADERA_EQ4_B5_GAIN_SHIFT
,
235 24, 0, madera_eq_tlv
),
237 MADERA_MIXER_CONTROLS("DRC1L", MADERA_DRC1LMIX_INPUT_1_SOURCE
),
238 MADERA_MIXER_CONTROLS("DRC1R", MADERA_DRC1RMIX_INPUT_1_SOURCE
),
239 MADERA_MIXER_CONTROLS("DRC2L", MADERA_DRC2LMIX_INPUT_1_SOURCE
),
240 MADERA_MIXER_CONTROLS("DRC2R", MADERA_DRC2RMIX_INPUT_1_SOURCE
),
242 SND_SOC_BYTES_MASK("DRC1", MADERA_DRC1_CTRL1
, 5,
243 MADERA_DRC1R_ENA
| MADERA_DRC1L_ENA
),
244 SND_SOC_BYTES_MASK("DRC2", MADERA_DRC2_CTRL1
, 5,
245 MADERA_DRC2R_ENA
| MADERA_DRC2L_ENA
),
247 MADERA_MIXER_CONTROLS("LHPF1", MADERA_HPLP1MIX_INPUT_1_SOURCE
),
248 MADERA_MIXER_CONTROLS("LHPF2", MADERA_HPLP2MIX_INPUT_1_SOURCE
),
249 MADERA_MIXER_CONTROLS("LHPF3", MADERA_HPLP3MIX_INPUT_1_SOURCE
),
250 MADERA_MIXER_CONTROLS("LHPF4", MADERA_HPLP4MIX_INPUT_1_SOURCE
),
252 MADERA_LHPF_CONTROL("LHPF1 Coefficients", MADERA_HPLPF1_2
),
253 MADERA_LHPF_CONTROL("LHPF2 Coefficients", MADERA_HPLPF2_2
),
254 MADERA_LHPF_CONTROL("LHPF3 Coefficients", MADERA_HPLPF3_2
),
255 MADERA_LHPF_CONTROL("LHPF4 Coefficients", MADERA_HPLPF4_2
),
257 SOC_ENUM("LHPF1 Mode", madera_lhpf1_mode
),
258 SOC_ENUM("LHPF2 Mode", madera_lhpf2_mode
),
259 SOC_ENUM("LHPF3 Mode", madera_lhpf3_mode
),
260 SOC_ENUM("LHPF4 Mode", madera_lhpf4_mode
),
262 MADERA_RATE_ENUM("ISRC1 FSL", madera_isrc_fsl
[0]),
263 MADERA_RATE_ENUM("ISRC2 FSL", madera_isrc_fsl
[1]),
264 MADERA_RATE_ENUM("ISRC1 FSH", madera_isrc_fsh
[0]),
265 MADERA_RATE_ENUM("ISRC2 FSH", madera_isrc_fsh
[1]),
267 WM_ADSP2_PRELOAD_SWITCH("DSP1", 1),
269 MADERA_MIXER_CONTROLS("DSP1L", MADERA_DSP1LMIX_INPUT_1_SOURCE
),
270 MADERA_MIXER_CONTROLS("DSP1R", MADERA_DSP1RMIX_INPUT_1_SOURCE
),
272 SOC_SINGLE_TLV("Noise Generator Volume", MADERA_COMFORT_NOISE_GENERATOR
,
273 MADERA_NOISE_GEN_GAIN_SHIFT
, 0x16, 0, madera_noise_tlv
),
275 MADERA_MIXER_CONTROLS("HPOUT1L", MADERA_OUT1LMIX_INPUT_1_SOURCE
),
276 MADERA_MIXER_CONTROLS("HPOUT1R", MADERA_OUT1RMIX_INPUT_1_SOURCE
),
277 MADERA_MIXER_CONTROLS("SPKOUTL", MADERA_OUT4LMIX_INPUT_1_SOURCE
),
278 MADERA_MIXER_CONTROLS("SPKDAT1L", MADERA_OUT5LMIX_INPUT_1_SOURCE
),
279 MADERA_MIXER_CONTROLS("SPKDAT1R", MADERA_OUT5RMIX_INPUT_1_SOURCE
),
281 SOC_SINGLE("HPOUT1 SC Protect Switch", MADERA_HP1_SHORT_CIRCUIT_CTRL
,
282 MADERA_HP1_SC_ENA_SHIFT
, 1, 0),
284 SOC_SINGLE("SPKDAT1 High Performance Switch", MADERA_OUTPUT_PATH_CONFIG_5L
,
285 MADERA_OUT5_OSR_SHIFT
, 1, 0),
287 SOC_DOUBLE_R("HPOUT1 Digital Switch", MADERA_DAC_DIGITAL_VOLUME_1L
,
288 MADERA_DAC_DIGITAL_VOLUME_1R
, MADERA_OUT1L_MUTE_SHIFT
, 1, 1),
289 SOC_SINGLE("Speaker Digital Switch", MADERA_DAC_DIGITAL_VOLUME_4L
,
290 MADERA_OUT4L_MUTE_SHIFT
, 1, 1),
291 SOC_DOUBLE_R("SPKDAT1 Digital Switch", MADERA_DAC_DIGITAL_VOLUME_5L
,
292 MADERA_DAC_DIGITAL_VOLUME_5R
, MADERA_OUT5L_MUTE_SHIFT
, 1, 1),
294 SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", MADERA_DAC_DIGITAL_VOLUME_1L
,
295 MADERA_DAC_DIGITAL_VOLUME_1R
, MADERA_OUT1L_VOL_SHIFT
,
296 0xbf, 0, madera_digital_tlv
),
297 SOC_SINGLE_TLV("Speaker Digital Volume", MADERA_DAC_DIGITAL_VOLUME_4L
,
298 MADERA_OUT4L_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
299 SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", MADERA_DAC_DIGITAL_VOLUME_5L
,
300 MADERA_DAC_DIGITAL_VOLUME_5R
, MADERA_OUT5L_VOL_SHIFT
,
301 0xbf, 0, madera_digital_tlv
),
303 SOC_DOUBLE("SPKDAT1 Switch", MADERA_PDM_SPK1_CTRL_1
, MADERA_SPK1L_MUTE_SHIFT
,
304 MADERA_SPK1R_MUTE_SHIFT
, 1, 1),
306 SOC_ENUM("Output Ramp Up", madera_out_vi_ramp
),
307 SOC_ENUM("Output Ramp Down", madera_out_vd_ramp
),
309 SOC_SINGLE("Noise Gate Switch", MADERA_NOISE_GATE_CONTROL
,
310 MADERA_NGATE_ENA_SHIFT
, 1, 0),
311 SOC_SINGLE_TLV("Noise Gate Threshold Volume", MADERA_NOISE_GATE_CONTROL
,
312 MADERA_NGATE_THR_SHIFT
, 7, 1, madera_ng_tlv
),
313 SOC_ENUM("Noise Gate Hold", madera_ng_hold
),
315 SOC_SINGLE_BOOL_EXT("IN1 LP Mode Switch", 0,
316 cs47l15_in1_adc_get
, cs47l15_in1_adc_put
),
318 CS47L15_NG_SRC("HPOUT1L", MADERA_NOISE_GATE_SELECT_1L
),
319 CS47L15_NG_SRC("HPOUT1R", MADERA_NOISE_GATE_SELECT_1R
),
320 CS47L15_NG_SRC("SPKOUTL", MADERA_NOISE_GATE_SELECT_4L
),
321 CS47L15_NG_SRC("SPKDAT1L", MADERA_NOISE_GATE_SELECT_5L
),
322 CS47L15_NG_SRC("SPKDAT1R", MADERA_NOISE_GATE_SELECT_5R
),
324 MADERA_MIXER_CONTROLS("AIF1TX1", MADERA_AIF1TX1MIX_INPUT_1_SOURCE
),
325 MADERA_MIXER_CONTROLS("AIF1TX2", MADERA_AIF1TX2MIX_INPUT_1_SOURCE
),
326 MADERA_MIXER_CONTROLS("AIF1TX3", MADERA_AIF1TX3MIX_INPUT_1_SOURCE
),
327 MADERA_MIXER_CONTROLS("AIF1TX4", MADERA_AIF1TX4MIX_INPUT_1_SOURCE
),
328 MADERA_MIXER_CONTROLS("AIF1TX5", MADERA_AIF1TX5MIX_INPUT_1_SOURCE
),
329 MADERA_MIXER_CONTROLS("AIF1TX6", MADERA_AIF1TX6MIX_INPUT_1_SOURCE
),
331 MADERA_MIXER_CONTROLS("AIF2TX1", MADERA_AIF2TX1MIX_INPUT_1_SOURCE
),
332 MADERA_MIXER_CONTROLS("AIF2TX2", MADERA_AIF2TX2MIX_INPUT_1_SOURCE
),
333 MADERA_MIXER_CONTROLS("AIF2TX3", MADERA_AIF2TX3MIX_INPUT_1_SOURCE
),
334 MADERA_MIXER_CONTROLS("AIF2TX4", MADERA_AIF2TX4MIX_INPUT_1_SOURCE
),
336 MADERA_MIXER_CONTROLS("AIF3TX1", MADERA_AIF3TX1MIX_INPUT_1_SOURCE
),
337 MADERA_MIXER_CONTROLS("AIF3TX2", MADERA_AIF3TX2MIX_INPUT_1_SOURCE
),
339 MADERA_GAINMUX_CONTROLS("SPDIF1TX1", MADERA_SPDIF1TX1MIX_INPUT_1_SOURCE
),
340 MADERA_GAINMUX_CONTROLS("SPDIF1TX2", MADERA_SPDIF1TX2MIX_INPUT_1_SOURCE
),
342 WM_ADSP_FW_CONTROL("DSP1", 0),
345 MADERA_MIXER_ENUMS(EQ1
, MADERA_EQ1MIX_INPUT_1_SOURCE
);
346 MADERA_MIXER_ENUMS(EQ2
, MADERA_EQ2MIX_INPUT_1_SOURCE
);
347 MADERA_MIXER_ENUMS(EQ3
, MADERA_EQ3MIX_INPUT_1_SOURCE
);
348 MADERA_MIXER_ENUMS(EQ4
, MADERA_EQ4MIX_INPUT_1_SOURCE
);
350 MADERA_MIXER_ENUMS(DRC1L
, MADERA_DRC1LMIX_INPUT_1_SOURCE
);
351 MADERA_MIXER_ENUMS(DRC1R
, MADERA_DRC1RMIX_INPUT_1_SOURCE
);
352 MADERA_MIXER_ENUMS(DRC2L
, MADERA_DRC2LMIX_INPUT_1_SOURCE
);
353 MADERA_MIXER_ENUMS(DRC2R
, MADERA_DRC2RMIX_INPUT_1_SOURCE
);
355 MADERA_MIXER_ENUMS(LHPF1
, MADERA_HPLP1MIX_INPUT_1_SOURCE
);
356 MADERA_MIXER_ENUMS(LHPF2
, MADERA_HPLP2MIX_INPUT_1_SOURCE
);
357 MADERA_MIXER_ENUMS(LHPF3
, MADERA_HPLP3MIX_INPUT_1_SOURCE
);
358 MADERA_MIXER_ENUMS(LHPF4
, MADERA_HPLP4MIX_INPUT_1_SOURCE
);
360 MADERA_MIXER_ENUMS(DSP1L
, MADERA_DSP1LMIX_INPUT_1_SOURCE
);
361 MADERA_MIXER_ENUMS(DSP1R
, MADERA_DSP1RMIX_INPUT_1_SOURCE
);
362 MADERA_DSP_AUX_ENUMS(DSP1
, MADERA_DSP1AUX1MIX_INPUT_1_SOURCE
);
364 MADERA_MIXER_ENUMS(PWM1
, MADERA_PWM1MIX_INPUT_1_SOURCE
);
365 MADERA_MIXER_ENUMS(PWM2
, MADERA_PWM2MIX_INPUT_1_SOURCE
);
367 MADERA_MIXER_ENUMS(OUT1L
, MADERA_OUT1LMIX_INPUT_1_SOURCE
);
368 MADERA_MIXER_ENUMS(OUT1R
, MADERA_OUT1RMIX_INPUT_1_SOURCE
);
369 MADERA_MIXER_ENUMS(SPKOUTL
, MADERA_OUT4LMIX_INPUT_1_SOURCE
);
370 MADERA_MIXER_ENUMS(SPKDAT1L
, MADERA_OUT5LMIX_INPUT_1_SOURCE
);
371 MADERA_MIXER_ENUMS(SPKDAT1R
, MADERA_OUT5RMIX_INPUT_1_SOURCE
);
373 MADERA_MIXER_ENUMS(AIF1TX1
, MADERA_AIF1TX1MIX_INPUT_1_SOURCE
);
374 MADERA_MIXER_ENUMS(AIF1TX2
, MADERA_AIF1TX2MIX_INPUT_1_SOURCE
);
375 MADERA_MIXER_ENUMS(AIF1TX3
, MADERA_AIF1TX3MIX_INPUT_1_SOURCE
);
376 MADERA_MIXER_ENUMS(AIF1TX4
, MADERA_AIF1TX4MIX_INPUT_1_SOURCE
);
377 MADERA_MIXER_ENUMS(AIF1TX5
, MADERA_AIF1TX5MIX_INPUT_1_SOURCE
);
378 MADERA_MIXER_ENUMS(AIF1TX6
, MADERA_AIF1TX6MIX_INPUT_1_SOURCE
);
380 MADERA_MIXER_ENUMS(AIF2TX1
, MADERA_AIF2TX1MIX_INPUT_1_SOURCE
);
381 MADERA_MIXER_ENUMS(AIF2TX2
, MADERA_AIF2TX2MIX_INPUT_1_SOURCE
);
382 MADERA_MIXER_ENUMS(AIF2TX3
, MADERA_AIF2TX3MIX_INPUT_1_SOURCE
);
383 MADERA_MIXER_ENUMS(AIF2TX4
, MADERA_AIF2TX4MIX_INPUT_1_SOURCE
);
385 MADERA_MIXER_ENUMS(AIF3TX1
, MADERA_AIF3TX1MIX_INPUT_1_SOURCE
);
386 MADERA_MIXER_ENUMS(AIF3TX2
, MADERA_AIF3TX2MIX_INPUT_1_SOURCE
);
388 MADERA_MUX_ENUMS(SPD1TX1
, MADERA_SPDIF1TX1MIX_INPUT_1_SOURCE
);
389 MADERA_MUX_ENUMS(SPD1TX2
, MADERA_SPDIF1TX2MIX_INPUT_1_SOURCE
);
391 MADERA_MUX_ENUMS(ISRC1INT1
, MADERA_ISRC1INT1MIX_INPUT_1_SOURCE
);
392 MADERA_MUX_ENUMS(ISRC1INT2
, MADERA_ISRC1INT2MIX_INPUT_1_SOURCE
);
393 MADERA_MUX_ENUMS(ISRC1INT3
, MADERA_ISRC1INT3MIX_INPUT_1_SOURCE
);
394 MADERA_MUX_ENUMS(ISRC1INT4
, MADERA_ISRC1INT4MIX_INPUT_1_SOURCE
);
396 MADERA_MUX_ENUMS(ISRC1DEC1
, MADERA_ISRC1DEC1MIX_INPUT_1_SOURCE
);
397 MADERA_MUX_ENUMS(ISRC1DEC2
, MADERA_ISRC1DEC2MIX_INPUT_1_SOURCE
);
398 MADERA_MUX_ENUMS(ISRC1DEC3
, MADERA_ISRC1DEC3MIX_INPUT_1_SOURCE
);
399 MADERA_MUX_ENUMS(ISRC1DEC4
, MADERA_ISRC1DEC4MIX_INPUT_1_SOURCE
);
401 MADERA_MUX_ENUMS(ISRC2INT1
, MADERA_ISRC2INT1MIX_INPUT_1_SOURCE
);
402 MADERA_MUX_ENUMS(ISRC2INT2
, MADERA_ISRC2INT2MIX_INPUT_1_SOURCE
);
403 MADERA_MUX_ENUMS(ISRC2INT3
, MADERA_ISRC2INT3MIX_INPUT_1_SOURCE
);
404 MADERA_MUX_ENUMS(ISRC2INT4
, MADERA_ISRC2INT4MIX_INPUT_1_SOURCE
);
406 MADERA_MUX_ENUMS(ISRC2DEC1
, MADERA_ISRC2DEC1MIX_INPUT_1_SOURCE
);
407 MADERA_MUX_ENUMS(ISRC2DEC2
, MADERA_ISRC2DEC2MIX_INPUT_1_SOURCE
);
408 MADERA_MUX_ENUMS(ISRC2DEC3
, MADERA_ISRC2DEC3MIX_INPUT_1_SOURCE
);
409 MADERA_MUX_ENUMS(ISRC2DEC4
, MADERA_ISRC2DEC4MIX_INPUT_1_SOURCE
);
411 static const char * const cs47l15_aec_loopback_texts
[] = {
412 "HPOUT1L", "HPOUT1R", "SPKOUTL", "SPKDAT1L", "SPKDAT1R",
415 static const unsigned int cs47l15_aec_loopback_values
[] = {
419 static const struct soc_enum cs47l15_aec1_loopback
=
420 SOC_VALUE_ENUM_SINGLE(MADERA_DAC_AEC_CONTROL_1
,
421 MADERA_AEC1_LOOPBACK_SRC_SHIFT
, 0xf,
422 ARRAY_SIZE(cs47l15_aec_loopback_texts
),
423 cs47l15_aec_loopback_texts
,
424 cs47l15_aec_loopback_values
);
426 static const struct soc_enum cs47l15_aec2_loopback
=
427 SOC_VALUE_ENUM_SINGLE(MADERA_DAC_AEC_CONTROL_2
,
428 MADERA_AEC2_LOOPBACK_SRC_SHIFT
, 0xf,
429 ARRAY_SIZE(cs47l15_aec_loopback_texts
),
430 cs47l15_aec_loopback_texts
,
431 cs47l15_aec_loopback_values
);
433 static const struct snd_kcontrol_new cs47l15_aec_loopback_mux
[] = {
434 SOC_DAPM_ENUM("AEC1 Loopback", cs47l15_aec1_loopback
),
435 SOC_DAPM_ENUM("AEC2 Loopback", cs47l15_aec2_loopback
),
438 static const struct snd_soc_dapm_widget cs47l15_dapm_widgets
[] = {
439 SND_SOC_DAPM_SUPPLY("SYSCLK", MADERA_SYSTEM_CLOCK_1
, MADERA_SYSCLK_ENA_SHIFT
,
441 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
|
442 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
),
443 SND_SOC_DAPM_SUPPLY("OPCLK", MADERA_OUTPUT_SYSTEM_CLOCK
,
444 MADERA_OPCLK_ENA_SHIFT
, 0, NULL
, 0),
445 SND_SOC_DAPM_SUPPLY("DSPCLK", MADERA_DSP_CLOCK_1
, MADERA_DSP_CLK_ENA_SHIFT
,
447 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
449 SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD1", 20, 0),
450 SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS
),
451 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDD", 0, 0),
453 SND_SOC_DAPM_SUPPLY("MICBIAS1", MADERA_MIC_BIAS_CTRL_1
,
454 MADERA_MICB1_ENA_SHIFT
, 0, NULL
, 0),
456 SND_SOC_DAPM_SUPPLY("MICBIAS1A", MADERA_MIC_BIAS_CTRL_5
,
457 MADERA_MICB1A_ENA_SHIFT
, 0, NULL
, 0),
458 SND_SOC_DAPM_SUPPLY("MICBIAS1B", MADERA_MIC_BIAS_CTRL_5
,
459 MADERA_MICB1B_ENA_SHIFT
, 0, NULL
, 0),
460 SND_SOC_DAPM_SUPPLY("MICBIAS1C", MADERA_MIC_BIAS_CTRL_5
,
461 MADERA_MICB1C_ENA_SHIFT
, 0, NULL
, 0),
463 SND_SOC_DAPM_SUPPLY("FXCLK", SND_SOC_NOPM
,
464 MADERA_DOM_GRP_FX
, 0,
465 madera_domain_clk_ev
,
466 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
467 SND_SOC_DAPM_SUPPLY("ISRC1CLK", SND_SOC_NOPM
,
468 MADERA_DOM_GRP_ISRC1
, 0,
469 madera_domain_clk_ev
,
470 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
471 SND_SOC_DAPM_SUPPLY("ISRC2CLK", SND_SOC_NOPM
,
472 MADERA_DOM_GRP_ISRC2
, 0,
473 madera_domain_clk_ev
,
474 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
475 SND_SOC_DAPM_SUPPLY("OUTCLK", SND_SOC_NOPM
,
476 MADERA_DOM_GRP_OUT
, 0,
477 madera_domain_clk_ev
,
478 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
479 SND_SOC_DAPM_SUPPLY("SPDCLK", SND_SOC_NOPM
,
480 MADERA_DOM_GRP_SPD
, 0,
481 madera_domain_clk_ev
,
482 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
483 SND_SOC_DAPM_SUPPLY("DSP1CLK", SND_SOC_NOPM
,
484 MADERA_DOM_GRP_DSP1
, 0,
485 madera_domain_clk_ev
,
486 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
487 SND_SOC_DAPM_SUPPLY("AIF1TXCLK", SND_SOC_NOPM
,
488 MADERA_DOM_GRP_AIF1
, 0,
489 madera_domain_clk_ev
,
490 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
491 SND_SOC_DAPM_SUPPLY("AIF2TXCLK", SND_SOC_NOPM
,
492 MADERA_DOM_GRP_AIF2
, 0,
493 madera_domain_clk_ev
,
494 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
495 SND_SOC_DAPM_SUPPLY("AIF3TXCLK", SND_SOC_NOPM
,
496 MADERA_DOM_GRP_AIF3
, 0,
497 madera_domain_clk_ev
,
498 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
499 SND_SOC_DAPM_SUPPLY("PWMCLK", SND_SOC_NOPM
,
500 MADERA_DOM_GRP_PWM
, 0,
501 madera_domain_clk_ev
,
502 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
504 SND_SOC_DAPM_SIGGEN("TONE"),
505 SND_SOC_DAPM_SIGGEN("NOISE"),
507 SND_SOC_DAPM_INPUT("IN1ALN"),
508 SND_SOC_DAPM_INPUT("IN1ALP"),
509 SND_SOC_DAPM_INPUT("IN1BLN"),
510 SND_SOC_DAPM_INPUT("IN1BLP"),
511 SND_SOC_DAPM_INPUT("IN1ARN"),
512 SND_SOC_DAPM_INPUT("IN1ARP"),
513 SND_SOC_DAPM_INPUT("IN1BRN"),
514 SND_SOC_DAPM_INPUT("IN1BRP"),
515 SND_SOC_DAPM_INPUT("IN2N"),
516 SND_SOC_DAPM_INPUT("IN2P"),
517 SND_SOC_DAPM_INPUT("SPKRXDAT"),
519 SND_SOC_DAPM_MUX("IN1L Analog Mux", SND_SOC_NOPM
, 0, 0, &madera_inmux
[0]),
520 SND_SOC_DAPM_MUX("IN1R Analog Mux", SND_SOC_NOPM
, 0, 0, &madera_inmux
[1]),
522 SND_SOC_DAPM_MUX("IN1L Mode", SND_SOC_NOPM
, 0, 0, &madera_inmode
[0]),
523 SND_SOC_DAPM_MUX("IN1R Mode", SND_SOC_NOPM
, 0, 0, &madera_inmode
[0]),
525 SND_SOC_DAPM_MUX("IN2L Mode", SND_SOC_NOPM
, 0, 0, &madera_inmode
[1]),
526 SND_SOC_DAPM_MUX("IN2R Mode", SND_SOC_NOPM
, 0, 0, &madera_inmode
[1]),
528 SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
529 SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
531 SND_SOC_DAPM_OUTPUT("DSP Trigger Out"),
533 SND_SOC_DAPM_DEMUX("HPOUT1 Demux", SND_SOC_NOPM
, 0, 0, &cs47l15_outdemux
),
534 SND_SOC_DAPM_MUX("HPOUT1 Mono Mux", SND_SOC_NOPM
, 0, 0, &cs47l15_outdemux
),
536 SND_SOC_DAPM_PGA("PWM1 Driver", MADERA_PWM_DRIVE_1
, MADERA_PWM1_ENA_SHIFT
,
538 SND_SOC_DAPM_PGA("PWM2 Driver", MADERA_PWM_DRIVE_1
, MADERA_PWM2_ENA_SHIFT
,
541 SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL
, 0,
542 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX1_ENA_SHIFT
, 0),
543 SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL
, 0,
544 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX2_ENA_SHIFT
, 0),
545 SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL
, 0,
546 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX3_ENA_SHIFT
, 0),
547 SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL
, 0,
548 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX4_ENA_SHIFT
, 0),
549 SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL
, 0,
550 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX5_ENA_SHIFT
, 0),
551 SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL
, 0,
552 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX6_ENA_SHIFT
, 0),
554 SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL
, 0,
555 MADERA_AIF2_TX_ENABLES
, MADERA_AIF2TX1_ENA_SHIFT
, 0),
556 SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL
, 0,
557 MADERA_AIF2_TX_ENABLES
, MADERA_AIF2TX2_ENA_SHIFT
, 0),
558 SND_SOC_DAPM_AIF_OUT("AIF2TX3", NULL
, 0,
559 MADERA_AIF2_TX_ENABLES
, MADERA_AIF2TX3_ENA_SHIFT
, 0),
560 SND_SOC_DAPM_AIF_OUT("AIF2TX4", NULL
, 0,
561 MADERA_AIF2_TX_ENABLES
, MADERA_AIF2TX4_ENA_SHIFT
, 0),
563 SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL
, 0,
564 MADERA_AIF3_TX_ENABLES
, MADERA_AIF3TX1_ENA_SHIFT
, 0),
565 SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL
, 0,
566 MADERA_AIF3_TX_ENABLES
, MADERA_AIF3TX2_ENA_SHIFT
, 0),
568 SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM
,
569 MADERA_OUT1L_ENA_SHIFT
, 0, NULL
, 0, madera_hp_ev
,
570 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
571 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
572 SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM
,
573 MADERA_OUT1R_ENA_SHIFT
, 0, NULL
, 0, madera_hp_ev
,
574 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
575 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
576 SND_SOC_DAPM_PGA_E("OUT4L", SND_SOC_NOPM
,
577 MADERA_OUT4L_ENA_SHIFT
, 0, NULL
, 0, madera_spk_ev
,
578 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
579 SND_SOC_DAPM_PGA_E("OUT5L", MADERA_OUTPUT_ENABLES_1
,
580 MADERA_OUT5L_ENA_SHIFT
, 0, NULL
, 0, madera_out_ev
,
581 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
582 SND_SOC_DAPM_PGA_E("OUT5R", MADERA_OUTPUT_ENABLES_1
,
583 MADERA_OUT5R_ENA_SHIFT
, 0, NULL
, 0, madera_out_ev
,
584 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
586 SND_SOC_DAPM_PGA("SPD1TX1", MADERA_SPD1_TX_CONTROL
,
587 MADERA_SPD1_VAL1_SHIFT
, 0, NULL
, 0),
588 SND_SOC_DAPM_PGA("SPD1TX2", MADERA_SPD1_TX_CONTROL
,
589 MADERA_SPD1_VAL2_SHIFT
, 0, NULL
, 0),
590 SND_SOC_DAPM_OUT_DRV("SPD1", MADERA_SPD1_TX_CONTROL
,
591 MADERA_SPD1_ENA_SHIFT
, 0, NULL
, 0),
594 * mux_in widgets : arranged in the order of sources
595 * specified in MADERA_MIXER_INPUT_ROUTES
598 SND_SOC_DAPM_PGA("Noise Generator", MADERA_COMFORT_NOISE_GENERATOR
,
599 MADERA_NOISE_GEN_ENA_SHIFT
, 0, NULL
, 0),
601 SND_SOC_DAPM_PGA("Tone Generator 1", MADERA_TONE_GENERATOR_1
,
602 MADERA_TONE1_ENA_SHIFT
, 0, NULL
, 0),
603 SND_SOC_DAPM_PGA("Tone Generator 2", MADERA_TONE_GENERATOR_1
,
604 MADERA_TONE2_ENA_SHIFT
, 0, NULL
, 0),
606 SND_SOC_DAPM_SIGGEN("HAPTICS"),
608 SND_SOC_DAPM_MUX("AEC1 Loopback", MADERA_DAC_AEC_CONTROL_1
,
609 MADERA_AEC1_LOOPBACK_ENA_SHIFT
, 0,
610 &cs47l15_aec_loopback_mux
[0]),
611 SND_SOC_DAPM_MUX("AEC2 Loopback", MADERA_DAC_AEC_CONTROL_2
,
612 MADERA_AEC2_LOOPBACK_ENA_SHIFT
, 0,
613 &cs47l15_aec_loopback_mux
[1]),
615 SND_SOC_DAPM_PGA_E("IN1L", MADERA_INPUT_ENABLES
, MADERA_IN1L_ENA_SHIFT
,
616 0, NULL
, 0, madera_in_ev
,
617 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
618 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
619 SND_SOC_DAPM_PGA_E("IN1R", MADERA_INPUT_ENABLES
, MADERA_IN1R_ENA_SHIFT
,
620 0, NULL
, 0, madera_in_ev
,
621 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
622 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
623 SND_SOC_DAPM_PGA_E("IN2L", MADERA_INPUT_ENABLES
, MADERA_IN2L_ENA_SHIFT
,
624 0, NULL
, 0, madera_in_ev
,
625 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
626 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
627 SND_SOC_DAPM_PGA_E("IN2R", MADERA_INPUT_ENABLES
, MADERA_IN2R_ENA_SHIFT
,
628 0, NULL
, 0, madera_in_ev
,
629 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
630 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
632 SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL
, 0,
633 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX1_ENA_SHIFT
, 0),
634 SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL
, 0,
635 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX2_ENA_SHIFT
, 0),
636 SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL
, 0,
637 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX3_ENA_SHIFT
, 0),
638 SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL
, 0,
639 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX4_ENA_SHIFT
, 0),
640 SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL
, 0,
641 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX5_ENA_SHIFT
, 0),
642 SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL
, 0,
643 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX6_ENA_SHIFT
, 0),
645 SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL
, 0,
646 MADERA_AIF2_RX_ENABLES
, MADERA_AIF2RX1_ENA_SHIFT
, 0),
647 SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL
, 0,
648 MADERA_AIF2_RX_ENABLES
, MADERA_AIF2RX2_ENA_SHIFT
, 0),
649 SND_SOC_DAPM_AIF_IN("AIF2RX3", NULL
, 0,
650 MADERA_AIF2_RX_ENABLES
, MADERA_AIF2RX3_ENA_SHIFT
, 0),
651 SND_SOC_DAPM_AIF_IN("AIF2RX4", NULL
, 0,
652 MADERA_AIF2_RX_ENABLES
, MADERA_AIF2RX4_ENA_SHIFT
, 0),
654 SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL
, 0,
655 MADERA_AIF3_RX_ENABLES
, MADERA_AIF3RX1_ENA_SHIFT
, 0),
656 SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL
, 0,
657 MADERA_AIF3_RX_ENABLES
, MADERA_AIF3RX2_ENA_SHIFT
, 0),
659 SND_SOC_DAPM_PGA("EQ1", MADERA_EQ1_1
, MADERA_EQ1_ENA_SHIFT
, 0, NULL
, 0),
660 SND_SOC_DAPM_PGA("EQ2", MADERA_EQ2_1
, MADERA_EQ2_ENA_SHIFT
, 0, NULL
, 0),
661 SND_SOC_DAPM_PGA("EQ3", MADERA_EQ3_1
, MADERA_EQ3_ENA_SHIFT
, 0, NULL
, 0),
662 SND_SOC_DAPM_PGA("EQ4", MADERA_EQ4_1
, MADERA_EQ4_ENA_SHIFT
, 0, NULL
, 0),
664 SND_SOC_DAPM_PGA("DRC1L", MADERA_DRC1_CTRL1
, MADERA_DRC1L_ENA_SHIFT
, 0,
666 SND_SOC_DAPM_PGA("DRC1R", MADERA_DRC1_CTRL1
, MADERA_DRC1R_ENA_SHIFT
, 0,
668 SND_SOC_DAPM_PGA("DRC2L", MADERA_DRC2_CTRL1
, MADERA_DRC2L_ENA_SHIFT
, 0,
670 SND_SOC_DAPM_PGA("DRC2R", MADERA_DRC2_CTRL1
, MADERA_DRC2R_ENA_SHIFT
, 0,
673 SND_SOC_DAPM_PGA("LHPF1", MADERA_HPLPF1_1
, MADERA_LHPF1_ENA_SHIFT
, 0, NULL
, 0),
674 SND_SOC_DAPM_PGA("LHPF2", MADERA_HPLPF2_1
, MADERA_LHPF2_ENA_SHIFT
, 0, NULL
, 0),
675 SND_SOC_DAPM_PGA("LHPF3", MADERA_HPLPF3_1
, MADERA_LHPF3_ENA_SHIFT
, 0, NULL
, 0),
676 SND_SOC_DAPM_PGA("LHPF4", MADERA_HPLPF4_1
, MADERA_LHPF4_ENA_SHIFT
, 0, NULL
, 0),
678 SND_SOC_DAPM_PGA("ISRC1DEC1", MADERA_ISRC_1_CTRL_3
,
679 MADERA_ISRC1_DEC1_ENA_SHIFT
, 0, NULL
, 0),
680 SND_SOC_DAPM_PGA("ISRC1DEC2", MADERA_ISRC_1_CTRL_3
,
681 MADERA_ISRC1_DEC2_ENA_SHIFT
, 0, NULL
, 0),
682 SND_SOC_DAPM_PGA("ISRC1DEC3", MADERA_ISRC_1_CTRL_3
,
683 MADERA_ISRC1_DEC3_ENA_SHIFT
, 0, NULL
, 0),
684 SND_SOC_DAPM_PGA("ISRC1DEC4", MADERA_ISRC_1_CTRL_3
,
685 MADERA_ISRC1_DEC4_ENA_SHIFT
, 0, NULL
, 0),
687 SND_SOC_DAPM_PGA("ISRC1INT1", MADERA_ISRC_1_CTRL_3
,
688 MADERA_ISRC1_INT1_ENA_SHIFT
, 0, NULL
, 0),
689 SND_SOC_DAPM_PGA("ISRC1INT2", MADERA_ISRC_1_CTRL_3
,
690 MADERA_ISRC1_INT2_ENA_SHIFT
, 0, NULL
, 0),
691 SND_SOC_DAPM_PGA("ISRC1INT3", MADERA_ISRC_1_CTRL_3
,
692 MADERA_ISRC1_INT3_ENA_SHIFT
, 0, NULL
, 0),
693 SND_SOC_DAPM_PGA("ISRC1INT4", MADERA_ISRC_1_CTRL_3
,
694 MADERA_ISRC1_INT4_ENA_SHIFT
, 0, NULL
, 0),
696 SND_SOC_DAPM_PGA("ISRC2DEC1", MADERA_ISRC_2_CTRL_3
,
697 MADERA_ISRC2_DEC1_ENA_SHIFT
, 0, NULL
, 0),
698 SND_SOC_DAPM_PGA("ISRC2DEC2", MADERA_ISRC_2_CTRL_3
,
699 MADERA_ISRC2_DEC2_ENA_SHIFT
, 0, NULL
, 0),
700 SND_SOC_DAPM_PGA("ISRC2DEC3", MADERA_ISRC_2_CTRL_3
,
701 MADERA_ISRC2_DEC3_ENA_SHIFT
, 0, NULL
, 0),
702 SND_SOC_DAPM_PGA("ISRC2DEC4", MADERA_ISRC_2_CTRL_3
,
703 MADERA_ISRC2_DEC4_ENA_SHIFT
, 0, NULL
, 0),
705 SND_SOC_DAPM_PGA("ISRC2INT1", MADERA_ISRC_2_CTRL_3
,
706 MADERA_ISRC2_INT1_ENA_SHIFT
, 0, NULL
, 0),
707 SND_SOC_DAPM_PGA("ISRC2INT2", MADERA_ISRC_2_CTRL_3
,
708 MADERA_ISRC2_INT2_ENA_SHIFT
, 0, NULL
, 0),
709 SND_SOC_DAPM_PGA("ISRC2INT3", MADERA_ISRC_2_CTRL_3
,
710 MADERA_ISRC2_INT3_ENA_SHIFT
, 0, NULL
, 0),
711 SND_SOC_DAPM_PGA("ISRC2INT4", MADERA_ISRC_2_CTRL_3
,
712 MADERA_ISRC2_INT4_ENA_SHIFT
, 0, NULL
, 0),
714 WM_ADSP2("DSP1", 0, cs47l15_adsp_power_ev
),
716 /* end of ordered widget list */
718 MADERA_MIXER_WIDGETS(EQ1
, "EQ1"),
719 MADERA_MIXER_WIDGETS(EQ2
, "EQ2"),
720 MADERA_MIXER_WIDGETS(EQ3
, "EQ3"),
721 MADERA_MIXER_WIDGETS(EQ4
, "EQ4"),
723 MADERA_MIXER_WIDGETS(DRC1L
, "DRC1L"),
724 MADERA_MIXER_WIDGETS(DRC1R
, "DRC1R"),
725 MADERA_MIXER_WIDGETS(DRC2L
, "DRC2L"),
726 MADERA_MIXER_WIDGETS(DRC2R
, "DRC2R"),
728 SND_SOC_DAPM_SWITCH("DRC1 Activity Output", SND_SOC_NOPM
, 0, 0,
729 &madera_drc_activity_output_mux
[0]),
730 SND_SOC_DAPM_SWITCH("DRC2 Activity Output", SND_SOC_NOPM
, 0, 0,
731 &madera_drc_activity_output_mux
[1]),
733 MADERA_MIXER_WIDGETS(LHPF1
, "LHPF1"),
734 MADERA_MIXER_WIDGETS(LHPF2
, "LHPF2"),
735 MADERA_MIXER_WIDGETS(LHPF3
, "LHPF3"),
736 MADERA_MIXER_WIDGETS(LHPF4
, "LHPF4"),
738 MADERA_MIXER_WIDGETS(PWM1
, "PWM1"),
739 MADERA_MIXER_WIDGETS(PWM2
, "PWM2"),
741 MADERA_MIXER_WIDGETS(OUT1L
, "HPOUT1L"),
742 MADERA_MIXER_WIDGETS(OUT1R
, "HPOUT1R"),
743 MADERA_MIXER_WIDGETS(SPKOUTL
, "SPKOUTL"),
744 MADERA_MIXER_WIDGETS(SPKDAT1L
, "SPKDAT1L"),
745 MADERA_MIXER_WIDGETS(SPKDAT1R
, "SPKDAT1R"),
747 MADERA_MIXER_WIDGETS(AIF1TX1
, "AIF1TX1"),
748 MADERA_MIXER_WIDGETS(AIF1TX2
, "AIF1TX2"),
749 MADERA_MIXER_WIDGETS(AIF1TX3
, "AIF1TX3"),
750 MADERA_MIXER_WIDGETS(AIF1TX4
, "AIF1TX4"),
751 MADERA_MIXER_WIDGETS(AIF1TX5
, "AIF1TX5"),
752 MADERA_MIXER_WIDGETS(AIF1TX6
, "AIF1TX6"),
754 MADERA_MIXER_WIDGETS(AIF2TX1
, "AIF2TX1"),
755 MADERA_MIXER_WIDGETS(AIF2TX2
, "AIF2TX2"),
756 MADERA_MIXER_WIDGETS(AIF2TX3
, "AIF2TX3"),
757 MADERA_MIXER_WIDGETS(AIF2TX4
, "AIF2TX4"),
759 MADERA_MIXER_WIDGETS(AIF3TX1
, "AIF3TX1"),
760 MADERA_MIXER_WIDGETS(AIF3TX2
, "AIF3TX2"),
762 MADERA_MUX_WIDGETS(SPD1TX1
, "SPDIF1TX1"),
763 MADERA_MUX_WIDGETS(SPD1TX2
, "SPDIF1TX2"),
765 MADERA_DSP_WIDGETS(DSP1
, "DSP1"),
767 SND_SOC_DAPM_SWITCH("DSP1 Trigger Output", SND_SOC_NOPM
, 0, 0,
768 &madera_dsp_trigger_output_mux
[0]),
770 MADERA_MUX_WIDGETS(ISRC1DEC1
, "ISRC1DEC1"),
771 MADERA_MUX_WIDGETS(ISRC1DEC2
, "ISRC1DEC2"),
772 MADERA_MUX_WIDGETS(ISRC1DEC3
, "ISRC1DEC3"),
773 MADERA_MUX_WIDGETS(ISRC1DEC4
, "ISRC1DEC4"),
775 MADERA_MUX_WIDGETS(ISRC1INT1
, "ISRC1INT1"),
776 MADERA_MUX_WIDGETS(ISRC1INT2
, "ISRC1INT2"),
777 MADERA_MUX_WIDGETS(ISRC1INT3
, "ISRC1INT3"),
778 MADERA_MUX_WIDGETS(ISRC1INT4
, "ISRC1INT4"),
780 MADERA_MUX_WIDGETS(ISRC2DEC1
, "ISRC2DEC1"),
781 MADERA_MUX_WIDGETS(ISRC2DEC2
, "ISRC2DEC2"),
782 MADERA_MUX_WIDGETS(ISRC2DEC3
, "ISRC2DEC3"),
783 MADERA_MUX_WIDGETS(ISRC2DEC4
, "ISRC2DEC4"),
785 MADERA_MUX_WIDGETS(ISRC2INT1
, "ISRC2INT1"),
786 MADERA_MUX_WIDGETS(ISRC2INT2
, "ISRC2INT2"),
787 MADERA_MUX_WIDGETS(ISRC2INT3
, "ISRC2INT3"),
788 MADERA_MUX_WIDGETS(ISRC2INT4
, "ISRC2INT4"),
790 SND_SOC_DAPM_OUTPUT("HPOUTL"),
791 SND_SOC_DAPM_OUTPUT("HPOUTR"),
792 SND_SOC_DAPM_OUTPUT("EPOUTP"),
793 SND_SOC_DAPM_OUTPUT("EPOUTN"),
794 SND_SOC_DAPM_OUTPUT("SPKOUTN"),
795 SND_SOC_DAPM_OUTPUT("SPKOUTP"),
796 SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
797 SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
798 SND_SOC_DAPM_OUTPUT("SPDIF1"),
800 SND_SOC_DAPM_OUTPUT("MICSUPP"),
803 #define MADERA_MIXER_INPUT_ROUTES(name) \
804 { name, "Noise Generator", "Noise Generator" }, \
805 { name, "Tone Generator 1", "Tone Generator 1" }, \
806 { name, "Tone Generator 2", "Tone Generator 2" }, \
807 { name, "Haptics", "HAPTICS" }, \
808 { name, "AEC1", "AEC1 Loopback" }, \
809 { name, "AEC2", "AEC2 Loopback" }, \
810 { name, "IN1L", "IN1L" }, \
811 { name, "IN1R", "IN1R" }, \
812 { name, "IN2L", "IN2L" }, \
813 { name, "IN2R", "IN2R" }, \
814 { name, "AIF1RX1", "AIF1RX1" }, \
815 { name, "AIF1RX2", "AIF1RX2" }, \
816 { name, "AIF1RX3", "AIF1RX3" }, \
817 { name, "AIF1RX4", "AIF1RX4" }, \
818 { name, "AIF1RX5", "AIF1RX5" }, \
819 { name, "AIF1RX6", "AIF1RX6" }, \
820 { name, "AIF2RX1", "AIF2RX1" }, \
821 { name, "AIF2RX2", "AIF2RX2" }, \
822 { name, "AIF2RX3", "AIF2RX3" }, \
823 { name, "AIF2RX4", "AIF2RX4" }, \
824 { name, "AIF3RX1", "AIF3RX1" }, \
825 { name, "AIF3RX2", "AIF3RX2" }, \
826 { name, "EQ1", "EQ1" }, \
827 { name, "EQ2", "EQ2" }, \
828 { name, "EQ3", "EQ3" }, \
829 { name, "EQ4", "EQ4" }, \
830 { name, "DRC1L", "DRC1L" }, \
831 { name, "DRC1R", "DRC1R" }, \
832 { name, "DRC2L", "DRC2L" }, \
833 { name, "DRC2R", "DRC2R" }, \
834 { name, "LHPF1", "LHPF1" }, \
835 { name, "LHPF2", "LHPF2" }, \
836 { name, "LHPF3", "LHPF3" }, \
837 { name, "LHPF4", "LHPF4" }, \
838 { name, "ISRC1DEC1", "ISRC1DEC1" }, \
839 { name, "ISRC1DEC2", "ISRC1DEC2" }, \
840 { name, "ISRC1DEC3", "ISRC1DEC3" }, \
841 { name, "ISRC1DEC4", "ISRC1DEC4" }, \
842 { name, "ISRC1INT1", "ISRC1INT1" }, \
843 { name, "ISRC1INT2", "ISRC1INT2" }, \
844 { name, "ISRC1INT3", "ISRC1INT3" }, \
845 { name, "ISRC1INT4", "ISRC1INT4" }, \
846 { name, "ISRC2DEC1", "ISRC2DEC1" }, \
847 { name, "ISRC2DEC2", "ISRC2DEC2" }, \
848 { name, "ISRC2DEC3", "ISRC2DEC3" }, \
849 { name, "ISRC2DEC4", "ISRC2DEC4" }, \
850 { name, "ISRC2INT1", "ISRC2INT1" }, \
851 { name, "ISRC2INT2", "ISRC2INT2" }, \
852 { name, "ISRC2INT3", "ISRC2INT3" }, \
853 { name, "ISRC2INT4", "ISRC2INT4" }, \
854 { name, "DSP1.1", "DSP1" }, \
855 { name, "DSP1.2", "DSP1" }, \
856 { name, "DSP1.3", "DSP1" }, \
857 { name, "DSP1.4", "DSP1" }, \
858 { name, "DSP1.5", "DSP1" }, \
859 { name, "DSP1.6", "DSP1" }
861 static const struct snd_soc_dapm_route cs47l15_dapm_routes
[] = {
862 /* Internal clock domains */
863 { "EQ1", NULL
, "FXCLK" },
864 { "EQ2", NULL
, "FXCLK" },
865 { "EQ3", NULL
, "FXCLK" },
866 { "EQ4", NULL
, "FXCLK" },
867 { "DRC1L", NULL
, "FXCLK" },
868 { "DRC1R", NULL
, "FXCLK" },
869 { "DRC2L", NULL
, "FXCLK" },
870 { "DRC2R", NULL
, "FXCLK" },
871 { "LHPF1", NULL
, "FXCLK" },
872 { "LHPF2", NULL
, "FXCLK" },
873 { "LHPF3", NULL
, "FXCLK" },
874 { "LHPF4", NULL
, "FXCLK" },
875 { "PWM1 Mixer", NULL
, "PWMCLK" },
876 { "PWM2 Mixer", NULL
, "PWMCLK" },
877 { "OUT1L", NULL
, "OUTCLK" },
878 { "OUT1R", NULL
, "OUTCLK" },
879 { "OUT4L", NULL
, "OUTCLK" },
880 { "OUT5L", NULL
, "OUTCLK" },
881 { "OUT5R", NULL
, "OUTCLK" },
882 { "AIF1TX1", NULL
, "AIF1TXCLK" },
883 { "AIF1TX2", NULL
, "AIF1TXCLK" },
884 { "AIF1TX3", NULL
, "AIF1TXCLK" },
885 { "AIF1TX4", NULL
, "AIF1TXCLK" },
886 { "AIF1TX5", NULL
, "AIF1TXCLK" },
887 { "AIF1TX6", NULL
, "AIF1TXCLK" },
888 { "AIF2TX1", NULL
, "AIF2TXCLK" },
889 { "AIF2TX2", NULL
, "AIF2TXCLK" },
890 { "AIF2TX3", NULL
, "AIF2TXCLK" },
891 { "AIF2TX4", NULL
, "AIF2TXCLK" },
892 { "AIF3TX1", NULL
, "AIF3TXCLK" },
893 { "AIF3TX2", NULL
, "AIF3TXCLK" },
894 { "SPD1TX1", NULL
, "SPDCLK" },
895 { "SPD1TX2", NULL
, "SPDCLK" },
896 { "DSP1", NULL
, "DSP1CLK" },
897 { "ISRC1DEC1", NULL
, "ISRC1CLK" },
898 { "ISRC1DEC2", NULL
, "ISRC1CLK" },
899 { "ISRC1DEC3", NULL
, "ISRC1CLK" },
900 { "ISRC1DEC4", NULL
, "ISRC1CLK" },
901 { "ISRC1INT1", NULL
, "ISRC1CLK" },
902 { "ISRC1INT2", NULL
, "ISRC1CLK" },
903 { "ISRC1INT3", NULL
, "ISRC1CLK" },
904 { "ISRC1INT4", NULL
, "ISRC1CLK" },
905 { "ISRC2DEC1", NULL
, "ISRC2CLK" },
906 { "ISRC2DEC2", NULL
, "ISRC2CLK" },
907 { "ISRC2DEC3", NULL
, "ISRC2CLK" },
908 { "ISRC2DEC4", NULL
, "ISRC2CLK" },
909 { "ISRC2INT1", NULL
, "ISRC2CLK" },
910 { "ISRC2INT2", NULL
, "ISRC2CLK" },
911 { "ISRC2INT3", NULL
, "ISRC2CLK" },
912 { "ISRC2INT4", NULL
, "ISRC2CLK" },
914 { "OUT1L", NULL
, "CPVDD1" },
915 { "OUT1R", NULL
, "CPVDD1" },
916 { "OUT4L", NULL
, "SPKVDD" },
918 { "OUT1L", NULL
, "SYSCLK" },
919 { "OUT1R", NULL
, "SYSCLK" },
920 { "OUT4L", NULL
, "SYSCLK" },
921 { "OUT5L", NULL
, "SYSCLK" },
922 { "OUT5R", NULL
, "SYSCLK" },
924 { "SPD1", NULL
, "SYSCLK" },
925 { "SPD1", NULL
, "SPD1TX1" },
926 { "SPD1", NULL
, "SPD1TX2" },
928 { "IN1L", NULL
, "SYSCLK" },
929 { "IN1R", NULL
, "SYSCLK" },
930 { "IN2L", NULL
, "SYSCLK" },
931 { "IN2R", NULL
, "SYSCLK" },
933 { "MICBIAS1", NULL
, "MICVDD" },
935 { "MICBIAS1A", NULL
, "MICBIAS1" },
936 { "MICBIAS1B", NULL
, "MICBIAS1" },
937 { "MICBIAS1C", NULL
, "MICBIAS1" },
939 { "Noise Generator", NULL
, "SYSCLK" },
940 { "Tone Generator 1", NULL
, "SYSCLK" },
941 { "Tone Generator 2", NULL
, "SYSCLK" },
943 { "Noise Generator", NULL
, "NOISE" },
944 { "Tone Generator 1", NULL
, "TONE" },
945 { "Tone Generator 2", NULL
, "TONE" },
947 { "AIF1 Capture", NULL
, "AIF1TX1" },
948 { "AIF1 Capture", NULL
, "AIF1TX2" },
949 { "AIF1 Capture", NULL
, "AIF1TX3" },
950 { "AIF1 Capture", NULL
, "AIF1TX4" },
951 { "AIF1 Capture", NULL
, "AIF1TX5" },
952 { "AIF1 Capture", NULL
, "AIF1TX6" },
954 { "AIF1RX1", NULL
, "AIF1 Playback" },
955 { "AIF1RX2", NULL
, "AIF1 Playback" },
956 { "AIF1RX3", NULL
, "AIF1 Playback" },
957 { "AIF1RX4", NULL
, "AIF1 Playback" },
958 { "AIF1RX5", NULL
, "AIF1 Playback" },
959 { "AIF1RX6", NULL
, "AIF1 Playback" },
961 { "AIF2 Capture", NULL
, "AIF2TX1" },
962 { "AIF2 Capture", NULL
, "AIF2TX2" },
963 { "AIF2 Capture", NULL
, "AIF2TX3" },
964 { "AIF2 Capture", NULL
, "AIF2TX4" },
966 { "AIF2RX1", NULL
, "AIF2 Playback" },
967 { "AIF2RX2", NULL
, "AIF2 Playback" },
968 { "AIF2RX3", NULL
, "AIF2 Playback" },
969 { "AIF2RX4", NULL
, "AIF2 Playback" },
971 { "AIF3 Capture", NULL
, "AIF3TX1" },
972 { "AIF3 Capture", NULL
, "AIF3TX2" },
974 { "AIF3RX1", NULL
, "AIF3 Playback" },
975 { "AIF3RX2", NULL
, "AIF3 Playback" },
977 { "AIF1 Playback", NULL
, "SYSCLK" },
978 { "AIF2 Playback", NULL
, "SYSCLK" },
979 { "AIF3 Playback", NULL
, "SYSCLK" },
981 { "AIF1 Capture", NULL
, "SYSCLK" },
982 { "AIF2 Capture", NULL
, "SYSCLK" },
983 { "AIF3 Capture", NULL
, "SYSCLK" },
985 { "Audio Trace DSP", NULL
, "DSP1" },
987 { "IN1L Analog Mux", "A", "IN1ALN" },
988 { "IN1L Analog Mux", "A", "IN1ALP" },
989 { "IN1L Analog Mux", "B", "IN1BLN" },
990 { "IN1L Analog Mux", "B", "IN1BLP" },
991 { "IN1R Analog Mux", "A", "IN1ARN" },
992 { "IN1R Analog Mux", "A", "IN1ARP" },
993 { "IN1R Analog Mux", "B", "IN1BRN" },
994 { "IN1R Analog Mux", "B", "IN1BRP" },
996 { "IN1L Mode", "Analog", "IN1L Analog Mux" },
997 { "IN1R Mode", "Analog", "IN1R Analog Mux" },
999 { "IN1L Mode", "Digital", "IN1ALN" },
1000 { "IN1L Mode", "Digital", "IN1ALP" },
1001 { "IN1R Mode", "Digital", "IN1ALN" },
1002 { "IN1R Mode", "Digital", "IN1ALP" },
1004 { "IN1L", NULL
, "IN1L Mode" },
1005 { "IN1R", NULL
, "IN1R Mode" },
1007 { "IN2L Mode", "Analog", "IN2N" },
1008 { "IN2L Mode", "Analog", "IN2P" },
1010 { "IN2L Mode", "Digital", "SPKRXDAT" },
1011 { "IN2R Mode", "Digital", "SPKRXDAT" },
1013 { "IN2L", NULL
, "IN2L Mode" },
1014 { "IN2R", NULL
, "IN2R Mode" },
1016 MADERA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
1017 MADERA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
1018 MADERA_MIXER_ROUTES("OUT4L", "SPKOUTL"),
1019 MADERA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
1020 MADERA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
1022 MADERA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
1023 MADERA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
1025 MADERA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
1026 MADERA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
1027 MADERA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
1028 MADERA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
1029 MADERA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
1030 MADERA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
1032 MADERA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
1033 MADERA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
1034 MADERA_MIXER_ROUTES("AIF2TX3", "AIF2TX3"),
1035 MADERA_MIXER_ROUTES("AIF2TX4", "AIF2TX4"),
1037 MADERA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
1038 MADERA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
1040 MADERA_MUX_ROUTES("SPD1TX1", "SPDIF1TX1"),
1041 MADERA_MUX_ROUTES("SPD1TX2", "SPDIF1TX2"),
1043 MADERA_MIXER_ROUTES("EQ1", "EQ1"),
1044 MADERA_MIXER_ROUTES("EQ2", "EQ2"),
1045 MADERA_MIXER_ROUTES("EQ3", "EQ3"),
1046 MADERA_MIXER_ROUTES("EQ4", "EQ4"),
1048 MADERA_MIXER_ROUTES("DRC1L", "DRC1L"),
1049 MADERA_MIXER_ROUTES("DRC1R", "DRC1R"),
1050 MADERA_MIXER_ROUTES("DRC2L", "DRC2L"),
1051 MADERA_MIXER_ROUTES("DRC2R", "DRC2R"),
1053 MADERA_MIXER_ROUTES("LHPF1", "LHPF1"),
1054 MADERA_MIXER_ROUTES("LHPF2", "LHPF2"),
1055 MADERA_MIXER_ROUTES("LHPF3", "LHPF3"),
1056 MADERA_MIXER_ROUTES("LHPF4", "LHPF4"),
1058 MADERA_DSP_ROUTES("DSP1"),
1060 { "DSP Trigger Out", NULL
, "DSP1 Trigger Output" },
1062 { "DSP1 Trigger Output", "Switch", "DSP1" },
1064 MADERA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
1065 MADERA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
1066 MADERA_MUX_ROUTES("ISRC1INT3", "ISRC1INT3"),
1067 MADERA_MUX_ROUTES("ISRC1INT4", "ISRC1INT4"),
1069 MADERA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
1070 MADERA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
1071 MADERA_MUX_ROUTES("ISRC1DEC3", "ISRC1DEC3"),
1072 MADERA_MUX_ROUTES("ISRC1DEC4", "ISRC1DEC4"),
1074 MADERA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
1075 MADERA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
1076 MADERA_MUX_ROUTES("ISRC2INT3", "ISRC2INT3"),
1077 MADERA_MUX_ROUTES("ISRC2INT4", "ISRC2INT4"),
1079 MADERA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
1080 MADERA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
1081 MADERA_MUX_ROUTES("ISRC2DEC3", "ISRC2DEC3"),
1082 MADERA_MUX_ROUTES("ISRC2DEC4", "ISRC2DEC4"),
1084 { "AEC1 Loopback", "HPOUT1L", "OUT1L" },
1085 { "AEC1 Loopback", "HPOUT1R", "OUT1R" },
1086 { "AEC2 Loopback", "HPOUT1L", "OUT1L" },
1087 { "AEC2 Loopback", "HPOUT1R", "OUT1R" },
1088 { "HPOUT1 Demux", NULL
, "OUT1L" },
1089 { "HPOUT1 Demux", NULL
, "OUT1R" },
1091 { "OUT1R", NULL
, "HPOUT1 Mono Mux" },
1093 { "HPOUTL", "HPOUT", "HPOUT1 Demux" },
1094 { "HPOUTR", "HPOUT", "HPOUT1 Demux" },
1095 { "EPOUTP", "EPOUT", "HPOUT1 Demux" },
1096 { "EPOUTN", "EPOUT", "HPOUT1 Demux" },
1098 { "AEC1 Loopback", "SPKOUTL", "OUT4L" },
1099 { "AEC2 Loopback", "SPKOUTL", "OUT4L" },
1100 { "SPKOUTN", NULL
, "OUT4L" },
1101 { "SPKOUTP", NULL
, "OUT4L" },
1103 { "AEC1 Loopback", "SPKDAT1L", "OUT5L" },
1104 { "AEC1 Loopback", "SPKDAT1R", "OUT5R" },
1105 { "AEC2 Loopback", "SPKDAT1L", "OUT5L" },
1106 { "AEC2 Loopback", "SPKDAT1R", "OUT5R" },
1107 { "SPKDAT1L", NULL
, "OUT5L" },
1108 { "SPKDAT1R", NULL
, "OUT5R" },
1110 { "SPDIF1", NULL
, "SPD1" },
1112 { "MICSUPP", NULL
, "SYSCLK" },
1114 { "DRC1 Signal Activity", NULL
, "DRC1 Activity Output" },
1115 { "DRC2 Signal Activity", NULL
, "DRC2 Activity Output" },
1116 { "DRC1 Activity Output", "Switch", "DRC1L" },
1117 { "DRC1 Activity Output", "Switch", "DRC1R" },
1118 { "DRC2 Activity Output", "Switch", "DRC2L" },
1119 { "DRC2 Activity Output", "Switch", "DRC2R" },
1122 static int cs47l15_set_fll(struct snd_soc_component
*component
, int fll_id
,
1123 int source
, unsigned int fref
, unsigned int fout
)
1125 struct cs47l15
*cs47l15
= snd_soc_component_get_drvdata(component
);
1128 case MADERA_FLL1_REFCLK
:
1129 return madera_set_fll_refclk(&cs47l15
->fll
[0], source
, fref
,
1131 case MADERA_FLLAO_REFCLK
:
1132 return madera_set_fll_ao_refclk(&cs47l15
->fll
[1], source
, fref
,
1134 case MADERA_FLL1_SYNCCLK
:
1135 return madera_set_fll_syncclk(&cs47l15
->fll
[0], source
, fref
,
1142 static struct snd_soc_dai_driver cs47l15_dai
[] = {
1144 .name
= "cs47l15-aif1",
1146 .base
= MADERA_AIF1_BCLK_CTRL
,
1148 .stream_name
= "AIF1 Playback",
1151 .rates
= MADERA_RATES
,
1152 .formats
= MADERA_FORMATS
,
1155 .stream_name
= "AIF1 Capture",
1158 .rates
= MADERA_RATES
,
1159 .formats
= MADERA_FORMATS
,
1161 .ops
= &madera_dai_ops
,
1162 .symmetric_rates
= 1,
1163 .symmetric_samplebits
= 1,
1166 .name
= "cs47l15-aif2",
1168 .base
= MADERA_AIF2_BCLK_CTRL
,
1170 .stream_name
= "AIF2 Playback",
1173 .rates
= MADERA_RATES
,
1174 .formats
= MADERA_FORMATS
,
1177 .stream_name
= "AIF2 Capture",
1180 .rates
= MADERA_RATES
,
1181 .formats
= MADERA_FORMATS
,
1183 .ops
= &madera_dai_ops
,
1184 .symmetric_rates
= 1,
1185 .symmetric_samplebits
= 1,
1188 .name
= "cs47l15-aif3",
1190 .base
= MADERA_AIF3_BCLK_CTRL
,
1192 .stream_name
= "AIF3 Playback",
1195 .rates
= MADERA_RATES
,
1196 .formats
= MADERA_FORMATS
,
1199 .stream_name
= "AIF3 Capture",
1202 .rates
= MADERA_RATES
,
1203 .formats
= MADERA_FORMATS
,
1205 .ops
= &madera_dai_ops
,
1206 .symmetric_rates
= 1,
1207 .symmetric_samplebits
= 1,
1210 .name
= "cs47l15-cpu-trace",
1212 .stream_name
= "Audio Trace CPU",
1215 .rates
= MADERA_RATES
,
1216 .formats
= MADERA_FORMATS
,
1218 .compress_new
= snd_soc_new_compress
,
1221 .name
= "cs47l15-dsp-trace",
1223 .stream_name
= "Audio Trace DSP",
1226 .rates
= MADERA_RATES
,
1227 .formats
= MADERA_FORMATS
,
1232 static int cs47l15_open(struct snd_compr_stream
*stream
)
1234 struct snd_soc_pcm_runtime
*rtd
= stream
->private_data
;
1235 struct snd_soc_component
*component
=
1236 snd_soc_rtdcom_lookup(rtd
, DRV_NAME
);
1237 struct cs47l15
*cs47l15
= snd_soc_component_get_drvdata(component
);
1238 struct madera_priv
*priv
= &cs47l15
->core
;
1239 struct madera
*madera
= priv
->madera
;
1242 if (strcmp(rtd
->codec_dai
->name
, "cs47l15-dsp-trace") == 0) {
1245 dev_err(madera
->dev
,
1246 "No suitable compressed stream for DAI '%s'\n",
1247 rtd
->codec_dai
->name
);
1251 return wm_adsp_compr_open(&priv
->adsp
[n_adsp
], stream
);
1254 static irqreturn_t
cs47l15_adsp2_irq(int irq
, void *data
)
1256 struct cs47l15
*cs47l15
= data
;
1257 struct madera_priv
*priv
= &cs47l15
->core
;
1258 struct madera
*madera
= priv
->madera
;
1261 ret
= wm_adsp_compr_handle_irq(&priv
->adsp
[0]);
1262 if (ret
== -ENODEV
) {
1263 dev_err(madera
->dev
, "Spurious compressed data IRQ\n");
1270 static const struct snd_soc_dapm_route cs47l15_mono_routes
[] = {
1271 { "HPOUT1 Mono Mux", "HPOUT", "OUT1L" },
1272 { "HPOUT1 Mono Mux", "EPOUT", "OUT1L" },
1275 static int cs47l15_component_probe(struct snd_soc_component
*component
)
1277 struct cs47l15
*cs47l15
= snd_soc_component_get_drvdata(component
);
1278 struct madera
*madera
= cs47l15
->core
.madera
;
1281 snd_soc_component_init_regmap(component
, madera
->regmap
);
1283 mutex_lock(&madera
->dapm_ptr_lock
);
1284 madera
->dapm
= snd_soc_component_get_dapm(component
);
1285 mutex_unlock(&madera
->dapm_ptr_lock
);
1287 ret
= madera_init_inputs(component
);
1291 ret
= madera_init_outputs(component
, cs47l15_mono_routes
,
1292 ARRAY_SIZE(cs47l15_mono_routes
),
1293 CS47L15_MONO_OUTPUTS
);
1297 snd_soc_component_disable_pin(component
, "HAPTICS");
1299 ret
= snd_soc_add_component_controls(component
,
1300 madera_adsp_rate_controls
,
1305 wm_adsp2_component_probe(&cs47l15
->core
.adsp
[0], component
);
1310 static void cs47l15_component_remove(struct snd_soc_component
*component
)
1312 struct cs47l15
*cs47l15
= snd_soc_component_get_drvdata(component
);
1313 struct madera
*madera
= cs47l15
->core
.madera
;
1315 mutex_lock(&madera
->dapm_ptr_lock
);
1316 madera
->dapm
= NULL
;
1317 mutex_unlock(&madera
->dapm_ptr_lock
);
1319 wm_adsp2_component_remove(&cs47l15
->core
.adsp
[0], component
);
1322 #define CS47L15_DIG_VU 0x0200
1324 static unsigned int cs47l15_digital_vu
[] = {
1325 MADERA_DAC_DIGITAL_VOLUME_1L
,
1326 MADERA_DAC_DIGITAL_VOLUME_1R
,
1327 MADERA_DAC_DIGITAL_VOLUME_4L
,
1328 MADERA_DAC_DIGITAL_VOLUME_5L
,
1329 MADERA_DAC_DIGITAL_VOLUME_5R
,
1332 static const struct snd_compr_ops cs47l15_compr_ops
= {
1333 .open
= &cs47l15_open
,
1334 .free
= &wm_adsp_compr_free
,
1335 .set_params
= &wm_adsp_compr_set_params
,
1336 .get_caps
= &wm_adsp_compr_get_caps
,
1337 .trigger
= &wm_adsp_compr_trigger
,
1338 .pointer
= &wm_adsp_compr_pointer
,
1339 .copy
= &wm_adsp_compr_copy
,
1342 static const struct snd_soc_component_driver soc_component_dev_cs47l15
= {
1343 .probe
= &cs47l15_component_probe
,
1344 .remove
= &cs47l15_component_remove
,
1345 .set_sysclk
= &madera_set_sysclk
,
1346 .set_pll
= &cs47l15_set_fll
,
1348 .compr_ops
= &cs47l15_compr_ops
,
1349 .controls
= cs47l15_snd_controls
,
1350 .num_controls
= ARRAY_SIZE(cs47l15_snd_controls
),
1351 .dapm_widgets
= cs47l15_dapm_widgets
,
1352 .num_dapm_widgets
= ARRAY_SIZE(cs47l15_dapm_widgets
),
1353 .dapm_routes
= cs47l15_dapm_routes
,
1354 .num_dapm_routes
= ARRAY_SIZE(cs47l15_dapm_routes
),
1355 .use_pmdown_time
= 1,
1357 .non_legacy_dai_naming
= 1,
1360 static int cs47l15_probe(struct platform_device
*pdev
)
1362 struct madera
*madera
= dev_get_drvdata(pdev
->dev
.parent
);
1363 struct cs47l15
*cs47l15
;
1366 BUILD_BUG_ON(ARRAY_SIZE(cs47l15_dai
) > MADERA_MAX_DAI
);
1368 /* quick exit if Madera irqchip driver hasn't completed probe */
1369 if (!madera
->irq_dev
) {
1370 dev_dbg(&pdev
->dev
, "irqchip driver not ready\n");
1371 return -EPROBE_DEFER
;
1374 cs47l15
= devm_kzalloc(&pdev
->dev
, sizeof(struct cs47l15
),
1379 platform_set_drvdata(pdev
, cs47l15
);
1381 cs47l15
->core
.madera
= madera
;
1382 cs47l15
->core
.dev
= &pdev
->dev
;
1383 cs47l15
->core
.num_inputs
= 4;
1385 ret
= madera_core_init(&cs47l15
->core
);
1389 ret
= madera_init_overheat(&cs47l15
->core
);
1393 ret
= madera_request_irq(madera
, MADERA_IRQ_DSP_IRQ1
,
1394 "ADSP2 Compressed IRQ", cs47l15_adsp2_irq
,
1397 dev_err(&pdev
->dev
, "Failed to request DSP IRQ: %d\n", ret
);
1398 goto error_overheat
;
1401 ret
= madera_set_irq_wake(madera
, MADERA_IRQ_DSP_IRQ1
, 1);
1403 dev_warn(&pdev
->dev
, "Failed to set DSP IRQ wake: %d\n", ret
);
1405 cs47l15
->core
.adsp
[0].part
= "cs47l15";
1406 cs47l15
->core
.adsp
[0].num
= 1;
1407 cs47l15
->core
.adsp
[0].type
= WMFW_ADSP2
;
1408 cs47l15
->core
.adsp
[0].rev
= 2;
1409 cs47l15
->core
.adsp
[0].dev
= madera
->dev
;
1410 cs47l15
->core
.adsp
[0].regmap
= madera
->regmap_32bit
;
1412 cs47l15
->core
.adsp
[0].base
= MADERA_DSP1_CONFIG_1
;
1413 cs47l15
->core
.adsp
[0].mem
= cs47l15_dsp1_regions
;
1414 cs47l15
->core
.adsp
[0].num_mems
= ARRAY_SIZE(cs47l15_dsp1_regions
);
1416 cs47l15
->core
.adsp
[0].lock_regions
=
1417 WM_ADSP2_REGION_1
| WM_ADSP2_REGION_2
| WM_ADSP2_REGION_3
;
1419 ret
= wm_adsp2_init(&cs47l15
->core
.adsp
[0]);
1423 ret
= madera_init_bus_error_irq(&cs47l15
->core
, 0, wm_adsp2_bus_error
);
1427 madera_init_fll(madera
, 1, MADERA_FLL1_CONTROL_1
- 1,
1429 madera_init_fll(madera
, 4, MADERA_FLLAO_CONTROL_1
- 1,
1432 for (i
= 0; i
< ARRAY_SIZE(cs47l15_dai
); i
++)
1433 madera_init_dai(&cs47l15
->core
, i
);
1435 /* Latch volume update bits */
1436 for (i
= 0; i
< ARRAY_SIZE(cs47l15_digital_vu
); i
++)
1437 regmap_update_bits(madera
->regmap
, cs47l15_digital_vu
[i
],
1438 CS47L15_DIG_VU
, CS47L15_DIG_VU
);
1440 pm_runtime_enable(&pdev
->dev
);
1441 pm_runtime_idle(&pdev
->dev
);
1443 ret
= devm_snd_soc_register_component(&pdev
->dev
,
1444 &soc_component_dev_cs47l15
,
1446 ARRAY_SIZE(cs47l15_dai
));
1448 dev_err(&pdev
->dev
, "Failed to register component: %d\n", ret
);
1449 goto error_pm_runtime
;
1455 pm_runtime_disable(&pdev
->dev
);
1456 madera_free_bus_error_irq(&cs47l15
->core
, 0);
1458 wm_adsp2_remove(&cs47l15
->core
.adsp
[0]);
1460 madera_set_irq_wake(madera
, MADERA_IRQ_DSP_IRQ1
, 0);
1461 madera_free_irq(madera
, MADERA_IRQ_DSP_IRQ1
, cs47l15
);
1463 madera_free_overheat(&cs47l15
->core
);
1465 madera_core_free(&cs47l15
->core
);
1470 static int cs47l15_remove(struct platform_device
*pdev
)
1472 struct cs47l15
*cs47l15
= platform_get_drvdata(pdev
);
1474 pm_runtime_disable(&pdev
->dev
);
1476 madera_free_bus_error_irq(&cs47l15
->core
, 0);
1478 wm_adsp2_remove(&cs47l15
->core
.adsp
[0]);
1480 madera_set_irq_wake(cs47l15
->core
.madera
, MADERA_IRQ_DSP_IRQ1
, 0);
1481 madera_free_irq(cs47l15
->core
.madera
, MADERA_IRQ_DSP_IRQ1
, cs47l15
);
1482 madera_free_overheat(&cs47l15
->core
);
1483 madera_core_free(&cs47l15
->core
);
1488 static struct platform_driver cs47l15_codec_driver
= {
1490 .name
= "cs47l15-codec",
1492 .probe
= &cs47l15_probe
,
1493 .remove
= &cs47l15_remove
,
1496 module_platform_driver(cs47l15_codec_driver
);
1498 MODULE_SOFTDEP("pre: madera irq-madera arizona-micsupp");
1499 MODULE_DESCRIPTION("ASoC CS47L15 driver");
1500 MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
1501 MODULE_AUTHOR("Jaswinder Jassal <jjassal@opensource.cirrus.com>");
1502 MODULE_LICENSE("GPL v2");
1503 MODULE_ALIAS("platform:cs47l15-codec");