Skip to content

Commit

Permalink
ASoC: soc-cache: let reg be AND'ed by 0xff instead of data buffer for…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Barry Song authored and Mark Brown committed Mar 18, 2010
1 parent 85dfcdf commit f4bee1b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/soc/soc-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,

BUG_ON(codec->volatile_register);

data[0] = reg & 0xff;
reg &= 0xff;
data[0] = reg;
data[1] = value & 0xff;

if (reg < codec->reg_cache_size)
Expand All @@ -180,6 +181,7 @@ static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec,
unsigned int reg)
{
u8 *cache = codec->reg_cache;
reg &= 0xff;
if (reg >= codec->reg_cache_size)
return -1;
return cache[reg];
Expand Down

0 comments on commit f4bee1b

Please sign in to comment.