Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Nikula <jhnikula@gmail.com>
To: alsa-devel@alsa-project.org
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>
Subject: [PATCHv2 3/3] ASoC: tlv320aic3x: Complete the soc-cache conversion
Date: Tue, 14 Sep 2010 16:59:47 +0300	[thread overview]
Message-ID: <1284472787-9881-1-git-send-email-jhnikula@gmail.com> (raw)
In-Reply-To: <20100914125510.GA21715@rakim.wolfsonmicro.main>

Complete the phasing out of aic3x_read_reg_cache, aic3x_write_reg_cache,
aic3x_read and aic3x_write calls.

This patch uses in aic3x_read the codec->hw_read that points to a function
implemented by soc-cache. Only use for aic3x_read is if wanting to read
volatile bits from those registers that has both read-only and read/write
bits. All other cases should use snd_soc_read.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
---
 sound/soc/codecs/tlv320aic3x.c |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 86e5a58..7b5f159 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -112,28 +112,21 @@ static const u8 aic3x_reg[AIC3X_CACHEREGNUM] = {
 };
 
 /*
- * write aic3x register cache
- */
-static inline void aic3x_write_reg_cache(struct snd_soc_codec *codec,
-					 u8 reg, u8 value)
-{
-	u8 *cache = codec->reg_cache;
-	if (reg >= AIC3X_CACHEREGNUM)
-		return;
-	cache[reg] = value;
-}
-
-/*
- * read from the aic3x register space
+ * read from the aic3x register space. Only use for this function is if
+ * wanting to read volatile bits from those registers that has both read-only
+ * and read/write bits. All other cases should use snd_soc_read.
  */
 static int aic3x_read(struct snd_soc_codec *codec, unsigned int reg,
 		      u8 *value)
 {
-	*value = reg & 0xff;
+	u8 *cache = codec->reg_cache;
+
+	if (reg >= AIC3X_CACHEREGNUM)
+		return -1;
 
-	value[0] = i2c_smbus_read_byte_data(codec->control_data, value[0]);
+	*value = codec->hw_read(codec, reg);
+	cache[reg] = *value;
 
-	aic3x_write_reg_cache(codec, reg, *value);
 	return 0;
 }
 
-- 
1.7.1

  reply	other threads:[~2010-09-14 13:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-14 11:54 [PATCH 1/3] ASoC: tlv320aic3x: Use snd_soc_read and snd_soc_write Jarkko Nikula
2010-09-14 11:54 ` [PATCH 2/3] ASoC: tlv320aic3x: Switch to soc-cache helpers Jarkko Nikula
2010-09-14 11:59   ` Mark Brown
2010-09-14 11:54 ` [PATCH 3/3] ASoC: tlv320aic3x: Complete the soc-cache conversion Jarkko Nikula
2010-09-14 12:04   ` Mark Brown
2010-09-14 12:14     ` Jarkko Nikula
2010-09-14 12:21       ` Mark Brown
2010-09-14 12:45         ` Jarkko Nikula
2010-09-14 12:55           ` Mark Brown
2010-09-14 13:59             ` Jarkko Nikula [this message]
2010-09-14 15:08               ` [PATCHv2 " Mark Brown
2010-09-15 12:57                 ` Liam Girdwood
2010-09-14 11:59 ` [PATCH 1/3] ASoC: tlv320aic3x: Use snd_soc_read and snd_soc_write Mark Brown

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=1284472787-9881-1-git-send-email-jhnikula@gmail.com \
    --to=jhnikula@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lrg@slimlogic.co.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox