aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-cache.c
diff options
context:
space:
mode:
authorBarry Song <21cnbao@gmail.com>2010-03-18 04:17:01 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-03-18 07:23:23 -0400
commitf4bee1bb0083869b1b7d73c6eda7703a7aae0506 (patch)
tree9c2202d7969ff5ea2cdde8b7ff2a573f7cb9bc08 /sound/soc/soc-cache.c
parent85dfcdffc227717fd218b9a86b507d9b7a3c321d (diff)
ASoC: soc-cache: let reg be AND'ed by 0xff instead of data buffer for 8_8 mode
The registers for AD193X are defined as 0x800-0x810 for spi which uses 16_8 mode, for i2c to support AD1937, we will use 8_8 mode, only the low byte of 0x800-0x810 is valid. The patch will not destory other codecs, but make soc cache interface more useful. Signed-off-by: Barry Song <barry.song@analog.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r--sound/soc/soc-cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 91db7afb1210..9dfe9a58a314 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -159,7 +159,8 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,
159 159
160 BUG_ON(codec->volatile_register); 160 BUG_ON(codec->volatile_register);
161 161
162 data[0] = reg & 0xff; 162 reg &= 0xff;
163 data[0] = reg;
163 data[1] = value & 0xff; 164 data[1] = value & 0xff;
164 165
165 if (reg < codec->reg_cache_size) 166 if (reg < codec->reg_cache_size)
@@ -180,6 +181,7 @@ static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec,
180 unsigned int reg) 181 unsigned int reg)
181{ 182{
182 u8 *cache = codec->reg_cache; 183 u8 *cache = codec->reg_cache;
184 reg &= 0xff;
183 if (reg >= codec->reg_cache_size) 185 if (reg >= codec->reg_cache_size)
184 return -1; 186 return -1;
185 return cache[reg]; 187 return cache[reg];