Commit 283375ce authored by Mark Brown's avatar Mark Brown

ASoC: Push registers out of mixer power decision

No need for the mixers to know about this, and it allows for virtual
controls.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent ffbfd336
...@@ -1262,8 +1262,7 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget, ...@@ -1262,8 +1262,7 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
/* test and update the power status of a mixer or switch widget */ /* test and update the power status of a mixer or switch widget */
static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
struct snd_kcontrol *kcontrol, int reg, struct snd_kcontrol *kcontrol, int connect)
int val_mask, int val, int invert)
{ {
struct snd_soc_dapm_path *path; struct snd_soc_dapm_path *path;
int found = 0; int found = 0;
...@@ -1273,9 +1272,6 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, ...@@ -1273,9 +1272,6 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
widget->id != snd_soc_dapm_switch) widget->id != snd_soc_dapm_switch)
return -ENODEV; return -ENODEV;
if (!snd_soc_test_bits(widget->codec, reg, val_mask, val))
return 0;
/* find dapm widget path assoc with kcontrol */ /* find dapm widget path assoc with kcontrol */
list_for_each_entry(path, &widget->codec->dapm_paths, list) { list_for_each_entry(path, &widget->codec->dapm_paths, list) {
if (path->kcontrol != kcontrol) if (path->kcontrol != kcontrol)
...@@ -1283,12 +1279,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, ...@@ -1283,12 +1279,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
/* found, now check type */ /* found, now check type */
found = 1; found = 1;
if (val) path->connect = connect;
/* new connection */
path->connect = invert ? 0:1;
else
/* old connection must be powered down */
path->connect = invert ? 1:0;
break; break;
} }
...@@ -1695,6 +1686,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, ...@@ -1695,6 +1686,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
unsigned int mask = (1 << fls(max)) - 1; unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert; unsigned int invert = mc->invert;
unsigned int val, val2, val_mask; unsigned int val, val2, val_mask;
int connect;
int ret; int ret;
val = (ucontrol->value.integer.value[0] & mask); val = (ucontrol->value.integer.value[0] & mask);
...@@ -1721,7 +1713,17 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, ...@@ -1721,7 +1713,17 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
return 1; return 1;
} }
dapm_mixer_update_power(widget, kcontrol, reg, val_mask, val, invert); if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) {
if (val)
/* new connection */
connect = invert ? 0:1;
else
/* old connection must be powered down */
connect = invert ? 1:0;
dapm_mixer_update_power(widget, kcontrol, connect);
}
if (widget->event) { if (widget->event) {
if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
ret = widget->event(widget, kcontrol, ret = widget->event(widget, kcontrol,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment