All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
To: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org
Cc: sameo@linux.intel.com, tony@atomide.com,
	broonie@opensource.wolfsonmicro.com
Subject: [PATCH 3/4] ASoC: TWL4030: Only update the needed bits in *set_dai_sysclk
Date: Mon, 19 Oct 2009 15:42:19 +0300	[thread overview]
Message-ID: <1255956140-4829-4-git-send-email-peter.ujfalusi@nokia.com> (raw)
In-Reply-To: <1255956140-4829-3-git-send-email-peter.ujfalusi@nokia.com>

Do not rewrite the whole register, but only update the needed
bits in set_dai_sysclk functions.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
 sound/soc/codecs/twl4030.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 4df7c6c..559e9b2 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1785,19 +1785,21 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 {
 	struct snd_soc_codec *codec = codec_dai->codec;
 	struct twl4030_priv *twl4030 = codec->private_data;
-	u8 infreq;
+	u8 apll_ctrl;
 
+	apll_ctrl = twl4030_read_reg_cache(codec, TWL4030_REG_APLL_CTL);
+	apll_ctrl &= ~TWL4030_APLL_INFREQ;
 	switch (freq) {
 	case 19200000:
-		infreq = TWL4030_APLL_INFREQ_19200KHZ;
+		apll_ctrl |= TWL4030_APLL_INFREQ_19200KHZ;
 		twl4030->sysclk = 19200;
 		break;
 	case 26000000:
-		infreq = TWL4030_APLL_INFREQ_26000KHZ;
+		apll_ctrl |= TWL4030_APLL_INFREQ_26000KHZ;
 		twl4030->sysclk = 26000;
 		break;
 	case 38400000:
-		infreq = TWL4030_APLL_INFREQ_38400KHZ;
+		apll_ctrl |= TWL4030_APLL_INFREQ_38400KHZ;
 		twl4030->sysclk = 38400;
 		break;
 	default:
@@ -1806,8 +1808,7 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 		return -EINVAL;
 	}
 
-	infreq |= TWL4030_APLL_EN;
-	twl4030_write(codec, TWL4030_REG_APLL_CTL, infreq);
+	twl4030_write(codec, TWL4030_REG_APLL_CTL, apll_ctrl);
 
 	return 0;
 }
