aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-10-05 12:23:30 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-10-06 08:04:41 -0400
commit3a65577d2199a7b33c85fd32838020c39da200f3 (patch)
tree0fcc8ea9b16773dc6a7ed072568c2268e76bfd3d /sound/soc/soc-dapm.c
parent1642e3d42a062221e4df18df260d4703d18ca519 (diff)
ASoC: Push DAPM enumeration register change test out
Don't assume that enumerations are backed by registers when updating mux power. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 613764638c7d..311467b95afb 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1202,8 +1202,8 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec)
1202 1202
1203/* test and update the power status of a mux widget */ 1203/* test and update the power status of a mux widget */
1204static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget, 1204static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
1205 struct snd_kcontrol *kcontrol, int mask, 1205 struct snd_kcontrol *kcontrol, int change,
1206 int mux, int val, struct soc_enum *e) 1206 int mux, struct soc_enum *e)
1207{ 1207{
1208 struct snd_soc_dapm_path *path; 1208 struct snd_soc_dapm_path *path;
1209 int found = 0; 1209 int found = 0;
@@ -1212,7 +1212,7 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
1212 widget->id != snd_soc_dapm_value_mux) 1212 widget->id != snd_soc_dapm_value_mux)
1213 return -ENODEV; 1213 return -ENODEV;
1214 1214
1215 if (!snd_soc_test_bits(widget->codec, e->reg, mask, val)) 1215 if (!change)
1216 return 0; 1216 return 0;
1217 1217
1218 /* find dapm widget path assoc with kcontrol */ 1218 /* find dapm widget path assoc with kcontrol */
@@ -1765,7 +1765,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
1765{ 1765{
1766 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); 1766 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
1767 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 1767 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
1768 unsigned int val, mux; 1768 unsigned int val, mux, change;
1769 unsigned int mask, bitmask; 1769 unsigned int mask, bitmask;
1770 int ret = 0; 1770 int ret = 0;
1771 1771
@@ -1785,7 +1785,8 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
1785 1785
1786 mutex_lock(&widget->codec->mutex); 1786 mutex_lock(&widget->codec->mutex);
1787 widget->value = val; 1787 widget->value = val;
1788 dapm_mux_update_power(widget, kcontrol, mask, mux, val, e); 1788 change = snd_soc_test_bits(widget->codec, e->reg, mask, val);
1789 dapm_mux_update_power(widget, kcontrol, change, mux, e);
1789 1790
1790 if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { 1791 if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
1791 ret = widget->event(widget, 1792 ret = widget->event(widget,
@@ -1864,7 +1865,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
1864{ 1865{
1865 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); 1866 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
1866 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 1867 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
1867 unsigned int val, mux; 1868 unsigned int val, mux, change;
1868 unsigned int mask; 1869 unsigned int mask;
1869 int ret = 0; 1870 int ret = 0;
1870 1871
@@ -1882,7 +1883,8 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
1882 1883
1883 mutex_lock(&widget->codec->mutex); 1884 mutex_lock(&widget->codec->mutex);
1884 widget->value = val; 1885 widget->value = val;
1885 dapm_mux_update_power(widget, kcontrol, mask, mux, val, e); 1886 change = snd_soc_test_bits(widget->codec, e->reg, mask, val);
1887 dapm_mux_update_power(widget, kcontrol, change, mux, e);
1886 1888
1887 if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { 1889 if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
1888 ret = widget->event(widget, 1890 ret = widget->event(widget,