diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-11-10 19:21:01 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-11 03:47:03 -0500 |
commit | ed2dd7da35cad3115c38fd42eecbecae899a1d7a (patch) | |
tree | 25b2788804ccb5d642ee98e79694b8022ad2a528 /sound | |
parent | 88c494b99a5873a46738c4c3f6f37ccce87b03e9 (diff) |
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>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/ak4642.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index b854eb0e6ad1..004a093547f9 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c | |||
@@ -196,8 +196,8 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, | |||
196 | snd_soc_update_bits(codec, MD_CTL3, BST1, BST1); | 196 | snd_soc_update_bits(codec, MD_CTL3, BST1, BST1); |
197 | snd_soc_write(codec, L_IVC, 0x91); /* volume */ | 197 | snd_soc_write(codec, L_IVC, 0x91); /* volume */ |
198 | snd_soc_write(codec, R_IVC, 0x91); /* volume */ | 198 | snd_soc_write(codec, R_IVC, 0x91); /* volume */ |
199 | snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMMIN | PMDAC, | 199 | snd_soc_update_bits(codec, PW_MGMT1, PMMIN | PMDAC, |
200 | PMVCM | PMMIN | PMDAC); | 200 | PMMIN | PMDAC); |
201 | snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP); | 201 | snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP); |
202 | snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); | 202 | snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); |
203 | } else { | 203 | } else { |
@@ -217,8 +217,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, | |||
217 | snd_soc_write(codec, SG_SL1, PMMP | MGAIN0); | 217 | snd_soc_write(codec, SG_SL1, PMMP | MGAIN0); |
218 | snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); | 218 | snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); |
219 | snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); | 219 | snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); |
220 | snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMADL, | 220 | snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL); |
221 | PMVCM | PMADL); | ||
222 | snd_soc_update_bits(codec, PW_MGMT3, PMADR, PMADR); | 221 | snd_soc_update_bits(codec, PW_MGMT3, PMADR, PMADR); |
223 | } | 222 | } |
224 | 223 | ||
@@ -376,6 +375,22 @@ static int ak4642_dai_hw_params(struct snd_pcm_substream *substream, | |||
376 | return 0; | 375 | return 0; |
377 | } | 376 | } |
378 | 377 | ||
378 | static int ak4642_set_bias_level(struct snd_soc_codec *codec, | ||
379 | enum snd_soc_bias_level level) | ||
380 | { | ||
381 | switch (level) { | ||
382 | case SND_SOC_BIAS_OFF: | ||
383 | snd_soc_write(codec, PW_MGMT1, 0x00); | ||
384 | break; | ||
385 | default: | ||
386 | snd_soc_update_bits(codec, PW_MGMT1, PMVCM, PMVCM); | ||
387 | break; | ||
388 | } | ||
389 | codec->dapm.bias_level = level; | ||
390 | |||
391 | return 0; | ||
392 | } | ||
393 | |||
379 | static struct snd_soc_dai_ops ak4642_dai_ops = { | 394 | static struct snd_soc_dai_ops ak4642_dai_ops = { |
380 | .startup = ak4642_dai_startup, | 395 | .startup = ak4642_dai_startup, |
381 | .shutdown = ak4642_dai_shutdown, | 396 | .shutdown = ak4642_dai_shutdown, |
@@ -425,12 +440,22 @@ static int ak4642_probe(struct snd_soc_codec *codec) | |||
425 | snd_soc_add_controls(codec, ak4642_snd_controls, | 440 | snd_soc_add_controls(codec, ak4642_snd_controls, |
426 | ARRAY_SIZE(ak4642_snd_controls)); | 441 | ARRAY_SIZE(ak4642_snd_controls)); |
427 | 442 | ||
443 | ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
444 | |||
445 | return 0; | ||
446 | } | ||
447 | |||
448 | static int ak4642_remove(struct snd_soc_codec *codec) | ||
449 | { | ||
450 | ak4642_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
428 | return 0; | 451 | return 0; |
429 | } | 452 | } |
430 | 453 | ||
431 | static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { | 454 | static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { |
432 | .probe = ak4642_probe, | 455 | .probe = ak4642_probe, |
456 | .remove = ak4642_remove, | ||
433 | .resume = ak4642_resume, | 457 | .resume = ak4642_resume, |
458 | .set_bias_level = ak4642_set_bias_level, | ||
434 | .reg_cache_size = ARRAY_SIZE(ak4642_reg), | 459 | .reg_cache_size = ARRAY_SIZE(ak4642_reg), |
435 | .reg_word_size = sizeof(u8), | 460 | .reg_word_size = sizeof(u8), |
436 | .reg_cache_default = ak4642_reg, | 461 | .reg_cache_default = ak4642_reg, |