Commit 5f609f28 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: cs35l32: Simplify implementation of cs35l32_codec_set_sysclk

Use single snd_soc_update_bits() call to update the register bits.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Tested-by: default avatarBrian Austin <brian.austin@cirrus.com>
Acked-by: default avatarBrian Austin <brian.austin@cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 1a83269d
...@@ -242,41 +242,27 @@ static struct snd_soc_dai_driver cs35l32_dai[] = { ...@@ -242,41 +242,27 @@ static struct snd_soc_dai_driver cs35l32_dai[] = {
static int cs35l32_codec_set_sysclk(struct snd_soc_codec *codec, static int cs35l32_codec_set_sysclk(struct snd_soc_codec *codec,
int clk_id, int source, unsigned int freq, int dir) int clk_id, int source, unsigned int freq, int dir)
{ {
unsigned int val;
switch (freq) { switch (freq) {
case 6000000: case 6000000:
snd_soc_update_bits(codec, CS35L32_CLK_CTL, val = CS35L32_MCLK_RATIO;
CS35L32_MCLK_DIV2_MASK, 0);
snd_soc_update_bits(codec, CS35L32_CLK_CTL,
CS35L32_MCLK_RATIO_MASK,
CS35L32_MCLK_RATIO);
break; break;
case 12000000: case 12000000:
snd_soc_update_bits(codec, CS35L32_CLK_CTL, val = CS35L32_MCLK_DIV2_MASK | CS35L32_MCLK_RATIO;
CS35L32_MCLK_DIV2_MASK,
CS35L32_MCLK_DIV2_MASK);
snd_soc_update_bits(codec, CS35L32_CLK_CTL,
CS35L32_MCLK_RATIO_MASK,
CS35L32_MCLK_RATIO);
break; break;
case 6144000: case 6144000:
snd_soc_update_bits(codec, CS35L32_CLK_CTL, val = 0;
CS35L32_MCLK_DIV2_MASK, 0);
snd_soc_update_bits(codec, CS35L32_CLK_CTL,
CS35L32_MCLK_RATIO_MASK, 0);
break; break;
case 12288000: case 12288000:
snd_soc_update_bits(codec, CS35L32_CLK_CTL, val = CS35L32_MCLK_DIV2_MASK;
CS35L32_MCLK_DIV2_MASK,
CS35L32_MCLK_DIV2_MASK);
snd_soc_update_bits(codec, CS35L32_CLK_CTL,
CS35L32_MCLK_RATIO_MASK, 0);
break; break;
default: default:
return -EINVAL; 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 = { static struct snd_soc_codec_driver soc_codec_dev_cs35l32 = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment