diff options
Diffstat (limited to 'sound/soc/soc-cache.c')
| -rw-r--r-- | sound/soc/soc-cache.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 472af38188c1..83cd8ed944bf 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
| @@ -19,7 +19,7 @@ static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec, | |||
| 19 | unsigned int reg) | 19 | unsigned int reg) |
| 20 | { | 20 | { |
| 21 | u16 *cache = codec->reg_cache; | 21 | u16 *cache = codec->reg_cache; |
| 22 | if (reg >= codec->reg_cache_size) | 22 | if (reg >= codec->driver->reg_cache_size) |
| 23 | return -1; | 23 | return -1; |
| 24 | return cache[reg]; | 24 | return cache[reg]; |
| 25 | } | 25 | } |
| @@ -31,12 +31,12 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg, | |||
| 31 | u8 data[2]; | 31 | u8 data[2]; |
| 32 | int ret; | 32 | int ret; |
| 33 | 33 | ||
| 34 | BUG_ON(codec->volatile_register); | 34 | BUG_ON(codec->driver->volatile_register); |
| 35 | 35 | ||
| 36 | data[0] = (reg << 4) | ((value >> 8) & 0x000f); | 36 | data[0] = (reg << 4) | ((value >> 8) & 0x000f); |
| 37 | data[1] = value & 0x00ff; | 37 | data[1] = value & 0x00ff; |
| 38 | 38 | ||
| 39 | if (reg < codec->reg_cache_size) | 39 | if (reg < codec->driver->reg_cache_size) |
| 40 | cache[reg] = value; | 40 | cache[reg] = value; |
| 41 | 41 | ||
| 42 | if (codec->cache_only) { | 42 | if (codec->cache_only) { |
| @@ -89,7 +89,7 @@ static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec, | |||
| 89 | unsigned int reg) | 89 | unsigned int reg) |
| 90 | { | 90 | { |
| 91 | u16 *cache = codec->reg_cache; | 91 | u16 *cache = codec->reg_cache; |
| 92 | if (reg >= codec->reg_cache_size) | 92 | if (reg >= codec->driver->reg_cache_size) |
| 93 | return -1; | 93 | return -1; |
| 94 | return cache[reg]; | 94 | return cache[reg]; |
| 95 | } | 95 | } |
| @@ -101,12 +101,12 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg, | |||
| 101 | u8 data[2]; | 101 | u8 data[2]; |
| 102 | int ret; | 102 | int ret; |
| 103 | 103 | ||
| 104 | BUG_ON(codec->volatile_register); | 104 | BUG_ON(codec->driver->volatile_register); |
| 105 | 105 | ||
| 106 | data[0] = (reg << 1) | ((value >> 8) & 0x0001); | 106 | data[0] = (reg << 1) | ((value >> 8) & 0x0001); |
| 107 | data[1] = value & 0x00ff; | 107 | data[1] = value & 0x00ff; |
| 108 | 108 | ||
| 109 | if (reg < codec->reg_cache_size) | 109 | if (reg < codec->driver->reg_cache_size) |
| 110 | cache[reg] = value; | 110 | cache[reg] = value; |
| 111 | 111 | ||
| 112 | if (codec->cache_only) { | 112 | if (codec->cache_only) { |
| @@ -161,13 +161,13 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg, | |||
| 161 | u8 *cache = codec->reg_cache; | 161 | u8 *cache = codec->reg_cache; |
| 162 | u8 data[2]; | 162 | u8 data[2]; |
| 163 | 163 | ||
| 164 | BUG_ON(codec->volatile_register); | 164 | BUG_ON(codec->driver->volatile_register); |
| 165 | 165 | ||
| 166 | reg &= 0xff; | 166 | reg &= 0xff; |
| 167 | data[0] = reg; | 167 | data[0] = reg; |
| 168 | data[1] = value & 0xff; | 168 | data[1] = value & 0xff; |
| 169 | 169 | ||
| 170 | if (reg < codec->reg_cache_size) | 170 | if (reg < codec->driver->reg_cache_size) |
| 171 | cache[reg] = value; | 171 | cache[reg] = value; |
| 172 | 172 | ||
| 173 | if (codec->cache_only) { | 173 | if (codec->cache_only) { |
| @@ -188,7 +188,7 @@ static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec, | |||
| 188 | { | 188 | { |
| 189 | u8 *cache = codec->reg_cache; | 189 | u8 *cache = codec->reg_cache; |
| 190 | reg &= 0xff; | 190 | reg &= 0xff; |
| 191 | if (reg >= codec->reg_cache_size) | 191 | if (reg >= codec->driver->reg_cache_size) |
| 192 | return -1; | 192 | return -1; |
| 193 | return cache[reg]; | 193 | return cache[reg]; |
| 194 | } | 194 | } |
| @@ -224,7 +224,7 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec, | |||
| 224 | { | 224 | { |
| 225 | u16 *cache = codec->reg_cache; | 225 | u16 *cache = codec->reg_cache; |
| 226 | 226 | ||
| 227 | if (reg >= codec->reg_cache_size || | 227 | if (reg >= codec->driver->reg_cache_size || |
| 228 | snd_soc_codec_volatile_register(codec, reg)) { | 228 | snd_soc_codec_volatile_register(codec, reg)) { |
| 229 | if (codec->cache_only) | 229 | if (codec->cache_only) |
| 230 | return -EINVAL; | 230 | return -EINVAL; |
| @@ -343,7 +343,7 @@ static unsigned int snd_soc_16_8_read(struct snd_soc_codec *codec, | |||
| 343 | u16 *cache = codec->reg_cache; | 343 | u16 *cache = codec->reg_cache; |
| 344 | 344 | ||
| 345 | reg &= 0xff; | 345 | reg &= 0xff; |
| 346 | if (reg >= codec->reg_cache_size) | 346 | if (reg >= codec->driver->reg_cache_size) |
| 347 | return -1; | 347 | return -1; |
| 348 | return cache[reg]; | 348 | return cache[reg]; |
| 349 | } | 349 | } |
| @@ -355,14 +355,14 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg, | |||
| 355 | u8 data[3]; | 355 | u8 data[3]; |
| 356 | int ret; | 356 | int ret; |
| 357 | 357 | ||
| 358 | BUG_ON(codec->volatile_register); | 358 | BUG_ON(codec->driver->volatile_register); |
| 359 | 359 | ||
| 360 | data[0] = (reg >> 8) & 0xff; | 360 | data[0] = (reg >> 8) & 0xff; |
| 361 | data[1] = reg & 0xff; | 361 | data[1] = reg & 0xff; |
| 362 | data[2] = value; | 362 | data[2] = value; |
| 363 | 363 | ||
| 364 | reg &= 0xff; | 364 | reg &= 0xff; |
| 365 | if (reg < codec->reg_cache_size) | 365 | if (reg < codec->driver->reg_cache_size) |
| 366 | cache[reg] = value; | 366 | cache[reg] = value; |
| 367 | 367 | ||
| 368 | if (codec->cache_only) { | 368 | if (codec->cache_only) { |
| @@ -451,7 +451,7 @@ static unsigned int snd_soc_16_16_read(struct snd_soc_codec *codec, | |||
| 451 | { | 451 | { |
| 452 | u16 *cache = codec->reg_cache; | 452 | u16 *cache = codec->reg_cache; |
| 453 | 453 | ||
| 454 | if (reg >= codec->reg_cache_size || | 454 | if (reg >= codec->driver->reg_cache_size || |
| 455 | snd_soc_codec_volatile_register(codec, reg)) { | 455 | snd_soc_codec_volatile_register(codec, reg)) { |
| 456 | if (codec->cache_only) | 456 | if (codec->cache_only) |
| 457 | return -EINVAL; | 457 | return -EINVAL; |
| @@ -474,7 +474,7 @@ static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg, | |||
| 474 | data[2] = (value >> 8) & 0xff; | 474 | data[2] = (value >> 8) & 0xff; |
| 475 | data[3] = value & 0xff; | 475 | data[3] = value & 0xff; |
| 476 | 476 | ||
| 477 | if (reg < codec->reg_cache_size) | 477 | if (reg < codec->driver->reg_cache_size) |
| 478 | cache[reg] = value; | 478 | cache[reg] = value; |
| 479 | 479 | ||
| 480 | if (codec->cache_only) { | 480 | if (codec->cache_only) { |
| @@ -571,8 +571,8 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | |||
| 571 | return -EINVAL; | 571 | return -EINVAL; |
| 572 | } | 572 | } |
| 573 | 573 | ||
| 574 | codec->write = io_types[i].write; | 574 | codec->driver->write = io_types[i].write; |
| 575 | codec->read = io_types[i].read; | 575 | codec->driver->read = io_types[i].read; |
| 576 | 576 | ||
| 577 | switch (control) { | 577 | switch (control) { |
| 578 | case SND_SOC_CUSTOM: | 578 | case SND_SOC_CUSTOM: |