@@ -1989,11 +1990,13 @@ static int twl4030_voice_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 		int clk_id, unsigned int freq, int dir)
 {
 	struct snd_soc_codec *codec = codec_dai->codec;
-	u8 infreq;
+	u8 apll_ctrl;
 
+	apll_ctrl = twl4030_read_reg_cache(codec, TWL4030_REG_APLL_CTL);
+	apll_ctrl &= ~TWL4030_APLL_INFREQ;
 	switch (freq) {
 	case 26000000:
-		infreq = TWL4030_APLL_INFREQ_26000KHZ;
+		apll_ctrl |= TWL4030_APLL_INFREQ_26000KHZ;
 		break;
 	default:
 		printk(KERN_ERR "TWL4030 voice set sysclk: unknown rate %d\n",
@@ -2001,8 +2004,7 @@ static int twl4030_voice_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 		return -EINVAL;
 	}
 
-	infreq |= TWL4030_APLL_EN;
-	twl4030_write(codec, TWL4030_REG_APLL_CTL, infreq);
+	twl4030_write(codec, TWL4030_REG_APLL_CTL, apll_ctrl);
 
 	return 0;
 }
-- 
1.6.5.1


WARNING: multiple messages have this Message-ID (diff)
From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
To: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org
Cc: tony@atomide.com, broonie@opensource.wolfsonmicro.com,
	sameo@linux.intel.com
Subject: [PATCH 3/4] ASoC: TWL4030: Only update the needed bits in *set_dai_sysclk
Date: Mon, 19 Oct 2009 15:42:19 +0300	[thread overview]
Message-ID: <1255956140-4829-4-git-send-email-peter.ujfalusi@nokia.com> (raw)
In-Reply-To: <1255956140-4829-3-git-send-email-peter.ujfalusi@nokia.com>

Do not rewrite the whole register, but only update the needed
bits in set_dai_sysclk functions.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
 sound/soc/codecs/twl4030.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 4df7c6c..559e9b2 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1785,19 +1785,21 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 {
 	struct snd_soc_codec *codec = codec_dai->codec;
 	struct twl4030_priv *twl4030 = codec->private_data;
-	u8 infreq;
+	u8 apll_ctrl;
 
+	apll_ctrl = twl4030_read_reg_cache(codec, TWL4030_REG_APLL_CTL);
+	apll_ctrl &= ~TWL4030_APLL_INFREQ;
 	switch (freq) {
 	case 19200000:
-		infreq = TWL4030_APLL_INFREQ_19200KHZ;
+		apll_ctrl |= TWL4030_APLL_INFREQ_19200KHZ;
 		twl4030->sysclk = 19200;
 		break;
 	case 26000000:
-		infreq = TWL4030_APLL_INFREQ_26000KHZ;
+		apll_ctrl |= TWL4030_APLL_INFREQ_26000KHZ;
 		twl4030->sysclk = 26000;
 		break;
 	case 38400000:
-		infreq = TWL4030_APLL_INFREQ_38400KHZ;
+		apll_ctrl |= TWL4030_APLL_INFREQ_38400KHZ;
 		twl4030->sysclk = 38400;
 		break;
 	default:
@@ -1806,8 +1808,7 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 		return -EINVAL;
 	}
 
-	infreq |= TWL4030_APLL_EN;
-	twl4030_write(codec, TWL4030_REG_APLL_CTL, infreq);
+	twl4030_write(codec, TWL4030_REG_APLL_CTL, apll_ctrl);
 
 	return 0;
 }
@@ -1989,11 +1990,13 @@ static int twl4030_voice_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 		int clk_id, unsigned int freq, int dir)
 {
 	struct snd_soc_codec *codec = codec_dai->codec;
-	u8 infreq;
+	u8 apll_ctrl;
 
+	apll_ctrl = twl4030_read_reg_cache(codec, TWL4030_REG_APLL_CTL);
+	apll_ctrl &= ~TWL4030_APLL_INFREQ;
 	switch (freq) {
 	case 26000000:
-		infreq = TWL4030_APLL_INFREQ_26000KHZ;
+		apll_ctrl |= TWL4030_APLL_INFREQ_26000KHZ;
 		break;
 	default:
 		printk(KERN_ERR "TWL4030 voice set sysclk: unknown rate %d\n",
@@ -2001,8 +2004,7 @@ static int twl4030_voice_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 		return -EINVAL;
 	}
 
-	infreq |= TWL4030_APLL_EN;
-	twl4030_write(codec, TWL4030_REG_APLL_CTL, infreq);
+	twl4030_write(codec, TWL4030_REG_APLL_CTL, apll_ctrl);
 
 	return 0;
 }
-- 
1.6.5.1

  reply	other threads:[~2009-10-19 12:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19 12:42 [PATCH 0/4] twl4030 codec as MFD device Peter Ujfalusi
2009-10-19 12:42 ` [PATCH 1/4] MFD: twl4030: add twl4030_codec MFD as a new child to the core Peter Ujfalusi
2009-10-19 12:42   ` Peter Ujfalusi
2009-10-19 12:42   ` [PATCH 2/4] OMAP: Platform support for twl4030_codec MFD Peter Ujfalusi
2009-10-19 12:42     ` Peter Ujfalusi
2009-10-19 12:42     ` Peter Ujfalusi [this message]
2009-10-19 12:42       ` [PATCH 3/4] ASoC: TWL4030: Only update the needed bits in *set_dai_sysclk Peter Ujfalusi
2009-10-19 12:42       ` [PATCH 4/4] ASoC: TWL4030: Driver registration via twl4030_codec MFD Peter Ujfalusi
2009-10-19 12:42         ` Peter Ujfalusi
2009-10-20 10:25         ` Mark Brown
2009-10-20 11:30           ` Peter Ujfalusi
2009-10-20 11:30             ` Peter Ujfalusi
2009-10-20 11:51             ` Mark Brown
2009-10-20 11:51               ` Mark Brown
2009-10-20 12:01               ` Peter Ujfalusi
2009-10-20 12:01                 ` Peter Ujfalusi
2009-10-19 12:55       ` [PATCH 3/4] ASoC: TWL4030: Only update the needed bits in *set_dai_sysclk Mark Brown
2009-10-19 12:59         ` Peter Ujfalusi
2009-10-19 12:59           ` Peter Ujfalusi
2009-10-20 19:01     ` [PATCH 2/4] OMAP: Platform support for twl4030_codec MFD Tony Lindgren
2009-10-20 19:01       ` Tony Lindgren
2009-10-20 10:03   ` [PATCH 1/4] MFD: twl4030: add twl4030_codec MFD as a new child to the core Mark Brown
2009-10-20 10:03     ` Mark Brown
2009-10-20 11:16     ` [alsa-devel] " Peter Ujfalusi
2009-10-20 11:16       ` Peter Ujfalusi
2009-10-21 23:13   ` Samuel Ortiz
2009-10-22  6:04     ` Peter Ujfalusi
2009-10-22  6:04       ` Peter Ujfalusi
2009-10-22  7:57       ` Samuel Ortiz
2009-10-22  7:57         ` Samuel Ortiz
2009-10-22 10:55         ` Mark Brown
2009-10-22 10:55           ` Mark Brown
2009-10-22 11:02           ` Peter Ujfalusi
2009-10-22 11:02             ` Peter Ujfalusi
2009-10-21  8:56 ` [PATCH 0/4] twl4030 codec as MFD device Peter Ujfalusi
2009-10-21  8:56   ` Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1255956140-4829-4-git-send-email-peter.ujfalusi@nokia.com \
    --to=peter.ujfalusi@nokia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.