Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293212
b: refs/heads/master
c: 8a713da
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Jan 21, 2012
1 parent 08b3bcf commit 7bc561b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 21 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: 278047fd654dde7ed95c8604fcefeeacc5c0bb2b
refs/heads/master: 8a713da8d1ce9ceaf738b32e2b24f22d4432f886
1 change: 1 addition & 0 deletions trunk/include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ struct snd_soc_codec {
unsigned int ac97_created:1; /* Codec has been created by SoC */
unsigned int sysfs_registered:1; /* codec has been sysfs registered */
unsigned int cache_init:1; /* codec cache has been initialized */
unsigned int using_regmap:1; /* using regmap access */
u32 cache_only; /* Suppress writes to hardware */
u32 cache_sync; /* Cache needs to be synced to hardware */

Expand Down
25 changes: 15 additions & 10 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1869,23 +1869,28 @@ EXPORT_SYMBOL_GPL(snd_soc_bulk_write_raw);
int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
unsigned int mask, unsigned int value)
{
int change;
bool change;
unsigned int old, new;
int ret;

ret = snd_soc_read(codec, reg);
if (ret < 0)
return ret;

old = ret;
new = (old & ~mask) | (value & mask);
change = old != new;
if (change) {
ret = snd_soc_write(codec, reg, new);
if (codec->using_regmap) {
ret = regmap_update_bits_check(codec->control_data, reg,
mask, value, &change);
} else {
ret = snd_soc_read(codec, reg);
if (ret < 0)
return ret;

old = ret;
new = (old & ~mask) | (value & mask);
change = old != new;
if (change)
ret = snd_soc_write(codec, reg, new);
}

if (ret < 0)
return ret;

return change;
}
EXPORT_SYMBOL_GPL(snd_soc_update_bits);
Expand Down
27 changes: 17 additions & 10 deletions trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,28 @@ static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val)
static int soc_widget_update_bits(struct snd_soc_dapm_widget *w,
unsigned short reg, unsigned int mask, unsigned int value)
{
int change;
bool change;
unsigned int old, new;
int ret;

ret = soc_widget_read(w, reg);
if (ret < 0)
return ret;

old = ret;
new = (old & ~mask) | (value & mask);
change = old != new;
if (change) {
ret = soc_widget_write(w, reg, new);
if (w->codec && w->codec->using_regmap) {
ret = regmap_update_bits_check(w->codec->control_data,
reg, mask, value, &change);
if (ret != 0)
return ret;
} else {
ret = soc_widget_read(w, reg);
if (ret < 0)
return ret;

old = ret;
new = (old & ~mask) | (value & mask);
change = old != new;
if (change) {
ret = soc_widget_write(w, reg, new);
if (ret < 0)
return ret;
}
}

return change;
Expand Down
1 change: 1 addition & 0 deletions trunk/sound/soc/soc-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,

case SND_SOC_REGMAP:
/* Device has made its own regmap arrangements */
codec->using_regmap = true;
break;

default:
Expand Down

0 comments on commit 7bc561b

Please sign in to comment.