From 566db037828dcb44142ad59dfc400b8b258cf33b Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Mon, 7 Sep 2009 12:04:37 +0900 Subject: [PATCH] --- yaml --- r: 170127 b: refs/heads/master c: 341c9b84bc01040bd5c75140303e32f6b10098f3 h: refs/heads/master i: 170125: 92148e23d591535462d91c84f7d18ace7120a289 170123: 2d740daf16c6e87d27e1c91845bd2b5b666249d7 170119: be8c4d7d4ed39c69819ca8069748fadca79d095a 170111: 32f4783855c0e76c58d110a6c0b69b4017e72575 v: v3 --- [refs] | 2 +- trunk/sound/soc/soc-cache.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 7ad256f7fe55..caa0e57d6ead 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 85488037bb9b533b064be66412dbe1dbcd2734d9 +refs/heads/master: 341c9b84bc01040bd5c75140303e32f6b10098f3 diff --git a/trunk/sound/soc/soc-cache.c b/trunk/sound/soc/soc-cache.c index c8ceddc2a26c..404231ee8780 100644 --- a/trunk/sound/soc/soc-cache.c +++ b/trunk/sound/soc/soc-cache.c @@ -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) { @@ -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 }, };