All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: cs35l32: Simplify implementation of cs35l32_codec_set_sysclk
@ 2014-08-28  8:27 Axel Lin
  2014-08-28 15:08 ` Brian Austin
  2014-08-28 18:14 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2014-08-28  8:27 UTC (permalink / raw)
  To: Mark Brown
  Cc: Brian Austin, alsa-devel@alsa-project.org, Liam Girdwood,
	Paul Handrigan

Use single snd_soc_update_bits() call to update the register bits.

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

diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c
index 9c6b272..380c212 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 = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: cs35l32: Simplify implementation of cs35l32_codec_set_sysclk
  2014-08-28  8:27 [PATCH] ASoC: cs35l32: Simplify implementation of cs35l32_codec_set_sysclk Axel Lin
@ 2014-08-28 15:08 ` Brian Austin
  2014-08-28 18:14 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Austin @ 2014-08-28 15:08 UTC (permalink / raw)
  To: Axel Lin
  Cc: alsa-devel@alsa-project.org, Brian Austin, Mark Brown,
	Liam Girdwood, Paul Handrigan

On Thu, 28 Aug 2014, Axel Lin wrote:

> Use single snd_soc_update_bits() call to update the register bits.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  sound/soc/codecs/cs35l32.c | 28 +++++++---------------------
>  1 file changed, 7 insertions(+), 21 deletions(-)
> 
> diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c
> index 9c6b272..380c212 100644
> --- a/sound/soc/codecs/cs35l32.c
> +++ b/sound/soc/codecs/cs35l32.c
Thanks Axel,

Tested-by: Brian Austin <brian.austin@cirrus.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: cs35l32: Simplify implementation of cs35l32_codec_set_sysclk
  2014-08-28  8:27 [PATCH] ASoC: cs35l32: Simplify implementation of cs35l32_codec_set_sysclk Axel Lin
  2014-08-28 15:08 ` Brian Austin
@ 2014-08-28 18:14 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-08-28 18:14 UTC (permalink / raw)
  To: Axel Lin
  Cc: Brian Austin, alsa-devel@alsa-project.org, Liam Girdwood,
	Paul Handrigan


[-- Attachment #1.1: Type: text/plain, Size: 145 bytes --]

On Thu, Aug 28, 2014 at 04:27:56PM +0800, Axel Lin wrote:
> Use single snd_soc_update_bits() call to update the register bits.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-28 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28  8:27 [PATCH] ASoC: cs35l32: Simplify implementation of cs35l32_codec_set_sysclk Axel Lin
2014-08-28 15:08 ` Brian Austin
2014-08-28 18:14 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.