* [alsa-devel] [PATCH] ASoC: codecs: da9055: Minor improvement in ALC calibration process
@ 2012-10-11 8:34 Ashish Chavan
2012-10-11 8:42 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Ashish Chavan @ 2012-10-11 8:34 UTC (permalink / raw)
To: Mark Brown, lrg, alsa-devel; +Cc: David Dajun Chen, linux-kernel
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>
---
sound/soc/codecs/da9055.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
index 27c4454..abf3e43 100644
--- a/sound/soc/codecs/da9055.c
+++ b/sound/soc/codecs/da9055.c
@@ -179,6 +179,12 @@
#define DA9055_AIF_WORD_S24_LE (2 << 2)
#define DA9055_AIF_WORD_S32_LE (3 << 2)
+/* MIC_L_CTRL bit fields */
+#define DA9055_MIC_L_MUTE_EN (1 << 6)
+
+/* MIC_R_CTRL bit fields */
+#define DA9055_MIC_R_MUTE_EN (1 << 6)
+
/* MIXIN_L_CTRL bit fields */
#define DA9055_MIXIN_L_MIX_EN (1 << 3)
@@ -477,7 +483,7 @@ static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
- u8 reg_val, adc_left, adc_right;
+ u8 reg_val, adc_left, adc_right, mic_left, mic_right;
int avg_left_data, avg_right_data, offset_l, offset_r;
if (ucontrol->value.integer.value[0]) {
@@ -486,6 +492,16 @@ static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
* offsets must be done first
*/
+ /* Save current values from Mic control registers */
+ mic_left = snd_soc_read(codec, DA9055_MIC_L_CTRL);
+ mic_right = snd_soc_read(codec, DA9055_MIC_R_CTRL);
+
+ /* Mute Mic PGA Left and Right */
+ snd_soc_update_bits(codec, DA9055_MIC_L_CTRL,
+ DA9055_MIC_L_MUTE_EN, DA9055_MIC_L_MUTE_EN);
+ snd_soc_update_bits(codec, DA9055_MIC_R_CTRL,
+ DA9055_MIC_R_MUTE_EN, DA9055_MIC_R_MUTE_EN);
+
/* Save current values from ADC control registers */
adc_left = snd_soc_read(codec, DA9055_ADC_L_CTRL);
adc_right = snd_soc_read(codec, DA9055_ADC_R_CTRL);
@@ -521,6 +537,10 @@ static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
/* Restore original values of ADC control registers */
snd_soc_write(codec, DA9055_ADC_L_CTRL, adc_left);
snd_soc_write(codec, DA9055_ADC_R_CTRL, adc_right);
+
+ /* Restore original values of Mic control registers */
+ snd_soc_write(codec, DA9055_MIC_L_CTRL, mic_left);
+ snd_soc_write(codec, DA9055_MIC_R_CTRL, mic_right);
}
return snd_soc_put_volsw(kcontrol, ucontrol);
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [alsa-devel] [PATCH] ASoC: codecs: da9055: Minor improvement in ALC calibration process
2012-10-11 8:34 [alsa-devel] [PATCH] ASoC: codecs: da9055: Minor improvement in ALC calibration process Ashish Chavan
@ 2012-10-11 8:42 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-10-11 8:42 UTC (permalink / raw)
To: Ashish Chavan; +Cc: lrg, alsa-devel, David Dajun Chen, linux-kernel
On Thu, Oct 11, 2012 at 02:04:37PM +0530, Ashish Chavan wrote:
> This patch slightly improves ALC calibration process of da9055 codec
> driver by muting Mic PGAs during calibration.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-11 8:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-11 8:34 [alsa-devel] [PATCH] ASoC: codecs: da9055: Minor improvement in ALC calibration process Ashish Chavan
2012-10-11 8:42 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).