summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/cs35l32.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-08-28 10:27:56 +0200
committerMark Brown <broonie@linaro.org>2014-08-28 20:14:18 +0200
commit5f609f282b59f111840e755bac8da980387e044e (patch)
tree1c0af65b83c15805f18fbc5faf0f28855434020e /sound/soc/codecs/cs35l32.c
parentASoC: cs35l32: Remove unneeded regulator_bulk_free call in cs35l32_i2c_remove (diff)
downloadlinux-5f609f282b59f111840e755bac8da980387e044e.tar.xz
linux-5f609f282b59f111840e755bac8da980387e044e.zip
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>
Diffstat (limited to 'sound/soc/codecs/cs35l32.c')
-rw-r--r--sound/soc/codecs/cs35l32.c28
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[] = {
static int cs35l32_codec_set_sysclk(struct snd_soc_codec *codec,
int clk_id, int source, unsigned int freq, int dir)
{
+ unsigned int val;
switch (freq) {
case 6000000:
- snd_soc_update_bits(codec, CS35L32_CLK_CTL,
- CS35L32_MCLK_DIV2_MASK, 0);
- snd_soc_update_bits(codec, CS35L32_CLK_CTL,
- CS35L32_MCLK_RATIO_MASK,
- CS35L32_MCLK_RATIO);
+ val = CS35L32_MCLK_RATIO;
break;
case 12000000:
- snd_soc_update_bits(codec, CS35L32_CLK_CTL,
- CS35L32_MCLK_DIV2_MASK,
- CS35L32_MCLK_DIV2_MASK);
- snd_soc_update_bits(codec, CS35L32_CLK_CTL,
- CS35L32_MCLK_RATIO_MASK,
- CS35L32_MCLK_RATIO);
+ val = CS35L32_MCLK_DIV2_MASK | CS35L32_MCLK_RATIO;
break;
case 6144000:
- snd_soc_update_bits(codec, CS35L32_CLK_CTL,
- CS35L32_MCLK_DIV2_MASK, 0);
- snd_soc_update_bits(codec, CS35L32_CLK_CTL,
- CS35L32_MCLK_RATIO_MASK, 0);
+ val = 0;
break;
case 12288000:
- snd_soc_update_bits(codec, CS35L32_CLK_CTL,
- CS35L32_MCLK_DIV2_MASK,
- CS35L32_MCLK_DIV2_MASK);
- snd_soc_update_bits(codec, CS35L32_CLK_CTL,
- CS35L32_MCLK_RATIO_MASK, 0);
+ val = CS35L32_MCLK_DIV2_MASK;
break;
default:
return -EINVAL;
}
- return 0;
+ return snd_soc_update_bits(codec, CS35L32_CLK_CTL,
+ CS35L32_MCLK_DIV2_MASK | CS35L32_MCLK_RATIO_MASK, val);
}
static struct snd_soc_codec_driver soc_codec_dev_cs35l32 = {