diff options
author | Margarita Olaya Cabrera <magi.olaya@ti.com> | 2010-06-16 14:40:38 -0500 |
---|---|---|
committer | Jorge Eduardo Candelaria <jorge.candelaria@ti.com> | 2010-06-18 11:37:30 -0500 |
commit | 50067097cc516b938881cc5de95c4b4cd596d259 (patch) | |
tree | f052247890bfcb50c862c51f1391ebf057124f49 | |
parent | dc226897d359908b45101af24b5f8ee0edae8aca (diff) |
ASoC: ABE-TWL6040: Add digital_mute callback
Created twl6040_mute in order to mute the analog path
before stopping McPDM channels, this reduces the pop at
stop.
Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
-rw-r--r-- | sound/soc/codecs/abe-twl6040.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sound/soc/codecs/abe-twl6040.c b/sound/soc/codecs/abe-twl6040.c index c5bf9c9b23dd..52c9ce25bbf7 100644 --- a/sound/soc/codecs/abe-twl6040.c +++ b/sound/soc/codecs/abe-twl6040.c @@ -1361,9 +1361,35 @@ static void abe_mm_shutdown(struct snd_pcm_substream *substream, pdata->device_idle(pdev); } +static int twl6040_mute(struct snd_soc_dai *dai, int mute) +{ + struct snd_soc_codec *codec = dai->codec; + struct twl6040_data *priv = codec->private_data; + + int hs_gain, hf_gain; + + hf_gain = twl6040_read_reg_cache(codec, TWL6040_REG_HFRGAIN); + hs_gain = twl6040_read_reg_cache(codec, TWL6040_REG_HSGAIN); + + if (mute) { + if (priv->mcpdm_dl_enable == 1) { + twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, 0x1D, TWL6040_REG_HFRGAIN); + twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, 0x1D, TWL6040_REG_HFLGAIN); + twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, 0xFF, TWL6040_REG_HSGAIN); + } + } else { + twl6040_write(codec, TWL6040_REG_HFRGAIN, hf_gain); + twl6040_write(codec, TWL6040_REG_HFLGAIN, hf_gain); + twl6040_write(codec, TWL6040_REG_HSGAIN, hs_gain); + } + + return 0; +} + static struct snd_soc_dai_ops abe_mm_dai_ops = { .startup = abe_mm_startup, .hw_params = abe_mm_hw_params, + .digital_mute = twl6040_mute, .shutdown = abe_mm_shutdown, .trigger = abe_mm_trigger, .set_sysclk = twl6040_set_dai_sysclk, @@ -1506,6 +1532,7 @@ static void abe_tones_shutdown(struct snd_pcm_substream *substream, static struct snd_soc_dai_ops abe_tones_dai_ops = { .startup = abe_mm_startup, .hw_params = abe_tones_hw_params, + .digital_mute = twl6040_mute, .shutdown = abe_tones_shutdown, .trigger = abe_tones_trigger, .set_sysclk = twl6040_set_dai_sysclk, @@ -1735,6 +1762,7 @@ static void abe_voice_shutdown(struct snd_pcm_substream *substream, static struct snd_soc_dai_ops abe_voice_dai_ops = { .startup = abe_voice_startup, .hw_params = abe_voice_hw_params, + .digital_mute = twl6040_mute, .shutdown = abe_voice_shutdown, .trigger = abe_voice_trigger, .set_sysclk = twl6040_set_dai_sysclk, |