1 // SPDX-License-Identifier: GPL-2.0-only
3 // ALSA SoC Audio driver for CS47L35 codec
5 // Copyright (C) 2015-2019 Cirrus Logic, Inc. and
6 // Cirrus Logic International Semiconductor Ltd.
9 #include <linux/delay.h>
10 #include <linux/device.h>
11 #include <linux/init.h>
12 #include <linux/module.h>
13 #include <linux/moduleparam.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 CS47L35_NUM_ADSP 3
31 #define CS47L35_MONO_OUTPUTS 1
33 #define DRV_NAME "cs47l35-codec"
36 struct madera_priv core
;
37 struct madera_fll fll
;
40 static const struct wm_adsp_region cs47l35_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 },
47 static const struct wm_adsp_region cs47l35_dsp2_regions
[] = {
48 { .type
= WMFW_ADSP2_PM
, .base
= 0x100000 },
49 { .type
= WMFW_ADSP2_ZM
, .base
= 0x160000 },
50 { .type
= WMFW_ADSP2_XM
, .base
= 0x120000 },
51 { .type
= WMFW_ADSP2_YM
, .base
= 0x140000 },
54 static const struct wm_adsp_region cs47l35_dsp3_regions
[] = {
55 { .type
= WMFW_ADSP2_PM
, .base
= 0x180000 },
56 { .type
= WMFW_ADSP2_ZM
, .base
= 0x1e0000 },
57 { .type
= WMFW_ADSP2_XM
, .base
= 0x1a0000 },
58 { .type
= WMFW_ADSP2_YM
, .base
= 0x1c0000 },
61 static const struct wm_adsp_region
*cs47l35_dsp_regions
[] = {
67 static const int wm_adsp2_control_bases
[] = {
73 static const char * const cs47l35_outdemux_texts
[] = {
78 static SOC_ENUM_SINGLE_DECL(cs47l35_outdemux_enum
, SND_SOC_NOPM
, 0,
79 cs47l35_outdemux_texts
);
81 static const struct snd_kcontrol_new cs47l35_outdemux
=
82 SOC_DAPM_ENUM_EXT("HPOUT1 Demux", cs47l35_outdemux_enum
,
83 madera_out1_demux_get
, madera_out1_demux_put
);
85 static int cs47l35_adsp_power_ev(struct snd_soc_dapm_widget
*w
,
86 struct snd_kcontrol
*kcontrol
,
89 struct snd_soc_component
*component
=
90 snd_soc_dapm_to_component(w
->dapm
);
91 struct cs47l35
*cs47l35
= snd_soc_component_get_drvdata(component
);
92 struct madera_priv
*priv
= &cs47l35
->core
;
93 struct madera
*madera
= priv
->madera
;
97 ret
= regmap_read(madera
->regmap
, MADERA_DSP_CLOCK_1
, &freq
);
100 "Failed to read MADERA_DSP_CLOCK_1: %d\n", ret
);
104 freq
&= MADERA_DSP_CLK_FREQ_LEGACY_MASK
;
105 freq
>>= MADERA_DSP_CLK_FREQ_LEGACY_SHIFT
;
108 case SND_SOC_DAPM_PRE_PMU
:
109 ret
= madera_set_adsp_clk(&cs47l35
->core
, w
->shift
, freq
);
117 return wm_adsp_early_event(w
, kcontrol
, event
);
120 #define CS47L35_NG_SRC(name, base) \
121 SOC_SINGLE(name " NG HPOUT1L Switch", base, 0, 1, 0), \
122 SOC_SINGLE(name " NG HPOUT1R Switch", base, 1, 1, 0), \
123 SOC_SINGLE(name " NG SPKOUT Switch", base, 6, 1, 0), \
124 SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \
125 SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0)
127 static void cs47l35_hp_post_enable(struct snd_soc_dapm_widget
*w
)
129 struct snd_soc_component
*component
=
130 snd_soc_dapm_to_component(w
->dapm
);
135 case MADERA_OUT1L_ENA_SHIFT
:
136 case MADERA_OUT1R_ENA_SHIFT
:
137 ret
= snd_soc_component_read(component
, MADERA_OUTPUT_ENABLES_1
,
140 dev_err(component
->dev
,
141 "Failed to check output enables: %d\n", ret
);
145 val
&= (MADERA_OUT1L_ENA
| MADERA_OUT1R_ENA
);
147 if (val
!= (MADERA_OUT1L_ENA
| MADERA_OUT1R_ENA
))
150 snd_soc_component_update_bits(component
,
151 MADERA_EDRE_HP_STEREO_CONTROL
,
159 static void cs47l35_hp_post_disable(struct snd_soc_dapm_widget
*w
)
161 struct snd_soc_component
*component
=
162 snd_soc_dapm_to_component(w
->dapm
);
165 case MADERA_OUT1L_ENA_SHIFT
:
166 snd_soc_component_write(component
, MADERA_DCS_HP1L_CONTROL
,
169 case MADERA_OUT1R_ENA_SHIFT
:
170 snd_soc_component_write(component
, MADERA_DCS_HP1R_CONTROL
,
177 /* Only get to here for OUT1L and OUT1R */
178 snd_soc_component_update_bits(component
,
179 MADERA_EDRE_HP_STEREO_CONTROL
,
183 static int cs47l35_hp_ev(struct snd_soc_dapm_widget
*w
,
184 struct snd_kcontrol
*kcontrol
, int event
)
189 case SND_SOC_DAPM_PRE_PMU
:
190 case SND_SOC_DAPM_PRE_PMD
:
191 return madera_hp_ev(w
, kcontrol
, event
);
192 case SND_SOC_DAPM_POST_PMU
:
193 ret
= madera_hp_ev(w
, kcontrol
, event
);
197 cs47l35_hp_post_enable(w
);
199 case SND_SOC_DAPM_POST_PMD
:
200 ret
= madera_hp_ev(w
, kcontrol
, event
);
201 cs47l35_hp_post_disable(w
);
208 static const struct snd_kcontrol_new cs47l35_snd_controls
[] = {
209 SOC_ENUM("IN1 OSR", madera_in_dmic_osr
[0]),
210 SOC_ENUM("IN2 OSR", madera_in_dmic_osr
[1]),
212 SOC_SINGLE_RANGE_TLV("IN1L Volume", MADERA_IN1L_CONTROL
,
213 MADERA_IN1L_PGA_VOL_SHIFT
, 0x40, 0x5f, 0, madera_ana_tlv
),
214 SOC_SINGLE_RANGE_TLV("IN1R Volume", MADERA_IN1R_CONTROL
,
215 MADERA_IN1R_PGA_VOL_SHIFT
, 0x40, 0x5f, 0, madera_ana_tlv
),
216 SOC_SINGLE_RANGE_TLV("IN2L Volume", MADERA_IN2L_CONTROL
,
217 MADERA_IN2L_PGA_VOL_SHIFT
, 0x40, 0x5f, 0, madera_ana_tlv
),
218 SOC_SINGLE_RANGE_TLV("IN2R Volume", MADERA_IN2R_CONTROL
,
219 MADERA_IN2R_PGA_VOL_SHIFT
, 0x40, 0x5f, 0, madera_ana_tlv
),
221 SOC_ENUM("IN HPF Cutoff Frequency", madera_in_hpf_cut_enum
),
223 SOC_SINGLE("IN1L HPF Switch", MADERA_IN1L_CONTROL
,
224 MADERA_IN1L_HPF_SHIFT
, 1, 0),
225 SOC_SINGLE("IN1R HPF Switch", MADERA_IN1R_CONTROL
,
226 MADERA_IN1R_HPF_SHIFT
, 1, 0),
227 SOC_SINGLE("IN2L HPF Switch", MADERA_IN2L_CONTROL
,
228 MADERA_IN2L_HPF_SHIFT
, 1, 0),
229 SOC_SINGLE("IN2R HPF Switch", MADERA_IN2R_CONTROL
,
230 MADERA_IN2R_HPF_SHIFT
, 1, 0),
232 SOC_SINGLE_TLV("IN1L Digital Volume", MADERA_ADC_DIGITAL_VOLUME_1L
,
233 MADERA_IN1L_DIG_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
234 SOC_SINGLE_TLV("IN1R Digital Volume", MADERA_ADC_DIGITAL_VOLUME_1R
,
235 MADERA_IN1R_DIG_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
236 SOC_SINGLE_TLV("IN2L Digital Volume", MADERA_ADC_DIGITAL_VOLUME_2L
,
237 MADERA_IN2L_DIG_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
238 SOC_SINGLE_TLV("IN2R Digital Volume", MADERA_ADC_DIGITAL_VOLUME_2R
,
239 MADERA_IN2R_DIG_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
241 SOC_ENUM("Input Ramp Up", madera_in_vi_ramp
),
242 SOC_ENUM("Input Ramp Down", madera_in_vd_ramp
),
244 MADERA_MIXER_CONTROLS("EQ1", MADERA_EQ1MIX_INPUT_1_SOURCE
),
245 MADERA_MIXER_CONTROLS("EQ2", MADERA_EQ2MIX_INPUT_1_SOURCE
),
246 MADERA_MIXER_CONTROLS("EQ3", MADERA_EQ3MIX_INPUT_1_SOURCE
),
247 MADERA_MIXER_CONTROLS("EQ4", MADERA_EQ4MIX_INPUT_1_SOURCE
),
249 MADERA_EQ_CONTROL("EQ1 Coefficients", MADERA_EQ1_2
),
250 SOC_SINGLE_TLV("EQ1 B1 Volume", MADERA_EQ1_1
, MADERA_EQ1_B1_GAIN_SHIFT
,
251 24, 0, madera_eq_tlv
),
252 SOC_SINGLE_TLV("EQ1 B2 Volume", MADERA_EQ1_1
, MADERA_EQ1_B2_GAIN_SHIFT
,
253 24, 0, madera_eq_tlv
),
254 SOC_SINGLE_TLV("EQ1 B3 Volume", MADERA_EQ1_1
, MADERA_EQ1_B3_GAIN_SHIFT
,
255 24, 0, madera_eq_tlv
),
256 SOC_SINGLE_TLV("EQ1 B4 Volume", MADERA_EQ1_2
, MADERA_EQ1_B4_GAIN_SHIFT
,
257 24, 0, madera_eq_tlv
),
258 SOC_SINGLE_TLV("EQ1 B5 Volume", MADERA_EQ1_2
, MADERA_EQ1_B5_GAIN_SHIFT
,
259 24, 0, madera_eq_tlv
),
261 MADERA_EQ_CONTROL("EQ2 Coefficients", MADERA_EQ2_2
),
262 SOC_SINGLE_TLV("EQ2 B1 Volume", MADERA_EQ2_1
, MADERA_EQ2_B1_GAIN_SHIFT
,
263 24, 0, madera_eq_tlv
),
264 SOC_SINGLE_TLV("EQ2 B2 Volume", MADERA_EQ2_1
, MADERA_EQ2_B2_GAIN_SHIFT
,
265 24, 0, madera_eq_tlv
),
266 SOC_SINGLE_TLV("EQ2 B3 Volume", MADERA_EQ2_1
, MADERA_EQ2_B3_GAIN_SHIFT
,
267 24, 0, madera_eq_tlv
),
268 SOC_SINGLE_TLV("EQ2 B4 Volume", MADERA_EQ2_2
, MADERA_EQ2_B4_GAIN_SHIFT
,
269 24, 0, madera_eq_tlv
),
270 SOC_SINGLE_TLV("EQ2 B5 Volume", MADERA_EQ2_2
, MADERA_EQ2_B5_GAIN_SHIFT
,
271 24, 0, madera_eq_tlv
),
273 MADERA_EQ_CONTROL("EQ3 Coefficients", MADERA_EQ3_2
),
274 SOC_SINGLE_TLV("EQ3 B1 Volume", MADERA_EQ3_1
, MADERA_EQ3_B1_GAIN_SHIFT
,
275 24, 0, madera_eq_tlv
),
276 SOC_SINGLE_TLV("EQ3 B2 Volume", MADERA_EQ3_1
, MADERA_EQ3_B2_GAIN_SHIFT
,
277 24, 0, madera_eq_tlv
),
278 SOC_SINGLE_TLV("EQ3 B3 Volume", MADERA_EQ3_1
, MADERA_EQ3_B3_GAIN_SHIFT
,
279 24, 0, madera_eq_tlv
),
280 SOC_SINGLE_TLV("EQ3 B4 Volume", MADERA_EQ3_2
, MADERA_EQ3_B4_GAIN_SHIFT
,
281 24, 0, madera_eq_tlv
),
282 SOC_SINGLE_TLV("EQ3 B5 Volume", MADERA_EQ3_2
, MADERA_EQ3_B5_GAIN_SHIFT
,
283 24, 0, madera_eq_tlv
),
285 MADERA_EQ_CONTROL("EQ4 Coefficients", MADERA_EQ4_2
),
286 SOC_SINGLE_TLV("EQ4 B1 Volume", MADERA_EQ4_1
, MADERA_EQ4_B1_GAIN_SHIFT
,
287 24, 0, madera_eq_tlv
),
288 SOC_SINGLE_TLV("EQ4 B2 Volume", MADERA_EQ4_1
, MADERA_EQ4_B2_GAIN_SHIFT
,
289 24, 0, madera_eq_tlv
),
290 SOC_SINGLE_TLV("EQ4 B3 Volume", MADERA_EQ4_1
, MADERA_EQ4_B3_GAIN_SHIFT
,
291 24, 0, madera_eq_tlv
),
292 SOC_SINGLE_TLV("EQ4 B4 Volume", MADERA_EQ4_2
, MADERA_EQ4_B4_GAIN_SHIFT
,
293 24, 0, madera_eq_tlv
),
294 SOC_SINGLE_TLV("EQ4 B5 Volume", MADERA_EQ4_2
, MADERA_EQ4_B5_GAIN_SHIFT
,
295 24, 0, madera_eq_tlv
),
297 MADERA_MIXER_CONTROLS("DRC1L", MADERA_DRC1LMIX_INPUT_1_SOURCE
),
298 MADERA_MIXER_CONTROLS("DRC1R", MADERA_DRC1RMIX_INPUT_1_SOURCE
),
299 MADERA_MIXER_CONTROLS("DRC2L", MADERA_DRC2LMIX_INPUT_1_SOURCE
),
300 MADERA_MIXER_CONTROLS("DRC2R", MADERA_DRC2RMIX_INPUT_1_SOURCE
),
302 SND_SOC_BYTES_MASK("DRC1", MADERA_DRC1_CTRL1
, 5,
303 MADERA_DRC1R_ENA
| MADERA_DRC1L_ENA
),
304 SND_SOC_BYTES_MASK("DRC2", MADERA_DRC2_CTRL1
, 5,
305 MADERA_DRC2R_ENA
| MADERA_DRC2L_ENA
),
307 MADERA_MIXER_CONTROLS("LHPF1", MADERA_HPLP1MIX_INPUT_1_SOURCE
),
308 MADERA_MIXER_CONTROLS("LHPF2", MADERA_HPLP2MIX_INPUT_1_SOURCE
),
309 MADERA_MIXER_CONTROLS("LHPF3", MADERA_HPLP3MIX_INPUT_1_SOURCE
),
310 MADERA_MIXER_CONTROLS("LHPF4", MADERA_HPLP4MIX_INPUT_1_SOURCE
),
312 MADERA_LHPF_CONTROL("LHPF1 Coefficients", MADERA_HPLPF1_2
),
313 MADERA_LHPF_CONTROL("LHPF2 Coefficients", MADERA_HPLPF2_2
),
314 MADERA_LHPF_CONTROL("LHPF3 Coefficients", MADERA_HPLPF3_2
),
315 MADERA_LHPF_CONTROL("LHPF4 Coefficients", MADERA_HPLPF4_2
),
317 SOC_ENUM("LHPF1 Mode", madera_lhpf1_mode
),
318 SOC_ENUM("LHPF2 Mode", madera_lhpf2_mode
),
319 SOC_ENUM("LHPF3 Mode", madera_lhpf3_mode
),
320 SOC_ENUM("LHPF4 Mode", madera_lhpf4_mode
),
322 MADERA_RATE_ENUM("ISRC1 FSL", madera_isrc_fsl
[0]),
323 MADERA_RATE_ENUM("ISRC2 FSL", madera_isrc_fsl
[1]),
324 MADERA_RATE_ENUM("ISRC1 FSH", madera_isrc_fsh
[0]),
325 MADERA_RATE_ENUM("ISRC2 FSH", madera_isrc_fsh
[1]),
327 WM_ADSP2_PRELOAD_SWITCH("DSP1", 1),
328 WM_ADSP2_PRELOAD_SWITCH("DSP2", 2),
329 WM_ADSP2_PRELOAD_SWITCH("DSP3", 3),
331 MADERA_MIXER_CONTROLS("DSP1L", MADERA_DSP1LMIX_INPUT_1_SOURCE
),
332 MADERA_MIXER_CONTROLS("DSP1R", MADERA_DSP1RMIX_INPUT_1_SOURCE
),
333 MADERA_MIXER_CONTROLS("DSP2L", MADERA_DSP2LMIX_INPUT_1_SOURCE
),
334 MADERA_MIXER_CONTROLS("DSP2R", MADERA_DSP2RMIX_INPUT_1_SOURCE
),
335 MADERA_MIXER_CONTROLS("DSP3L", MADERA_DSP3LMIX_INPUT_1_SOURCE
),
336 MADERA_MIXER_CONTROLS("DSP3R", MADERA_DSP3RMIX_INPUT_1_SOURCE
),
338 SOC_SINGLE_TLV("Noise Generator Volume", MADERA_COMFORT_NOISE_GENERATOR
,
339 MADERA_NOISE_GEN_GAIN_SHIFT
, 0x16, 0, madera_noise_tlv
),
341 MADERA_MIXER_CONTROLS("HPOUT1L", MADERA_OUT1LMIX_INPUT_1_SOURCE
),
342 MADERA_MIXER_CONTROLS("HPOUT1R", MADERA_OUT1RMIX_INPUT_1_SOURCE
),
343 MADERA_MIXER_CONTROLS("SPKOUT", MADERA_OUT4LMIX_INPUT_1_SOURCE
),
344 MADERA_MIXER_CONTROLS("SPKDAT1L", MADERA_OUT5LMIX_INPUT_1_SOURCE
),
345 MADERA_MIXER_CONTROLS("SPKDAT1R", MADERA_OUT5RMIX_INPUT_1_SOURCE
),
347 SOC_SINGLE("HPOUT1 SC Protect Switch", MADERA_HP1_SHORT_CIRCUIT_CTRL
,
348 MADERA_HP1_SC_ENA_SHIFT
, 1, 0),
350 SOC_SINGLE("SPKDAT1 High Performance Switch", MADERA_OUTPUT_PATH_CONFIG_5L
,
351 MADERA_OUT5_OSR_SHIFT
, 1, 0),
353 SOC_DOUBLE_R("HPOUT1 Digital Switch", MADERA_DAC_DIGITAL_VOLUME_1L
,
354 MADERA_DAC_DIGITAL_VOLUME_1R
, MADERA_OUT1L_MUTE_SHIFT
, 1, 1),
355 SOC_SINGLE("Speaker Digital Switch", MADERA_DAC_DIGITAL_VOLUME_4L
,
356 MADERA_OUT4L_MUTE_SHIFT
, 1, 1),
357 SOC_DOUBLE_R("SPKDAT1 Digital Switch", MADERA_DAC_DIGITAL_VOLUME_5L
,
358 MADERA_DAC_DIGITAL_VOLUME_5R
, MADERA_OUT5L_MUTE_SHIFT
, 1, 1),
360 SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", MADERA_DAC_DIGITAL_VOLUME_1L
,
361 MADERA_DAC_DIGITAL_VOLUME_1R
, MADERA_OUT1L_VOL_SHIFT
,
362 0xbf, 0, madera_digital_tlv
),
363 SOC_SINGLE_TLV("Speaker Digital Volume", MADERA_DAC_DIGITAL_VOLUME_4L
,
364 MADERA_OUT4L_VOL_SHIFT
, 0xbf, 0, madera_digital_tlv
),
365 SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", MADERA_DAC_DIGITAL_VOLUME_5L
,
366 MADERA_DAC_DIGITAL_VOLUME_5R
, MADERA_OUT5L_VOL_SHIFT
,
367 0xbf, 0, madera_digital_tlv
),
369 SOC_DOUBLE("SPKDAT1 Switch", MADERA_PDM_SPK1_CTRL_1
, MADERA_SPK1L_MUTE_SHIFT
,
370 MADERA_SPK1R_MUTE_SHIFT
, 1, 1),
372 SOC_ENUM("Output Ramp Up", madera_out_vi_ramp
),
373 SOC_ENUM("Output Ramp Down", madera_out_vd_ramp
),
375 SOC_SINGLE("Noise Gate Switch", MADERA_NOISE_GATE_CONTROL
,
376 MADERA_NGATE_ENA_SHIFT
, 1, 0),
377 SOC_SINGLE_TLV("Noise Gate Threshold Volume", MADERA_NOISE_GATE_CONTROL
,
378 MADERA_NGATE_THR_SHIFT
, 7, 1, madera_ng_tlv
),
379 SOC_ENUM("Noise Gate Hold", madera_ng_hold
),
381 CS47L35_NG_SRC("HPOUT1L", MADERA_NOISE_GATE_SELECT_1L
),
382 CS47L35_NG_SRC("HPOUT1R", MADERA_NOISE_GATE_SELECT_1R
),
383 CS47L35_NG_SRC("SPKOUT", MADERA_NOISE_GATE_SELECT_4L
),
384 CS47L35_NG_SRC("SPKDAT1L", MADERA_NOISE_GATE_SELECT_5L
),
385 CS47L35_NG_SRC("SPKDAT1R", MADERA_NOISE_GATE_SELECT_5R
),
387 MADERA_MIXER_CONTROLS("AIF1TX1", MADERA_AIF1TX1MIX_INPUT_1_SOURCE
),
388 MADERA_MIXER_CONTROLS("AIF1TX2", MADERA_AIF1TX2MIX_INPUT_1_SOURCE
),
389 MADERA_MIXER_CONTROLS("AIF1TX3", MADERA_AIF1TX3MIX_INPUT_1_SOURCE
),
390 MADERA_MIXER_CONTROLS("AIF1TX4", MADERA_AIF1TX4MIX_INPUT_1_SOURCE
),
391 MADERA_MIXER_CONTROLS("AIF1TX5", MADERA_AIF1TX5MIX_INPUT_1_SOURCE
),
392 MADERA_MIXER_CONTROLS("AIF1TX6", MADERA_AIF1TX6MIX_INPUT_1_SOURCE
),
394 MADERA_MIXER_CONTROLS("AIF2TX1", MADERA_AIF2TX1MIX_INPUT_1_SOURCE
),
395 MADERA_MIXER_CONTROLS("AIF2TX2", MADERA_AIF2TX2MIX_INPUT_1_SOURCE
),
397 MADERA_MIXER_CONTROLS("AIF3TX1", MADERA_AIF3TX1MIX_INPUT_1_SOURCE
),
398 MADERA_MIXER_CONTROLS("AIF3TX2", MADERA_AIF3TX2MIX_INPUT_1_SOURCE
),
400 MADERA_MIXER_CONTROLS("SLIMTX1", MADERA_SLIMTX1MIX_INPUT_1_SOURCE
),
401 MADERA_MIXER_CONTROLS("SLIMTX2", MADERA_SLIMTX2MIX_INPUT_1_SOURCE
),
402 MADERA_MIXER_CONTROLS("SLIMTX3", MADERA_SLIMTX3MIX_INPUT_1_SOURCE
),
403 MADERA_MIXER_CONTROLS("SLIMTX4", MADERA_SLIMTX4MIX_INPUT_1_SOURCE
),
404 MADERA_MIXER_CONTROLS("SLIMTX5", MADERA_SLIMTX5MIX_INPUT_1_SOURCE
),
405 MADERA_MIXER_CONTROLS("SLIMTX6", MADERA_SLIMTX6MIX_INPUT_1_SOURCE
),
407 MADERA_GAINMUX_CONTROLS("SPDIF1TX1", MADERA_SPDIF1TX1MIX_INPUT_1_SOURCE
),
408 MADERA_GAINMUX_CONTROLS("SPDIF1TX2", MADERA_SPDIF1TX2MIX_INPUT_1_SOURCE
),
410 WM_ADSP_FW_CONTROL("DSP1", 0),
411 WM_ADSP_FW_CONTROL("DSP2", 1),
412 WM_ADSP_FW_CONTROL("DSP3", 2),
415 MADERA_MIXER_ENUMS(EQ1
, MADERA_EQ1MIX_INPUT_1_SOURCE
);
416 MADERA_MIXER_ENUMS(EQ2
, MADERA_EQ2MIX_INPUT_1_SOURCE
);
417 MADERA_MIXER_ENUMS(EQ3
, MADERA_EQ3MIX_INPUT_1_SOURCE
);
418 MADERA_MIXER_ENUMS(EQ4
, MADERA_EQ4MIX_INPUT_1_SOURCE
);
420 MADERA_MIXER_ENUMS(DRC1L
, MADERA_DRC1LMIX_INPUT_1_SOURCE
);
421 MADERA_MIXER_ENUMS(DRC1R
, MADERA_DRC1RMIX_INPUT_1_SOURCE
);
422 MADERA_MIXER_ENUMS(DRC2L
, MADERA_DRC2LMIX_INPUT_1_SOURCE
);
423 MADERA_MIXER_ENUMS(DRC2R
, MADERA_DRC2RMIX_INPUT_1_SOURCE
);
425 MADERA_MIXER_ENUMS(LHPF1
, MADERA_HPLP1MIX_INPUT_1_SOURCE
);
426 MADERA_MIXER_ENUMS(LHPF2
, MADERA_HPLP2MIX_INPUT_1_SOURCE
);
427 MADERA_MIXER_ENUMS(LHPF3
, MADERA_HPLP3MIX_INPUT_1_SOURCE
);
428 MADERA_MIXER_ENUMS(LHPF4
, MADERA_HPLP4MIX_INPUT_1_SOURCE
);
430 MADERA_MIXER_ENUMS(DSP1L
, MADERA_DSP1LMIX_INPUT_1_SOURCE
);
431 MADERA_MIXER_ENUMS(DSP1R
, MADERA_DSP1RMIX_INPUT_1_SOURCE
);
432 MADERA_DSP_AUX_ENUMS(DSP1
, MADERA_DSP1AUX1MIX_INPUT_1_SOURCE
);
434 MADERA_MIXER_ENUMS(DSP2L
, MADERA_DSP2LMIX_INPUT_1_SOURCE
);
435 MADERA_MIXER_ENUMS(DSP2R
, MADERA_DSP2RMIX_INPUT_1_SOURCE
);
436 MADERA_DSP_AUX_ENUMS(DSP2
, MADERA_DSP2AUX1MIX_INPUT_1_SOURCE
);
438 MADERA_MIXER_ENUMS(DSP3L
, MADERA_DSP3LMIX_INPUT_1_SOURCE
);
439 MADERA_MIXER_ENUMS(DSP3R
, MADERA_DSP3RMIX_INPUT_1_SOURCE
);
440 MADERA_DSP_AUX_ENUMS(DSP3
, MADERA_DSP3AUX1MIX_INPUT_1_SOURCE
);
442 MADERA_MIXER_ENUMS(PWM1
, MADERA_PWM1MIX_INPUT_1_SOURCE
);
443 MADERA_MIXER_ENUMS(PWM2
, MADERA_PWM2MIX_INPUT_1_SOURCE
);
445 MADERA_MIXER_ENUMS(OUT1L
, MADERA_OUT1LMIX_INPUT_1_SOURCE
);
446 MADERA_MIXER_ENUMS(OUT1R
, MADERA_OUT1RMIX_INPUT_1_SOURCE
);
447 MADERA_MIXER_ENUMS(SPKOUT
, MADERA_OUT4LMIX_INPUT_1_SOURCE
);
448 MADERA_MIXER_ENUMS(SPKDAT1L
, MADERA_OUT5LMIX_INPUT_1_SOURCE
);
449 MADERA_MIXER_ENUMS(SPKDAT1R
, MADERA_OUT5RMIX_INPUT_1_SOURCE
);
451 MADERA_MIXER_ENUMS(AIF1TX1
, MADERA_AIF1TX1MIX_INPUT_1_SOURCE
);
452 MADERA_MIXER_ENUMS(AIF1TX2
, MADERA_AIF1TX2MIX_INPUT_1_SOURCE
);
453 MADERA_MIXER_ENUMS(AIF1TX3
, MADERA_AIF1TX3MIX_INPUT_1_SOURCE
);
454 MADERA_MIXER_ENUMS(AIF1TX4
, MADERA_AIF1TX4MIX_INPUT_1_SOURCE
);
455 MADERA_MIXER_ENUMS(AIF1TX5
, MADERA_AIF1TX5MIX_INPUT_1_SOURCE
);
456 MADERA_MIXER_ENUMS(AIF1TX6
, MADERA_AIF1TX6MIX_INPUT_1_SOURCE
);
458 MADERA_MIXER_ENUMS(AIF2TX1
, MADERA_AIF2TX1MIX_INPUT_1_SOURCE
);
459 MADERA_MIXER_ENUMS(AIF2TX2
, MADERA_AIF2TX2MIX_INPUT_1_SOURCE
);
461 MADERA_MIXER_ENUMS(AIF3TX1
, MADERA_AIF3TX1MIX_INPUT_1_SOURCE
);
462 MADERA_MIXER_ENUMS(AIF3TX2
, MADERA_AIF3TX2MIX_INPUT_1_SOURCE
);
464 MADERA_MIXER_ENUMS(SLIMTX1
, MADERA_SLIMTX1MIX_INPUT_1_SOURCE
);
465 MADERA_MIXER_ENUMS(SLIMTX2
, MADERA_SLIMTX2MIX_INPUT_1_SOURCE
);
466 MADERA_MIXER_ENUMS(SLIMTX3
, MADERA_SLIMTX3MIX_INPUT_1_SOURCE
);
467 MADERA_MIXER_ENUMS(SLIMTX4
, MADERA_SLIMTX4MIX_INPUT_1_SOURCE
);
468 MADERA_MIXER_ENUMS(SLIMTX5
, MADERA_SLIMTX5MIX_INPUT_1_SOURCE
);
469 MADERA_MIXER_ENUMS(SLIMTX6
, MADERA_SLIMTX6MIX_INPUT_1_SOURCE
);
471 MADERA_MUX_ENUMS(SPD1TX1
, MADERA_SPDIF1TX1MIX_INPUT_1_SOURCE
);
472 MADERA_MUX_ENUMS(SPD1TX2
, MADERA_SPDIF1TX2MIX_INPUT_1_SOURCE
);
474 MADERA_MUX_ENUMS(ISRC1INT1
, MADERA_ISRC1INT1MIX_INPUT_1_SOURCE
);
475 MADERA_MUX_ENUMS(ISRC1INT2
, MADERA_ISRC1INT2MIX_INPUT_1_SOURCE
);
476 MADERA_MUX_ENUMS(ISRC1INT3
, MADERA_ISRC1INT3MIX_INPUT_1_SOURCE
);
477 MADERA_MUX_ENUMS(ISRC1INT4
, MADERA_ISRC1INT4MIX_INPUT_1_SOURCE
);
479 MADERA_MUX_ENUMS(ISRC1DEC1
, MADERA_ISRC1DEC1MIX_INPUT_1_SOURCE
);
480 MADERA_MUX_ENUMS(ISRC1DEC2
, MADERA_ISRC1DEC2MIX_INPUT_1_SOURCE
);
481 MADERA_MUX_ENUMS(ISRC1DEC3
, MADERA_ISRC1DEC3MIX_INPUT_1_SOURCE
);
482 MADERA_MUX_ENUMS(ISRC1DEC4
, MADERA_ISRC1DEC4MIX_INPUT_1_SOURCE
);
484 MADERA_MUX_ENUMS(ISRC2INT1
, MADERA_ISRC2INT1MIX_INPUT_1_SOURCE
);
485 MADERA_MUX_ENUMS(ISRC2INT2
, MADERA_ISRC2INT2MIX_INPUT_1_SOURCE
);
486 MADERA_MUX_ENUMS(ISRC2INT3
, MADERA_ISRC2INT3MIX_INPUT_1_SOURCE
);
487 MADERA_MUX_ENUMS(ISRC2INT4
, MADERA_ISRC2INT4MIX_INPUT_1_SOURCE
);
489 MADERA_MUX_ENUMS(ISRC2DEC1
, MADERA_ISRC2DEC1MIX_INPUT_1_SOURCE
);
490 MADERA_MUX_ENUMS(ISRC2DEC2
, MADERA_ISRC2DEC2MIX_INPUT_1_SOURCE
);
491 MADERA_MUX_ENUMS(ISRC2DEC3
, MADERA_ISRC2DEC3MIX_INPUT_1_SOURCE
);
492 MADERA_MUX_ENUMS(ISRC2DEC4
, MADERA_ISRC2DEC4MIX_INPUT_1_SOURCE
);
494 static const char * const cs47l35_aec_loopback_texts
[] = {
495 "HPOUT1L", "HPOUT1R", "SPKOUT", "SPKDAT1L", "SPKDAT1R",
498 static const unsigned int cs47l35_aec_loopback_values
[] = {
502 static const struct soc_enum cs47l35_aec1_loopback
=
503 SOC_VALUE_ENUM_SINGLE(MADERA_DAC_AEC_CONTROL_1
,
504 MADERA_AEC1_LOOPBACK_SRC_SHIFT
, 0xf,
505 ARRAY_SIZE(cs47l35_aec_loopback_texts
),
506 cs47l35_aec_loopback_texts
,
507 cs47l35_aec_loopback_values
);
509 static const struct soc_enum cs47l35_aec2_loopback
=
510 SOC_VALUE_ENUM_SINGLE(MADERA_DAC_AEC_CONTROL_2
,
511 MADERA_AEC2_LOOPBACK_SRC_SHIFT
, 0xf,
512 ARRAY_SIZE(cs47l35_aec_loopback_texts
),
513 cs47l35_aec_loopback_texts
,
514 cs47l35_aec_loopback_values
);
516 static const struct snd_kcontrol_new cs47l35_aec_loopback_mux
[] = {
517 SOC_DAPM_ENUM("AEC1 Loopback", cs47l35_aec1_loopback
),
518 SOC_DAPM_ENUM("AEC2 Loopback", cs47l35_aec2_loopback
),
521 static const struct snd_soc_dapm_widget cs47l35_dapm_widgets
[] = {
522 SND_SOC_DAPM_SUPPLY("SYSCLK", MADERA_SYSTEM_CLOCK_1
, MADERA_SYSCLK_ENA_SHIFT
,
524 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
|
525 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
),
526 SND_SOC_DAPM_SUPPLY("OPCLK", MADERA_OUTPUT_SYSTEM_CLOCK
,
527 MADERA_OPCLK_ENA_SHIFT
, 0, NULL
, 0),
528 SND_SOC_DAPM_SUPPLY("DSPCLK", MADERA_DSP_CLOCK_1
, MADERA_DSP_CLK_ENA_SHIFT
,
530 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
532 SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
533 SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD1", 20, 0),
534 SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD2", 20, 0),
535 SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS
),
536 SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDD", 0, 0),
538 SND_SOC_DAPM_SUPPLY("MICBIAS1", MADERA_MIC_BIAS_CTRL_1
,
539 MADERA_MICB1_ENA_SHIFT
, 0, NULL
, 0),
540 SND_SOC_DAPM_SUPPLY("MICBIAS2", MADERA_MIC_BIAS_CTRL_2
,
541 MADERA_MICB1_ENA_SHIFT
, 0, NULL
, 0),
543 SND_SOC_DAPM_SUPPLY("MICBIAS1A", MADERA_MIC_BIAS_CTRL_5
,
544 MADERA_MICB1A_ENA_SHIFT
, 0, NULL
, 0),
545 SND_SOC_DAPM_SUPPLY("MICBIAS1B", MADERA_MIC_BIAS_CTRL_5
,
546 MADERA_MICB1B_ENA_SHIFT
, 0, NULL
, 0),
547 SND_SOC_DAPM_SUPPLY("MICBIAS2A", MADERA_MIC_BIAS_CTRL_6
,
548 MADERA_MICB2A_ENA_SHIFT
, 0, NULL
, 0),
549 SND_SOC_DAPM_SUPPLY("MICBIAS2B", MADERA_MIC_BIAS_CTRL_6
,
550 MADERA_MICB2B_ENA_SHIFT
, 0, NULL
, 0),
552 SND_SOC_DAPM_SUPPLY("FXCLK", SND_SOC_NOPM
,
553 MADERA_DOM_GRP_FX
, 0,
554 madera_domain_clk_ev
,
555 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
556 SND_SOC_DAPM_SUPPLY("ISRC1CLK", SND_SOC_NOPM
,
557 MADERA_DOM_GRP_ISRC1
, 0,
558 madera_domain_clk_ev
,
559 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
560 SND_SOC_DAPM_SUPPLY("ISRC2CLK", SND_SOC_NOPM
,
561 MADERA_DOM_GRP_ISRC2
, 0,
562 madera_domain_clk_ev
,
563 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
564 SND_SOC_DAPM_SUPPLY("OUTCLK", SND_SOC_NOPM
,
565 MADERA_DOM_GRP_OUT
, 0,
566 madera_domain_clk_ev
,
567 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
568 SND_SOC_DAPM_SUPPLY("SPDCLK", SND_SOC_NOPM
,
569 MADERA_DOM_GRP_SPD
, 0,
570 madera_domain_clk_ev
,
571 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
572 SND_SOC_DAPM_SUPPLY("DSP1CLK", SND_SOC_NOPM
,
573 MADERA_DOM_GRP_DSP1
, 0,
574 madera_domain_clk_ev
,
575 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
576 SND_SOC_DAPM_SUPPLY("DSP2CLK", SND_SOC_NOPM
,
577 MADERA_DOM_GRP_DSP2
, 0,
578 madera_domain_clk_ev
,
579 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
580 SND_SOC_DAPM_SUPPLY("DSP3CLK", SND_SOC_NOPM
,
581 MADERA_DOM_GRP_DSP3
, 0,
582 madera_domain_clk_ev
,
583 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
584 SND_SOC_DAPM_SUPPLY("AIF1TXCLK", SND_SOC_NOPM
,
585 MADERA_DOM_GRP_AIF1
, 0,
586 madera_domain_clk_ev
,
587 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
588 SND_SOC_DAPM_SUPPLY("AIF2TXCLK", SND_SOC_NOPM
,
589 MADERA_DOM_GRP_AIF2
, 0,
590 madera_domain_clk_ev
,
591 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
592 SND_SOC_DAPM_SUPPLY("AIF3TXCLK", SND_SOC_NOPM
,
593 MADERA_DOM_GRP_AIF3
, 0,
594 madera_domain_clk_ev
,
595 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
596 SND_SOC_DAPM_SUPPLY("SLIMBUSCLK", SND_SOC_NOPM
,
597 MADERA_DOM_GRP_SLIMBUS
, 0,
598 madera_domain_clk_ev
,
599 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
600 SND_SOC_DAPM_SUPPLY("PWMCLK", SND_SOC_NOPM
,
601 MADERA_DOM_GRP_PWM
, 0,
602 madera_domain_clk_ev
,
603 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMD
),
605 SND_SOC_DAPM_SIGGEN("TONE"),
606 SND_SOC_DAPM_SIGGEN("NOISE"),
608 SND_SOC_DAPM_INPUT("IN1ALN"),
609 SND_SOC_DAPM_INPUT("IN1ALP"),
610 SND_SOC_DAPM_INPUT("IN1BLN"),
611 SND_SOC_DAPM_INPUT("IN1BLP"),
612 SND_SOC_DAPM_INPUT("IN1ARN"),
613 SND_SOC_DAPM_INPUT("IN1ARP"),
614 SND_SOC_DAPM_INPUT("IN1BRN"),
615 SND_SOC_DAPM_INPUT("IN1BRP"),
616 SND_SOC_DAPM_INPUT("IN2LN"),
617 SND_SOC_DAPM_INPUT("IN2LP"),
618 SND_SOC_DAPM_INPUT("IN2RN"),
619 SND_SOC_DAPM_INPUT("IN2RP"),
621 SND_SOC_DAPM_MUX("IN1L Analog Mux", SND_SOC_NOPM
, 0, 0, &madera_inmux
[0]),
622 SND_SOC_DAPM_MUX("IN1R Analog Mux", SND_SOC_NOPM
, 0, 0, &madera_inmux
[1]),
624 SND_SOC_DAPM_MUX("IN1L Mode", SND_SOC_NOPM
, 0, 0, &madera_inmode
[0]),
625 SND_SOC_DAPM_MUX("IN1R Mode", SND_SOC_NOPM
, 0, 0, &madera_inmode
[0]),
627 SND_SOC_DAPM_MUX("IN2L Mode", SND_SOC_NOPM
, 0, 0, &madera_inmode
[1]),
628 SND_SOC_DAPM_MUX("IN2R Mode", SND_SOC_NOPM
, 0, 0, &madera_inmode
[1]),
630 SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
631 SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
633 SND_SOC_DAPM_OUTPUT("DSP Trigger Out"),
635 SND_SOC_DAPM_DEMUX("HPOUT1 Demux", SND_SOC_NOPM
, 0, 0, &cs47l35_outdemux
),
636 SND_SOC_DAPM_MUX("HPOUT1 Mono Mux", SND_SOC_NOPM
, 0, 0, &cs47l35_outdemux
),
638 SND_SOC_DAPM_PGA("PWM1 Driver", MADERA_PWM_DRIVE_1
, MADERA_PWM1_ENA_SHIFT
,
640 SND_SOC_DAPM_PGA("PWM2 Driver", MADERA_PWM_DRIVE_1
, MADERA_PWM2_ENA_SHIFT
,
643 SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL
, 0,
644 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX1_ENA_SHIFT
, 0),
645 SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL
, 0,
646 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX2_ENA_SHIFT
, 0),
647 SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL
, 0,
648 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX3_ENA_SHIFT
, 0),
649 SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL
, 0,
650 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX4_ENA_SHIFT
, 0),
651 SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL
, 0,
652 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX5_ENA_SHIFT
, 0),
653 SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL
, 0,
654 MADERA_AIF1_TX_ENABLES
, MADERA_AIF1TX6_ENA_SHIFT
, 0),
656 SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL
, 0,
657 MADERA_AIF2_TX_ENABLES
, MADERA_AIF2TX1_ENA_SHIFT
, 0),
658 SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL
, 0,
659 MADERA_AIF2_TX_ENABLES
, MADERA_AIF2TX2_ENA_SHIFT
, 0),
661 SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL
, 0,
662 MADERA_AIF3_TX_ENABLES
, MADERA_AIF3TX1_ENA_SHIFT
, 0),
663 SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL
, 0,
664 MADERA_AIF3_TX_ENABLES
, MADERA_AIF3TX2_ENA_SHIFT
, 0),
666 SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL
, 0,
667 MADERA_SLIMBUS_TX_CHANNEL_ENABLE
,
668 MADERA_SLIMTX1_ENA_SHIFT
, 0),
669 SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL
, 0,
670 MADERA_SLIMBUS_TX_CHANNEL_ENABLE
,
671 MADERA_SLIMTX2_ENA_SHIFT
, 0),
672 SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL
, 0,
673 MADERA_SLIMBUS_TX_CHANNEL_ENABLE
,
674 MADERA_SLIMTX3_ENA_SHIFT
, 0),
675 SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL
, 0,
676 MADERA_SLIMBUS_TX_CHANNEL_ENABLE
,
677 MADERA_SLIMTX4_ENA_SHIFT
, 0),
678 SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL
, 0,
679 MADERA_SLIMBUS_TX_CHANNEL_ENABLE
,
680 MADERA_SLIMTX5_ENA_SHIFT
, 0),
681 SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL
, 0,
682 MADERA_SLIMBUS_TX_CHANNEL_ENABLE
,
683 MADERA_SLIMTX6_ENA_SHIFT
, 0),
685 SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM
,
686 MADERA_OUT1L_ENA_SHIFT
, 0, NULL
, 0, cs47l35_hp_ev
,
687 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
688 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
689 SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM
,
690 MADERA_OUT1R_ENA_SHIFT
, 0, NULL
, 0, cs47l35_hp_ev
,
691 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
692 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
693 SND_SOC_DAPM_PGA_E("OUT4L", SND_SOC_NOPM
,
694 MADERA_OUT4L_ENA_SHIFT
, 0, NULL
, 0, madera_spk_ev
,
695 SND_SOC_DAPM_POST_PMU
| SND_SOC_DAPM_PRE_PMD
),
696 SND_SOC_DAPM_PGA_E("OUT5L", MADERA_OUTPUT_ENABLES_1
,
697 MADERA_OUT5L_ENA_SHIFT
, 0, NULL
, 0, madera_out_ev
,
698 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
699 SND_SOC_DAPM_PGA_E("OUT5R", MADERA_OUTPUT_ENABLES_1
,
700 MADERA_OUT5R_ENA_SHIFT
, 0, NULL
, 0, madera_out_ev
,
701 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
703 SND_SOC_DAPM_PGA("SPD1TX1", MADERA_SPD1_TX_CONTROL
,
704 MADERA_SPD1_VAL1_SHIFT
, 0, NULL
, 0),
705 SND_SOC_DAPM_PGA("SPD1TX2", MADERA_SPD1_TX_CONTROL
,
706 MADERA_SPD1_VAL2_SHIFT
, 0, NULL
, 0),
707 SND_SOC_DAPM_OUT_DRV("SPD1", MADERA_SPD1_TX_CONTROL
,
708 MADERA_SPD1_ENA_SHIFT
, 0, NULL
, 0),
711 * Input mux widgets arranged in order of sources in MADERA_MIXER_INPUT_ROUTES
712 * to take advantage of cache lookup in DAPM
714 SND_SOC_DAPM_PGA("Noise Generator", MADERA_COMFORT_NOISE_GENERATOR
,
715 MADERA_NOISE_GEN_ENA_SHIFT
, 0, NULL
, 0),
717 SND_SOC_DAPM_PGA("Tone Generator 1", MADERA_TONE_GENERATOR_1
,
718 MADERA_TONE1_ENA_SHIFT
, 0, NULL
, 0),
719 SND_SOC_DAPM_PGA("Tone Generator 2", MADERA_TONE_GENERATOR_1
,
720 MADERA_TONE2_ENA_SHIFT
, 0, NULL
, 0),
722 SND_SOC_DAPM_SIGGEN("HAPTICS"),
724 SND_SOC_DAPM_MUX("AEC1 Loopback", MADERA_DAC_AEC_CONTROL_1
,
725 MADERA_AEC1_LOOPBACK_ENA_SHIFT
, 0,
726 &cs47l35_aec_loopback_mux
[0]),
728 SND_SOC_DAPM_MUX("AEC2 Loopback", MADERA_DAC_AEC_CONTROL_2
,
729 MADERA_AEC2_LOOPBACK_ENA_SHIFT
, 0,
730 &cs47l35_aec_loopback_mux
[1]),
732 SND_SOC_DAPM_PGA_E("IN1L", MADERA_INPUT_ENABLES
, MADERA_IN1L_ENA_SHIFT
,
733 0, NULL
, 0, madera_in_ev
,
734 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
735 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
736 SND_SOC_DAPM_PGA_E("IN1R", MADERA_INPUT_ENABLES
, MADERA_IN1R_ENA_SHIFT
,
737 0, NULL
, 0, madera_in_ev
,
738 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
739 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
741 SND_SOC_DAPM_PGA_E("IN2L", MADERA_INPUT_ENABLES
, MADERA_IN2L_ENA_SHIFT
,
742 0, NULL
, 0, madera_in_ev
,
743 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
744 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
745 SND_SOC_DAPM_PGA_E("IN2R", MADERA_INPUT_ENABLES
, MADERA_IN2R_ENA_SHIFT
,
746 0, NULL
, 0, madera_in_ev
,
747 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMD
|
748 SND_SOC_DAPM_PRE_PMU
| SND_SOC_DAPM_POST_PMU
),
750 SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL
, 0,
751 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX1_ENA_SHIFT
, 0),
752 SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL
, 0,
753 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX2_ENA_SHIFT
, 0),
754 SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL
, 0,
755 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX3_ENA_SHIFT
, 0),
756 SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL
, 0,
757 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX4_ENA_SHIFT
, 0),
758 SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL
, 0,
759 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX5_ENA_SHIFT
, 0),
760 SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL
, 0,
761 MADERA_AIF1_RX_ENABLES
, MADERA_AIF1RX6_ENA_SHIFT
, 0),
763 SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL
, 0,
764 MADERA_AIF2_RX_ENABLES
, MADERA_AIF2RX1_ENA_SHIFT
, 0),
765 SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL
, 0,
766 MADERA_AIF2_RX_ENABLES
, MADERA_AIF2RX2_ENA_SHIFT
, 0),
768 SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL
, 0,
769 MADERA_AIF3_RX_ENABLES
, MADERA_AIF3RX1_ENA_SHIFT
, 0),
770 SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL
, 0,
771 MADERA_AIF3_RX_ENABLES
, MADERA_AIF3RX2_ENA_SHIFT
, 0),
773 SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL
, 0,
774 MADERA_SLIMBUS_RX_CHANNEL_ENABLE
,
775 MADERA_SLIMRX1_ENA_SHIFT
, 0),
776 SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL
, 0,
777 MADERA_SLIMBUS_RX_CHANNEL_ENABLE
,
778 MADERA_SLIMRX2_ENA_SHIFT
, 0),
779 SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL
, 0,
780 MADERA_SLIMBUS_RX_CHANNEL_ENABLE
,
781 MADERA_SLIMRX3_ENA_SHIFT
, 0),
782 SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL
, 0,
783 MADERA_SLIMBUS_RX_CHANNEL_ENABLE
,
784 MADERA_SLIMRX4_ENA_SHIFT
, 0),
785 SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL
, 0,
786 MADERA_SLIMBUS_RX_CHANNEL_ENABLE
,
787 MADERA_SLIMRX5_ENA_SHIFT
, 0),
788 SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL
, 0,
789 MADERA_SLIMBUS_RX_CHANNEL_ENABLE
,
790 MADERA_SLIMRX6_ENA_SHIFT
, 0),
792 SND_SOC_DAPM_PGA("EQ1", MADERA_EQ1_1
, MADERA_EQ1_ENA_SHIFT
, 0, NULL
, 0),
793 SND_SOC_DAPM_PGA("EQ2", MADERA_EQ2_1
, MADERA_EQ2_ENA_SHIFT
, 0, NULL
, 0),
794 SND_SOC_DAPM_PGA("EQ3", MADERA_EQ3_1
, MADERA_EQ3_ENA_SHIFT
, 0, NULL
, 0),
795 SND_SOC_DAPM_PGA("EQ4", MADERA_EQ4_1
, MADERA_EQ4_ENA_SHIFT
, 0, NULL
, 0),
797 SND_SOC_DAPM_PGA("DRC1L", MADERA_DRC1_CTRL1
, MADERA_DRC1L_ENA_SHIFT
, 0,
799 SND_SOC_DAPM_PGA("DRC1R", MADERA_DRC1_CTRL1
, MADERA_DRC1R_ENA_SHIFT
, 0,
801 SND_SOC_DAPM_PGA("DRC2L", MADERA_DRC2_CTRL1
, MADERA_DRC2L_ENA_SHIFT
, 0,
803 SND_SOC_DAPM_PGA("DRC2R", MADERA_DRC2_CTRL1
, MADERA_DRC2R_ENA_SHIFT
, 0,
806 SND_SOC_DAPM_PGA("LHPF1", MADERA_HPLPF1_1
, MADERA_LHPF1_ENA_SHIFT
, 0,
808 SND_SOC_DAPM_PGA("LHPF2", MADERA_HPLPF2_1
, MADERA_LHPF2_ENA_SHIFT
, 0,
810 SND_SOC_DAPM_PGA("LHPF3", MADERA_HPLPF3_1
, MADERA_LHPF3_ENA_SHIFT
, 0,
812 SND_SOC_DAPM_PGA("LHPF4", MADERA_HPLPF4_1
, MADERA_LHPF4_ENA_SHIFT
, 0,
815 SND_SOC_DAPM_PGA("ISRC1DEC1", MADERA_ISRC_1_CTRL_3
,
816 MADERA_ISRC1_DEC1_ENA_SHIFT
, 0, NULL
, 0),
817 SND_SOC_DAPM_PGA("ISRC1DEC2", MADERA_ISRC_1_CTRL_3
,
818 MADERA_ISRC1_DEC2_ENA_SHIFT
, 0, NULL
, 0),
819 SND_SOC_DAPM_PGA("ISRC1DEC3", MADERA_ISRC_1_CTRL_3
,
820 MADERA_ISRC1_DEC3_ENA_SHIFT
, 0, NULL
, 0),
821 SND_SOC_DAPM_PGA("ISRC1DEC4", MADERA_ISRC_1_CTRL_3
,
822 MADERA_ISRC1_DEC4_ENA_SHIFT
, 0, NULL
, 0),
824 SND_SOC_DAPM_PGA("ISRC1INT1", MADERA_ISRC_1_CTRL_3
,
825 MADERA_ISRC1_INT1_ENA_SHIFT
, 0, NULL
, 0),
826 SND_SOC_DAPM_PGA("ISRC1INT2", MADERA_ISRC_1_CTRL_3
,
827 MADERA_ISRC1_INT2_ENA_SHIFT
, 0, NULL
, 0),
828 SND_SOC_DAPM_PGA("ISRC1INT3", MADERA_ISRC_1_CTRL_3
,
829 MADERA_ISRC1_INT3_ENA_SHIFT
, 0, NULL
, 0),
830 SND_SOC_DAPM_PGA("ISRC1INT4", MADERA_ISRC_1_CTRL_3
,
831 MADERA_ISRC1_INT4_ENA_SHIFT
, 0, NULL
, 0),
833 SND_SOC_DAPM_PGA("ISRC2DEC1", MADERA_ISRC_2_CTRL_3
,
834 MADERA_ISRC2_DEC1_ENA_SHIFT
, 0, NULL
, 0),
835 SND_SOC_DAPM_PGA("ISRC2DEC2", MADERA_ISRC_2_CTRL_3
,
836 MADERA_ISRC2_DEC2_ENA_SHIFT
, 0, NULL
, 0),
837 SND_SOC_DAPM_PGA("ISRC2DEC3", MADERA_ISRC_2_CTRL_3
,
838 MADERA_ISRC2_DEC3_ENA_SHIFT
, 0, NULL
, 0),
839 SND_SOC_DAPM_PGA("ISRC2DEC4", MADERA_ISRC_2_CTRL_3
,
840 MADERA_ISRC2_DEC4_ENA_SHIFT
, 0, NULL
, 0),
842 SND_SOC_DAPM_PGA("ISRC2INT1", MADERA_ISRC_2_CTRL_3
,
843 MADERA_ISRC2_INT1_ENA_SHIFT
, 0, NULL
, 0),
844 SND_SOC_DAPM_PGA("ISRC2INT2", MADERA_ISRC_2_CTRL_3
,
845 MADERA_ISRC2_INT2_ENA_SHIFT
, 0, NULL
, 0),
846 SND_SOC_DAPM_PGA("ISRC2INT3", MADERA_ISRC_2_CTRL_3
,
847 MADERA_ISRC2_INT3_ENA_SHIFT
, 0, NULL
, 0),
848 SND_SOC_DAPM_PGA("ISRC2INT4", MADERA_ISRC_2_CTRL_3
,
849 MADERA_ISRC2_INT4_ENA_SHIFT
, 0, NULL
, 0),
851 WM_ADSP2("DSP1", 0, cs47l35_adsp_power_ev
),
852 WM_ADSP2("DSP2", 1, cs47l35_adsp_power_ev
),
853 WM_ADSP2("DSP3", 2, cs47l35_adsp_power_ev
),
855 /* End of ordered input mux widgets */
857 MADERA_MIXER_WIDGETS(EQ1
, "EQ1"),
858 MADERA_MIXER_WIDGETS(EQ2
, "EQ2"),
859 MADERA_MIXER_WIDGETS(EQ3
, "EQ3"),
860 MADERA_MIXER_WIDGETS(EQ4
, "EQ4"),
862 MADERA_MIXER_WIDGETS(DRC1L
, "DRC1L"),
863 MADERA_MIXER_WIDGETS(DRC1R
, "DRC1R"),
864 MADERA_MIXER_WIDGETS(DRC2L
, "DRC2L"),
865 MADERA_MIXER_WIDGETS(DRC2R
, "DRC2R"),
867 SND_SOC_DAPM_SWITCH("DRC1 Activity Output", SND_SOC_NOPM
, 0, 0,
868 &madera_drc_activity_output_mux
[0]),
869 SND_SOC_DAPM_SWITCH("DRC2 Activity Output", SND_SOC_NOPM
, 0, 0,
870 &madera_drc_activity_output_mux
[1]),
872 MADERA_MIXER_WIDGETS(LHPF1
, "LHPF1"),
873 MADERA_MIXER_WIDGETS(LHPF2
, "LHPF2"),
874 MADERA_MIXER_WIDGETS(LHPF3
, "LHPF3"),
875 MADERA_MIXER_WIDGETS(LHPF4
, "LHPF4"),
877 MADERA_MIXER_WIDGETS(PWM1
, "PWM1"),
878 MADERA_MIXER_WIDGETS(PWM2
, "PWM2"),
880 MADERA_MIXER_WIDGETS(OUT1L
, "HPOUT1L"),
881 MADERA_MIXER_WIDGETS(OUT1R
, "HPOUT1R"),
882 MADERA_MIXER_WIDGETS(SPKOUT
, "SPKOUT"),
883 MADERA_MIXER_WIDGETS(SPKDAT1L
, "SPKDAT1L"),
884 MADERA_MIXER_WIDGETS(SPKDAT1R
, "SPKDAT1R"),
886 MADERA_MIXER_WIDGETS(AIF1TX1
, "AIF1TX1"),
887 MADERA_MIXER_WIDGETS(AIF1TX2
, "AIF1TX2"),
888 MADERA_MIXER_WIDGETS(AIF1TX3
, "AIF1TX3"),
889 MADERA_MIXER_WIDGETS(AIF1TX4
, "AIF1TX4"),
890 MADERA_MIXER_WIDGETS(AIF1TX5
, "AIF1TX5"),
891 MADERA_MIXER_WIDGETS(AIF1TX6
, "AIF1TX6"),
893 MADERA_MIXER_WIDGETS(AIF2TX1
, "AIF2TX1"),
894 MADERA_MIXER_WIDGETS(AIF2TX2
, "AIF2TX2"),
896 MADERA_MIXER_WIDGETS(AIF3TX1
, "AIF3TX1"),
897 MADERA_MIXER_WIDGETS(AIF3TX2
, "AIF3TX2"),
899 MADERA_MIXER_WIDGETS(SLIMTX1
, "SLIMTX1"),
900 MADERA_MIXER_WIDGETS(SLIMTX2
, "SLIMTX2"),
901 MADERA_MIXER_WIDGETS(SLIMTX3
, "SLIMTX3"),
902 MADERA_MIXER_WIDGETS(SLIMTX4
, "SLIMTX4"),
903 MADERA_MIXER_WIDGETS(SLIMTX5
, "SLIMTX5"),
904 MADERA_MIXER_WIDGETS(SLIMTX6
, "SLIMTX6"),
906 MADERA_MUX_WIDGETS(SPD1TX1
, "SPDIF1TX1"),
907 MADERA_MUX_WIDGETS(SPD1TX2
, "SPDIF1TX2"),
909 MADERA_DSP_WIDGETS(DSP1
, "DSP1"),
910 MADERA_DSP_WIDGETS(DSP2
, "DSP2"),
911 MADERA_DSP_WIDGETS(DSP3
, "DSP3"),
913 SND_SOC_DAPM_SWITCH("DSP1 Trigger Output", SND_SOC_NOPM
, 0, 0,
914 &madera_dsp_trigger_output_mux
[0]),
915 SND_SOC_DAPM_SWITCH("DSP2 Trigger Output", SND_SOC_NOPM
, 0, 0,
916 &madera_dsp_trigger_output_mux
[1]),
917 SND_SOC_DAPM_SWITCH("DSP3 Trigger Output", SND_SOC_NOPM
, 0, 0,
918 &madera_dsp_trigger_output_mux
[2]),
920 MADERA_MUX_WIDGETS(ISRC1DEC1
, "ISRC1DEC1"),
921 MADERA_MUX_WIDGETS(ISRC1DEC2
, "ISRC1DEC2"),
922 MADERA_MUX_WIDGETS(ISRC1DEC3
, "ISRC1DEC3"),
923 MADERA_MUX_WIDGETS(ISRC1DEC4
, "ISRC1DEC4"),
925 MADERA_MUX_WIDGETS(ISRC1INT1
, "ISRC1INT1"),
926 MADERA_MUX_WIDGETS(ISRC1INT2
, "ISRC1INT2"),
927 MADERA_MUX_WIDGETS(ISRC1INT3
, "ISRC1INT3"),
928 MADERA_MUX_WIDGETS(ISRC1INT4
, "ISRC1INT4"),
930 MADERA_MUX_WIDGETS(ISRC2DEC1
, "ISRC2DEC1"),
931 MADERA_MUX_WIDGETS(ISRC2DEC2
, "ISRC2DEC2"),
932 MADERA_MUX_WIDGETS(ISRC2DEC3
, "ISRC2DEC3"),
933 MADERA_MUX_WIDGETS(ISRC2DEC4
, "ISRC2DEC4"),
935 MADERA_MUX_WIDGETS(ISRC2INT1
, "ISRC2INT1"),
936 MADERA_MUX_WIDGETS(ISRC2INT2
, "ISRC2INT2"),
937 MADERA_MUX_WIDGETS(ISRC2INT3
, "ISRC2INT3"),
938 MADERA_MUX_WIDGETS(ISRC2INT4
, "ISRC2INT4"),
940 SND_SOC_DAPM_OUTPUT("HPOUTL"),
941 SND_SOC_DAPM_OUTPUT("HPOUTR"),
942 SND_SOC_DAPM_OUTPUT("EPOUTP"),
943 SND_SOC_DAPM_OUTPUT("EPOUTN"),
944 SND_SOC_DAPM_OUTPUT("SPKOUTN"),
945 SND_SOC_DAPM_OUTPUT("SPKOUTP"),
946 SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
947 SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
948 SND_SOC_DAPM_OUTPUT("SPDIF1"),
950 SND_SOC_DAPM_OUTPUT("MICSUPP"),
953 #define MADERA_MIXER_INPUT_ROUTES(name) \
954 { name, "Noise Generator", "Noise Generator" }, \
955 { name, "Tone Generator 1", "Tone Generator 1" }, \
956 { name, "Tone Generator 2", "Tone Generator 2" }, \
957 { name, "Haptics", "HAPTICS" }, \
958 { name, "AEC1", "AEC1 Loopback" }, \
959 { name, "AEC2", "AEC2 Loopback" }, \
960 { name, "IN1L", "IN1L" }, \
961 { name, "IN1R", "IN1R" }, \
962 { name, "IN2L", "IN2L" }, \
963 { name, "IN2R", "IN2R" }, \
964 { name, "AIF1RX1", "AIF1RX1" }, \
965 { name, "AIF1RX2", "AIF1RX2" }, \
966 { name, "AIF1RX3", "AIF1RX3" }, \
967 { name, "AIF1RX4", "AIF1RX4" }, \
968 { name, "AIF1RX5", "AIF1RX5" }, \
969 { name, "AIF1RX6", "AIF1RX6" }, \
970 { name, "AIF2RX1", "AIF2RX1" }, \
971 { name, "AIF2RX2", "AIF2RX2" }, \
972 { name, "AIF3RX1", "AIF3RX1" }, \
973 { name, "AIF3RX2", "AIF3RX2" }, \
974 { name, "SLIMRX1", "SLIMRX1" }, \
975 { name, "SLIMRX2", "SLIMRX2" }, \
976 { name, "SLIMRX3", "SLIMRX3" }, \
977 { name, "SLIMRX4", "SLIMRX4" }, \
978 { name, "SLIMRX5", "SLIMRX5" }, \
979 { name, "SLIMRX6", "SLIMRX6" }, \
980 { name, "EQ1", "EQ1" }, \
981 { name, "EQ2", "EQ2" }, \
982 { name, "EQ3", "EQ3" }, \
983 { name, "EQ4", "EQ4" }, \
984 { name, "DRC1L", "DRC1L" }, \
985 { name, "DRC1R", "DRC1R" }, \
986 { name, "DRC2L", "DRC2L" }, \
987 { name, "DRC2R", "DRC2R" }, \
988 { name, "LHPF1", "LHPF1" }, \
989 { name, "LHPF2", "LHPF2" }, \
990 { name, "LHPF3", "LHPF3" }, \
991 { name, "LHPF4", "LHPF4" }, \
992 { name, "ISRC1DEC1", "ISRC1DEC1" }, \
993 { name, "ISRC1DEC2", "ISRC1DEC2" }, \
994 { name, "ISRC1DEC3", "ISRC1DEC3" }, \
995 { name, "ISRC1DEC4", "ISRC1DEC4" }, \
996 { name, "ISRC1INT1", "ISRC1INT1" }, \
997 { name, "ISRC1INT2", "ISRC1INT2" }, \
998 { name, "ISRC1INT3", "ISRC1INT3" }, \
999 { name, "ISRC1INT4", "ISRC1INT4" }, \
1000 { name, "ISRC2DEC1", "ISRC2DEC1" }, \
1001 { name, "ISRC2DEC2", "ISRC2DEC2" }, \
1002 { name, "ISRC2DEC3", "ISRC2DEC3" }, \
1003 { name, "ISRC2DEC4", "ISRC2DEC4" }, \
1004 { name, "ISRC2INT1", "ISRC2INT1" }, \
1005 { name, "ISRC2INT2", "ISRC2INT2" }, \
1006 { name, "ISRC2INT3", "ISRC2INT3" }, \
1007 { name, "ISRC2INT4", "ISRC2INT4" }, \
1008 { name, "DSP1.1", "DSP1" }, \
1009 { name, "DSP1.2", "DSP1" }, \
1010 { name, "DSP1.3", "DSP1" }, \
1011 { name, "DSP1.4", "DSP1" }, \
1012 { name, "DSP1.5", "DSP1" }, \
1013 { name, "DSP1.6", "DSP1" }, \
1014 { name, "DSP2.1", "DSP2" }, \
1015 { name, "DSP2.2", "DSP2" }, \
1016 { name, "DSP2.3", "DSP2" }, \
1017 { name, "DSP2.4", "DSP2" }, \
1018 { name, "DSP2.5", "DSP2" }, \
1019 { name, "DSP2.6", "DSP2" }, \
1020 { name, "DSP3.1", "DSP3" }, \
1021 { name, "DSP3.2", "DSP3" }, \
1022 { name, "DSP3.3", "DSP3" }, \
1023 { name, "DSP3.4", "DSP3" }, \
1024 { name, "DSP3.5", "DSP3" }, \
1025 { name, "DSP3.6", "DSP3" }
1027 static const struct snd_soc_dapm_route cs47l35_dapm_routes
[] = {
1028 /* Internal clock domains */
1029 { "EQ1", NULL
, "FXCLK" },
1030 { "EQ2", NULL
, "FXCLK" },
1031 { "EQ3", NULL
, "FXCLK" },
1032 { "EQ4", NULL
, "FXCLK" },
1033 { "DRC1L", NULL
, "FXCLK" },
1034 { "DRC1R", NULL
, "FXCLK" },
1035 { "DRC2L", NULL
, "FXCLK" },
1036 { "DRC2R", NULL
, "FXCLK" },
1037 { "LHPF1", NULL
, "FXCLK" },
1038 { "LHPF2", NULL
, "FXCLK" },
1039 { "LHPF3", NULL
, "FXCLK" },
1040 { "LHPF4", NULL
, "FXCLK" },
1041 { "PWM1 Mixer", NULL
, "PWMCLK" },
1042 { "PWM2 Mixer", NULL
, "PWMCLK" },
1043 { "OUT1L", NULL
, "OUTCLK" },
1044 { "OUT1R", NULL
, "OUTCLK" },
1045 { "OUT4L", NULL
, "OUTCLK" },
1046 { "OUT5L", NULL
, "OUTCLK" },
1047 { "OUT5R", NULL
, "OUTCLK" },
1048 { "AIF1TX1", NULL
, "AIF1TXCLK" },
1049 { "AIF1TX2", NULL
, "AIF1TXCLK" },
1050 { "AIF1TX3", NULL
, "AIF1TXCLK" },
1051 { "AIF1TX4", NULL
, "AIF1TXCLK" },
1052 { "AIF1TX5", NULL
, "AIF1TXCLK" },
1053 { "AIF1TX6", NULL
, "AIF1TXCLK" },
1054 { "AIF2TX1", NULL
, "AIF2TXCLK" },
1055 { "AIF2TX2", NULL
, "AIF2TXCLK" },
1056 { "AIF3TX1", NULL
, "AIF3TXCLK" },
1057 { "AIF3TX2", NULL
, "AIF3TXCLK" },
1058 { "SLIMTX1", NULL
, "SLIMBUSCLK" },
1059 { "SLIMTX2", NULL
, "SLIMBUSCLK" },
1060 { "SLIMTX3", NULL
, "SLIMBUSCLK" },
1061 { "SLIMTX4", NULL
, "SLIMBUSCLK" },
1062 { "SLIMTX5", NULL
, "SLIMBUSCLK" },
1063 { "SLIMTX6", NULL
, "SLIMBUSCLK" },
1064 { "SPD1TX1", NULL
, "SPDCLK" },
1065 { "SPD1TX2", NULL
, "SPDCLK" },
1066 { "DSP1", NULL
, "DSP1CLK" },
1067 { "DSP2", NULL
, "DSP2CLK" },
1068 { "DSP3", NULL
, "DSP3CLK" },
1069 { "ISRC1DEC1", NULL
, "ISRC1CLK" },
1070 { "ISRC1DEC2", NULL
, "ISRC1CLK" },
1071 { "ISRC1DEC3", NULL
, "ISRC1CLK" },
1072 { "ISRC1DEC4", NULL
, "ISRC1CLK" },
1073 { "ISRC1INT1", NULL
, "ISRC1CLK" },
1074 { "ISRC1INT2", NULL
, "ISRC1CLK" },
1075 { "ISRC1INT3", NULL
, "ISRC1CLK" },
1076 { "ISRC1INT4", NULL
, "ISRC1CLK" },
1077 { "ISRC2DEC1", NULL
, "ISRC2CLK" },
1078 { "ISRC2DEC2", NULL
, "ISRC2CLK" },
1079 { "ISRC2DEC3", NULL
, "ISRC2CLK" },
1080 { "ISRC2DEC4", NULL
, "ISRC2CLK" },
1081 { "ISRC2INT1", NULL
, "ISRC2CLK" },
1082 { "ISRC2INT2", NULL
, "ISRC2CLK" },
1083 { "ISRC2INT3", NULL
, "ISRC2CLK" },
1084 { "ISRC2INT4", NULL
, "ISRC2CLK" },
1086 { "AIF2 Capture", NULL
, "DBVDD2" },
1087 { "AIF2 Playback", NULL
, "DBVDD2" },
1089 { "AIF3 Capture", NULL
, "DBVDD2" },
1090 { "AIF3 Playback", NULL
, "DBVDD2" },
1092 { "OUT1L", NULL
, "CPVDD1" },
1093 { "OUT1R", NULL
, "CPVDD1" },
1094 { "OUT1L", NULL
, "CPVDD2" },
1095 { "OUT1R", NULL
, "CPVDD2" },
1097 { "OUT4L", NULL
, "SPKVDD" },
1099 { "OUT1L", NULL
, "SYSCLK" },
1100 { "OUT1R", NULL
, "SYSCLK" },
1101 { "OUT4L", NULL
, "SYSCLK" },
1102 { "OUT5L", NULL
, "SYSCLK" },
1103 { "OUT5R", NULL
, "SYSCLK" },
1105 { "SPD1", NULL
, "SYSCLK" },
1106 { "SPD1", NULL
, "SPD1TX1" },
1107 { "SPD1", NULL
, "SPD1TX2" },
1109 { "IN1L", NULL
, "SYSCLK" },
1110 { "IN1R", NULL
, "SYSCLK" },
1111 { "IN2L", NULL
, "SYSCLK" },
1112 { "IN2R", NULL
, "SYSCLK" },
1114 { "MICBIAS1", NULL
, "MICVDD" },
1115 { "MICBIAS2", NULL
, "MICVDD" },
1117 { "MICBIAS1A", NULL
, "MICBIAS1" },
1118 { "MICBIAS1B", NULL
, "MICBIAS1" },
1119 { "MICBIAS2A", NULL
, "MICBIAS2" },
1120 { "MICBIAS2B", NULL
, "MICBIAS2" },
1122 { "Noise Generator", NULL
, "SYSCLK" },
1123 { "Tone Generator 1", NULL
, "SYSCLK" },
1124 { "Tone Generator 2", NULL
, "SYSCLK" },
1126 { "Noise Generator", NULL
, "NOISE" },
1127 { "Tone Generator 1", NULL
, "TONE" },
1128 { "Tone Generator 2", NULL
, "TONE" },
1130 { "AIF1 Capture", NULL
, "AIF1TX1" },
1131 { "AIF1 Capture", NULL
, "AIF1TX2" },
1132 { "AIF1 Capture", NULL
, "AIF1TX3" },
1133 { "AIF1 Capture", NULL
, "AIF1TX4" },
1134 { "AIF1 Capture", NULL
, "AIF1TX5" },
1135 { "AIF1 Capture", NULL
, "AIF1TX6" },
1137 { "AIF1RX1", NULL
, "AIF1 Playback" },
1138 { "AIF1RX2", NULL
, "AIF1 Playback" },
1139 { "AIF1RX3", NULL
, "AIF1 Playback" },
1140 { "AIF1RX4", NULL
, "AIF1 Playback" },
1141 { "AIF1RX5", NULL
, "AIF1 Playback" },
1142 { "AIF1RX6", NULL
, "AIF1 Playback" },
1144 { "AIF2 Capture", NULL
, "AIF2TX1" },
1145 { "AIF2 Capture", NULL
, "AIF2TX2" },
1147 { "AIF2RX1", NULL
, "AIF2 Playback" },
1148 { "AIF2RX2", NULL
, "AIF2 Playback" },
1150 { "AIF3 Capture", NULL
, "AIF3TX1" },
1151 { "AIF3 Capture", NULL
, "AIF3TX2" },
1153 { "AIF3RX1", NULL
, "AIF3 Playback" },
1154 { "AIF3RX2", NULL
, "AIF3 Playback" },
1156 { "Slim1 Capture", NULL
, "SLIMTX1" },
1157 { "Slim1 Capture", NULL
, "SLIMTX2" },
1158 { "Slim1 Capture", NULL
, "SLIMTX3" },
1159 { "Slim1 Capture", NULL
, "SLIMTX4" },
1161 { "SLIMRX1", NULL
, "Slim1 Playback" },
1162 { "SLIMRX2", NULL
, "Slim1 Playback" },
1163 { "SLIMRX3", NULL
, "Slim1 Playback" },
1164 { "SLIMRX4", NULL
, "Slim1 Playback" },
1166 { "Slim2 Capture", NULL
, "SLIMTX5" },
1167 { "Slim2 Capture", NULL
, "SLIMTX6" },
1169 { "SLIMRX5", NULL
, "Slim2 Playback" },
1170 { "SLIMRX6", NULL
, "Slim2 Playback" },
1172 { "AIF1 Playback", NULL
, "SYSCLK" },
1173 { "AIF2 Playback", NULL
, "SYSCLK" },
1174 { "AIF3 Playback", NULL
, "SYSCLK" },
1175 { "Slim1 Playback", NULL
, "SYSCLK" },
1176 { "Slim2 Playback", NULL
, "SYSCLK" },
1178 { "AIF1 Capture", NULL
, "SYSCLK" },
1179 { "AIF2 Capture", NULL
, "SYSCLK" },
1180 { "AIF3 Capture", NULL
, "SYSCLK" },
1181 { "Slim1 Capture", NULL
, "SYSCLK" },
1182 { "Slim2 Capture", NULL
, "SYSCLK" },
1184 { "Voice Control DSP", NULL
, "DSP3" },
1186 { "Audio Trace DSP", NULL
, "DSP1" },
1188 { "IN1L Analog Mux", "A", "IN1ALN" },
1189 { "IN1L Analog Mux", "A", "IN1ALP" },
1190 { "IN1L Analog Mux", "B", "IN1BLN" },
1191 { "IN1L Analog Mux", "B", "IN1BLP" },
1193 { "IN1R Analog Mux", "A", "IN1ARN" },
1194 { "IN1R Analog Mux", "A", "IN1ARP" },
1195 { "IN1R Analog Mux", "B", "IN1BRN" },
1196 { "IN1R Analog Mux", "B", "IN1BRP" },
1198 { "IN1L Mode", "Analog", "IN1L Analog Mux" },
1199 { "IN1R Mode", "Analog", "IN1R Analog Mux" },
1201 { "IN1L Mode", "Digital", "IN1ALN" },
1202 { "IN1L Mode", "Digital", "IN1ARN" },
1203 { "IN1R Mode", "Digital", "IN1ALN" },
1204 { "IN1R Mode", "Digital", "IN1ARN" },
1206 { "IN1L", NULL
, "IN1L Mode" },
1207 { "IN1R", NULL
, "IN1R Mode" },
1209 { "IN2L Mode", "Analog", "IN2LN" },
1210 { "IN2L Mode", "Analog", "IN2LP" },
1211 { "IN2R Mode", "Analog", "IN2RN" },
1212 { "IN2R Mode", "Analog", "IN2RP" },
1214 { "IN2L Mode", "Digital", "IN2LN" },
1215 { "IN2L Mode", "Digital", "IN2RN" },
1216 { "IN2R Mode", "Digital", "IN2LN" },
1217 { "IN2R Mode", "Digital", "IN2RN" },
1219 { "IN2L", NULL
, "IN2L Mode" },
1220 { "IN2R", NULL
, "IN2R Mode" },
1222 MADERA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
1223 MADERA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
1225 MADERA_MIXER_ROUTES("OUT4L", "SPKOUT"),
1227 MADERA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
1228 MADERA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
1230 MADERA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
1231 MADERA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
1233 MADERA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
1234 MADERA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
1235 MADERA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
1236 MADERA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
1237 MADERA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
1238 MADERA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
1240 MADERA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
1241 MADERA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
1243 MADERA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
1244 MADERA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
1246 MADERA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
1247 MADERA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
1248 MADERA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
1249 MADERA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
1250 MADERA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
1251 MADERA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
1253 MADERA_MUX_ROUTES("SPD1TX1", "SPDIF1TX1"),
1254 MADERA_MUX_ROUTES("SPD1TX2", "SPDIF1TX2"),
1256 MADERA_MIXER_ROUTES("EQ1", "EQ1"),
1257 MADERA_MIXER_ROUTES("EQ2", "EQ2"),
1258 MADERA_MIXER_ROUTES("EQ3", "EQ3"),
1259 MADERA_MIXER_ROUTES("EQ4", "EQ4"),
1261 MADERA_MIXER_ROUTES("DRC1L", "DRC1L"),
1262 MADERA_MIXER_ROUTES("DRC1R", "DRC1R"),
1263 MADERA_MIXER_ROUTES("DRC2L", "DRC2L"),
1264 MADERA_MIXER_ROUTES("DRC2R", "DRC2R"),
1266 MADERA_MIXER_ROUTES("LHPF1", "LHPF1"),
1267 MADERA_MIXER_ROUTES("LHPF2", "LHPF2"),
1268 MADERA_MIXER_ROUTES("LHPF3", "LHPF3"),
1269 MADERA_MIXER_ROUTES("LHPF4", "LHPF4"),
1271 MADERA_DSP_ROUTES("DSP1"),
1272 MADERA_DSP_ROUTES("DSP2"),
1273 MADERA_DSP_ROUTES("DSP3"),
1275 { "DSP Trigger Out", NULL
, "DSP1 Trigger Output" },
1276 { "DSP Trigger Out", NULL
, "DSP2 Trigger Output" },
1277 { "DSP Trigger Out", NULL
, "DSP3 Trigger Output" },
1279 { "DSP1 Trigger Output", "Switch", "DSP1" },
1280 { "DSP2 Trigger Output", "Switch", "DSP2" },
1281 { "DSP3 Trigger Output", "Switch", "DSP3" },
1283 MADERA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
1284 MADERA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
1285 MADERA_MUX_ROUTES("ISRC1INT3", "ISRC1INT3"),
1286 MADERA_MUX_ROUTES("ISRC1INT4", "ISRC1INT4"),
1288 MADERA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
1289 MADERA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
1290 MADERA_MUX_ROUTES("ISRC1DEC3", "ISRC1DEC3"),
1291 MADERA_MUX_ROUTES("ISRC1DEC4", "ISRC1DEC4"),
1293 MADERA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
1294 MADERA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
1295 MADERA_MUX_ROUTES("ISRC2INT3", "ISRC2INT3"),
1296 MADERA_MUX_ROUTES("ISRC2INT4", "ISRC2INT4"),
1298 MADERA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
1299 MADERA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
1300 MADERA_MUX_ROUTES("ISRC2DEC3", "ISRC2DEC3"),
1301 MADERA_MUX_ROUTES("ISRC2DEC4", "ISRC2DEC4"),
1303 { "AEC1 Loopback", "HPOUT1L", "OUT1L" },
1304 { "AEC1 Loopback", "HPOUT1R", "OUT1R" },
1305 { "AEC2 Loopback", "HPOUT1L", "OUT1L" },
1306 { "AEC2 Loopback", "HPOUT1R", "OUT1R" },
1307 { "HPOUT1 Demux", NULL
, "OUT1L" },
1308 { "HPOUT1 Demux", NULL
, "OUT1R" },
1310 { "AEC1 Loopback", "SPKOUT", "OUT4L" },
1311 { "AEC2 Loopback", "SPKOUT", "OUT4L" },
1312 { "SPKOUTN", NULL
, "OUT4L" },
1313 { "SPKOUTP", NULL
, "OUT4L" },
1315 { "OUT1R", NULL
, "HPOUT1 Mono Mux" },
1317 { "HPOUTL", "HPOUT", "HPOUT1 Demux" },
1318 { "HPOUTR", "HPOUT", "HPOUT1 Demux" },
1319 { "EPOUTP", "EPOUT", "HPOUT1 Demux" },
1320 { "EPOUTN", "EPOUT", "HPOUT1 Demux" },
1322 { "AEC1 Loopback", "SPKDAT1L", "OUT5L" },
1323 { "AEC1 Loopback", "SPKDAT1R", "OUT5R" },
1324 { "AEC2 Loopback", "SPKDAT1L", "OUT5L" },
1325 { "AEC2 Loopback", "SPKDAT1R", "OUT5R" },
1326 { "SPKDAT1L", NULL
, "OUT5L" },
1327 { "SPKDAT1R", NULL
, "OUT5R" },
1329 { "SPDIF1", NULL
, "SPD1" },
1331 { "MICSUPP", NULL
, "SYSCLK" },
1333 { "DRC1 Signal Activity", NULL
, "DRC1 Activity Output" },
1334 { "DRC2 Signal Activity", NULL
, "DRC2 Activity Output" },
1335 { "DRC1 Activity Output", "Switch", "DRC1L" },
1336 { "DRC1 Activity Output", "Switch", "DRC1R" },
1337 { "DRC2 Activity Output", "Switch", "DRC2L" },
1338 { "DRC2 Activity Output", "Switch", "DRC2R" },
1341 static int cs47l35_set_fll(struct snd_soc_component
*component
, int fll_id
,
1342 int source
, unsigned int fref
, unsigned int fout
)
1344 struct cs47l35
*cs47l35
= snd_soc_component_get_drvdata(component
);
1347 case MADERA_FLL1_REFCLK
:
1348 return madera_set_fll_refclk(&cs47l35
->fll
, source
, fref
,
1350 case MADERA_FLL1_SYNCCLK
:
1351 return madera_set_fll_syncclk(&cs47l35
->fll
, source
, fref
,
1358 static struct snd_soc_dai_driver cs47l35_dai
[] = {
1360 .name
= "cs47l35-aif1",
1362 .base
= MADERA_AIF1_BCLK_CTRL
,
1364 .stream_name
= "AIF1 Playback",
1367 .rates
= MADERA_RATES
,
1368 .formats
= MADERA_FORMATS
,
1371 .stream_name
= "AIF1 Capture",
1374 .rates
= MADERA_RATES
,
1375 .formats
= MADERA_FORMATS
,
1377 .ops
= &madera_dai_ops
,
1378 .symmetric_rates
= 1,
1379 .symmetric_samplebits
= 1,
1382 .name
= "cs47l35-aif2",
1384 .base
= MADERA_AIF2_BCLK_CTRL
,
1386 .stream_name
= "AIF2 Playback",
1389 .rates
= MADERA_RATES
,
1390 .formats
= MADERA_FORMATS
,
1393 .stream_name
= "AIF2 Capture",
1396 .rates
= MADERA_RATES
,
1397 .formats
= MADERA_FORMATS
,
1399 .ops
= &madera_dai_ops
,
1400 .symmetric_rates
= 1,
1401 .symmetric_samplebits
= 1,
1404 .name
= "cs47l35-aif3",
1406 .base
= MADERA_AIF3_BCLK_CTRL
,
1408 .stream_name
= "AIF3 Playback",
1411 .rates
= MADERA_RATES
,
1412 .formats
= MADERA_FORMATS
,
1415 .stream_name
= "AIF3 Capture",
1418 .rates
= MADERA_RATES
,
1419 .formats
= MADERA_FORMATS
,
1421 .ops
= &madera_dai_ops
,
1422 .symmetric_rates
= 1,
1423 .symmetric_samplebits
= 1,
1426 .name
= "cs47l35-slim1",
1429 .stream_name
= "Slim1 Playback",
1432 .rates
= MADERA_RATES
,
1433 .formats
= MADERA_FORMATS
,
1436 .stream_name
= "Slim1 Capture",
1439 .rates
= MADERA_RATES
,
1440 .formats
= MADERA_FORMATS
,
1442 .ops
= &madera_simple_dai_ops
,
1445 .name
= "cs47l35-slim2",
1448 .stream_name
= "Slim2 Playback",
1451 .rates
= MADERA_RATES
,
1452 .formats
= MADERA_FORMATS
,
1455 .stream_name
= "Slim2 Capture",
1458 .rates
= MADERA_RATES
,
1459 .formats
= MADERA_FORMATS
,
1461 .ops
= &madera_simple_dai_ops
,
1464 .name
= "cs47l35-cpu-voicectrl",
1466 .stream_name
= "Voice Control CPU",
1469 .rates
= MADERA_RATES
,
1470 .formats
= MADERA_FORMATS
,
1472 .compress_new
= &snd_soc_new_compress
,
1475 .name
= "cs47l35-dsp-voicectrl",
1477 .stream_name
= "Voice Control DSP",
1480 .rates
= MADERA_RATES
,
1481 .formats
= MADERA_FORMATS
,
1485 .name
= "cs47l35-cpu-trace",
1487 .stream_name
= "Audio Trace CPU",
1490 .rates
= MADERA_RATES
,
1491 .formats
= MADERA_FORMATS
,
1493 .compress_new
= &snd_soc_new_compress
,
1496 .name
= "cs47l35-dsp-trace",
1498 .stream_name
= "Audio Trace DSP",
1501 .rates
= MADERA_RATES
,
1502 .formats
= MADERA_FORMATS
,
1507 static int cs47l35_open(struct snd_compr_stream
*stream
)
1509 struct snd_soc_pcm_runtime
*rtd
= stream
->private_data
;
1510 struct snd_soc_component
*component
=
1511 snd_soc_rtdcom_lookup(rtd
, DRV_NAME
);
1512 struct cs47l35
*cs47l35
= snd_soc_component_get_drvdata(component
);
1513 struct madera_priv
*priv
= &cs47l35
->core
;
1514 struct madera
*madera
= priv
->madera
;
1517 if (strcmp(rtd
->codec_dai
->name
, "cs47l35-dsp-voicectrl") == 0) {
1519 } else if (strcmp(rtd
->codec_dai
->name
, "cs47l35-dsp-trace") == 0) {
1522 dev_err(madera
->dev
,
1523 "No suitable compressed stream for DAI '%s'\n",
1524 rtd
->codec_dai
->name
);
1528 return wm_adsp_compr_open(&priv
->adsp
[n_adsp
], stream
);
1531 static irqreturn_t
cs47l35_adsp2_irq(int irq
, void *data
)
1533 struct cs47l35
*cs47l35
= data
;
1534 struct madera_priv
*priv
= &cs47l35
->core
;
1535 struct madera
*madera
= priv
->madera
;
1536 struct madera_voice_trigger_info trig_info
;
1540 for (i
= 0; i
< CS47L35_NUM_ADSP
; ++i
) {
1541 ret
= wm_adsp_compr_handle_irq(&priv
->adsp
[i
]);
1544 if (ret
== WM_ADSP_COMPR_VOICE_TRIGGER
) {
1545 trig_info
.core_num
= i
+ 1;
1546 blocking_notifier_call_chain(&madera
->notifier
,
1547 MADERA_NOTIFY_VOICE_TRIGGER
,
1553 dev_err(madera
->dev
, "Spurious compressed data IRQ\n");
1560 static const struct snd_soc_dapm_route cs47l35_mono_routes
[] = {
1561 { "HPOUT1 Mono Mux", "HPOUT", "OUT1L" },
1562 { "HPOUT1 Mono Mux", "EPOUT", "OUT1L" },
1565 static int cs47l35_component_probe(struct snd_soc_component
*component
)
1567 struct cs47l35
*cs47l35
= snd_soc_component_get_drvdata(component
);
1568 struct madera
*madera
= cs47l35
->core
.madera
;
1571 snd_soc_component_init_regmap(component
, madera
->regmap
);
1573 mutex_lock(&madera
->dapm_ptr_lock
);
1574 madera
->dapm
= snd_soc_component_get_dapm(component
);
1575 mutex_unlock(&madera
->dapm_ptr_lock
);
1577 ret
= madera_init_inputs(component
);
1581 ret
= madera_init_outputs(component
, cs47l35_mono_routes
,
1582 ARRAY_SIZE(cs47l35_mono_routes
),
1583 CS47L35_MONO_OUTPUTS
);
1587 snd_soc_component_disable_pin(component
, "HAPTICS");
1589 ret
= snd_soc_add_component_controls(component
,
1590 madera_adsp_rate_controls
,
1595 for (i
= 0; i
< CS47L35_NUM_ADSP
; i
++)
1596 wm_adsp2_component_probe(&cs47l35
->core
.adsp
[i
], component
);
1601 static void cs47l35_component_remove(struct snd_soc_component
*component
)
1603 struct cs47l35
*cs47l35
= snd_soc_component_get_drvdata(component
);
1604 struct madera
*madera
= cs47l35
->core
.madera
;
1607 mutex_lock(&madera
->dapm_ptr_lock
);
1608 madera
->dapm
= NULL
;
1609 mutex_unlock(&madera
->dapm_ptr_lock
);
1611 for (i
= 0; i
< CS47L35_NUM_ADSP
; i
++)
1612 wm_adsp2_component_remove(&cs47l35
->core
.adsp
[i
], component
);
1615 #define CS47L35_DIG_VU 0x0200
1617 static unsigned int cs47l35_digital_vu
[] = {
1618 MADERA_DAC_DIGITAL_VOLUME_1L
,
1619 MADERA_DAC_DIGITAL_VOLUME_1R
,
1620 MADERA_DAC_DIGITAL_VOLUME_4L
,
1621 MADERA_DAC_DIGITAL_VOLUME_5L
,
1622 MADERA_DAC_DIGITAL_VOLUME_5R
,
1625 static const struct snd_compr_ops cs47l35_compr_ops
= {
1626 .open
= &cs47l35_open
,
1627 .free
= &wm_adsp_compr_free
,
1628 .set_params
= &wm_adsp_compr_set_params
,
1629 .get_caps
= &wm_adsp_compr_get_caps
,
1630 .trigger
= &wm_adsp_compr_trigger
,
1631 .pointer
= &wm_adsp_compr_pointer
,
1632 .copy
= &wm_adsp_compr_copy
,
1635 static const struct snd_soc_component_driver soc_component_dev_cs47l35
= {
1636 .probe
= &cs47l35_component_probe
,
1637 .remove
= &cs47l35_component_remove
,
1638 .set_sysclk
= &madera_set_sysclk
,
1639 .set_pll
= &cs47l35_set_fll
,
1641 .compr_ops
= &cs47l35_compr_ops
,
1642 .controls
= cs47l35_snd_controls
,
1643 .num_controls
= ARRAY_SIZE(cs47l35_snd_controls
),
1644 .dapm_widgets
= cs47l35_dapm_widgets
,
1645 .num_dapm_widgets
= ARRAY_SIZE(cs47l35_dapm_widgets
),
1646 .dapm_routes
= cs47l35_dapm_routes
,
1647 .num_dapm_routes
= ARRAY_SIZE(cs47l35_dapm_routes
),
1648 .use_pmdown_time
= 1,
1650 .non_legacy_dai_naming
= 1,
1653 static int cs47l35_probe(struct platform_device
*pdev
)
1655 struct madera
*madera
= dev_get_drvdata(pdev
->dev
.parent
);
1656 struct cs47l35
*cs47l35
;
1659 BUILD_BUG_ON(ARRAY_SIZE(cs47l35_dai
) > MADERA_MAX_DAI
);
1661 /* quick exit if Madera irqchip driver hasn't completed probe */
1662 if (!madera
->irq_dev
) {
1663 dev_dbg(&pdev
->dev
, "irqchip driver not ready\n");
1664 return -EPROBE_DEFER
;
1667 cs47l35
= devm_kzalloc(&pdev
->dev
, sizeof(struct cs47l35
), GFP_KERNEL
);
1670 platform_set_drvdata(pdev
, cs47l35
);
1672 cs47l35
->core
.madera
= madera
;
1673 cs47l35
->core
.dev
= &pdev
->dev
;
1674 cs47l35
->core
.num_inputs
= 4;
1676 ret
= madera_core_init(&cs47l35
->core
);
1680 ret
= madera_init_overheat(&cs47l35
->core
);
1684 ret
= madera_request_irq(madera
, MADERA_IRQ_DSP_IRQ1
,
1685 "ADSP2 Compressed IRQ", cs47l35_adsp2_irq
,
1688 dev_err(&pdev
->dev
, "Failed to request DSP IRQ: %d\n", ret
);
1689 goto error_overheat
;
1692 ret
= madera_set_irq_wake(madera
, MADERA_IRQ_DSP_IRQ1
, 1);
1694 dev_warn(&pdev
->dev
, "Failed to set DSP IRQ wake: %d\n", ret
);
1696 for (i
= 0; i
< CS47L35_NUM_ADSP
; i
++) {
1697 cs47l35
->core
.adsp
[i
].part
= "cs47l35";
1698 cs47l35
->core
.adsp
[i
].num
= i
+ 1;
1699 cs47l35
->core
.adsp
[i
].type
= WMFW_ADSP2
;
1700 cs47l35
->core
.adsp
[i
].rev
= 1;
1701 cs47l35
->core
.adsp
[i
].dev
= madera
->dev
;
1702 cs47l35
->core
.adsp
[i
].regmap
= madera
->regmap_32bit
;
1704 cs47l35
->core
.adsp
[i
].base
= wm_adsp2_control_bases
[i
];
1705 cs47l35
->core
.adsp
[i
].mem
= cs47l35_dsp_regions
[i
];
1706 cs47l35
->core
.adsp
[i
].num_mems
=
1707 ARRAY_SIZE(cs47l35_dsp1_regions
);
1709 ret
= wm_adsp2_init(&cs47l35
->core
.adsp
[i
]);
1711 for (--i
; i
>= 0; --i
)
1712 wm_adsp2_remove(&cs47l35
->core
.adsp
[i
]);
1717 madera_init_fll(madera
, 1, MADERA_FLL1_CONTROL_1
- 1, &cs47l35
->fll
);
1719 for (i
= 0; i
< ARRAY_SIZE(cs47l35_dai
); i
++)
1720 madera_init_dai(&cs47l35
->core
, i
);
1722 /* Latch volume update bits */
1723 for (i
= 0; i
< ARRAY_SIZE(cs47l35_digital_vu
); i
++)
1724 regmap_update_bits(madera
->regmap
, cs47l35_digital_vu
[i
],
1725 CS47L35_DIG_VU
, CS47L35_DIG_VU
);
1727 pm_runtime_enable(&pdev
->dev
);
1728 pm_runtime_idle(&pdev
->dev
);
1730 ret
= devm_snd_soc_register_component(&pdev
->dev
,
1731 &soc_component_dev_cs47l35
,
1733 ARRAY_SIZE(cs47l35_dai
));
1735 dev_err(&pdev
->dev
, "Failed to register component: %d\n", ret
);
1736 goto error_pm_runtime
;
1742 pm_runtime_disable(&pdev
->dev
);
1744 for (i
= 0; i
< CS47L35_NUM_ADSP
; i
++)
1745 wm_adsp2_remove(&cs47l35
->core
.adsp
[i
]);
1747 madera_set_irq_wake(madera
, MADERA_IRQ_DSP_IRQ1
, 0);
1748 madera_free_irq(madera
, MADERA_IRQ_DSP_IRQ1
, cs47l35
);
1750 madera_free_overheat(&cs47l35
->core
);
1752 madera_core_free(&cs47l35
->core
);
1757 static int cs47l35_remove(struct platform_device
*pdev
)
1759 struct cs47l35
*cs47l35
= platform_get_drvdata(pdev
);
1762 pm_runtime_disable(&pdev
->dev
);
1764 for (i
= 0; i
< CS47L35_NUM_ADSP
; i
++)
1765 wm_adsp2_remove(&cs47l35
->core
.adsp
[i
]);
1767 madera_set_irq_wake(cs47l35
->core
.madera
, MADERA_IRQ_DSP_IRQ1
, 0);
1768 madera_free_irq(cs47l35
->core
.madera
, MADERA_IRQ_DSP_IRQ1
, cs47l35
);
1769 madera_free_overheat(&cs47l35
->core
);
1770 madera_core_free(&cs47l35
->core
);
1775 static struct platform_driver cs47l35_codec_driver
= {
1777 .name
= "cs47l35-codec",
1779 .probe
= &cs47l35_probe
,
1780 .remove
= &cs47l35_remove
,
1783 module_platform_driver(cs47l35_codec_driver
);
1785 MODULE_SOFTDEP("pre: madera irq-madera arizona-micsupp");
1786 MODULE_DESCRIPTION("ASoC CS47L35 driver");
1787 MODULE_AUTHOR("Piotr Stankiewicz <piotrs@opensource.cirrus.com>");
1788 MODULE_LICENSE("GPL v2");
1789 MODULE_ALIAS("platform:cs47l35-codec");