Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182874
b: refs/heads/master
c: 8c961bc
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Feb 3, 2010
1 parent d4b1eda commit a75f318
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0f69d9782c6e6a7b0e60113a850845bc642c3f4e
refs/heads/master: 8c961bcca1d10be4f2c06375eb561679167653a0
1 change: 1 addition & 0 deletions trunk/include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ struct snd_soc_codec {
short reg_cache_step;

unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
unsigned int cache_only:1; /* Suppress writes to hardware */

/* dapm */
u32 pop_time;
Expand Down
26 changes: 24 additions & 2 deletions trunk/sound/soc/soc-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg,

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

if (codec->cache_only)
return 0;

ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2)
return 0;
Expand Down Expand Up @@ -100,6 +104,10 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg,

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

if (codec->cache_only)
return 0;

ret = codec->hw_write(codec->control_data, data, 2);
if (ret == 2)
return 0;
Expand Down Expand Up @@ -153,6 +161,9 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,
if (reg < codec->reg_cache_size)
cache[reg] = value;

if (codec->cache_only)
return 0;

if (codec->hw_write(codec->control_data, data, 2) == 2)
return 0;
else
Expand Down Expand Up @@ -181,6 +192,9 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg,
if (!snd_soc_codec_volatile_register(codec, reg))
reg_cache[reg] = value;

if (codec->cache_only)
return 0;

if (codec->hw_write(codec->control_data, data, 3) == 3)
return 0;
else
Expand All @@ -193,10 +207,14 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec,
u16 *cache = codec->reg_cache;

if (reg >= codec->reg_cache_size ||
snd_soc_codec_volatile_register(codec, reg))
snd_soc_codec_volatile_register(codec, reg)) {
if (codec->cache_only)
return -EINVAL;

return codec->hw_read(codec, reg);
else
} else {
return cache[reg];
}
}

#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
Expand Down Expand Up @@ -294,6 +312,10 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
reg &= 0xff;
if (reg < codec->reg_cache_size)
cache[reg] = value;

if (codec->cache_only)
return 0;

ret = codec->hw_write(codec->control_data, data, 3);
if (ret == 3)
return 0;
Expand Down

0 comments on commit a75f318

Please sign in to comment.