diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-08-28 04:27:56 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-08-28 14:14:18 -0400 |
commit | 5f609f282b59f111840e755bac8da980387e044e (patch) | |
tree | 1c0af65b83c15805f18fbc5faf0f28855434020e | |
parent | 1a83269d5c41b77f2a4bbb3828c668c96832742e (diff) |
ASoC: cs35l32: Simplify implementation of cs35l32_codec_set_sysclk
Use single snd_soc_update_bits() call to update the register bits.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Brian Austin <brian.austin@cirrus.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | sound/soc/codecs/cs35l32.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c index b32d7a9d0c0f..76f628bd7f2b 100644 --- a/sound/soc/codecs/cs35l32.c +++ b/sound/soc/codecs/cs35l32.c | |||
@@ -242,41 +242,27 @@ static struct snd_soc_dai_driver cs35l32_dai[] = { | |||
242 | static int cs35l32_codec_set_sysclk(struct snd_soc_codec *codec, | 242 | static int cs35l32_codec_set_sysclk(struct snd_soc_codec *codec, |
243 | int clk_id, int source, unsigned int freq, int dir) | 243 | int clk_id, int source, unsigned int freq, int dir) |
244 | { | 244 | { |
245 | unsigned int val; | ||
245 | 246 | ||
246 | switch (freq) { | 247 | switch (freq) { |
247 | case 6000000: | 248 | case 6000000: |
248 | snd_soc_update_bits(codec, CS35L32_CLK_CTL, | 249 | val = CS35L32_MCLK_RATIO; |
249 | CS35L32_MCLK_DIV2_MASK, 0); | ||
250 | snd_soc_update_bits(codec, CS35L32_CLK_CTL, | ||
251 | CS35L32_MCLK_RATIO_MASK, | ||
252 | CS35L32_MCLK_RATIO); | ||
253 | break; | 250 | break; |
254 | case 12000000: | 251 | case 12000000: |
255 | snd_soc_update_bits(codec, CS35L32_CLK_CTL, | 252 | val = CS35L32_MCLK_DIV2_MASK | CS35L32_MCLK_RATIO; |
256 | CS35L32_MCLK_DIV2_MASK, | ||
257 | CS35L32_MCLK_DIV2_MASK); | ||
258 | snd_soc_update_bits(codec, CS35L32_CLK_CTL, | ||
259 | CS35L32_MCLK_RATIO_MASK, | ||
260 | CS35L32_MCLK_RATIO); | ||
261 | break; | 253 | break; |
262 | case 6144000: | 254 | case 6144000: |
263 | snd_soc_update_bits(codec, CS35L32_CLK_CTL, | 255 | val = 0; |
264 | CS35L32_MCLK_DIV2_MASK, 0); | ||
265 | snd_soc_update_bits(codec, CS35L32_CLK_CTL, | ||
266 | CS35L32_MCLK_RATIO_MASK, 0); | ||
267 | break; | 256 | break; |
268 | case 12288000: | 257 | case 12288000: |
269 | snd_soc_update_bits(codec, CS35L32_CLK_CTL, | 258 | val = CS35L32_MCLK_DIV2_MASK; |
270 | CS35L32_MCLK_DIV2_MASK, | ||
271 | CS35L32_MCLK_DIV2_MASK); | ||
272 | snd_soc_update_bits(codec, CS35L32_CLK_CTL, | ||
273 | CS35L32_MCLK_RATIO_MASK, 0); | ||
274 | break; | 259 | break; |
275 | default: | 260 | default: |
276 | return -EINVAL; | 261 | return -EINVAL; |
277 | } | 262 | } |
278 | 263 | ||
279 | return 0; | 264 | return snd_soc_update_bits(codec, CS35L32_CLK_CTL, |
265 | CS35L32_MCLK_DIV2_MASK | CS35L32_MCLK_RATIO_MASK, val); | ||
280 | } | 266 | } |
281 | 267 | ||
282 | static struct snd_soc_codec_driver soc_codec_dev_cs35l32 = { | 268 | static struct snd_soc_codec_driver soc_codec_dev_cs35l32 = { |