All of 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: [PATCH 2/3] ASoC: tlv320aic3x: Switch to soc-cache helpers
Date: Tue, 14 Sep 2010 14:54:48 +0300	[thread overview]
Message-ID: <1284465289-4865-2-git-send-email-jhnikula@gmail.com> (raw)
In-Reply-To: <1284465289-4865-1-git-send-email-jhnikula@gmail.com>

Continue phasing out aic3x_read_reg_cache, aic3x_write_reg_cache, aic3x_read
and aic3x_write calls.

This patch takes the soc-cache in use and removes aic3x_read_reg_cache and
aic3x_write.

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

diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 138165c..86e5a58 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -112,18 +112,6 @@ static const u8 aic3x_reg[AIC3X_CACHEREGNUM] = {
 };
 
 /*
- * read aic3x register cache
- */
-static inline unsigned int aic3x_read_reg_cache(struct snd_soc_codec *codec,
-						unsigned int reg)
-{
-	u8 *cache = codec->reg_cache;
-	if (reg >= AIC3X_CACHEREGNUM)
-		return -1;
-	return cache[reg];
-}
-
-/*
  * write aic3x register cache
  */
 static inline void aic3x_write_reg_cache(struct snd_soc_codec *codec,
@@ -136,28 +124,6 @@ static inline void aic3x_write_reg_cache(struct snd_soc_codec *codec,
 }
 
 /*
- * write to the aic3x register space
- */
-static int aic3x_write(struct snd_soc_codec *codec, unsigned int reg,
-		       unsigned int value)
-{
-	u8 data[2];
-
-	/* data is
-	 *   D15..D8 aic3x register offset
-	 *   D7...D0 register data
-	 */
-	data[0] = reg & 0xff;
-	data[1] = value & 0xff;
-
-	aic3x_write_reg_cache(codec, data[0], data[1]);
-	if (codec->hw_write(codec->control_data, data, 2) == 2)
-		return 0;
-	else
-		return -EIO;
-}
-
-/*
  * read from the aic3x register space
  */
 static int aic3x_read(struct snd_soc_codec *codec, unsigned int reg,
@@ -1299,10 +1265,16 @@ static int aic3x_init(struct snd_soc_codec *codec)
 static int aic3x_probe(struct snd_soc_codec *codec)
 {
 	struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
+	int ret;
 
-	codec->hw_write = (hw_write_t) i2c_master_send;
 	codec->control_data = aic3x->control_data;
 
+	ret = snd_soc_codec_set_cache_io(codec, 8, 8, aic3x->control_type);
+	if (ret != 0) {
+		dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
+		return ret;
+	}
+
 	aic3x_init(codec);
 
 	if (aic3x->setup) {
@@ -1330,8 +1302,6 @@ static int aic3x_remove(struct snd_soc_codec *codec)
 }
 
 static struct snd_soc_codec_driver soc_codec_dev_aic3x = {
-	.read = aic3x_read_reg_cache,
-	.write = aic3x_write,
 	.set_bias_level = aic3x_set_bias_level,
 	.reg_cache_size = ARRAY_SIZE(aic3x_reg),
 	.reg_word_size = sizeof(u8),
@@ -1375,6 +1345,8 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
 	}
 
 	aic3x->control_data = i2c;
+	aic3x->control_type = SND_SOC_I2C;
+
 	i2c_set_clientdata(i2c, aic3x);
 	if (pdata) {
 		aic3x->gpio_reset = pdata->gpio_reset;
-- 
1.7.1

  reply	other threads:[~2010-09-14 11:55 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 ` Jarkko Nikula [this message]
2010-09-14 11:59   ` [PATCH 2/3] ASoC: tlv320aic3x: Switch to soc-cache helpers 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             ` [PATCHv2 " Jarkko Nikula
2010-09-14 15:08               ` 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=1284465289-4865-2-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 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.