aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-10 07:22:15 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-10 07:22:15 -0500
commitc31b71de6f7bdbec205920077c684b55e92355ed (patch)
tree6e0beb9071a170bf637036ac6ccef6ef1f83c070 /sound
parentfa17cb4a02b698eb7086effd43b277a01372c0d8 (diff)
parent9dc754dfa78ca4ef9a117245e5ae3b9b7312d59d (diff)
Merge remote-tracking branch 'asoc/fix/lm49453' into tmp
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/lm49453.c106
1 files changed, 40 insertions, 66 deletions
diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c
index d75257d40a49..e19490cfb3a8 100644
--- a/sound/soc/codecs/lm49453.c
+++ b/sound/soc/codecs/lm49453.c
@@ -111,9 +111,9 @@ static struct reg_default lm49453_reg_defs[] = {
111 { 101, 0x00 }, 111 { 101, 0x00 },
112 { 102, 0x00 }, 112 { 102, 0x00 },
113 { 103, 0x01 }, 113 { 103, 0x01 },
114 { 105, 0x01 }, 114 { 104, 0x01 },
115 { 106, 0x00 }, 115 { 105, 0x00 },
116 { 107, 0x01 }, 116 { 106, 0x01 },
117 { 107, 0x00 }, 117 { 107, 0x00 },
118 { 108, 0x00 }, 118 { 108, 0x00 },
119 { 109, 0x00 }, 119 { 109, 0x00 },
@@ -163,56 +163,25 @@ static struct reg_default lm49453_reg_defs[] = {
163 { 184, 0x00 }, 163 { 184, 0x00 },
164 { 185, 0x00 }, 164 { 185, 0x00 },
165 { 186, 0x00 }, 165 { 186, 0x00 },
166 { 189, 0x00 }, 166 { 187, 0x00 },
167 { 188, 0x00 }, 167 { 188, 0x00 },
168 { 194, 0x00 }, 168 { 189, 0x00 },
169 { 195, 0x00 }, 169 { 208, 0x06 },
170 { 196, 0x00 },
171 { 197, 0x00 },
172 { 200, 0x00 },
173 { 201, 0x00 },
174 { 202, 0x00 },
175 { 203, 0x00 },
176 { 204, 0x00 },
177 { 205, 0x00 },
178 { 208, 0x00 },
179 { 209, 0x00 }, 170 { 209, 0x00 },
180 { 210, 0x00 }, 171 { 210, 0x08 },
181 { 211, 0x00 }, 172 { 211, 0x54 },
182 { 213, 0x00 }, 173 { 212, 0x14 },
183 { 214, 0x00 }, 174 { 213, 0x0d },
184 { 215, 0x00 }, 175 { 214, 0x0d },
185 { 216, 0x00 }, 176 { 215, 0x14 },
186 { 217, 0x00 }, 177 { 216, 0x60 },
187 { 218, 0x00 },
188 { 219, 0x00 },
189 { 221, 0x00 }, 178 { 221, 0x00 },
190 { 222, 0x00 }, 179 { 222, 0x00 },
180 { 223, 0x00 },
191 { 224, 0x00 }, 181 { 224, 0x00 },
192 { 225, 0x00 },
193 { 226, 0x00 },
194 { 227, 0x00 },
195 { 228, 0x00 },
196 { 229, 0x00 },
197 { 230, 0x13 },
198 { 231, 0x00 },
199 { 232, 0x80 },
200 { 233, 0x0C },
201 { 234, 0xDD },
202 { 235, 0x00 },
203 { 236, 0x04 },
204 { 237, 0x00 },
205 { 238, 0x00 },
206 { 239, 0x00 },
207 { 240, 0x00 },
208 { 241, 0x00 },
209 { 242, 0x00 },
210 { 243, 0x00 },
211 { 244, 0x00 },
212 { 245, 0x00 },
213 { 248, 0x00 }, 182 { 248, 0x00 },
214 { 249, 0x00 }, 183 { 249, 0x00 },
215 { 254, 0x00 }, 184 { 250, 0x00 },
216 { 255, 0x00 }, 185 { 255, 0x00 },
217}; 186};
218 187
@@ -525,36 +494,41 @@ SOC_DAPM_SINGLE("Port2_2 Switch", LM49453_P0_PORT2_TX2_REG, 7, 1, 0),
525}; 494};
526 495
527/* TLV Declarations */ 496/* TLV Declarations */
528static const DECLARE_TLV_DB_SCALE(digital_tlv, -7650, 150, 1); 497static const DECLARE_TLV_DB_SCALE(adc_dac_tlv, -7650, 150, 1);
529static const DECLARE_TLV_DB_SCALE(port_tlv, 0, 600, 0); 498static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 200, 1);
499static const DECLARE_TLV_DB_SCALE(port_tlv, -1800, 600, 0);
500static const DECLARE_TLV_DB_SCALE(stn_tlv, -7200, 150, 0);
530 501
531static const struct snd_kcontrol_new lm49453_sidetone_mixer_controls[] = { 502static const struct snd_kcontrol_new lm49453_sidetone_mixer_controls[] = {
532/* Sidetone supports mono only */ 503/* Sidetone supports mono only */
533SOC_DAPM_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG, 504SOC_DAPM_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG,
534 0, 0x3F, 0, digital_tlv), 505 0, 0x3F, 0, stn_tlv),
535SOC_DAPM_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG, 506SOC_DAPM_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG,
536 0, 0x3F, 0, digital_tlv), 507 0, 0x3F, 0, stn_tlv),
537SOC_DAPM_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG, 508SOC_DAPM_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG,
538 0, 0x3F, 0, digital_tlv), 509 0, 0x3F, 0, stn_tlv),
539SOC_DAPM_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG, 510SOC_DAPM_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG,
540 0, 0x3F, 0, digital_tlv), 511 0, 0x3F, 0, stn_tlv),
541SOC_DAPM_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG, 512SOC_DAPM_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG,
542 0, 0x3F, 0, digital_tlv), 513 0, 0x3F, 0, stn_tlv),
543SOC_DAPM_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG, 514SOC_DAPM_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG,
544 0, 0x3F, 0, digital_tlv), 515 0, 0x3F, 0, stn_tlv),
545}; 516};
546 517
547static const struct snd_kcontrol_new lm49453_snd_controls[] = { 518static const struct snd_kcontrol_new lm49453_snd_controls[] = {
548 /* mic1 and mic2 supports mono only */ 519 /* mic1 and mic2 supports mono only */
549 SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_ADC_LEVELL_REG, 0, 6, 520 SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_MICL_REG, 0, 15, 0, mic_tlv),
550 0, digital_tlv), 521 SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_MICR_REG, 0, 15, 0, mic_tlv),
551 SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_ADC_LEVELR_REG, 0, 6, 522
552 0, digital_tlv), 523 SOC_SINGLE_TLV("ADCL Volume", LM49453_P0_ADC_LEVELL_REG, 0, 63,
524 0, adc_dac_tlv),
525 SOC_SINGLE_TLV("ADCR Volume", LM49453_P0_ADC_LEVELR_REG, 0, 63,
526 0, adc_dac_tlv),
553 527
554 SOC_DOUBLE_R_TLV("DMIC1 Volume", LM49453_P0_DMIC1_LEVELL_REG, 528 SOC_DOUBLE_R_TLV("DMIC1 Volume", LM49453_P0_DMIC1_LEVELL_REG,
555 LM49453_P0_DMIC1_LEVELR_REG, 0, 6, 0, digital_tlv), 529 LM49453_P0_DMIC1_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
556 SOC_DOUBLE_R_TLV("DMIC2 Volume", LM49453_P0_DMIC2_LEVELL_REG, 530 SOC_DOUBLE_R_TLV("DMIC2 Volume", LM49453_P0_DMIC2_LEVELL_REG,
557 LM49453_P0_DMIC2_LEVELR_REG, 0, 6, 0, digital_tlv), 531 LM49453_P0_DMIC2_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
558 532
559 SOC_DAPM_ENUM("Mic2Mode", lm49453_mic2mode_enum), 533 SOC_DAPM_ENUM("Mic2Mode", lm49453_mic2mode_enum),
560 SOC_DAPM_ENUM("DMIC12 SRC", lm49453_dmic12_cfg_enum), 534 SOC_DAPM_ENUM("DMIC12 SRC", lm49453_dmic12_cfg_enum),
@@ -569,16 +543,16 @@ static const struct snd_kcontrol_new lm49453_snd_controls[] = {
569 2, 1, 0), 543 2, 1, 0),
570 544
571 SOC_DOUBLE_R_TLV("DAC HP Volume", LM49453_P0_DAC_HP_LEVELL_REG, 545 SOC_DOUBLE_R_TLV("DAC HP Volume", LM49453_P0_DAC_HP_LEVELL_REG,
572 LM49453_P0_DAC_HP_LEVELR_REG, 0, 6, 0, digital_tlv), 546 LM49453_P0_DAC_HP_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
573 SOC_DOUBLE_R_TLV("DAC LO Volume", LM49453_P0_DAC_LO_LEVELL_REG, 547 SOC_DOUBLE_R_TLV("DAC LO Volume", LM49453_P0_DAC_LO_LEVELL_REG,
574 LM49453_P0_DAC_LO_LEVELR_REG, 0, 6, 0, digital_tlv), 548 LM49453_P0_DAC_LO_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
575 SOC_DOUBLE_R_TLV("DAC LS Volume", LM49453_P0_DAC_LS_LEVELL_REG, 549 SOC_DOUBLE_R_TLV("DAC LS Volume", LM49453_P0_DAC_LS_LEVELL_REG,
576 LM49453_P0_DAC_LS_LEVELR_REG, 0, 6, 0, digital_tlv), 550 LM49453_P0_DAC_LS_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
577 SOC_DOUBLE_R_TLV("DAC HA Volume", LM49453_P0_DAC_HA_LEVELL_REG, 551 SOC_DOUBLE_R_TLV("DAC HA Volume", LM49453_P0_DAC_HA_LEVELL_REG,
578 LM49453_P0_DAC_HA_LEVELR_REG, 0, 6, 0, digital_tlv), 552 LM49453_P0_DAC_HA_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
579 553
580 SOC_SINGLE_TLV("EP Volume", LM49453_P0_DAC_LS_LEVELL_REG, 554 SOC_SINGLE_TLV("EP Volume", LM49453_P0_DAC_LS_LEVELL_REG,
581 0, 6, 0, digital_tlv), 555 0, 63, 0, adc_dac_tlv),
582 556
583 SOC_SINGLE_TLV("PORT1_1_RX_LVL Volume", LM49453_P0_PORT1_RX_LVL1_REG, 557 SOC_SINGLE_TLV("PORT1_1_RX_LVL Volume", LM49453_P0_PORT1_RX_LVL1_REG,
584 0, 3, 0, port_tlv), 558 0, 3, 0, port_tlv),
@@ -1218,7 +1192,7 @@ static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
1218 } 1192 }
1219 1193
1220 snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG, 1194 snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG,
1221 LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(1)|BIT(5), 1195 LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(0)|BIT(5),
1222 (aif_val | mode | clk_phase)); 1196 (aif_val | mode | clk_phase));
1223 1197
1224 snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift); 1198 snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift);