diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-10-19 02:07:31 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-10-19 10:22:01 -0400 |
commit | 2ee9c183f39f6e77f65a9e3414ff469a4dc34a0b (patch) | |
tree | fe9983d504e94610aa5f1f255c9762a58df0ebcb /sound/soc/codecs/ssm2602.c | |
parent | f8faadb6f204049252fe832d28df04640fa7e88e (diff) |
ASoC: ssm2602: Use snd_soc_update_bits for read-modify-write
Use snd_soc_update_bits for read-modify-write register access instead of
open-coding it using snd_soc_read and snd_soc_write
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/ssm2602.c')
-rw-r--r-- | sound/soc/codecs/ssm2602.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index e149ec61e6be..3cb3271c5fe2 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c | |||
@@ -343,12 +343,14 @@ static void ssm2602_shutdown(struct snd_pcm_substream *substream, | |||
343 | static int ssm2602_mute(struct snd_soc_dai *dai, int mute) | 343 | static int ssm2602_mute(struct snd_soc_dai *dai, int mute) |
344 | { | 344 | { |
345 | struct snd_soc_codec *codec = dai->codec; | 345 | struct snd_soc_codec *codec = dai->codec; |
346 | u16 mute_reg = snd_soc_read(codec, SSM2602_APDIGI) & ~APDIGI_ENABLE_DAC_MUTE; | 346 | |
347 | if (mute) | 347 | if (mute) |
348 | snd_soc_write(codec, SSM2602_APDIGI, | 348 | snd_soc_update_bits(codec, SSM2602_APDIGI, |
349 | mute_reg | APDIGI_ENABLE_DAC_MUTE); | 349 | APDIGI_ENABLE_DAC_MUTE, |
350 | APDIGI_ENABLE_DAC_MUTE); | ||
350 | else | 351 | else |
351 | snd_soc_write(codec, SSM2602_APDIGI, mute_reg); | 352 | snd_soc_update_bits(codec, SSM2602_APDIGI, |
353 | APDIGI_ENABLE_DAC_MUTE, 0); | ||
352 | return 0; | 354 | return 0; |
353 | } | 355 | } |
354 | 356 | ||
@@ -540,12 +542,12 @@ static int ssm2602_resume(struct snd_soc_codec *codec) | |||
540 | static int ssm2602_probe(struct snd_soc_codec *codec) | 542 | static int ssm2602_probe(struct snd_soc_codec *codec) |
541 | { | 543 | { |
542 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 544 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
543 | int ret, reg; | 545 | int ret; |
544 | 546 | ||
545 | reg = snd_soc_read(codec, SSM2602_LOUT1V); | 547 | snd_soc_update_bits(codec, SSM2602_LOUT1V, |
546 | snd_soc_write(codec, SSM2602_LOUT1V, reg | LOUT1V_LRHP_BOTH); | 548 | LOUT1V_LRHP_BOTH, LOUT1V_LRHP_BOTH); |
547 | reg = snd_soc_read(codec, SSM2602_ROUT1V); | 549 | snd_soc_update_bits(codec, SSM2602_ROUT1V, |
548 | snd_soc_write(codec, SSM2602_ROUT1V, reg | ROUT1V_RLHP_BOTH); | 550 | ROUT1V_RLHP_BOTH, ROUT1V_RLHP_BOTH); |
549 | 551 | ||
550 | ret = snd_soc_add_controls(codec, ssm2602_snd_controls, | 552 | ret = snd_soc_add_controls(codec, ssm2602_snd_controls, |
551 | ARRAY_SIZE(ssm2602_snd_controls)); | 553 | ARRAY_SIZE(ssm2602_snd_controls)); |
@@ -578,7 +580,7 @@ static int ssm2604_probe(struct snd_soc_codec *codec) | |||
578 | static int ssm260x_probe(struct snd_soc_codec *codec) | 580 | static int ssm260x_probe(struct snd_soc_codec *codec) |
579 | { | 581 | { |
580 | struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); | 582 | struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); |
581 | int ret, reg; | 583 | int ret; |
582 | 584 | ||
583 | pr_info("ssm2602 Audio Codec %s", SSM2602_VERSION); | 585 | pr_info("ssm2602 Audio Codec %s", SSM2602_VERSION); |
584 | 586 | ||
@@ -595,10 +597,10 @@ static int ssm260x_probe(struct snd_soc_codec *codec) | |||
595 | } | 597 | } |
596 | 598 | ||
597 | /* set the update bits */ | 599 | /* set the update bits */ |
598 | reg = snd_soc_read(codec, SSM2602_LINVOL); | 600 | snd_soc_update_bits(codec, SSM2602_LINVOL, |
599 | snd_soc_write(codec, SSM2602_LINVOL, reg | LINVOL_LRIN_BOTH); | 601 | LINVOL_LRIN_BOTH, LINVOL_LRIN_BOTH); |
600 | reg = snd_soc_read(codec, SSM2602_RINVOL); | 602 | snd_soc_update_bits(codec, SSM2602_RINVOL, |
601 | snd_soc_write(codec, SSM2602_RINVOL, reg | RINVOL_RLIN_BOTH); | 603 | RINVOL_RLIN_BOTH, RINVOL_RLIN_BOTH); |
602 | /*select Line in as default input*/ | 604 | /*select Line in as default input*/ |
603 | snd_soc_write(codec, SSM2602_APANA, APANA_SELECT_DAC | | 605 | snd_soc_write(codec, SSM2602_APANA, APANA_SELECT_DAC | |
604 | APANA_ENABLE_MIC_BOOST); | 606 | APANA_ENABLE_MIC_BOOST); |