Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170127
b: refs/heads/master
c: 341c9b8
h: refs/heads/master
i:
  170125: 92148e2
  170123: 2d740da
  170119: be8c4d7
  170111: 32f4783
v: v3
  • Loading branch information
Joonyoung Shim authored and Mark Brown committed Sep 7, 2009
1 parent 02f6fe3 commit 566db03
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 85488037bb9b533b064be66412dbe1dbcd2734d9
refs/heads/master: 341c9b84bc01040bd5c75140303e32f6b10098f3
30 changes: 30 additions & 0 deletions trunk/sound/soc/soc-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,35 @@ static int snd_soc_7_9_spi_write(void *control_data, const char *data,
#define snd_soc_7_9_spi_write NULL
#endif

static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value)
{
u8 *cache = codec->reg_cache;
u8 data[2];

BUG_ON(codec->volatile_register);

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

if (reg < codec->reg_cache_size)
cache[reg] = value;

if (codec->hw_write(codec->control_data, data, 2) == 2)
return 0;
else
return -EIO;
}

static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec,
unsigned int reg)
{
u8 *cache = codec->reg_cache;
if (reg >= codec->reg_cache_size)
return -1;
return cache[reg];
}

static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value)
{
Expand Down Expand Up @@ -151,6 +180,7 @@ static struct {
unsigned int (*i2c_read)(struct snd_soc_codec *, unsigned int);
} io_types[] = {
{ 7, 9, snd_soc_7_9_write, snd_soc_7_9_spi_write, snd_soc_7_9_read },
{ 8, 8, snd_soc_8_8_write, NULL, snd_soc_8_8_read, NULL },
{ 8, 16, snd_soc_8_16_write, NULL, snd_soc_8_16_read,
snd_soc_8_16_read_i2c },
};
Expand Down

0 comments on commit 566db03

Please sign in to comment.