| From 9c25a0a4023775793af9678041183eb80b268ac5 Mon Sep 17 00:00:00 2001 |
| From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| Date: Thu, 10 Nov 2011 16:21:01 -0800 |
| Subject: ASoC: ak4642: add ak4642_set_bias_level() |
| |
| Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> |
| (cherry picked from commit ed2dd7da35cad3115c38fd42eecbecae899a1d7a) |
| |
| Signed-off-by: Simon Horman <horms@verge.net.au> |
| --- |
| sound/soc/codecs/ak4642.c | 33 +++++++++++++++++++++++++++++---- |
| 1 file changed, 29 insertions(+), 4 deletions(-) |
| |
| diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c |
| index 96f6e2f..8946580 100644 |
| --- a/sound/soc/codecs/ak4642.c |
| +++ b/sound/soc/codecs/ak4642.c |
| @@ -195,8 +195,8 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, |
| snd_soc_update_bits(codec, MD_CTL3, BST1, BST1); |
| snd_soc_write(codec, L_IVC, 0x91); /* volume */ |
| snd_soc_write(codec, R_IVC, 0x91); /* volume */ |
| - snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMMIN | PMDAC, |
| - PMVCM | PMMIN | PMDAC); |
| + snd_soc_update_bits(codec, PW_MGMT1, PMMIN | PMDAC, |
| + PMMIN | PMDAC); |
| snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP); |
| snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); |
| } else { |
| @@ -216,8 +216,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, |
| snd_soc_write(codec, SG_SL1, PMMP | MGAIN0); |
| snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); |
| snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); |
| - snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMADL, |
| - PMVCM | PMADL); |
| + snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL); |
| snd_soc_update_bits(codec, PW_MGMT3, PMADR, PMADR); |
| } |
| |
| @@ -375,6 +374,22 @@ static int ak4642_dai_hw_params(struct snd_pcm_substream *substream, |
| return 0; |
| } |
| |
| +static int ak4642_set_bias_level(struct snd_soc_codec *codec, |
| + enum snd_soc_bias_level level) |
| +{ |
| + switch (level) { |
| + case SND_SOC_BIAS_OFF: |
| + snd_soc_write(codec, PW_MGMT1, 0x00); |
| + break; |
| + default: |
| + snd_soc_update_bits(codec, PW_MGMT1, PMVCM, PMVCM); |
| + break; |
| + } |
| + codec->dapm.bias_level = level; |
| + |
| + return 0; |
| +} |
| + |
| static struct snd_soc_dai_ops ak4642_dai_ops = { |
| .startup = ak4642_dai_startup, |
| .shutdown = ak4642_dai_shutdown, |
| @@ -424,12 +439,22 @@ static int ak4642_probe(struct snd_soc_codec *codec) |
| snd_soc_add_controls(codec, ak4642_snd_controls, |
| ARRAY_SIZE(ak4642_snd_controls)); |
| |
| + ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| + |
| + return 0; |
| +} |
| + |
| +static int ak4642_remove(struct snd_soc_codec *codec) |
| +{ |
| + ak4642_set_bias_level(codec, SND_SOC_BIAS_OFF); |
| return 0; |
| } |
| |
| static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { |
| .probe = ak4642_probe, |
| + .remove = ak4642_remove, |
| .resume = ak4642_resume, |
| + .set_bias_level = ak4642_set_bias_level, |
| .reg_cache_size = ARRAY_SIZE(ak4642_reg), |
| .reg_word_size = sizeof(u8), |
| .reg_cache_default = ak4642_reg, |
| -- |
| 1.7.10.2.565.gbd578b5 |
| |