}
}
-static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
+static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg,
+ unsigned int *value)
{
- if (w->codec)
- return snd_soc_read(w->codec, reg);
- else if (w->platform)
- return snd_soc_platform_read(w->platform, reg);
+ if (w->codec) {
+ *value = snd_soc_read(w->codec, reg);
+ return 0;
+ } else if (w->platform) {
+ *value = snd_soc_platform_read(w->platform, reg);
+ return 0;
+ }
dev_err(w->dapm->dev, "ASoC: no valid widget read method\n");
return -1;
return ret;
} else {
soc_widget_lock(w);
- ret = soc_widget_read(w, reg);
+ ret = soc_widget_read(w, reg, &old);
if (ret < 0) {
soc_widget_unlock(w);
return ret;
}
- old = ret;
new = (old & ~mask) | (value & mask);
change = old != new;
if (change) {
unsigned int invert = mc->invert;
if (reg != SND_SOC_NOPM) {
- val = soc_widget_read(w, reg);
+ soc_widget_read(w, reg, &val);
val = (val >> shift) & mask;
if (invert)
val = max - val;
w->kcontrol_news[i].private_value;
int val, item;
- val = soc_widget_read(w, e->reg);
+ soc_widget_read(w, e->reg, &val);
item = (val >> e->shift_l) & e->mask;
if (item < e->max && !strcmp(p->name, e->texts[item]))
w->kcontrol_news[i].private_value;
int val, item;
- val = soc_widget_read(w, e->reg);
+ soc_widget_read(w, e->reg, &val);
val = (val >> e->shift_l) & e->mask;
for (item = 0; item < e->max; item++) {
if (val == e->values[item])
/* Read the initial power state from the device */
if (w->reg >= 0) {
- val = soc_widget_read(w, w->reg) >> w->shift;
+ soc_widget_read(w, w->reg, &val);
+ val = val >> w->shift;
val &= w->mask;
if (val == w->on_val)
w->power = 1;