diff mbox

ASoC: cs35l34: Simplify the logic to set CS35L34_MCLK_CTL setting

Message ID 20161203071050.17811-1-axel.lin@ingics.com (mailing list archive)
State Accepted
Commit 914657c2be09fb89a50c7841e98186301c93767e
Headers show

Commit Message

Axel Lin Dec. 3, 2016, 7:10 a.m. UTC
The logic of "value = ~CS35L34_MCLK_DIV & CS35L34_MCLK_RATE_XXXXXX;" is
unnecessary complex. By setting CS35L34_MCLK_DIV | CS35L34_MCLK_RATE_MASK
as the mask for regmap_update_bits() call, what the code does is exactly
the same as setting value = CS35L34_MCLK_RATE_XXXXXX.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/cs35l34.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Paul Handrigan Dec. 5, 2016, 5:03 p.m. UTC | #1
On Sat, 3 Dec 2016, Axel Lin wrote:

> The logic of "value = ~CS35L34_MCLK_DIV & CS35L34_MCLK_RATE_XXXXXX;" is
> unnecessary complex. By setting CS35L34_MCLK_DIV | CS35L34_MCLK_RATE_MASK
> as the mask for regmap_update_bits() call, what the code does is exactly
> the same as setting value = CS35L34_MCLK_RATE_XXXXXX.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  sound/soc/codecs/cs35l34.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/codecs/cs35l34.c b/sound/soc/codecs/cs35l34.c
> index e0f672a..7c5d151 100644
> --- a/sound/soc/codecs/cs35l34.c
> +++ b/sound/soc/codecs/cs35l34.c
> @@ -610,15 +610,15 @@ static int cs35l34_dai_set_sysclk(struct snd_soc_dai *dai,
>  
>  	switch (freq) {
>  	case CS35L34_MCLK_5644:
> -		value = ~CS35L34_MCLK_DIV & CS35L34_MCLK_RATE_5P6448;
> +		value = CS35L34_MCLK_RATE_5P6448;
>  		cs35l34->mclk_int = freq;
>  	break;
>  	case CS35L34_MCLK_6:
> -		value = ~CS35L34_MCLK_DIV & CS35L34_MCLK_RATE_6P0000;
> +		value = CS35L34_MCLK_RATE_6P0000;
>  		cs35l34->mclk_int = freq;
>  	break;
>  	case CS35L34_MCLK_6144:
> -		value = ~CS35L34_MCLK_DIV & CS35L34_MCLK_RATE_6P1440;
> +		value = CS35L34_MCLK_RATE_6P1440;
>  		cs35l34->mclk_int = freq;
>  	break;
>  	case CS35L34_MCLK_11289:

Acked-by: Paul Handrigan <Paul.Handrigan@cirrus.com>
diff mbox

Patch

diff --git a/sound/soc/codecs/cs35l34.c b/sound/soc/codecs/cs35l34.c
index e0f672a..7c5d151 100644
--- a/sound/soc/codecs/cs35l34.c
+++ b/sound/soc/codecs/cs35l34.c
@@ -610,15 +610,15 @@  static int cs35l34_dai_set_sysclk(struct snd_soc_dai *dai,
 
 	switch (freq) {
 	case CS35L34_MCLK_5644:
-		value = ~CS35L34_MCLK_DIV & CS35L34_MCLK_RATE_5P6448;
+		value = CS35L34_MCLK_RATE_5P6448;
 		cs35l34->mclk_int = freq;
 	break;
 	case CS35L34_MCLK_6:
-		value = ~CS35L34_MCLK_DIV & CS35L34_MCLK_RATE_6P0000;
+		value = CS35L34_MCLK_RATE_6P0000;
 		cs35l34->mclk_int = freq;
 	break;
 	case CS35L34_MCLK_6144:
-		value = ~CS35L34_MCLK_DIV & CS35L34_MCLK_RATE_6P1440;
+		value = CS35L34_MCLK_RATE_6P1440;
 		cs35l34->mclk_int = freq;
 	break;
 	case CS35L34_MCLK_11289: