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/version.h>
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/delay.h>
21 #include <linux/regmap.h>
22 #include <linux/i2c.h>
23 #include <linux/slab.h>
24 #include <sound/core.h>
25 #include <sound/pcm.h>
26 #include <sound/pcm_params.h>
27 #include <sound/soc.h>
28 #include <sound/soc-dapm.h>
29 #include <sound/tlv.h>
30 #include <sound/jack.h>
31 #include <sound/initval.h>
32 #include <asm/div64.h>
36 /* Register default values for ISABELLE driver. */
37 static struct reg_default isabelle_reg_defs
[] = {
140 static const char *isabelle_rx1_texts
[] = {"VRX1", "ARX1"};
141 static const char *isabelle_rx2_texts
[] = {"VRX2", "ARX2"};
143 static const struct soc_enum isabelle_rx1_enum
[] = {
144 SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG
, 3, 1, isabelle_rx1_texts
),
145 SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG
, 5, 1, isabelle_rx1_texts
),
148 static const struct soc_enum isabelle_rx2_enum
[] = {
149 SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG
, 2, 1, isabelle_rx2_texts
),
150 SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG
, 4, 1, isabelle_rx2_texts
),
153 /* Headset DAC playback switches */
154 static const struct snd_kcontrol_new rx1_mux_controls
=
155 SOC_DAPM_ENUM("Route", isabelle_rx1_enum
);
157 static const struct snd_kcontrol_new rx2_mux_controls
=
158 SOC_DAPM_ENUM("Route", isabelle_rx2_enum
);
160 /* TX input selection */
161 static const char *isabelle_atx_texts
[] = {"AMIC1", "DMIC"};
162 static const char *isabelle_vtx_texts
[] = {"AMIC2", "DMIC"};
164 static const struct soc_enum isabelle_atx_enum
[] = {
165 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG
, 7, 1, isabelle_atx_texts
),
166 SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG
, 0, 1, isabelle_atx_texts
),
169 static const struct soc_enum isabelle_vtx_enum
[] = {
170 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG
, 6, 1, isabelle_vtx_texts
),
171 SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG
, 0, 1, isabelle_vtx_texts
),
174 static const struct snd_kcontrol_new atx_mux_controls
=
175 SOC_DAPM_ENUM("Route", isabelle_atx_enum
);
177 static const struct snd_kcontrol_new vtx_mux_controls
=
178 SOC_DAPM_ENUM("Route", isabelle_vtx_enum
);
180 /* Left analog microphone selection */
181 static const char *isabelle_amic1_texts
[] = {
182 "Main Mic", "Headset Mic", "Aux/FM Left"};
184 /* Left analog microphone selection */
185 static const char *isabelle_amic2_texts
[] = {"Sub Mic", "Aux/FM Right"};
187 static const struct soc_enum isabelle_amic1_enum
[] = {
188 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG
, 5,
189 ARRAY_SIZE(isabelle_amic1_texts
),
190 isabelle_amic1_texts
),
193 static const struct soc_enum isabelle_amic2_enum
[] = {
194 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG
, 4,
195 ARRAY_SIZE(isabelle_amic2_texts
),
196 isabelle_amic2_texts
),
199 static const struct snd_kcontrol_new amic1_control
=
200 SOC_DAPM_ENUM("Route", isabelle_amic1_enum
);
202 static const struct snd_kcontrol_new amic2_control
=
203 SOC_DAPM_ENUM("Route", isabelle_amic2_enum
);
205 static const char *isabelle_st_audio_texts
[] = {"ATX1", "ATX2"};
207 static const char *isabelle_st_voice_texts
[] = {"VTX1", "VTX2"};
209 static const struct soc_enum isabelle_st_audio_enum
[] = {
210 SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG
, 7, 1,
211 isabelle_st_audio_texts
),
212 SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG
, 7, 1,
213 isabelle_st_audio_texts
),
216 static const struct soc_enum isabelle_st_voice_enum
[] = {
217 SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG
, 7, 1,
218 isabelle_st_voice_texts
),
219 SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG
, 7, 1,
220 isabelle_st_voice_texts
),
223 static const struct snd_kcontrol_new st_audio_control
=
224 SOC_DAPM_ENUM("Route", isabelle_st_audio_enum
);
226 static const struct snd_kcontrol_new st_voice_control
=
227 SOC_DAPM_ENUM("Route", isabelle_st_voice_enum
);
230 static const struct snd_kcontrol_new isabelle_hs_left_mixer_controls
[] = {
231 SOC_DAPM_SINGLE("DAC1L Playback Switch", ISABELLE_HSDRV_CFG1_REG
, 7, 1, 0),
232 SOC_DAPM_SINGLE("APGA1 Playback Switch", ISABELLE_HSDRV_CFG1_REG
, 6, 1, 0),
235 static const struct snd_kcontrol_new isabelle_hs_right_mixer_controls
[] = {
236 SOC_DAPM_SINGLE("DAC1R Playback Switch", ISABELLE_HSDRV_CFG1_REG
, 5, 1, 0),
237 SOC_DAPM_SINGLE("APGA2 Playback Switch", ISABELLE_HSDRV_CFG1_REG
, 4, 1, 0),
240 static const struct snd_kcontrol_new isabelle_hf_left_mixer_controls
[] = {
241 SOC_DAPM_SINGLE("DAC2L Playback Switch", ISABELLE_HFLPGA_CFG_REG
, 7, 1, 0),
242 SOC_DAPM_SINGLE("APGA1 Playback Switch", ISABELLE_HFLPGA_CFG_REG
, 6, 1, 0),
245 static const struct snd_kcontrol_new isabelle_hf_right_mixer_controls
[] = {
246 SOC_DAPM_SINGLE("DAC2R Playback Switch", ISABELLE_HFRPGA_CFG_REG
, 7, 1, 0),
247 SOC_DAPM_SINGLE("APGA2 Playback Switch", ISABELLE_HFRPGA_CFG_REG
, 6, 1, 0),
250 static const struct snd_kcontrol_new isabelle_ep_mixer_controls
[] = {
251 SOC_DAPM_SINGLE("DAC2L Playback Switch", ISABELLE_EARDRV_CFG1_REG
, 7, 1, 0),
252 SOC_DAPM_SINGLE("APGA1 Playback Switch", ISABELLE_EARDRV_CFG1_REG
, 6, 1, 0),
255 static const struct snd_kcontrol_new isabelle_aux_left_mixer_controls
[] = {
256 SOC_DAPM_SINGLE("DAC3L Playback Switch", ISABELLE_LINEAMP_CFG_REG
, 7, 1, 0),
257 SOC_DAPM_SINGLE("APGA1 Playback Switch", ISABELLE_LINEAMP_CFG_REG
, 6, 1, 0),
260 static const struct snd_kcontrol_new isabelle_aux_right_mixer_controls
[] = {
261 SOC_DAPM_SINGLE("DAC3R Playback Switch", ISABELLE_LINEAMP_CFG_REG
, 5, 1, 0),
262 SOC_DAPM_SINGLE("APGA2 Playback Switch", ISABELLE_LINEAMP_CFG_REG
, 4, 1, 0),
265 static const struct snd_kcontrol_new isabelle_dpga1_left_mixer_controls
[] = {
266 SOC_DAPM_SINGLE("RX1 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 7, 1, 0),
267 SOC_DAPM_SINGLE("RX3 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 6, 1, 0),
268 SOC_DAPM_SINGLE("RX5 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 5, 1, 0),
271 static const struct snd_kcontrol_new isabelle_dpga1_right_mixer_controls
[] = {
272 SOC_DAPM_SINGLE("RX2 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 3, 1, 0),
273 SOC_DAPM_SINGLE("RX4 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 2, 1, 0),
274 SOC_DAPM_SINGLE("RX6 Playback Switch", ISABELLE_DPGA1LR_IN_SEL_REG
, 1, 1, 0),
277 static const struct snd_kcontrol_new isabelle_dpga2_left_mixer_controls
[] = {
278 SOC_DAPM_SINGLE("RX1 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 7, 1, 0),
279 SOC_DAPM_SINGLE("RX2 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 6, 1, 0),
280 SOC_DAPM_SINGLE("RX3 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 5, 1, 0),
281 SOC_DAPM_SINGLE("RX4 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 4, 1, 0),
282 SOC_DAPM_SINGLE("RX5 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 3, 1, 0),
283 SOC_DAPM_SINGLE("RX6 Playback Switch", ISABELLE_DPGA2L_IN_SEL_REG
, 2, 1, 0),
286 static const struct snd_kcontrol_new isabelle_dpga2_right_mixer_controls
[] = {
287 SOC_DAPM_SINGLE("USNC Playback Switch", ISABELLE_DPGA2R_IN_SEL_REG
, 7, 1, 0),
288 SOC_DAPM_SINGLE("RX2 Playback Switch", ISABELLE_DPGA2R_IN_SEL_REG
, 3, 1, 0),
289 SOC_DAPM_SINGLE("RX4 Playback Switch", ISABELLE_DPGA2R_IN_SEL_REG
, 2, 1, 0),
290 SOC_DAPM_SINGLE("RX6 Playback Switch", ISABELLE_DPGA2R_IN_SEL_REG
, 1, 1, 0),
293 static const struct snd_kcontrol_new isabelle_dpga3_left_mixer_controls
[] = {
294 SOC_DAPM_SINGLE("RX1 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 7, 1, 0),
295 SOC_DAPM_SINGLE("RX3 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 6, 1, 0),
296 SOC_DAPM_SINGLE("RX5 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 5, 1, 0),
299 static const struct snd_kcontrol_new isabelle_dpga3_right_mixer_controls
[] = {
300 SOC_DAPM_SINGLE("RX2 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 3, 1, 0),
301 SOC_DAPM_SINGLE("RX4 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 2, 1, 0),
302 SOC_DAPM_SINGLE("RX6 Playback Switch", ISABELLE_DPGA3LR_IN_SEL_REG
, 1, 1, 0),
305 static const struct snd_kcontrol_new isabelle_rx1_mixer_controls
[] = {
306 SOC_DAPM_SINGLE("ST1 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 7, 1, 0),
307 SOC_DAPM_SINGLE("DL1 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 6, 1, 0),
310 static const struct snd_kcontrol_new isabelle_rx2_mixer_controls
[] = {
311 SOC_DAPM_SINGLE("ST2 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 5, 1, 0),
312 SOC_DAPM_SINGLE("DL2 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 4, 1, 0),
315 static const struct snd_kcontrol_new isabelle_rx3_mixer_controls
[] = {
316 SOC_DAPM_SINGLE("ST1 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 3, 1, 0),
317 SOC_DAPM_SINGLE("DL3 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 2, 1, 0),
320 static const struct snd_kcontrol_new isabelle_rx4_mixer_controls
[] = {
321 SOC_DAPM_SINGLE("ST2 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 1, 1, 0),
322 SOC_DAPM_SINGLE("DL4 Playback Switch", ISABELLE_RX_INPUT_CFG_REG
, 0, 1, 0),
325 static const struct snd_kcontrol_new isabelle_rx5_mixer_controls
[] = {
326 SOC_DAPM_SINGLE("ST1 Playback Switch", ISABELLE_RX_INPUT_CFG2_REG
, 7, 1, 0),
327 SOC_DAPM_SINGLE("DL5 Playback Switch", ISABELLE_RX_INPUT_CFG2_REG
, 6, 1, 0),
330 static const struct snd_kcontrol_new isabelle_rx6_mixer_controls
[] = {
331 SOC_DAPM_SINGLE("ST2 Playback Switch", ISABELLE_RX_INPUT_CFG2_REG
, 5, 1, 0),
332 SOC_DAPM_SINGLE("DL6 Playback Switch", ISABELLE_RX_INPUT_CFG2_REG
, 4, 1, 0),
335 static const struct snd_kcontrol_new ep_path_enable_control
=
336 SOC_DAPM_SINGLE("Switch", ISABELLE_EARDRV_CFG2_REG
, 0, 1, 0);
338 /* TLV Declarations */
339 static const DECLARE_TLV_DB_SCALE(mic_amp_tlv
, 0, 100, 0);
340 static const DECLARE_TLV_DB_SCALE(afm_amp_tlv
, -3300, 300, 0);
341 static const DECLARE_TLV_DB_SCALE(dac_tlv
, -1200, 200, 0);
342 static const DECLARE_TLV_DB_SCALE(hf_tlv
, -5000, 200, 0);
344 /* from -63 to 0 dB in 1 dB steps */
345 static const DECLARE_TLV_DB_SCALE(dpga_tlv
, -6300, 100, 1);
347 /* from -63 to 9 dB in 1 dB steps */
348 static const DECLARE_TLV_DB_SCALE(rx_tlv
, -6300, 100, 1);
350 static const DECLARE_TLV_DB_SCALE(st_tlv
, -2700, 300, 1);
351 static const DECLARE_TLV_DB_SCALE(tx_tlv
, -600, 100, 0);
353 static const struct snd_kcontrol_new isabelle_snd_controls
[] = {
354 SOC_DOUBLE_TLV("Headset Playback Volume", ISABELLE_HSDRV_GAIN_REG
,
355 4, 0, 0xF, 0, dac_tlv
),
356 SOC_DOUBLE_R_TLV("Handsfree Playback Volume",
357 ISABELLE_HFLPGA_CFG_REG
, ISABELLE_HFRPGA_CFG_REG
,
359 SOC_DOUBLE_TLV("Aux Playback Volume", ISABELLE_LINEAMP_GAIN_REG
,
360 4, 0, 0xF, 0, dac_tlv
),
361 SOC_SINGLE_TLV("Earpiece Playback Volume", ISABELLE_EARDRV_CFG1_REG
,
364 SOC_DOUBLE_TLV("Aux FM Volume", ISABELLE_APGA_GAIN_REG
, 4, 0, 0xF, 0,
366 SOC_SINGLE_TLV("Mic1 Capture Volume", ISABELLE_MIC1_GAIN_REG
, 3, 0x1F,
368 SOC_SINGLE_TLV("Mic2 Capture Volume", ISABELLE_MIC2_GAIN_REG
, 3, 0x1F,
371 SOC_DOUBLE_R_TLV("DPGA1 Volume", ISABELLE_DPGA1L_GAIN_REG
,
372 ISABELLE_DPGA1R_GAIN_REG
, 0, 0x3F, 0, dpga_tlv
),
373 SOC_DOUBLE_R_TLV("DPGA2 Volume", ISABELLE_DPGA2L_GAIN_REG
,
374 ISABELLE_DPGA2R_GAIN_REG
, 0, 0x3F, 0, dpga_tlv
),
375 SOC_DOUBLE_R_TLV("DPGA3 Volume", ISABELLE_DPGA3L_GAIN_REG
,
376 ISABELLE_DPGA3R_GAIN_REG
, 0, 0x3F, 0, dpga_tlv
),
378 SOC_SINGLE_TLV("Sidetone Audio TX1 Volume",
379 ISABELLE_ATX_STPGA1_CFG_REG
, 0, 0xF, 0, st_tlv
),
380 SOC_SINGLE_TLV("Sidetone Audio TX2 Volume",
381 ISABELLE_ATX_STPGA2_CFG_REG
, 0, 0xF, 0, st_tlv
),
382 SOC_SINGLE_TLV("Sidetone Voice TX1 Volume",
383 ISABELLE_VTX_STPGA1_CFG_REG
, 0, 0xF, 0, st_tlv
),
384 SOC_SINGLE_TLV("Sidetone Voice TX2 Volume",
385 ISABELLE_VTX2_STPGA2_CFG_REG
, 0, 0xF, 0, st_tlv
),
387 SOC_SINGLE_TLV("Audio TX1 Volume", ISABELLE_ATX1_DPGA_REG
, 4, 0xF, 0,
389 SOC_SINGLE_TLV("Audio TX2 Volume", ISABELLE_ATX2_DPGA_REG
, 4, 0xF, 0,
391 SOC_SINGLE_TLV("Voice TX1 Volume", ISABELLE_VTX1_DPGA_REG
, 4, 0xF, 0,
393 SOC_SINGLE_TLV("Voice TX2 Volume", ISABELLE_VTX2_DPGA_REG
, 4, 0xF, 0,
396 SOC_SINGLE_TLV("RX1 DPGA Volume", ISABELLE_RX1_DPGA_REG
, 0, 0x3F, 0,
398 SOC_SINGLE_TLV("RX2 DPGA Volume", ISABELLE_RX2_DPGA_REG
, 0, 0x3F, 0,
400 SOC_SINGLE_TLV("RX3 DPGA Volume", ISABELLE_RX3_DPGA_REG
, 0, 0x3F, 0,
402 SOC_SINGLE_TLV("RX4 DPGA Volume", ISABELLE_RX4_DPGA_REG
, 0, 0x3F, 0,
404 SOC_SINGLE_TLV("RX5 DPGA Volume", ISABELLE_RX5_DPGA_REG
, 0, 0x3F, 0,
406 SOC_SINGLE_TLV("RX6 DPGA Volume", ISABELLE_RX6_DPGA_REG
, 0, 0x3F, 0,
409 SOC_SINGLE("Headset Noise Gate", ISABELLE_HS_NG_CFG1_REG
, 7, 1, 0),
410 SOC_SINGLE("Handsfree Noise Gate", ISABELLE_HF_NG_CFG1_REG
, 7, 1, 0),
412 SOC_SINGLE("ATX1 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
414 SOC_SINGLE("ATX2 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
416 SOC_SINGLE("ARX1 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
418 SOC_SINGLE("ARX2 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
420 SOC_SINGLE("ARX3 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
422 SOC_SINGLE("ARX4 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
424 SOC_SINGLE("ARX5 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
426 SOC_SINGLE("ARX6 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
428 SOC_SINGLE("VRX1 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
430 SOC_SINGLE("VRX2 Filter Bypass Switch", ISABELLE_AUDIO_HPF_CFG_REG
,
433 SOC_SINGLE("ATX1 Filter Enable Switch", ISABELLE_ALU_TX_EN_REG
,
435 SOC_SINGLE("ATX2 Filter Enable Switch", ISABELLE_ALU_TX_EN_REG
,
437 SOC_SINGLE("VTX1 Filter Enable Switch", ISABELLE_ALU_TX_EN_REG
,
439 SOC_SINGLE("VTX2 Filter Enable Switch", ISABELLE_ALU_TX_EN_REG
,
441 SOC_SINGLE("RX1 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
443 SOC_SINGLE("RX2 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
445 SOC_SINGLE("RX3 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
447 SOC_SINGLE("RX4 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
449 SOC_SINGLE("RX5 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
451 SOC_SINGLE("RX6 Filter Enable Switch", ISABELLE_ALU_RX_EN_REG
,
454 SOC_SINGLE("ULATX12 Capture Switch", ISABELLE_ULATX12_INTF_CFG_REG
,
457 SOC_SINGLE("DL12 Playback Switch", ISABELLE_DL12_INTF_CFG_REG
,
459 SOC_SINGLE("DL34 Playback Switch", ISABELLE_DL34_INTF_CFG_REG
,
461 SOC_SINGLE("DL56 Playback Switch", ISABELLE_DL56_INTF_CFG_REG
,
465 SOC_SINGLE("DMIC Switch", ISABELLE_DMIC_CFG_REG
, 0, 1, 0),
468 static const struct snd_soc_dapm_widget isabelle_dapm_widgets
[] = {
470 SND_SOC_DAPM_INPUT("MAINMIC"),
471 SND_SOC_DAPM_INPUT("HSMIC"),
472 SND_SOC_DAPM_INPUT("SUBMIC"),
473 SND_SOC_DAPM_INPUT("LINEIN1"),
474 SND_SOC_DAPM_INPUT("LINEIN2"),
475 SND_SOC_DAPM_INPUT("DMICDAT"),
478 SND_SOC_DAPM_OUTPUT("HSOL"),
479 SND_SOC_DAPM_OUTPUT("HSOR"),
480 SND_SOC_DAPM_OUTPUT("HFL"),
481 SND_SOC_DAPM_OUTPUT("HFR"),
482 SND_SOC_DAPM_OUTPUT("EP"),
483 SND_SOC_DAPM_OUTPUT("LINEOUT1"),
484 SND_SOC_DAPM_OUTPUT("LINEOUT2"),
486 SND_SOC_DAPM_PGA("DL1", SND_SOC_NOPM
, 0, 0, NULL
, 0),
487 SND_SOC_DAPM_PGA("DL2", SND_SOC_NOPM
, 0, 0, NULL
, 0),
488 SND_SOC_DAPM_PGA("DL3", SND_SOC_NOPM
, 0, 0, NULL
, 0),
489 SND_SOC_DAPM_PGA("DL4", SND_SOC_NOPM
, 0, 0, NULL
, 0),
490 SND_SOC_DAPM_PGA("DL5", SND_SOC_NOPM
, 0, 0, NULL
, 0),
491 SND_SOC_DAPM_PGA("DL6", SND_SOC_NOPM
, 0, 0, NULL
, 0),
493 /* Analog input muxes for the capture amplifiers */
494 SND_SOC_DAPM_MUX("Analog Left Capture Route",
495 SND_SOC_NOPM
, 0, 0, &amic1_control
),
496 SND_SOC_DAPM_MUX("Analog Right Capture Route",
497 SND_SOC_NOPM
, 0, 0, &amic2_control
),
499 SND_SOC_DAPM_MUX("Sidetone Audio Playback", SND_SOC_NOPM
, 0, 0,
501 SND_SOC_DAPM_MUX("Sidetone Voice Playback", SND_SOC_NOPM
, 0, 0,
505 SND_SOC_DAPM_AIF_IN("INTF1_SDI", NULL
, 0, ISABELLE_INTF_EN_REG
, 7, 0),
506 SND_SOC_DAPM_AIF_IN("INTF2_SDI", NULL
, 0, ISABELLE_INTF_EN_REG
, 6, 0),
508 SND_SOC_DAPM_AIF_OUT("INTF1_SDO", NULL
, 0, ISABELLE_INTF_EN_REG
, 5, 0),
509 SND_SOC_DAPM_AIF_OUT("INTF2_SDO", NULL
, 0, ISABELLE_INTF_EN_REG
, 4, 0),
511 SND_SOC_DAPM_OUT_DRV("ULATX1", SND_SOC_NOPM
, 0, 0, NULL
, 0),
512 SND_SOC_DAPM_OUT_DRV("ULATX2", SND_SOC_NOPM
, 0, 0, NULL
, 0),
513 SND_SOC_DAPM_OUT_DRV("ULVTX1", SND_SOC_NOPM
, 0, 0, NULL
, 0),
514 SND_SOC_DAPM_OUT_DRV("ULVTX2", SND_SOC_NOPM
, 0, 0, NULL
, 0),
516 /* Analog Capture PGAs */
517 SND_SOC_DAPM_PGA("MicAmp1", ISABELLE_AMIC_CFG_REG
, 5, 0, NULL
, 0),
518 SND_SOC_DAPM_PGA("MicAmp2", ISABELLE_AMIC_CFG_REG
, 4, 0, NULL
, 0),
520 /* Auxiliary FM PGAs */
521 SND_SOC_DAPM_PGA("APGA1", ISABELLE_APGA_CFG_REG
, 7, 0, NULL
, 0),
522 SND_SOC_DAPM_PGA("APGA2", ISABELLE_APGA_CFG_REG
, 6, 0, NULL
, 0),
525 SND_SOC_DAPM_ADC("ADC1", "Left Front Capture",
526 ISABELLE_AMIC_CFG_REG
, 7, 0),
527 SND_SOC_DAPM_ADC("ADC2", "Right Front Capture",
528 ISABELLE_AMIC_CFG_REG
, 6, 0),
530 /* Microphone Bias */
531 SND_SOC_DAPM_SUPPLY("Headset Mic Bias", ISABELLE_ABIAS_CFG_REG
,
533 SND_SOC_DAPM_SUPPLY("Main Mic Bias", ISABELLE_ABIAS_CFG_REG
,
535 SND_SOC_DAPM_SUPPLY("Digital Mic1 Bias",
536 ISABELLE_DBIAS_CFG_REG
, 3, 0, NULL
, 0),
537 SND_SOC_DAPM_SUPPLY("Digital Mic2 Bias",
538 ISABELLE_DBIAS_CFG_REG
, 2, 0, NULL
, 0),
541 SND_SOC_DAPM_MIXER("Headset Left Mixer", SND_SOC_NOPM
, 0, 0,
542 isabelle_hs_left_mixer_controls
,
543 ARRAY_SIZE(isabelle_hs_left_mixer_controls
)),
544 SND_SOC_DAPM_MIXER("Headset Right Mixer", SND_SOC_NOPM
, 0, 0,
545 isabelle_hs_right_mixer_controls
,
546 ARRAY_SIZE(isabelle_hs_right_mixer_controls
)),
547 SND_SOC_DAPM_MIXER("Handsfree Left Mixer", SND_SOC_NOPM
, 0, 0,
548 isabelle_hf_left_mixer_controls
,
549 ARRAY_SIZE(isabelle_hf_left_mixer_controls
)),
550 SND_SOC_DAPM_MIXER("Handsfree Right Mixer", SND_SOC_NOPM
, 0, 0,
551 isabelle_hf_right_mixer_controls
,
552 ARRAY_SIZE(isabelle_hf_right_mixer_controls
)),
553 SND_SOC_DAPM_MIXER("LINEOUT1 Mixer", SND_SOC_NOPM
, 0, 0,
554 isabelle_aux_left_mixer_controls
,
555 ARRAY_SIZE(isabelle_aux_left_mixer_controls
)),
556 SND_SOC_DAPM_MIXER("LINEOUT2 Mixer", SND_SOC_NOPM
, 0, 0,
557 isabelle_aux_right_mixer_controls
,
558 ARRAY_SIZE(isabelle_aux_right_mixer_controls
)),
559 SND_SOC_DAPM_MIXER("Earphone Mixer", SND_SOC_NOPM
, 0, 0,
560 isabelle_ep_mixer_controls
,
561 ARRAY_SIZE(isabelle_ep_mixer_controls
)),
563 SND_SOC_DAPM_MIXER("DPGA1L Mixer", SND_SOC_NOPM
, 0, 0,
564 isabelle_dpga1_left_mixer_controls
,
565 ARRAY_SIZE(isabelle_dpga1_left_mixer_controls
)),
566 SND_SOC_DAPM_MIXER("DPGA1R Mixer", SND_SOC_NOPM
, 0, 0,
567 isabelle_dpga1_right_mixer_controls
,
568 ARRAY_SIZE(isabelle_dpga1_right_mixer_controls
)),
569 SND_SOC_DAPM_MIXER("DPGA2L Mixer", SND_SOC_NOPM
, 0, 0,
570 isabelle_dpga2_left_mixer_controls
,
571 ARRAY_SIZE(isabelle_dpga2_left_mixer_controls
)),
572 SND_SOC_DAPM_MIXER("DPGA2R Mixer", SND_SOC_NOPM
, 0, 0,
573 isabelle_dpga2_right_mixer_controls
,
574 ARRAY_SIZE(isabelle_dpga2_right_mixer_controls
)),
575 SND_SOC_DAPM_MIXER("DPGA3L Mixer", SND_SOC_NOPM
, 0, 0,
576 isabelle_dpga3_left_mixer_controls
,
577 ARRAY_SIZE(isabelle_dpga3_left_mixer_controls
)),
578 SND_SOC_DAPM_MIXER("DPGA3R Mixer", SND_SOC_NOPM
, 0, 0,
579 isabelle_dpga3_right_mixer_controls
,
580 ARRAY_SIZE(isabelle_dpga3_right_mixer_controls
)),
582 SND_SOC_DAPM_MIXER("RX1 Mixer", SND_SOC_NOPM
, 0, 0,
583 isabelle_rx1_mixer_controls
,
584 ARRAY_SIZE(isabelle_rx1_mixer_controls
)),
585 SND_SOC_DAPM_MIXER("RX2 Mixer", SND_SOC_NOPM
, 0, 0,
586 isabelle_rx2_mixer_controls
,
587 ARRAY_SIZE(isabelle_rx2_mixer_controls
)),
588 SND_SOC_DAPM_MIXER("RX3 Mixer", SND_SOC_NOPM
, 0, 0,
589 isabelle_rx3_mixer_controls
,
590 ARRAY_SIZE(isabelle_rx3_mixer_controls
)),
591 SND_SOC_DAPM_MIXER("RX4 Mixer", SND_SOC_NOPM
, 0, 0,
592 isabelle_rx4_mixer_controls
,
593 ARRAY_SIZE(isabelle_rx4_mixer_controls
)),
594 SND_SOC_DAPM_MIXER("RX5 Mixer", SND_SOC_NOPM
, 0, 0,
595 isabelle_rx5_mixer_controls
,
596 ARRAY_SIZE(isabelle_rx5_mixer_controls
)),
597 SND_SOC_DAPM_MIXER("RX6 Mixer", SND_SOC_NOPM
, 0, 0,
598 isabelle_rx6_mixer_controls
,
599 ARRAY_SIZE(isabelle_rx6_mixer_controls
)),
602 SND_SOC_DAPM_DAC("DAC1L", "Headset Playback", ISABELLE_DAC_CFG_REG
,
604 SND_SOC_DAPM_DAC("DAC1R", "Headset Playback", ISABELLE_DAC_CFG_REG
,
606 SND_SOC_DAPM_DAC("DAC2L", "Handsfree Playback", ISABELLE_DAC_CFG_REG
,
608 SND_SOC_DAPM_DAC("DAC2R", "Handsfree Playback", ISABELLE_DAC_CFG_REG
,
610 SND_SOC_DAPM_DAC("DAC3L", "Lineout Playback", ISABELLE_DAC_CFG_REG
,
612 SND_SOC_DAPM_DAC("DAC3R", "Lineout Playback", ISABELLE_DAC_CFG_REG
,
615 /* Analog Playback PGAs */
616 SND_SOC_DAPM_PGA("Sidetone Audio PGA", SND_SOC_NOPM
, 0, 0, NULL
, 0),
617 SND_SOC_DAPM_PGA("Sidetone Voice PGA", SND_SOC_NOPM
, 0, 0, NULL
, 0),
618 SND_SOC_DAPM_PGA("HF Left PGA", SND_SOC_NOPM
, 0, 0, NULL
, 0),
619 SND_SOC_DAPM_PGA("HF Right PGA", SND_SOC_NOPM
, 0, 0, NULL
, 0),
620 SND_SOC_DAPM_PGA("DPGA1L", SND_SOC_NOPM
, 0, 0, NULL
, 0),
621 SND_SOC_DAPM_PGA("DPGA1R", SND_SOC_NOPM
, 0, 0, NULL
, 0),
622 SND_SOC_DAPM_PGA("DPGA2L", SND_SOC_NOPM
, 0, 0, NULL
, 0),
623 SND_SOC_DAPM_PGA("DPGA2R", SND_SOC_NOPM
, 0, 0, NULL
, 0),
624 SND_SOC_DAPM_PGA("DPGA3L", SND_SOC_NOPM
, 0, 0, NULL
, 0),
625 SND_SOC_DAPM_PGA("DPGA3R", SND_SOC_NOPM
, 0, 0, NULL
, 0),
627 /* Analog Playback Mux */
628 SND_SOC_DAPM_MUX("RX1 Playback", ISABELLE_ALU_RX_EN_REG
, 5, 0,
630 SND_SOC_DAPM_MUX("RX2 Playback", ISABELLE_ALU_RX_EN_REG
, 4, 0,
634 SND_SOC_DAPM_MUX("ATX Select", ISABELLE_TX_INPUT_CFG_REG
,
635 7, 0, &atx_mux_controls
),
636 SND_SOC_DAPM_MUX("VTX Select", ISABELLE_TX_INPUT_CFG_REG
,
637 6, 0, &vtx_mux_controls
),
639 SND_SOC_DAPM_SWITCH("Earphone Playback", SND_SOC_NOPM
, 0, 0,
640 &ep_path_enable_control
),
643 SND_SOC_DAPM_OUT_DRV("HS Left Driver", ISABELLE_HSDRV_CFG2_REG
,
645 SND_SOC_DAPM_OUT_DRV("HS Right Driver", ISABELLE_HSDRV_CFG2_REG
,
647 SND_SOC_DAPM_OUT_DRV("LINEOUT1 Left Driver", ISABELLE_LINEAMP_CFG_REG
,
649 SND_SOC_DAPM_OUT_DRV("LINEOUT2 Right Driver", ISABELLE_LINEAMP_CFG_REG
,
651 SND_SOC_DAPM_OUT_DRV("Earphone Driver", ISABELLE_EARDRV_CFG2_REG
,
654 SND_SOC_DAPM_OUT_DRV("HF Left Driver", ISABELLE_HFDRV_CFG_REG
,
656 SND_SOC_DAPM_OUT_DRV("HF Right Driver", ISABELLE_HFDRV_CFG_REG
,
660 static const struct snd_soc_dapm_route isabelle_intercon
[] = {
661 /* Interface mapping */
662 { "DL1", "DL12 Playback Switch", "INTF1_SDI" },
663 { "DL2", "DL12 Playback Switch", "INTF1_SDI" },
664 { "DL3", "DL34 Playback Switch", "INTF1_SDI" },
665 { "DL4", "DL34 Playback Switch", "INTF1_SDI" },
666 { "DL5", "DL56 Playback Switch", "INTF1_SDI" },
667 { "DL6", "DL56 Playback Switch", "INTF1_SDI" },
669 { "DL1", "DL12 Playback Switch", "INTF2_SDI" },
670 { "DL2", "DL12 Playback Switch", "INTF2_SDI" },
671 { "DL3", "DL34 Playback Switch", "INTF2_SDI" },
672 { "DL4", "DL34 Playback Switch", "INTF2_SDI" },
673 { "DL5", "DL56 Playback Switch", "INTF2_SDI" },
674 { "DL6", "DL56 Playback Switch", "INTF2_SDI" },
676 /* Input side mapping */
677 { "Sidetone Audio PGA", NULL
, "Sidetone Audio Playback" },
678 { "Sidetone Voice PGA", NULL
, "Sidetone Voice Playback" },
680 { "RX1 Mixer", "ST1 Playback Switch", "Sidetone Audio PGA" },
682 { "RX1 Mixer", "ST1 Playback Switch", "Sidetone Voice PGA" },
683 { "RX1 Mixer", "DL1 Playback Switch", "DL1" },
685 { "RX2 Mixer", "ST2 Playback Switch", "Sidetone Audio PGA" },
687 { "RX2 Mixer", "ST2 Playback Switch", "Sidetone Voice PGA" },
688 { "RX2 Mixer", "DL2 Playback Switch", "DL2" },
690 { "RX3 Mixer", "ST1 Playback Switch", "Sidetone Voice PGA" },
691 { "RX3 Mixer", "DL3 Playback Switch", "DL3" },
693 { "RX4 Mixer", "ST2 Playback Switch", "Sidetone Voice PGA" },
694 { "RX4 Mixer", "DL4 Playback Switch", "DL4" },
696 { "RX5 Mixer", "ST1 Playback Switch", "Sidetone Voice PGA" },
697 { "RX5 Mixer", "DL5 Playback Switch", "DL5" },
699 { "RX6 Mixer", "ST2 Playback Switch", "Sidetone Voice PGA" },
700 { "RX6 Mixer", "DL6 Playback Switch", "DL6" },
703 { "Analog Left Capture Route", "Headset Mic", "HSMIC" },
704 { "Analog Left Capture Route", "Main Mic", "MAINMIC" },
705 { "Analog Left Capture Route", "Aux/FM Left", "LINEIN1" },
707 { "Analog Right Capture Route", "Sub Mic", "SUBMIC" },
708 { "Analog Right Capture Route", "Aux/FM Right", "LINEIN2" },
710 { "MicAmp1", NULL
, "Analog Left Capture Route" },
711 { "MicAmp2", NULL
, "Analog Right Capture Route" },
713 { "ADC1", NULL
, "MicAmp1" },
714 { "ADC2", NULL
, "MicAmp2" },
716 { "ATX Select", "AMIC1", "ADC1" },
717 { "ATX Select", "DMIC", "DMICDAT" },
718 { "ATX Select", "AMIC2", "ADC2" },
720 { "VTX Select", "AMIC1", "ADC1" },
721 { "VTX Select", "DMIC", "DMICDAT" },
722 { "VTX Select", "AMIC2", "ADC2" },
724 { "ULATX1", "ATX1 Filter Enable Switch", "ATX Select" },
725 { "ULATX1", "ATX1 Filter Bypass Switch", "ATX Select" },
726 { "ULATX2", "ATX2 Filter Enable Switch", "ATX Select" },
727 { "ULATX2", "ATX2 Filter Bypass Switch", "ATX Select" },
729 { "ULVTX1", "VTX1 Filter Enable Switch", "VTX Select" },
730 { "ULVTX1", "VTX1 Filter Bypass Switch", "VTX Select" },
731 { "ULVTX2", "VTX2 Filter Enable Switch", "VTX Select" },
732 { "ULVTX2", "VTX2 Filter Bypass Switch", "VTX Select" },
734 { "INTF1_SDO", "ULATX12 Capture Switch", "ULATX1" },
735 { "INTF1_SDO", "ULATX12 Capture Switch", "ULATX2" },
736 { "INTF2_SDO", "ULATX12 Capture Switch", "ULATX1" },
737 { "INTF2_SDO", "ULATX12 Capture Switch", "ULATX2" },
739 { "INTF1_SDO", NULL
, "ULVTX1" },
740 { "INTF1_SDO", NULL
, "ULVTX2" },
741 { "INTF2_SDO", NULL
, "ULVTX1" },
742 { "INTF2_SDO", NULL
, "ULVTX2" },
745 { "APGA1", NULL
, "LINEIN1" },
746 { "APGA2", NULL
, "LINEIN2" },
748 { "RX1 Playback", "VRX1 Filter Bypass Switch", "RX1 Mixer" },
749 { "RX1 Playback", "ARX1 Filter Bypass Switch", "RX1 Mixer" },
750 { "RX1 Playback", "RX1 Filter Enable Switch", "RX1 Mixer" },
752 { "RX2 Playback", "VRX2 Filter Bypass Switch", "RX2 Mixer" },
753 { "RX2 Playback", "ARX2 Filter Bypass Switch", "RX2 Mixer" },
754 { "RX2 Playback", "RX2 Filter Enable Switch", "RX2 Mixer" },
756 { "RX3 Playback", "ARX3 Filter Bypass Switch", "RX3 Mixer" },
757 { "RX3 Playback", "RX3 Filter Enable Switch", "RX3 Mixer" },
759 { "RX4 Playback", "ARX4 Filter Bypass Switch", "RX4 Mixer" },
760 { "RX4 Playback", "RX4 Filter Enable Switch", "RX4 Mixer" },
762 { "RX5 Playback", "ARX5 Filter Bypass Switch", "RX5 Mixer" },
763 { "RX5 Playback", "RX5 Filter Enable Switch", "RX5 Mixer" },
765 { "RX6 Playback", "ARX6 Filter Bypass Switch", "RX6 Mixer" },
766 { "RX6 Playback", "RX6 Filter Enable Switch", "RX6 Mixer" },
768 { "DPGA1L Mixer", "RX1 Playback Switch", "RX1 Playback" },
769 { "DPGA1L Mixer", "RX3 Playback Switch", "RX3 Playback" },
770 { "DPGA1L Mixer", "RX5 Playback Switch", "RX5 Playback" },
772 { "DPGA1R Mixer", "RX2 Playback Switch", "RX2 Playback" },
773 { "DPGA1R Mixer", "RX4 Playback Switch", "RX4 Playback" },
774 { "DPGA1R Mixer", "RX6 Playback Switch", "RX6 Playback" },
776 { "DPGA1L", NULL
, "DPGA1L Mixer" },
777 { "DPGA1R", NULL
, "DPGA1R Mixer" },
779 { "DAC1L", NULL
, "DPGA1L" },
780 { "DAC1R", NULL
, "DPGA1R" },
782 { "DPGA2L Mixer", "RX1 Playback Switch", "RX1 Playback" },
783 { "DPGA2L Mixer", "RX2 Playback Switch", "RX2 Playback" },
784 { "DPGA2L Mixer", "RX3 Playback Switch", "RX3 Playback" },
785 { "DPGA2L Mixer", "RX4 Playback Switch", "RX4 Playback" },
786 { "DPGA2L Mixer", "RX5 Playback Switch", "RX5 Playback" },
787 { "DPGA2L Mixer", "RX6 Playback Switch", "RX6 Playback" },
789 { "DPGA2R Mixer", "RX2 Playback Switch", "RX2 Playback" },
790 { "DPGA2R Mixer", "RX4 Playback Switch", "RX4 Playback" },
791 { "DPGA2R Mixer", "RX6 Playback Switch", "RX6 Playback" },
793 { "DPGA2L", NULL
, "DPGA2L Mixer" },
794 { "DPGA2R", NULL
, "DPGA2R Mixer" },
796 { "DAC2L", NULL
, "DPGA2L" },
797 { "DAC2R", NULL
, "DPGA2R" },
799 { "DPGA3L Mixer", "RX1 Playback Switch", "RX1 Playback" },
800 { "DPGA3L Mixer", "RX3 Playback Switch", "RX3 Playback" },
801 { "DPGA3L Mixer", "RX5 Playback Switch", "RX5 Playback" },
803 { "DPGA3R Mixer", "RX2 Playback Switch", "RX2 Playback" },
804 { "DPGA3R Mixer", "RX4 Playback Switch", "RX4 Playback" },
805 { "DPGA3R Mixer", "RX6 Playback Switch", "RX6 Playback" },
807 { "DPGA3L", NULL
, "DPGA3L Mixer" },
808 { "DPGA3R", NULL
, "DPGA3R Mixer" },
810 { "DAC3L", NULL
, "DPGA3L" },
811 { "DAC3R", NULL
, "DPGA3R" },
813 { "Headset Left Mixer", "DAC1L Playback Switch", "DAC1L" },
814 { "Headset Left Mixer", "APGA1 Playback Switch", "APGA1" },
816 { "Headset Right Mixer", "DAC1R Playback Switch", "DAC1R" },
817 { "Headset Right Mixer", "APGA2 Playback Switch", "APGA2" },
819 { "HS Left Driver", NULL
, "Headset Left Mixer" },
820 { "HS Right Driver", NULL
, "Headset Right Mixer" },
822 { "HSOL", NULL
, "HS Left Driver" },
823 { "HSOR", NULL
, "HS Right Driver" },
825 /* Earphone playback path */
826 { "Earphone Mixer", "DAC2L Playback Switch", "DAC2L" },
827 { "Earphone Mixer", "APGA1 Playback Switch", "APGA1" },
829 { "Earphone Playback", "Switch", "Earphone Mixer" },
830 { "Earphone Driver", NULL
, "Earphone Playback" },
831 { "EP", NULL
, "Earphone Driver" },
833 { "Handsfree Left Mixer", "DAC2L Playback Switch", "DAC2L" },
834 { "Handsfree Left Mixer", "APGA1 Playback Switch", "APGA1" },
836 { "Handsfree Right Mixer", "DAC2R Playback Switch", "DAC2R" },
837 { "Handsfree Right Mixer", "APGA2 Playback Switch", "APGA2" },
839 { "HF Left PGA", NULL
, "Handsfree Left Mixer" },
840 { "HF Right PGA", NULL
, "Handsfree Right Mixer" },
842 { "HF Left Driver", NULL
, "HF Left PGA" },
843 { "HF Right Driver", NULL
, "HF Right PGA" },
845 { "HFL", NULL
, "HF Left Driver" },
846 { "HFR", NULL
, "HF Right Driver" },
848 { "LINEOUT1 Mixer", "DAC3L Playback Switch", "DAC3L" },
849 { "LINEOUT1 Mixer", "APGA1 Playback Switch", "APGA1" },
851 { "LINEOUT2 Mixer", "DAC3R Playback Switch", "DAC3R" },
852 { "LINEOUT2 Mixer", "APGA2 Playback Switch", "APGA2" },
854 { "LINEOUT1 Driver", NULL
, "LINEOUT1 Mixer" },
855 { "LINEOUT2 Driver", NULL
, "LINEOUT2 Mixer" },
857 { "LINEOUT1", NULL
, "LINEOUT1 Driver" },
858 { "LINEOUT2", NULL
, "LINEOUT2 Driver" },
861 static int isabelle_hs_mute(struct snd_soc_dai
*dai
, int mute
)
863 snd_soc_update_bits(dai
->codec
, ISABELLE_DAC1_SOFTRAMP_REG
,
864 BIT(4), (mute
? BIT(4) : 0));
869 static int isabelle_hf_mute(struct snd_soc_dai
*dai
, int mute
)
871 snd_soc_update_bits(dai
->codec
, ISABELLE_DAC2_SOFTRAMP_REG
,
872 BIT(4), (mute
? BIT(4) : 0));
877 static int isabelle_line_mute(struct snd_soc_dai
*dai
, int mute
)
879 snd_soc_update_bits(dai
->codec
, ISABELLE_DAC3_SOFTRAMP_REG
,
880 BIT(4), (mute
? BIT(4) : 0));
885 static int isabelle_set_bias_level(struct snd_soc_codec
*codec
,
886 enum snd_soc_bias_level level
)
889 case SND_SOC_BIAS_ON
:
891 case SND_SOC_BIAS_PREPARE
:
894 case SND_SOC_BIAS_STANDBY
:
895 snd_soc_update_bits(codec
, ISABELLE_PWR_EN_REG
,
896 ISABELLE_CHIP_EN
, BIT(0));
899 case SND_SOC_BIAS_OFF
:
900 snd_soc_update_bits(codec
, ISABELLE_PWR_EN_REG
,
901 ISABELLE_CHIP_EN
, 0);
905 codec
->dapm
.bias_level
= level
;
910 static int isabelle_hw_params(struct snd_pcm_substream
*substream
,
911 struct snd_pcm_hw_params
*params
,
912 struct snd_soc_dai
*dai
)
914 struct snd_soc_pcm_runtime
*rtd
= substream
->private_data
;
915 struct snd_soc_codec
*codec
= rtd
->codec
;
917 unsigned int fs_val
= 0;
919 switch (params_rate(params
)) {
921 fs_val
= ISABELLE_FS_RATE_8
;
924 fs_val
= ISABELLE_FS_RATE_11
;
927 fs_val
= ISABELLE_FS_RATE_12
;
930 fs_val
= ISABELLE_FS_RATE_16
;
933 fs_val
= ISABELLE_FS_RATE_22
;
936 fs_val
= ISABELLE_FS_RATE_24
;
939 fs_val
= ISABELLE_FS_RATE_32
;
942 fs_val
= ISABELLE_FS_RATE_44
;
945 fs_val
= ISABELLE_FS_RATE_48
;
951 snd_soc_update_bits(codec
, ISABELLE_FS_RATE_CFG_REG
,
952 ISABELLE_FS_RATE_MASK
, fs_val
);
955 switch (params_format(params
)) {
956 case SNDRV_PCM_FORMAT_S20_3LE
:
957 aif
|= ISABELLE_AIF_LENGTH_20
;
959 case SNDRV_PCM_FORMAT_S32_LE
:
960 aif
|= ISABELLE_AIF_LENGTH_32
;
966 snd_soc_update_bits(codec
, ISABELLE_INTF_CFG_REG
,
967 ISABELLE_AIF_LENGTH_MASK
, aif
);
972 static int isabelle_set_dai_fmt(struct snd_soc_dai
*codec_dai
, unsigned int fmt
)
974 struct snd_soc_codec
*codec
= codec_dai
->codec
;
975 unsigned int aif_val
= 0;
977 switch (fmt
& SND_SOC_DAIFMT_MASTER_MASK
) {
978 case SND_SOC_DAIFMT_CBS_CFS
:
979 aif_val
&= ~ISABELLE_AIF_MS
;
981 case SND_SOC_DAIFMT_CBM_CFM
:
982 aif_val
|= ISABELLE_AIF_MS
;
988 switch (fmt
& SND_SOC_DAIFMT_FORMAT_MASK
) {
989 case SND_SOC_DAIFMT_I2S
:
990 aif_val
|= ISABELLE_I2S_MODE
;
992 case SND_SOC_DAIFMT_LEFT_J
:
993 aif_val
|= ISABELLE_LEFT_J_MODE
;
995 case SND_SOC_DAIFMT_PDM
:
996 aif_val
|= ISABELLE_PDM_MODE
;
1002 snd_soc_update_bits(codec
, ISABELLE_INTF_CFG_REG
,
1003 (ISABELLE_AIF_MS
| ISABELLE_AIF_FMT_MASK
), aif_val
);
1008 /* Rates supported by Isabelle driver */
1009 #define ISABELLE_RATES SNDRV_PCM_RATE_8000_48000
1011 /* Formates supported by Isabelle driver. */
1012 #define ISABELLE_FORMATS (SNDRV_PCM_FMTBIT_S20_3LE |\
1013 SNDRV_PCM_FMTBIT_S32_LE)
1015 static struct snd_soc_dai_ops isabelle_hs_dai_ops
= {
1016 .hw_params
= isabelle_hw_params
,
1017 .set_fmt
= isabelle_set_dai_fmt
,
1018 .digital_mute
= isabelle_hs_mute
,
1021 static struct snd_soc_dai_ops isabelle_hf_dai_ops
= {
1022 .hw_params
= isabelle_hw_params
,
1023 .set_fmt
= isabelle_set_dai_fmt
,
1024 .digital_mute
= isabelle_hf_mute
,
1027 static struct snd_soc_dai_ops isabelle_line_dai_ops
= {
1028 .hw_params
= isabelle_hw_params
,
1029 .set_fmt
= isabelle_set_dai_fmt
,
1030 .digital_mute
= isabelle_line_mute
,
1033 static struct snd_soc_dai_ops isabelle_ul_dai_ops
= {
1034 .hw_params
= isabelle_hw_params
,
1035 .set_fmt
= isabelle_set_dai_fmt
,
1038 /* ISABELLE dai structure */
1039 static struct snd_soc_dai_driver isabelle_dai
[] = {
1041 .name
= "isabelle-dl1",
1043 .stream_name
= "Headset Playback",
1046 .rates
= ISABELLE_RATES
,
1047 .formats
= ISABELLE_FORMATS
,
1049 .ops
= &isabelle_hs_dai_ops
,
1052 .name
= "isabelle-dl2",
1054 .stream_name
= "Handsfree Playback",
1057 .rates
= ISABELLE_RATES
,
1058 .formats
= ISABELLE_FORMATS
,
1060 .ops
= &isabelle_hf_dai_ops
,
1063 .name
= "isabelle-lineout",
1065 .stream_name
= "Lineout Playback",
1068 .rates
= ISABELLE_RATES
,
1069 .formats
= ISABELLE_FORMATS
,
1071 .ops
= &isabelle_line_dai_ops
,
1074 .name
= "isabelle-ul",
1076 .stream_name
= "Capture",
1079 .rates
= ISABELLE_RATES
,
1080 .formats
= ISABELLE_FORMATS
,
1082 .ops
= &isabelle_ul_dai_ops
,
1086 static int isabelle_probe(struct snd_soc_codec
*codec
)
1090 codec
->control_data
= dev_get_regmap(codec
->dev
, NULL
);
1092 ret
= snd_soc_codec_set_cache_io(codec
, 8, 8, SND_SOC_REGMAP
);
1094 dev_err(codec
->dev
, "Failed to set cache I/O: %d\n", ret
);
1101 static struct snd_soc_codec_driver soc_codec_dev_isabelle
= {
1102 .probe
= isabelle_probe
,
1103 .set_bias_level
= isabelle_set_bias_level
,
1104 .controls
= isabelle_snd_controls
,
1105 .num_controls
= ARRAY_SIZE(isabelle_snd_controls
),
1106 .dapm_widgets
= isabelle_dapm_widgets
,
1107 .num_dapm_widgets
= ARRAY_SIZE(isabelle_dapm_widgets
),
1108 .dapm_routes
= isabelle_intercon
,
1109 .num_dapm_routes
= ARRAY_SIZE(isabelle_intercon
),
1110 .idle_bias_off
= true,
1113 static const struct regmap_config isabelle_regmap_config
= {
1117 .max_register
= ISABELLE_MAX_REGISTER
,
1118 .reg_defaults
= isabelle_reg_defs
,
1119 .num_reg_defaults
= ARRAY_SIZE(isabelle_reg_defs
),
1120 .cache_type
= REGCACHE_RBTREE
,
1123 static int __devinit
isabelle_i2c_probe(struct i2c_client
*i2c
,
1124 const struct i2c_device_id
*id
)
1126 struct regmap
*isabelle_regmap
;
1129 isabelle_regmap
= devm_regmap_init_i2c(i2c
, &isabelle_regmap_config
);
1130 if (IS_ERR(isabelle_regmap
)) {
1131 ret
= PTR_ERR(isabelle_regmap
);
1132 dev_err(&i2c
->dev
, "Failed to allocate register map: %d\n",
1136 i2c_set_clientdata(i2c
, isabelle_regmap
);
1138 ret
= snd_soc_register_codec(&i2c
->dev
,
1139 &soc_codec_dev_isabelle
, isabelle_dai
,
1140 ARRAY_SIZE(isabelle_dai
));
1142 dev_err(&i2c
->dev
, "Failed to register codec: %d\n", ret
);
1149 static int __devexit
isabelle_i2c_remove(struct i2c_client
*client
)
1151 snd_soc_unregister_codec(&client
->dev
);
1155 static const struct i2c_device_id isabelle_i2c_id
[] = {
1159 MODULE_DEVICE_TABLE(i2c
, isabelle_i2c_id
);
1161 static struct i2c_driver isabelle_i2c_driver
= {
1164 .owner
= THIS_MODULE
,
1166 .probe
= isabelle_i2c_probe
,
1167 .remove
= __devexit_p(isabelle_i2c_remove
),
1168 .id_table
= isabelle_i2c_id
,
1171 module_i2c_driver(isabelle_i2c_driver
);
1173 MODULE_DESCRIPTION("ASoC ISABELLE driver");
1174 MODULE_AUTHOR("Vishwas A Deshpande <vishwas.a.deshpande@ti.com>");
1175 MODULE_AUTHOR("M R Swami Reddy <MR.Swami.Reddy@ti.com>");
1176 MODULE_LICENSE("GPL v2");