diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-10-17 18:25:08 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-10-19 07:07:43 -0400 |
commit | 54c96cfd1ac815d278aa43f37d063b0c5972db1f (patch) | |
tree | 4fba328ed7a7fc087f4e4c86fb3013ab22857631 /sound/soc | |
parent | 4b1cfcb4f36dca33b4552d9612537e6c0ca73639 (diff) |
ASoC: ad193x: 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: Barry Song <21cnbao@gmail.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/ad193x.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index 39056ce66302..120602130b5c 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c | |||
@@ -103,12 +103,14 @@ static const struct snd_soc_dapm_route audio_paths[] = { | |||
103 | static int ad193x_mute(struct snd_soc_dai *dai, int mute) | 103 | static int ad193x_mute(struct snd_soc_dai *dai, int mute) |
104 | { | 104 | { |
105 | struct snd_soc_codec *codec = dai->codec; | 105 | struct snd_soc_codec *codec = dai->codec; |
106 | int reg; | ||
107 | 106 | ||
108 | reg = snd_soc_read(codec, AD193X_DAC_CTRL2); | 107 | if (mute) |
109 | reg = (mute > 0) ? reg | AD193X_DAC_MASTER_MUTE : reg & | 108 | snd_soc_update_bits(codec, AD193X_DAC_CTRL2, |
110 | (~AD193X_DAC_MASTER_MUTE); | 109 | AD193X_DAC_MASTER_MUTE, |
111 | snd_soc_write(codec, AD193X_DAC_CTRL2, reg); | 110 | AD193X_DAC_MASTER_MUTE); |
111 | else | ||
112 | snd_soc_update_bits(codec, AD193X_DAC_CTRL2, | ||
113 | AD193X_DAC_MASTER_MUTE, 0); | ||
112 | 114 | ||
113 | return 0; | 115 | return 0; |
114 | } | 116 | } |
@@ -262,7 +264,7 @@ static int ad193x_hw_params(struct snd_pcm_substream *substream, | |||
262 | struct snd_pcm_hw_params *params, | 264 | struct snd_pcm_hw_params *params, |
263 | struct snd_soc_dai *dai) | 265 | struct snd_soc_dai *dai) |
264 | { | 266 | { |
265 | int word_len = 0, reg = 0, master_rate = 0; | 267 | int word_len = 0, master_rate = 0; |
266 | 268 | ||
267 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 269 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
268 | struct snd_soc_codec *codec = rtd->codec; | 270 | struct snd_soc_codec *codec = rtd->codec; |
@@ -297,18 +299,15 @@ static int ad193x_hw_params(struct snd_pcm_substream *substream, | |||
297 | break; | 299 | break; |
298 | } | 300 | } |
299 | 301 | ||
300 | reg = snd_soc_read(codec, AD193X_PLL_CLK_CTRL0); | 302 | snd_soc_update_bits(codec, AD193X_PLL_CLK_CTRL0, |
301 | reg = (reg & (~AD193X_PLL_INPUT_MASK)) | master_rate; | 303 | AD193X_PLL_INPUT_MASK, master_rate); |
302 | snd_soc_write(codec, AD193X_PLL_CLK_CTRL0, reg); | ||
303 | 304 | ||
304 | reg = snd_soc_read(codec, AD193X_DAC_CTRL2); | 305 | snd_soc_update_bits(codec, AD193X_DAC_CTRL2, |
305 | reg = (reg & (~AD193X_DAC_WORD_LEN_MASK)) | 306 | AD193X_DAC_WORD_LEN_MASK, |
306 | | (word_len << AD193X_DAC_WORD_LEN_SHFT); | 307 | word_len << AD193X_DAC_WORD_LEN_SHFT); |
307 | snd_soc_write(codec, AD193X_DAC_CTRL2, reg); | ||
308 | 308 | ||
309 | reg = snd_soc_read(codec, AD193X_ADC_CTRL1); | 309 | snd_soc_update_bits(codec, AD193X_ADC_CTRL1, |
310 | reg = (reg & (~AD193X_ADC_WORD_LEN_MASK)) | word_len; | 310 | AD193X_ADC_WORD_LEN_MASK, word_len); |
311 | snd_soc_write(codec, AD193X_ADC_CTRL1, reg); | ||
312 | 311 | ||
313 | return 0; | 312 | return 0; |
314 | } | 313 | } |