2 * isabelle.c - Low power high fidelity audio codec driver
4 * Copyright (c) 2012 Texas Instruments, Inc
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
11 * Initially based on sound/soc/codecs/twl6040.c
14 #include <linux/module.h>
15 #include <linux/moduleparam.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/delay.h>
20 #include <linux/regmap.h>
21 #include <linux/i2c.h>
22 #include <linux/slab.h>
23 #include <sound/core.h>
24 #include <sound/pcm.h>
25 #include <sound/pcm_params.h>
26 #include <sound/soc.h>
27 #include <sound/soc-dapm.h>
28 #include <sound/tlv.h>
29 #include <sound/jack.h>
30 #include <sound/initval.h>
31 #include <asm/div64.h>
35 /* Register default values for ISABELLE driver. */
36 static const struct reg_default isabelle_reg_defs
[] = {
139 static const char *isabelle_rx1_texts
[] = {"VRX1", "ARX1"};
140 static const char *isabelle_rx2_texts
[] = {"VRX2", "ARX2"};
142 static const struct soc_enum isabelle_rx1_enum
[] = {
143 SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG
, 3,
144 ARRAY_SIZE(isabelle_rx1_texts
), isabelle_rx1_texts
),
145 SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG
, 5,
146 ARRAY_SIZE(isabelle_rx1_texts
), isabelle_rx1_texts
),
149 static const struct soc_enum isabelle_rx2_enum
[] = {
150 SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG
, 2,
151 ARRAY_SIZE(isabelle_rx2_texts
), isabelle_rx2_texts
),
152 SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG
, 4,
153 ARRAY_SIZE(isabelle_rx2_texts
), isabelle_rx2_texts
),
156 /* Headset DAC playback switches */
157 static const struct snd_kcontrol_new rx1_mux_controls
=
158 SOC_DAPM_ENUM("Route", isabelle_rx1_enum
);
160 static const struct snd_kcontrol_new rx2_mux_controls
=
161 SOC_DAPM_ENUM("Route", isabelle_rx2_enum
);
163 /* TX input selection */
164 static const char *isabelle_atx_texts
[] = {"AMIC1", "DMIC"};
165 static const char *isabelle_vtx_texts
[] = {"AMIC2", "DMIC"};
167 static const struct soc_enum isabelle_atx_enum
[] = {
168 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG
, 7,
169 ARRAY_SIZE(isabelle_atx_texts
), isabelle_atx_texts
),
170 SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG
, 0,
171 ARRAY_SIZE(isabelle_atx_texts
), isabelle_atx_texts
),
174 static const struct soc_enum isabelle_vtx_enum
[] = {
175 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG
, 6,
176 ARRAY_SIZE(isabelle_vtx_texts
), isabelle_vtx_texts
),
177 SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG
, 0,
178 ARRAY_SIZE(isabelle_vtx_texts
), isabelle_vtx_texts
),
181 static const struct snd_kcontrol_new atx_mux_controls
=
182 SOC_DAPM_ENUM("Route", isabelle_atx_enum
);
184 static const struct snd_kcontrol_new vtx_mux_controls
=
185 SOC_DAPM_ENUM("Route", isabelle_vtx_enum
);
187 /* Left analog microphone selection */
188 static const char *isabelle_amic1_texts
[] = {
189 "Main Mic", "Headset Mic", "Aux/FM Left"};
191 /* Left analog microphone selection */
192 static const char *isabelle_amic2_texts
[] = {"Sub Mic", "Aux/FM Right"};
194 static SOC_ENUM_SINGLE_DECL(isabelle_amic1_enum
,
195 ISABELLE_AMIC_CFG_REG
, 5,
196 isabelle_amic1_texts
);
198 static SOC_ENUM_SINGLE_DECL(isabelle_amic2_enum
,
199 ISABELLE_AMIC_CFG_REG
, 4,
200 isabelle_amic2_texts
);
202 static const struct snd_kcontrol_new amic1_control
=
203 SOC_DAPM_ENUM("Route", isabelle_amic1_enum
);
205 static const struct snd_kcontrol_new amic2_control
=
206 SOC_DAPM_ENUM("Route", isabelle_amic2_enum
);
208 static const char *isabelle_st_audio_texts
[] = {"ATX1", "ATX2"};
210 static const char *isabelle_st_voice_texts
[] = {"VTX1", "VTX2"};
212 static const struct soc_enum isabelle_st_audio_enum
[] = {
213 SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG
, 7,
214 ARRAY_SIZE(isabelle_st_audio_texts
),
215 isabelle_st_audio_texts
),
216 SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG
, 7,
217 ARRAY_SIZE(isabelle_st_audio_texts
),
218 isabelle_st_audio_texts
),
221 static const struct soc_enum isabelle_st_voice_enum
[] = {
222 SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG
, 7,
223 ARRAY_SIZE(isabelle_st_voice_texts
),
224 isabelle_st_voice_texts
),
225 SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG
, 7,
226 ARRAY_SIZE(isabelle_st_voice_texts
),
227 isabelle_st_voice_texts
),
230 static const struct snd_kcontrol_new st_audio_control
=
231 SOC_DAPM_ENUM("Route", isabelle_st_audio_enum
);
233 static const struct snd_kcontrol_new st_voice_control
=
234 SOC_DAPM_ENUM("Route", isabelle_st_voice_enum
);
237 static const struct snd_kcontrol_new isabelle_hs_left_mixer_controls
[] = {
238 SOC_DAPM_SINGLE("DAC1L Playback Switch", ISABELLE_HSDRV_CFG1_REG
, 7, 1, 0),
239 SOC_DAPM_SINGLE("APGA1 Playback Switch", ISABELLE_HSDRV_CFG1_REG
, 6, 1, 0),
242 static const struct snd_kcontrol_new isabelle_hs_right_mixer_controls
[] = {
243 SOC_DAPM_SINGLE("DAC1R Playback Switch", ISABELLE_HSDRV_CFG1_REG
, 5, 1, 0),
244 SOC_DAPM_SINGLE("APGA2 Playback Switch", ISABELLE_HSDRV_CFG1_REG
, 4, 1, 0),
247 static const struct snd_kcontrol_new isabelle_hf_left_mixer_controls
[] = {
248 SOC_DAPM_SINGLE("DAC2L Playback Switch", ISABELLE_HFLPGA_CFG_REG
, 7, 1, 0),
249 SOC_DAPM_SINGLE("APGA1 Playback Switch", ISABELLE_HFLPGA_CFG_REG
, 6, 1, 0),
252 static const struct snd_kcontrol_new isabelle_hf_right_mixer_controls
[] = {
253 SOC_DAPM_SINGLE("DAC2R Playback Switch", ISABELLE_HFRPGA_CFG_REG
, 7, 1, 0),
254 SOC_DAPM_SINGLE("APGA2 Playback Switch", ISABELLE_HFRPGA_CFG_REG
, 6, 1, 0),
257 static const struct snd_kcontrol_new isabelle_ep_mixer_controls
[] = {
258 SOC_DAPM_SINGLE("DAC2L Playback Switch", ISABELLE_EARDRV_CFG1_REG
, 7, 1, 0),
259 SOC_DAPM_SINGLE("APGA1 Playback Switch", ISABELLE_EARDRV_CFG1_REG
, 6, 1, 0),
262 static const struct snd_kcontrol_new isabelle_aux_left_mixer_controls
[] = {
263 SOC_DAPM_SINGLE("DAC3L Playback Switch", ISABELLE_LINEAMP_CFG_REG
, 7, 1, 0),
264 SOC_DAPM_SINGLE("APGA1 Playback Switch", ISABELLE_LINEAMP_CFG_REG
, 6, 1, 0),
267 static const struct snd_kcontrol_new isabelle_aux_right_mixer_controls
[] = {
268 SOC_DAPM_SINGLE("DAC3R Playback Switch", ISABELLE_LINEAMP_CFG_REG
, 5, 1, 0),
269 SOC_DAPM_SINGLE("APGA2 Playback Switch", ISABELLE_LINEAMP_CFG_REG
, 4, 1, 0),
272 static const struct snd_kcontrol_new isabelle_dpga1_left_mixer_controls
[] = {
273 SOC_DAPM_SINGLE("RX1 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 7, 1, 0),
274 SOC_DAPM_SINGLE("RX3 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 6, 1, 0),
275 SOC_DAPM_SINGLE("RX5 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 5, 1, 0),
278 static const struct snd_kcontrol_new isabelle_dpga1_right_mixer_controls
[] = {
279 SOC_DAPM_SINGLE("RX2 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 3, 1, 0),
280 SOC_DAPM_SINGLE("RX4 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 2, 1, 0),
281 SOC_DAPM_SINGLE("RX6 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 1, 1, 0),
284 static const struct snd_kcontrol_new isabelle_dpga2_left_mixer_controls
[] = {
285 SOC_DAPM_SINGLE("RX1 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 7, 1, 0),
286 SOC_DAPM_SINGLE("RX2 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 6, 1, 0),
287 SOC_DAPM_SINGLE("RX3 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 5, 1, 0),
288 SOC_DAPM_SINGLE("RX4 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 4, 1, 0),
289 SOC_DAPM_SINGLE("RX5 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 3, 1, 0),
290 SOC_DAPM_SINGLE("RX6 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 2, 1, 0),
293 static const struct snd_kcontrol_new isabelle_dpga2_right_mixer_controls
[] = {
294 SOC_DAPM_SINGLE("USNC Playback Switch", ISABELLE_DPGA2R_IN_SEL_REG
, 7, 1, 0),
295 SOC_DAPM_SINGLE("RX2 Playback Switch", ISABELLE_DPGA2R_IN_SEL_REG
, 3, 1, 0),
296 SOC_DAPM_SINGLE("RX4 Playback Switch", ISABELLE_DPGA2R_IN_SEL_REG
, 2, 1, 0),
297 SOC_DAPM_SINGLE("RX6 Playback Switch", ISABELLE_DPGA2R_IN_SEL_REG
, 1, 1, 0),
300 static const struct snd_kcontrol_new isabelle_dpga3_left_mixer_controls
[] = {
301 SOC_DAPM_SINGLE("RX1 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 7, 1, 0),
302 SOC_DAPM_SINGLE("RX3 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 6, 1, 0),
303 SOC_DAPM_SINGLE("RX5 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 5, 1, 0),
306 static const struct snd_kcontrol_new isabelle_dpga3_right_mixer_controls
[] = {
307 SOC_DAPM_SINGLE("RX2 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 3, 1, 0),
308 SOC_DAPM_SINGLE("RX4 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 2, 1, 0),
309 SOC_DAPM_SINGLE("RX6 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 1, 1, 0),
312 static const struct snd_kcontrol_new isabelle_rx1_mixer_controls
[] = {
313 SOC_DAPM_SINGLE("ST1 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 7, 1, 0),
314 SOC_DAPM_SINGLE("DL1 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 6, 1, 0),
317 static const struct snd_kcontrol_new isabelle_rx2_mixer_controls
[] = {
318 SOC_DAPM_SINGLE("ST2 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 5, 1, 0),
319 SOC_DAPM_SINGLE("DL2 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 4, 1, 0),
322 static const struct snd_kcontrol_new isabelle_rx3_mixer_controls
[] = {
323 SOC_DAPM_SINGLE("ST1 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 3, 1, 0),
324 SOC_DAPM_SINGLE("DL3 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 2, 1, 0),
327 static const struct snd_kcontrol_new isabelle_rx4_mixer_controls
[] = {
328 SOC_DAPM_SINGLE("ST2 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 1, 1, 0),
329 SOC_DAPM_SINGLE("DL4 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 0, 1, 0),
332 static const struct snd_kcontrol_new isabelle_rx5_mixer_controls
[] = {
333 SOC_DAPM_SINGLE("ST1 Playback Switch", ISABELLE_RX_INPUT_CFG2_REG
, 7, 1, 0),
334 SOC_DAPM_SINGLE("DL5 Playback Switch", ISABELLE_RX_INPUT_CFG2_REG
, 6, 1, 0),
337 static const struct snd_kcontrol_new isabelle_rx6_mixer_controls
[] = {
338 SOC_DAPM_SINGLE("ST2 Playback Switch", ISABELLE_RX_INPUT_CFG2_REG
, 5, 1, 0),
339 SOC_DAPM_SINGLE("DL6 Playback Switch", ISABELLE_RX_INPUT_CFG2_REG
, 4, 1, 0),
342 static const struct snd_kcontrol_new ep_path_enable_control
=
343 SOC_DAPM_SINGLE("Switch", ISABELLE_EARDRV_CFG2_REG
, 0, 1, 0);
345 /* TLV Declarations */
346 static const DECLARE_TLV_DB_SCALE(mic_amp_tlv
, 0, 100, 0);
347 static const DECLARE_TLV_DB_SCALE(afm_amp_tlv
, -3300, 300, 0);
348 static const DECLARE_TLV_DB_SCALE(dac_tlv
, -1200, 200, 0);
349 static const DECLARE_TLV_DB_SCALE(hf_tlv
, -5000, 200, 0);
351 /* from -63 to 0 dB in 1 dB steps */
352 static const DECLARE_TLV_DB_SCALE(dpga_tlv
, -6300, 100, 1);
354 /* from -63 to 9 dB in 1 dB steps */
355 static const DECLARE_TLV_DB_SCALE(rx_tlv
, -6300, 100, 1);
357 static const DECLARE_TLV_DB_SCALE(st_tlv
, -2700, 300, 1);
358 static const DECLARE_TLV_DB_SCALE(tx_tlv
, -600, 100, 0);
360 static const struct snd_kcontrol_new isabelle_snd_controls
[] = {
361 SOC_DOUBLE_TLV("Headset Playback Volume", ISABELLE_HSDRV_GAIN_REG
,
362 4, 0, 0xF, 0, dac_tlv
),
363 SOC_DOUBLE_R_TLV("Handsfree Playback Volume",
364 ISABELLE_HFLPGA_CFG_REG
, ISABELLE_HFRPGA_CFG_REG
,
366 SOC_DOUBLE_TLV("Aux Playback Volume", ISABELLE_LINEAMP_GAIN_REG
,
367 4, 0, 0xF, 0, dac_tlv
),
368 SOC_SINGLE_TLV("Earpiece Playback Volume", ISABELLE_EARDRV_CFG1_REG
,
371 SOC_DOUBLE_TLV("Aux FM Volume", ISABELLE_APGA_GAIN_REG
, 4, 0, 0xF, 0,
373 SOC_SINGLE_TLV("Mic1 Capture Volume", ISABELLE_MIC1_GAIN_REG
, 3, 0x1F,
375 SOC_SINGLE_TLV("Mic2 Capture Volume", ISABELLE_MIC2_GAIN_REG
, 3, 0x1F,
378 SOC_DOUBLE_R_TLV("DPGA1 Volume", ISABELLE_DPGA1L_GAIN_REG
,
379 ISABELLE_DPGA1R_GAIN_REG
, 0, 0x3F, 0, dpga_tlv
),
380 SOC_DOUBLE_R_TLV("DPGA2 Volume", ISABELLE_DPGA2L_GAIN_REG
,
381 ISABELLE_DPGA2R_GAIN_REG
, 0, 0x3F, 0, dpga_tlv
),
382 SOC_DOUBLE_R_TLV("DPGA3 Volume", ISABELLE_DPGA3L_GAIN_REG
,
383 ISABELLE_DPGA3R_GAIN_REG
, 0, 0x3F, 0, dpga_tlv
),
385 SOC_SINGLE_TLV("Sidetone Audio TX1 Volume",
386 ISABELLE_ATX_STPGA1_CFG_REG
, 0, 0xF, 0, st_tlv
),
387 SOC_SINGLE_TLV("Sidetone Audio TX2 Volume",
388 ISABELLE_ATX_STPGA2_CFG_REG
, 0, 0xF, 0, st_tlv
),
389 SOC_SINGLE_TLV("Sidetone Voice TX1 Volume",
390 ISABELLE_VTX_STPGA1_CFG_REG
, 0, 0xF, 0, st_tlv
),
391 SOC_SINGLE_TLV("Sidetone Voice TX2 Volume",
392 ISABELLE_VTX2_STPGA2_CFG_REG
, 0, 0xF, 0, st_tlv
),
394 SOC_SINGLE_TLV("Audio TX1 Volume", ISABELLE_ATX1_DPGA_REG
, 4, 0xF, 0,
396 SOC_SINGLE_TLV("Audio TX2 Volume", ISABELLE_ATX2_DPGA_REG
, 4, 0xF, 0,
398 SOC_SINGLE_TLV("Voice TX1 Volume", ISABELLE_VTX1_DPGA_REG
, 4, 0xF, 0,
400 SOC_SINGLE_TLV("Voice TX2 Volume", ISABELLE_VTX2_DPGA_REG
, 4, 0xF, 0,
403 SOC_SINGLE_TLV("RX1 DPGA Volume", ISABELLE_RX1_DPGA_REG
, 0, 0x3F, 0,
405 SOC_SINGLE_TLV("RX2 DPGA Volume", ISABELLE_RX2_DPGA_REG
, 0, 0x3F, 0,
407 SOC_SINGLE_TLV("RX3 DPGA Volume", ISABELLE_RX3_DPGA_REG
, 0, 0x3F, 0,
409 SOC_SINGLE_TLV("RX4 DPGA Volume", ISABELLE_RX4_DPGA_REG
, 0, 0x3F, 0,
411 SOC_SINGLE_TLV("RX5 DPGA Volume", ISABELLE_RX5_DPGA_REG
, 0, 0x3F, 0,
413 SOC_SINGLE_TLV("RX6 DPGA Volume", ISABELLE_RX6_DPGA_REG
, 0, 0x3F, 0,
416 SOC_SINGLE("Headset Noise Gate", ISABELLE_HS_NG_CFG1_REG
, 7, 1, 0),
417 SOC_SINGLE("Handsfree Noise Gate", ISABELLE_HF_NG_CFG1_REG
, 7, 1, 0),
419 SOC_SINGLE("ATX1 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
421 SOC_SINGLE("ATX2 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
423 SOC_SINGLE("ARX1 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
425 SOC_SINGLE("ARX2 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
427 SOC_SINGLE("ARX3 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
429 SOC_SINGLE("ARX4 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
431 SOC_SINGLE("ARX5 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
433 SOC_SINGLE("ARX6 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
435 SOC_SINGLE("VRX1 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
437 SOC_SINGLE("VRX2 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
440 SOC_SINGLE("ATX1 Filter Enable Switch", ISABELLE_ALU_TX_EN_REG
,
442 SOC_SINGLE("ATX2 Filter Enable Switch", ISABELLE_ALU_TX_EN_REG
,
444 SOC_SINGLE("VTX1 Filter Enable Switch", ISABELLE_ALU_TX_EN_REG
,
446 SOC_SINGLE("VTX2 Filter Enable Switch", ISABELLE_ALU_TX_EN_REG
,
448 SOC_SINGLE("RX1 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
450 SOC_SINGLE("RX2 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
452 SOC_SINGLE("RX3 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
454 SOC_SINGLE("RX4 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
456 SOC_SINGLE("RX5 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
458 SOC_SINGLE("RX6 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
461 SOC_SINGLE("ULATX12 Capture Switch", ISABELLE_ULATX12_INTF_CFG_REG
,
464 SOC_SINGLE("DL12 Playback Switch", ISABELLE_DL12_INTF_CFG_REG
,
466 SOC_SINGLE("DL34 Playback Switch", ISABELLE_DL34_INTF_CFG_REG
,
468 SOC_SINGLE("DL56 Playback Switch", ISABELLE_DL56_INTF_CFG_REG
,
472 SOC_SINGLE("DMIC Switch", ISABELLE_DMIC_CFG_REG
, 0, 1, 0),
475 static const struct snd_soc_dapm_widget isabelle_dapm_widgets
[] = {
477 SND_SOC_DAPM_INPUT("MAINMIC"),
478 SND_SOC_DAPM_INPUT("HSMIC"),
479 SND_SOC_DAPM_INPUT("SUBMIC"),
480 SND_SOC_DAPM_INPUT("LINEIN1"),
481 SND_SOC_DAPM_INPUT("LINEIN2"),
482 SND_SOC_DAPM_INPUT("DMICDAT"),
485 SND_SOC_DAPM_OUTPUT("HSOL"),
486 SND_SOC_DAPM_OUTPUT("HSOR"),
487 SND_SOC_DAPM_OUTPUT("HFL"),
488 SND_SOC_DAPM_OUTPUT("HFR"),
489 SND_SOC_DAPM_OUTPUT("EP"),
490 SND_SOC_DAPM_OUTPUT("LINEOUT1"),
491 SND_SOC_DAPM_OUTPUT("LINEOUT2"),
493 SND_SOC_DAPM_PGA("DL1", SND_SOC_NOPM
, 0, 0, NULL
, 0),
494 SND_SOC_DAPM_PGA("DL2", SND_SOC_NOPM
, 0, 0, NULL
, 0),
495 SND_SOC_DAPM_PGA("DL3", SND_SOC_NOPM
, 0, 0, NULL
, 0),
496 SND_SOC_DAPM_PGA("DL4", SND_SOC_NOPM
, 0, 0, NULL
, 0),
497 SND_SOC_DAPM_PGA("DL5", SND_SOC_NOPM
, 0, 0, NULL
, 0),
498 SND_SOC_DAPM_PGA("DL6", SND_SOC_NOPM
, 0, 0, NULL
, 0),
500 /* Analog input muxes for the capture amplifiers */
501 SND_SOC_DAPM_MUX("Analog Left Capture Route",
502 SND_SOC_NOPM
, 0, 0, &amic1_control
),
503 SND_SOC_DAPM_MUX("Analog Right Capture Route",
504 SND_SOC_NOPM
, 0, 0, &amic2_control
),
506 SND_SOC_DAPM_MUX("Sidetone Audio Playback", SND_SOC_NOPM
, 0, 0,
508 SND_SOC_DAPM_MUX("Sidetone Voice Playback", SND_SOC_NOPM
, 0, 0,
512 SND_SOC_DAPM_AIF_IN("INTF1_SDI", NULL
, 0, ISABELLE_INTF_EN_REG
, 7, 0),
513 SND_SOC_DAPM_AIF_IN("INTF2_SDI", NULL
, 0, ISABELLE_INTF_EN_REG
, 6, 0),
515 SND_SOC_DAPM_AIF_OUT("INTF1_SDO", NULL
, 0, ISABELLE_INTF_EN_REG
, 5, 0),
516 SND_SOC_DAPM_AIF_OUT("INTF2_SDO", NULL
, 0, ISABELLE_INTF_EN_REG
, 4, 0),
518 SND_SOC_DAPM_OUT_DRV("ULATX1", SND_SOC_NOPM
, 0, 0, NULL
, 0),
519 SND_SOC_DAPM_OUT_DRV("ULATX2", SND_SOC_NOPM
, 0, 0, NULL
, 0),
520 SND_SOC_DAPM_OUT_DRV("ULVTX1", SND_SOC_NOPM
, 0, 0, NULL
, 0),
521 SND_SOC_DAPM_OUT_DRV("ULVTX2", SND_SOC_NOPM
, 0, 0, NULL
, 0),
523 /* Analog Capture PGAs */
524 SND_SOC_DAPM_PGA("MicAmp1", ISABELLE_AMIC_CFG_REG
, 5, 0, NULL
, 0),
525 SND_SOC_DAPM_PGA("MicAmp2", ISABELLE_AMIC_CFG_REG
, 4, 0, NULL
, 0),
527 /* Auxiliary FM PGAs */
528 SND_SOC_DAPM_PGA("APGA1", ISABELLE_APGA_CFG_REG
, 7, 0, NULL
, 0),
529 SND_SOC_DAPM_PGA("APGA2", ISABELLE_APGA_CFG_REG
, 6, 0, NULL
, 0),
532 SND_SOC_DAPM_ADC("ADC1", "Left Front Capture",
533 ISABELLE_AMIC_CFG_REG
, 7, 0),
534 SND_SOC_DAPM_ADC("ADC2", "Right Front Capture",
535 ISABELLE_AMIC_CFG_REG
, 6, 0),
537 /* Microphone Bias */
538 SND_SOC_DAPM_SUPPLY("Headset Mic Bias", ISABELLE_ABIAS_CFG_REG
,
540 SND_SOC_DAPM_SUPPLY("Main Mic Bias", ISABELLE_ABIAS_CFG_REG
,
542 SND_SOC_DAPM_SUPPLY("Digital Mic1 Bias",
543 ISABELLE_DBIAS_CFG_REG
, 3, 0, NULL
, 0),
544 SND_SOC_DAPM_SUPPLY("Digital Mic2 Bias",
545 ISABELLE_DBIAS_CFG_REG
, 2, 0, NULL
, 0),
548 SND_SOC_DAPM_MIXER("Headset Left Mixer", SND_SOC_NOPM
, 0, 0,
549 isabelle_hs_left_mixer_controls
,
550 ARRAY_SIZE(isabelle_hs_left_mixer_controls
)),
551 SND_SOC_DAPM_MIXER("Headset Right Mixer", SND_SOC_NOPM
, 0, 0,
552 isabelle_hs_right_mixer_controls
,
553 ARRAY_SIZE(isabelle_hs_right_mixer_controls
)),
554 SND_SOC_DAPM_MIXER("Handsfree Left Mixer", SND_SOC_NOPM
, 0, 0,
555 isabelle_hf_left_mixer_controls
,
556 ARRAY_SIZE(isabelle_hf_left_mixer_controls
)),
557 SND_SOC_DAPM_MIXER("Handsfree Right Mixer", SND_SOC_NOPM
, 0, 0,
558 isabelle_hf_right_mixer_controls
,
559 ARRAY_SIZE(isabelle_hf_right_mixer_controls
)),
560 SND_SOC_DAPM_MIXER("LINEOUT1 Mixer", SND_SOC_NOPM
, 0, 0,
561 isabelle_aux_left_mixer_controls
,
562 ARRAY_SIZE(isabelle_aux_left_mixer_controls
)),
563 SND_SOC_DAPM_MIXER("LINEOUT2 Mixer", SND_SOC_NOPM
, 0, 0,
564 isabelle_aux_right_mixer_controls
,
565 ARRAY_SIZE(isabelle_aux_right_mixer_controls
)),
566 SND_SOC_DAPM_MIXER("Earphone Mixer", SND_SOC_NOPM
, 0, 0,
567 isabelle_ep_mixer_controls
,
568 ARRAY_SIZE(isabelle_ep_mixer_controls
)),
570 SND_SOC_DAPM_MIXER("DPGA1L Mixer", SND_SOC_NOPM
, 0, 0,
571 isabelle_dpga1_left_mixer_controls
,
572 ARRAY_SIZE(isabelle_dpga1_left_mixer_controls
)),
573 SND_SOC_DAPM_MIXER("DPGA1R Mixer", SND_SOC_NOPM
, 0, 0,
574 isabelle_dpga1_right_mixer_controls
,
575 ARRAY_SIZE(isabelle_dpga1_right_mixer_controls
)),
576 SND_SOC_DAPM_MIXER("DPGA2L Mixer", SND_SOC_NOPM
, 0, 0,
577 isabelle_dpga2_left_mixer_controls
,
578 ARRAY_SIZE(isabelle_dpga2_left_mixer_controls
)),
579 SND_SOC_DAPM_MIXER("DPGA2R Mixer", SND_SOC_NOPM
, 0, 0,
580 isabelle_dpga2_right_mixer_controls
,
581 ARRAY_SIZE(isabelle_dpga2_right_mixer_controls
)),
582 SND_SOC_DAPM_MIXER("DPGA3L Mixer", SND_SOC_NOPM
, 0, 0,
583 isabelle_dpga3_left_mixer_controls
,
584 ARRAY_SIZE(isabelle_dpga3_left_mixer_controls
)),
585 SND_SOC_DAPM_MIXER("DPGA3R Mixer", SND_SOC_NOPM
, 0, 0,
586 isabelle_dpga3_right_mixer_controls
,
587 ARRAY_SIZE(isabelle_dpga3_right_mixer_controls
)),
589 SND_SOC_DAPM_MIXER("RX1 Mixer", SND_SOC_NOPM
, 0, 0,
590 isabelle_rx1_mixer_controls
,
591 ARRAY_SIZE(isabelle_rx1_mixer_controls
)),
592 SND_SOC_DAPM_MIXER("RX2 Mixer", SND_SOC_NOPM
, 0, 0,
593 isabelle_rx2_mixer_controls
,
594 ARRAY_SIZE(isabelle_rx2_mixer_controls
)),
595 SND_SOC_DAPM_MIXER("RX3 Mixer", SND_SOC_NOPM
, 0, 0,
596 isabelle_rx3_mixer_controls
,
597 ARRAY_SIZE(isabelle_rx3_mixer_controls
)),
598 SND_SOC_DAPM_MIXER("RX4 Mixer", SND_SOC_NOPM
, 0, 0,
599 isabelle_rx4_mixer_controls
,
600 ARRAY_SIZE(isabelle_rx4_mixer_controls
)),
601 SND_SOC_DAPM_MIXER("RX5 Mixer", SND_SOC_NOPM
, 0, 0,
602 isabelle_rx5_mixer_controls
,
603 ARRAY_SIZE(isabelle_rx5_mixer_controls
)),
604 SND_SOC_DAPM_MIXER("RX6 Mixer", SND_SOC_NOPM
, 0, 0,
605 isabelle_rx6_mixer_controls
,
606 ARRAY_SIZE(isabelle_rx6_mixer_controls
)),
609 SND_SOC_DAPM_DAC("DAC1L", "Headset Playback", ISABELLE_DAC_CFG_REG
,
611 SND_SOC_DAPM_DAC("DAC1R", "Headset Playback", ISABELLE_DAC_CFG_REG
,
613 SND_SOC_DAPM_DAC("DAC2L", "Handsfree Playback", ISABELLE_DAC_CFG_REG
,
615 SND_SOC_DAPM_DAC("DAC2R", "Handsfree Playback", ISABELLE_DAC_CFG_REG
,
617 SND_SOC_DAPM_DAC("DAC3L", "Lineout Playback", ISABELLE_DAC_CFG_REG
,
619 SND_SOC_DAPM_DAC("DAC3R", "Lineout Playback", ISABELLE_DAC_CFG_REG
,
622 /* Analog Playback PGAs */
623 SND_SOC_DAPM_PGA("Sidetone Audio PGA", SND_SOC_NOPM
, 0, 0, NULL
, 0),
624 SND_SOC_DAPM_PGA("Sidetone Voice PGA", SND_SOC_NOPM
, 0, 0, NULL
, 0),
625 SND_SOC_DAPM_PGA("HF Left PGA", SND_SOC_NOPM
, 0, 0, NULL
, 0),
626 SND_SOC_DAPM_PGA("HF Right PGA", SND_SOC_NOPM
, 0, 0, NULL
, 0),
627 SND_SOC_DAPM_PGA("DPGA1L", SND_SOC_NOPM
, 0, 0, NULL
, 0),
628 SND_SOC_DAPM_PGA("DPGA1R", SND_SOC_NOPM
, 0, 0, NULL
, 0),
629 SND_SOC_DAPM_PGA("DPGA2L", SND_SOC_NOPM
, 0, 0, NULL
, 0),
630 SND_SOC_DAPM_PGA("DPGA2R", SND_SOC_NOPM
, 0, 0, NULL
, 0),
631 SND_SOC_DAPM_PGA("DPGA3L", SND_SOC_NOPM
, 0, 0, NULL
, 0),
632 SND_SOC_DAPM_PGA("DPGA3R", SND_SOC_NOPM
, 0, 0, NULL
, 0),
634 /* Analog Playback Mux */
635 SND_SOC_DAPM_MUX("RX1 Playback", ISABELLE_ALU_RX_EN_REG
, 5, 0,
637 SND_SOC_DAPM_MUX("RX2 Playback", ISABELLE_ALU_RX_EN_REG
, 4, 0,
641 SND_SOC_DAPM_MUX("ATX Select", ISABELLE_TX_INPUT_CFG_REG
,
642 7, 0, &atx_mux_controls
),
643 SND_SOC_DAPM_MUX("VTX Select", ISABELLE_TX_INPUT_CFG_REG
,
644 6, 0, &vtx_mux_controls
),
646 SND_SOC_DAPM_SWITCH("Earphone Playback", SND_SOC_NOPM
, 0, 0,
647 &ep_path_enable_control
),
650 SND_SOC_DAPM_OUT_DRV("HS Left Driver", ISABELLE_HSDRV_CFG2_REG
,
652 SND_SOC_DAPM_OUT_DRV("HS Right Driver", ISABELLE_HSDRV_CFG2_REG
,
654 SND_SOC_DAPM_OUT_DRV("LINEOUT1 Left Driver", ISABELLE_LINEAMP_CFG_REG
,
656 SND_SOC_DAPM_OUT_DRV("LINEOUT2 Right Driver", ISABELLE_LINEAMP_CFG_REG
,
658 SND_SOC_DAPM_OUT_DRV("Earphone Driver", ISABELLE_EARDRV_CFG2_REG
,
661 SND_SOC_DAPM_OUT_DRV("HF Left Driver", ISABELLE_HFDRV_CFG_REG
,
663 SND_SOC_DAPM_OUT_DRV("HF Right Driver", ISABELLE_HFDRV_CFG_REG
,
667 static const struct snd_soc_dapm_route isabelle_intercon
[] = {
668 /* Interface mapping */
669 { "DL1", "DL12 Playback Switch", "INTF1_SDI" },
670 { "DL2", "DL12 Playback Switch", "INTF1_SDI" },
671 { "DL3", "DL34 Playback Switch", "INTF1_SDI" },
672 { "DL4", "DL34 Playback Switch", "INTF1_SDI" },
673 { "DL5", "DL56 Playback Switch", "INTF1_SDI" },
674 { "DL6", "DL56 Playback Switch", "INTF1_SDI" },
676 { "DL1", "DL12 Playback Switch", "INTF2_SDI" },
677 { "DL2", "DL12 Playback Switch", "INTF2_SDI" },
678 { "DL3", "DL34 Playback Switch", "INTF2_SDI" },
679 { "DL4", "DL34 Playback Switch", "INTF2_SDI" },
680 { "DL5", "DL56 Playback Switch", "INTF2_SDI" },
681 { "DL6", "DL56 Playback Switch", "INTF2_SDI" },
683 /* Input side mapping */
684 { "Sidetone Audio PGA", NULL
, "Sidetone Audio Playback" },
685 { "Sidetone Voice PGA", NULL
, "Sidetone Voice Playback" },
687 { "RX1 Mixer", "ST1 Playback Switch", "Sidetone Audio PGA" },
689 { "RX1 Mixer", "ST1 Playback Switch", "Sidetone Voice PGA" },
690 { "RX1 Mixer", "DL1 Playback Switch", "DL1" },
692 { "RX2 Mixer", "ST2 Playback Switch", "Sidetone Audio PGA" },
694 { "RX2 Mixer", "ST2 Playback Switch", "Sidetone Voice PGA" },
695 { "RX2 Mixer", "DL2 Playback Switch", "DL2" },
697 { "RX3 Mixer", "ST1 Playback Switch", "Sidetone Voice PGA" },
698 { "RX3 Mixer", "DL3 Playback Switch", "DL3" },
700 { "RX4 Mixer", "ST2 Playback Switch", "Sidetone Voice PGA" },
701 { "RX4 Mixer", "DL4 Playback Switch", "DL4" },
703 { "RX5 Mixer", "ST1 Playback Switch", "Sidetone Voice PGA" },
704 { "RX5 Mixer", "DL5 Playback Switch", "DL5" },
706 { "RX6 Mixer", "ST2 Playback Switch", "Sidetone Voice PGA" },
707 { "RX6 Mixer", "DL6 Playback Switch", "DL6" },
710 { "Analog Left Capture Route", "Headset Mic", "HSMIC" },
711 { "Analog Left Capture Route", "Main Mic", "MAINMIC" },
712 { "Analog Left Capture Route", "Aux/FM Left", "LINEIN1" },
714 { "Analog Right Capture Route", "Sub Mic", "SUBMIC" },
715 { "Analog Right Capture Route", "Aux/FM Right", "LINEIN2" },
717 { "MicAmp1", NULL
, "Analog Left Capture Route" },
718 { "MicAmp2", NULL
, "Analog Right Capture Route" },
720 { "ADC1", NULL
, "MicAmp1" },
721 { "ADC2", NULL
, "MicAmp2" },
723 { "ATX Select", "AMIC1", "ADC1" },
724 { "ATX Select", "DMIC", "DMICDAT" },
725 { "ATX Select", "AMIC2", "ADC2" },
727 { "VTX Select", "AMIC1", "ADC1" },
728 { "VTX Select", "DMIC", "DMICDAT" },
729 { "VTX Select", "AMIC2", "ADC2" },
731 { "ULATX1", "ATX1 Filter Enable Switch", "ATX Select" },
732 { "ULATX1", "ATX1 Filter Bypass Switch", "ATX Select" },
733 { "ULATX2", "ATX2 Filter Enable Switch", "ATX Select" },
734 { "ULATX2", "ATX2 Filter Bypass Switch", "ATX Select" },
736 { "ULVTX1", "VTX1 Filter Enable Switch", "VTX Select" },
737 { "ULVTX1", "VTX1 Filter Bypass Switch", "VTX Select" },
738 { "ULVTX2", "VTX2 Filter Enable Switch", "VTX Select" },
739 { "ULVTX2", "VTX2 Filter Bypass Switch", "VTX Select" },
741 { "INTF1_SDO", "ULATX12 Capture Switch", "ULATX1" },
742 { "INTF1_SDO", "ULATX12 Capture Switch", "ULATX2" },
743 { "INTF2_SDO", "ULATX12 Capture Switch", "ULATX1" },
744 { "INTF2_SDO", "ULATX12 Capture Switch", "ULATX2" },
746 { "INTF1_SDO", NULL
, "ULVTX1" },
747 { "INTF1_SDO", NULL
, "ULVTX2" },
748 { "INTF2_SDO", NULL
, "ULVTX1" },
749 { "INTF2_SDO", NULL
, "ULVTX2" },
752 { "APGA1", NULL
, "LINEIN1" },
753 { "APGA2", NULL
, "LINEIN2" },
755 { "RX1 Playback", "VRX1 Filter Bypass Switch", "RX1 Mixer" },
756 { "RX1 Playback", "ARX1 Filter Bypass Switch", "RX1 Mixer" },
757 { "RX1 Playback", "RX1 Filter Enable Switch", "RX1 Mixer" },
759 { "RX2 Playback", "VRX2 Filter Bypass Switch", "RX2 Mixer" },
760 { "RX2 Playback", "ARX2 Filter Bypass Switch", "RX2 Mixer" },
761 { "RX2 Playback", "RX2 Filter Enable Switch", "RX2 Mixer" },
763 { "RX3 Playback", "ARX3 Filter Bypass Switch", "RX3 Mixer" },
764 { "RX3 Playback", "RX3 Filter Enable Switch", "RX3 Mixer" },
766 { "RX4 Playback", "ARX4 Filter Bypass Switch", "RX4 Mixer" },
767 { "RX4 Playback", "RX4 Filter Enable Switch", "RX4 Mixer" },
769 { "RX5 Playback", "ARX5 Filter Bypass Switch", "RX5 Mixer" },
770 { "RX5 Playback", "RX5 Filter Enable Switch", "RX5 Mixer" },
772 { "RX6 Playback", "ARX6 Filter Bypass Switch", "RX6 Mixer" },
773 { "RX6 Playback", "RX6 Filter Enable Switch", "RX6 Mixer" },
775 { "DPGA1L Mixer", "RX1 Playback Switch", "RX1 Playback" },
776 { "DPGA1L Mixer", "RX3 Playback Switch", "RX3 Playback" },
777 { "DPGA1L Mixer", "RX5 Playback Switch", "RX5 Playback" },
779 { "DPGA1R Mixer", "RX2 Playback Switch", "RX2 Playback" },
780 { "DPGA1R Mixer", "RX4 Playback Switch", "RX4 Playback" },
781 { "DPGA1R Mixer", "RX6 Playback Switch", "RX6 Playback" },
783 { "DPGA1L", NULL
, "DPGA1L Mixer" },
784 { "DPGA1R", NULL
, "DPGA1R Mixer" },
786 { "DAC1L", NULL
, "DPGA1L" },
787 { "DAC1R", NULL
, "DPGA1R" },
789 { "DPGA2L Mixer", "RX1 Playback Switch", "RX1 Playback" },
790 { "DPGA2L Mixer", "RX2 Playback Switch", "RX2 Playback" },
791 { "DPGA2L Mixer", "RX3 Playback Switch", "RX3 Playback" },
792 { "DPGA2L Mixer", "RX4 Playback Switch", "RX4 Playback" },
793 { "DPGA2L Mixer", "RX5 Playback Switch", "RX5 Playback" },
794 { "DPGA2L Mixer", "RX6 Playback Switch", "RX6 Playback" },
796 { "DPGA2R Mixer", "RX2 Playback Switch", "RX2 Playback" },
797 { "DPGA2R Mixer", "RX4 Playback Switch", "RX4 Playback" },
798 { "DPGA2R Mixer", "RX6 Playback Switch", "RX6 Playback" },
800 { "DPGA2L", NULL
, "DPGA2L Mixer" },
801 { "DPGA2R", NULL
, "DPGA2R Mixer" },
803 { "DAC2L", NULL
, "DPGA2L" },
804 { "DAC2R", NULL
, "DPGA2R" },
806 { "DPGA3L Mixer", "RX1 Playback Switch", "RX1 Playback" },
807 { "DPGA3L Mixer", "RX3 Playback Switch", "RX3 Playback" },
808 { "DPGA3L Mixer", "RX5 Playback Switch", "RX5 Playback" },
810 { "DPGA3R Mixer", "RX2 Playback Switch", "RX2 Playback" },
811 { "DPGA3R Mixer", "RX4 Playback Switch", "RX4 Playback" },
812 { "DPGA3R Mixer", "RX6 Playback Switch", "RX6 Playback" },
814 { "DPGA3L", NULL
, "DPGA3L Mixer" },
815 { "DPGA3R", NULL
, "DPGA3R Mixer" },
817 { "DAC3L", NULL
, "DPGA3L" },
818 { "DAC3R", NULL
, "DPGA3R" },
820 { "Headset Left Mixer", "DAC1L Playback Switch", "DAC1L" },
821 { "Headset Left Mixer", "APGA1 Playback Switch", "APGA1" },
823 { "Headset Right Mixer", "DAC1R Playback Switch", "DAC1R" },
824 { "Headset Right Mixer", "APGA2 Playback Switch", "APGA2" },
826 { "HS Left Driver", NULL
, "Headset Left Mixer" },
827 { "HS Right Driver", NULL
, "Headset Right Mixer" },
829 { "HSOL", NULL
, "HS Left Driver" },
830 { "HSOR", NULL
, "HS Right Driver" },
832 /* Earphone playback path */
833 { "Earphone Mixer", "DAC2L Playback Switch", "DAC2L" },
834 { "Earphone Mixer", "APGA1 Playback Switch", "APGA1" },
836 { "Earphone Playback", "Switch", "Earphone Mixer" },
837 { "Earphone Driver", NULL
, "Earphone Playback" },
838 { "EP", NULL
, "Earphone Driver" },
840 { "Handsfree Left Mixer", "DAC2L Playback Switch", "DAC2L" },
841 { "Handsfree Left Mixer", "APGA1 Playback Switch", "APGA1" },
843 { "Handsfree Right Mixer", "DAC2R Playback Switch", "DAC2R" },
844 { "Handsfree Right Mixer", "APGA2 Playback Switch", "APGA2" },
846 { "HF Left PGA", NULL
, "Handsfree Left Mixer" },
847 { "HF Right PGA", NULL
, "Handsfree Right Mixer" },
849 { "HF Left Driver", NULL
, "HF Left PGA" },
850 { "HF Right Driver", NULL
, "HF Right PGA" },
852 { "HFL", NULL
, "HF Left Driver" },
853 { "HFR", NULL
, "HF Right Driver" },
855 { "LINEOUT1 Mixer", "DAC3L Playback Switch", "DAC3L" },
856 { "LINEOUT1 Mixer", "APGA1 Playback Switch", "APGA1" },
858 { "LINEOUT2 Mixer", "DAC3R Playback Switch", "DAC3R" },
859 { "LINEOUT2 Mixer", "APGA2 Playback Switch", "APGA2" },
861 { "LINEOUT1 Driver", NULL
, "LINEOUT1 Mixer" },
862 { "LINEOUT2 Driver", NULL
, "LINEOUT2 Mixer" },
864 { "LINEOUT1", NULL
, "LINEOUT1 Driver" },
865 { "LINEOUT2", NULL
, "LINEOUT2 Driver" },
868 static int isabelle_hs_mute(struct snd_soc_dai
*dai
, int mute
)
870 snd_soc_update_bits(dai
->codec
, ISABELLE_DAC1_SOFTRAMP_REG
,
871 BIT(4), (mute
? BIT(4) : 0));
876 static int isabelle_hf_mute(struct snd_soc_dai
*dai
, int mute
)
878 snd_soc_update_bits(dai
->codec
, ISABELLE_DAC2_SOFTRAMP_REG
,
879 BIT(4), (mute
? BIT(4) : 0));
884 static int isabelle_line_mute(struct snd_soc_dai
*dai
, int mute
)
886 snd_soc_update_bits(dai
->codec
, ISABELLE_DAC3_SOFTRAMP_REG
,
887 BIT(4), (mute
? BIT(4) : 0));
892 static int isabelle_set_bias_level(struct snd_soc_codec
*codec
,
893 enum snd_soc_bias_level level
)
896 case SND_SOC_BIAS_ON
:
898 case SND_SOC_BIAS_PREPARE
:
901 case SND_SOC_BIAS_STANDBY
:
902 snd_soc_update_bits(codec
, ISABELLE_PWR_EN_REG
,
903 ISABELLE_CHIP_EN
, BIT(0));
906 case SND_SOC_BIAS_OFF
:
907 snd_soc_update_bits(codec
, ISABELLE_PWR_EN_REG
,
908 ISABELLE_CHIP_EN
, 0);
915 static int isabelle_hw_params(struct snd_pcm_substream
*substream
,
916 struct snd_pcm_hw_params
*params
,
917 struct snd_soc_dai
*dai
)
919 struct snd_soc_codec
*codec
= dai
->codec
;
921 unsigned int fs_val
= 0;
923 switch (params_rate(params
)) {
925 fs_val
= ISABELLE_FS_RATE_8
;
928 fs_val
= ISABELLE_FS_RATE_11
;
931 fs_val
= ISABELLE_FS_RATE_12
;
934 fs_val
= ISABELLE_FS_RATE_16
;
937 fs_val
= ISABELLE_FS_RATE_22
;
940 fs_val
= ISABELLE_FS_RATE_24
;
943 fs_val
= ISABELLE_FS_RATE_32
;
946 fs_val
= ISABELLE_FS_RATE_44
;
949 fs_val
= ISABELLE_FS_RATE_48
;
955 snd_soc_update_bits(codec
, ISABELLE_FS_RATE_CFG_REG
,
956 ISABELLE_FS_RATE_MASK
, fs_val
);
959 switch (params_width(params
)) {
961 aif
|= ISABELLE_AIF_LENGTH_20
;
964 aif
|= ISABELLE_AIF_LENGTH_32
;
970 snd_soc_update_bits(codec
, ISABELLE_INTF_CFG_REG
,
971 ISABELLE_AIF_LENGTH_MASK
, aif
);
976 static int isabelle_set_dai_fmt(struct snd_soc_dai
*codec_dai
, unsigned int fmt
)
978 struct snd_soc_codec
*codec
= codec_dai
->codec
;
979 unsigned int aif_val
= 0;
981 switch (fmt
& SND_SOC_DAIFMT_MASTER_MASK
) {
982 case SND_SOC_DAIFMT_CBS_CFS
:
983 aif_val
&= ~ISABELLE_AIF_MS
;
985 case SND_SOC_DAIFMT_CBM_CFM
:
986 aif_val
|= ISABELLE_AIF_MS
;
992 switch (fmt
& SND_SOC_DAIFMT_FORMAT_MASK
) {
993 case SND_SOC_DAIFMT_I2S
:
994 aif_val
|= ISABELLE_I2S_MODE
;
996 case SND_SOC_DAIFMT_LEFT_J
:
997 aif_val
|= ISABELLE_LEFT_J_MODE
;
999 case SND_SOC_DAIFMT_PDM
:
1000 aif_val
|= ISABELLE_PDM_MODE
;
1006 snd_soc_update_bits(codec
, ISABELLE_INTF_CFG_REG
,
1007 (ISABELLE_AIF_MS
| ISABELLE_AIF_FMT_MASK
), aif_val
);
1012 /* Rates supported by Isabelle driver */
1013 #define ISABELLE_RATES SNDRV_PCM_RATE_8000_48000
1015 /* Formates supported by Isabelle driver. */
1016 #define ISABELLE_FORMATS (SNDRV_PCM_FMTBIT_S20_3LE |\
1017 SNDRV_PCM_FMTBIT_S32_LE)
1019 static const struct snd_soc_dai_ops isabelle_hs_dai_ops
= {
1020 .hw_params
= isabelle_hw_params
,
1021 .set_fmt
= isabelle_set_dai_fmt
,
1022 .digital_mute
= isabelle_hs_mute
,
1025 static const struct snd_soc_dai_ops isabelle_hf_dai_ops
= {
1026 .hw_params
= isabelle_hw_params
,
1027 .set_fmt
= isabelle_set_dai_fmt
,
1028 .digital_mute
= isabelle_hf_mute
,
1031 static const struct snd_soc_dai_ops isabelle_line_dai_ops
= {
1032 .hw_params
= isabelle_hw_params
,
1033 .set_fmt
= isabelle_set_dai_fmt
,
1034 .digital_mute
= isabelle_line_mute
,
1037 static const struct snd_soc_dai_ops isabelle_ul_dai_ops
= {
1038 .hw_params
= isabelle_hw_params
,
1039 .set_fmt
= isabelle_set_dai_fmt
,
1042 /* ISABELLE dai structure */
1043 static struct snd_soc_dai_driver isabelle_dai
[] = {
1045 .name
= "isabelle-dl1",
1047 .stream_name
= "Headset Playback",
1050 .rates
= ISABELLE_RATES
,
1051 .formats
= ISABELLE_FORMATS
,
1053 .ops
= &isabelle_hs_dai_ops
,
1056 .name
= "isabelle-dl2",
1058 .stream_name
= "Handsfree Playback",
1061 .rates
= ISABELLE_RATES
,
1062 .formats
= ISABELLE_FORMATS
,
1064 .ops
= &isabelle_hf_dai_ops
,
1067 .name
= "isabelle-lineout",
1069 .stream_name
= "Lineout Playback",
1072 .rates
= ISABELLE_RATES
,
1073 .formats
= ISABELLE_FORMATS
,
1075 .ops
= &isabelle_line_dai_ops
,
1078 .name
= "isabelle-ul",
1080 .stream_name
= "Capture",
1083 .rates
= ISABELLE_RATES
,
1084 .formats
= ISABELLE_FORMATS
,
1086 .ops
= &isabelle_ul_dai_ops
,
1090 static const struct snd_soc_codec_driver soc_codec_dev_isabelle
= {
1091 .set_bias_level
= isabelle_set_bias_level
,
1092 .component_driver
= {
1093 .controls
= isabelle_snd_controls
,
1094 .num_controls
= ARRAY_SIZE(isabelle_snd_controls
),
1095 .dapm_widgets
= isabelle_dapm_widgets
,
1096 .num_dapm_widgets
= ARRAY_SIZE(isabelle_dapm_widgets
),
1097 .dapm_routes
= isabelle_intercon
,
1098 .num_dapm_routes
= ARRAY_SIZE(isabelle_intercon
),
1100 .idle_bias_off
= true,
1103 static const struct regmap_config isabelle_regmap_config
= {
1107 .max_register
= ISABELLE_MAX_REGISTER
,
1108 .reg_defaults
= isabelle_reg_defs
,
1109 .num_reg_defaults
= ARRAY_SIZE(isabelle_reg_defs
),
1110 .cache_type
= REGCACHE_RBTREE
,
1113 static int isabelle_i2c_probe(struct i2c_client
*i2c
,
1114 const struct i2c_device_id
*id
)
1116 struct regmap
*isabelle_regmap
;
1119 isabelle_regmap
= devm_regmap_init_i2c(i2c
, &isabelle_regmap_config
);
1120 if (IS_ERR(isabelle_regmap
)) {
1121 ret
= PTR_ERR(isabelle_regmap
);
1122 dev_err(&i2c
->dev
, "Failed to allocate register map: %d\n",
1126 i2c_set_clientdata(i2c
, isabelle_regmap
);
1128 ret
= snd_soc_register_codec(&i2c
->dev
,
1129 &soc_codec_dev_isabelle
, isabelle_dai
,
1130 ARRAY_SIZE(isabelle_dai
));
1132 dev_err(&i2c
->dev
, "Failed to register codec: %d\n", ret
);
1139 static int isabelle_i2c_remove(struct i2c_client
*client
)
1141 snd_soc_unregister_codec(&client
->dev
);
1145 static const struct i2c_device_id isabelle_i2c_id
[] = {
1149 MODULE_DEVICE_TABLE(i2c
, isabelle_i2c_id
);
1151 static struct i2c_driver isabelle_i2c_driver
= {
1155 .probe
= isabelle_i2c_probe
,
1156 .remove
= isabelle_i2c_remove
,
1157 .id_table
= isabelle_i2c_id
,
1160 module_i2c_driver(isabelle_i2c_driver
);
1162 MODULE_DESCRIPTION("ASoC ISABELLE driver");
1163 MODULE_AUTHOR("Vishwas A Deshpande <vishwas.a.deshpande@ti.com>");
1164 MODULE_AUTHOR("M R Swami Reddy <MR.Swami.Reddy@ti.com>");
1165 MODULE_LICENSE("GPL v2");