ASoC: dapm: Change prototype of soc_widget_read
soc_widget_read API returns the register data and it is possible that a register can contain 0xffffffff. Thus, change the prototype of soc_widget_read to return only the error code and pass the reg data through pointer argument. Signed-off-by: Arun Shamanna Lakshmi <aruns@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Родитель
b893ea5f1c
Коммит
f7d3c17096
|
@ -371,12 +371,16 @@ static void dapm_reset(struct snd_soc_card *card)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
if (w->codec) {
|
||||||
return snd_soc_read(w->codec, reg);
|
*value = snd_soc_read(w->codec, reg);
|
||||||
else if (w->platform)
|
return 0;
|
||||||
return snd_soc_platform_read(w->platform, reg);
|
} 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");
|
dev_err(w->dapm->dev, "ASoC: no valid widget read method\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -430,13 +434,12 @@ static int soc_widget_update_bits_locked(struct snd_soc_dapm_widget *w,
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
soc_widget_lock(w);
|
soc_widget_lock(w);
|
||||||
ret = soc_widget_read(w, reg);
|
ret = soc_widget_read(w, reg, &old);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
soc_widget_unlock(w);
|
soc_widget_unlock(w);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
old = ret;
|
|
||||||
new = (old & ~mask) | (value & mask);
|
new = (old & ~mask) | (value & mask);
|
||||||
change = old != new;
|
change = old != new;
|
||||||
if (change) {
|
if (change) {
|
||||||
|
@ -513,7 +516,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
|
||||||
unsigned int invert = mc->invert;
|
unsigned int invert = mc->invert;
|
||||||
|
|
||||||
if (reg != SND_SOC_NOPM) {
|
if (reg != SND_SOC_NOPM) {
|
||||||
val = soc_widget_read(w, reg);
|
soc_widget_read(w, reg, &val);
|
||||||
val = (val >> shift) & mask;
|
val = (val >> shift) & mask;
|
||||||
if (invert)
|
if (invert)
|
||||||
val = max - val;
|
val = max - val;
|
||||||
|
@ -529,7 +532,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
|
||||||
w->kcontrol_news[i].private_value;
|
w->kcontrol_news[i].private_value;
|
||||||
int val, item;
|
int val, item;
|
||||||
|
|
||||||
val = soc_widget_read(w, e->reg);
|
soc_widget_read(w, e->reg, &val);
|
||||||
item = (val >> e->shift_l) & e->mask;
|
item = (val >> e->shift_l) & e->mask;
|
||||||
|
|
||||||
if (item < e->max && !strcmp(p->name, e->texts[item]))
|
if (item < e->max && !strcmp(p->name, e->texts[item]))
|
||||||
|
@ -558,7 +561,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
|
||||||
w->kcontrol_news[i].private_value;
|
w->kcontrol_news[i].private_value;
|
||||||
int val, item;
|
int val, item;
|
||||||
|
|
||||||
val = soc_widget_read(w, e->reg);
|
soc_widget_read(w, e->reg, &val);
|
||||||
val = (val >> e->shift_l) & e->mask;
|
val = (val >> e->shift_l) & e->mask;
|
||||||
for (item = 0; item < e->max; item++) {
|
for (item = 0; item < e->max; item++) {
|
||||||
if (val == e->values[item])
|
if (val == e->values[item])
|
||||||
|
@ -2782,7 +2785,8 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
|
||||||
|
|
||||||
/* Read the initial power state from the device */
|
/* Read the initial power state from the device */
|
||||||
if (w->reg >= 0) {
|
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;
|
val &= w->mask;
|
||||||
if (val == w->on_val)
|
if (val == w->on_val)
|
||||||
w->power = 1;
|
w->power = 1;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче