Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334466
b: refs/heads/master
c: c7c0f2c
h: refs/heads/master
v: v3
  • Loading branch information
Ashish Chavan authored and Mark Brown committed Oct 11, 2012
1 parent f8ff2ff commit eaa514e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 961a7aeafab477f63d9eef26afde9cbb8badcd0f
refs/heads/master: c7c0f2cdef1362c5fe301a1ffa8379824ee3f813
22 changes: 21 additions & 1 deletion trunk/sound/soc/codecs/da9055.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,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)

Expand Down Expand Up @@ -476,7 +482,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]) {
Expand All @@ -485,6 +491,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);
Expand Down Expand Up @@ -520,6 +536,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);
Expand Down

0 comments on commit eaa514e

Please sign in to comment.