aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorAshish Chavan <ashish.chavan@kpitcummins.com>2012-10-11 04:34:37 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-10-11 04:42:31 -0400
commitc7c0f2cdef1362c5fe301a1ffa8379824ee3f813 (patch)
treed3848d3c93ce6b6db76b20befb91c9822474f4d8 /sound
parent961a7aeafab477f63d9eef26afde9cbb8badcd0f (diff)
ASoC: codecs: da9055: Minor improvement in ALC calibration process
This patch slightly improves ALC calibration process of da9055 codec driver by muting Mic PGAs during calibration. Signed-off-by: Ashish Chavan <ashish.chavan@kpitcummins.com> Signed-off-by: David Dajun Chen <david.chen@diasemi.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/da9055.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
index 185d8dd36399..f379b085c392 100644
--- a/sound/soc/codecs/da9055.c
+++ b/sound/soc/codecs/da9055.c
@@ -178,6 +178,12 @@
178#define DA9055_AIF_WORD_S24_LE (2 << 2) 178#define DA9055_AIF_WORD_S24_LE (2 << 2)
179#define DA9055_AIF_WORD_S32_LE (3 << 2) 179#define DA9055_AIF_WORD_S32_LE (3 << 2)
180 180
181/* MIC_L_CTRL bit fields */
182#define DA9055_MIC_L_MUTE_EN (1 << 6)
183
184/* MIC_R_CTRL bit fields */
185#define DA9055_MIC_R_MUTE_EN (1 << 6)
186
181/* MIXIN_L_CTRL bit fields */ 187/* MIXIN_L_CTRL bit fields */
182#define DA9055_MIXIN_L_MIX_EN (1 << 3) 188#define DA9055_MIXIN_L_MIX_EN (1 << 3)
183 189
@@ -476,7 +482,7 @@ static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
476 struct snd_ctl_elem_value *ucontrol) 482 struct snd_ctl_elem_value *ucontrol)
477{ 483{
478 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 484 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
479 u8 reg_val, adc_left, adc_right; 485 u8 reg_val, adc_left, adc_right, mic_left, mic_right;
480 int avg_left_data, avg_right_data, offset_l, offset_r; 486 int avg_left_data, avg_right_data, offset_l, offset_r;
481 487
482 if (ucontrol->value.integer.value[0]) { 488 if (ucontrol->value.integer.value[0]) {
@@ -485,6 +491,16 @@ static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
485 * offsets must be done first 491 * offsets must be done first
486 */ 492 */
487 493
494 /* Save current values from Mic control registers */
495 mic_left = snd_soc_read(codec, DA9055_MIC_L_CTRL);
496 mic_right = snd_soc_read(codec, DA9055_MIC_R_CTRL);
497
498 /* Mute Mic PGA Left and Right */
499 snd_soc_update_bits(codec, DA9055_MIC_L_CTRL,
500 DA9055_MIC_L_MUTE_EN, DA9055_MIC_L_MUTE_EN);
501 snd_soc_update_bits(codec, DA9055_MIC_R_CTRL,
502 DA9055_MIC_R_MUTE_EN, DA9055_MIC_R_MUTE_EN);
503
488 /* Save current values from ADC control registers */ 504 /* Save current values from ADC control registers */
489 adc_left = snd_soc_read(codec, DA9055_ADC_L_CTRL); 505 adc_left = snd_soc_read(codec, DA9055_ADC_L_CTRL);
490 adc_right = snd_soc_read(codec, DA9055_ADC_R_CTRL); 506 adc_right = snd_soc_read(codec, DA9055_ADC_R_CTRL);
@@ -520,6 +536,10 @@ static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
520 /* Restore original values of ADC control registers */ 536 /* Restore original values of ADC control registers */
521 snd_soc_write(codec, DA9055_ADC_L_CTRL, adc_left); 537 snd_soc_write(codec, DA9055_ADC_L_CTRL, adc_left);
522 snd_soc_write(codec, DA9055_ADC_R_CTRL, adc_right); 538 snd_soc_write(codec, DA9055_ADC_R_CTRL, adc_right);
539
540 /* Restore original values of Mic control registers */
541 snd_soc_write(codec, DA9055_MIC_L_CTRL, mic_left);
542 snd_soc_write(codec, DA9055_MIC_R_CTRL, mic_right);
523 } 543 }
524 544
525 return snd_soc_put_volsw(kcontrol, ucontrol); 545 return snd_soc_put_volsw(kcontrol, ucontrol);