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 3/3] ASoC: tlv320aic3x: Complete the soc-cache conversion
Date: Tue, 14 Sep 2010 14:54:49 +0300 [thread overview]
Message-ID: <1284465289-4865-3-git-send-email-jhnikula@gmail.com> (raw)
In-Reply-To: <1284465289-4865-1-git-send-email-jhnikula@gmail.com>
Complete the phasing out of aic3x_read_reg_cache, aic3x_write_reg_cache,
aic3x_read and aic3x_write calls.
This patch replaces the aic3x_read with codec->hw_read that points to a
function implemented by soc-cache. There is no need to cache the value from
chip since the functions using aic3x_read are interested only read-only
bits.
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
---
sound/soc/codecs/tlv320aic3x.c | 32 +++-----------------------------
1 files changed, 3 insertions(+), 29 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 86e5a58..9737afa 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -111,32 +111,6 @@ static const u8 aic3x_reg[AIC3X_CACHEREGNUM] = {
0x00, 0x00, 0x02, /* 100 */
};
-/*
- * 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
- */
-static int aic3x_read(struct snd_soc_codec *codec, unsigned int reg,
- u8 *value)
-{
- *value = reg & 0xff;
-
- value[0] = i2c_smbus_read_byte_data(codec->control_data, value[0]);
-
- aic3x_write_reg_cache(codec, reg, *value);
- return 0;
-}
-
#define SOC_DAPM_SINGLE_AIC3X(xname, reg, shift, mask, invert) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
.info = snd_soc_info_volsw, \
@@ -1076,7 +1050,7 @@ int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio)
u8 reg = gpio ? AIC3X_GPIO2_REG : AIC3X_GPIO1_REG;
u8 val, bit = gpio ? 2: 1;
- aic3x_read(codec, reg, &val);
+ val = codec->hw_read(codec, reg);
return (val >> bit) & 1;
}
EXPORT_SYMBOL_GPL(aic3x_get_gpio);
@@ -1103,7 +1077,7 @@ EXPORT_SYMBOL_GPL(aic3x_set_headset_detection);
int aic3x_headset_detected(struct snd_soc_codec *codec)
{
u8 val;
- aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val);
+ val = codec->hw_read(codec, AIC3X_HEADSET_DETECT_CTRL_B);
return (val >> 4) & 1;
}
EXPORT_SYMBOL_GPL(aic3x_headset_detected);
@@ -1111,7 +1085,7 @@ EXPORT_SYMBOL_GPL(aic3x_headset_detected);
int aic3x_button_pressed(struct snd_soc_codec *codec)
{
u8 val;
- aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val);
+ val = codec->hw_read(codec, AIC3X_HEADSET_DETECT_CTRL_B);
return (val >> 5) & 1;
}
EXPORT_SYMBOL_GPL(aic3x_button_pressed);
--
1.7.1
next prev parent 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 ` [PATCH 2/3] ASoC: tlv320aic3x: Switch to soc-cache helpers Jarkko Nikula
2010-09-14 11:59 ` Mark Brown
2010-09-14 11:54 ` Jarkko Nikula [this message]
2010-09-14 12:04 ` [PATCH 3/3] ASoC: tlv320aic3x: Complete the soc-cache conversion 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-3-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