]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
ASoC: dapm: Export mixer|mux_update_power() to public API.
authorLiam Girdwood <lrg@ti.com>
Mon, 6 Feb 2012 16:05:14 +0000 (16:05 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 6 Feb 2012 16:17:01 +0000 (16:17 +0000)
Allow for the operation of custom mixer and mux DAPM widgets that can call
snd_soc_dapm_mixer_update_power() and snd_soc_dapm_mux_update_power() directly
after updating their status. This is useful with complex DAPM Mixer operations
where we need to do additional work in addition to setting a few mixer register
bits.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c

index bfa0d3cbbf259e3687f55e189984e50e8273ba75..db8435a79a822c0efb7fe1b8d73e4370b27ea223 100644 (file)
@@ -371,6 +371,12 @@ int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd,
        const char *stream, int event);
 void snd_soc_dapm_shutdown(struct snd_soc_card *card);
 
+/* external DAPM widget events */
+int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
+               struct snd_kcontrol *kcontrol, int connect);
+int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
+                                struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e);
+
 /* dapm sys fs - used by the core */
 int snd_soc_dapm_sys_add(struct device *dev);
 void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
index ec58a31465694ba53747e5d8f73b7e212257b05c..e9776a133d84f5504eca24d6e71450f5c1e79bfa 100644 (file)
@@ -1699,9 +1699,8 @@ static inline void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm)
 #endif
 
 /* test and update the power status of a mux widget */
-static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
-                                struct snd_kcontrol *kcontrol, int change,
-                                int mux, struct soc_enum *e)
+int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
+                                struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e)
 {
        struct snd_soc_dapm_path *path;
        int found = 0;
@@ -1711,9 +1710,6 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
            widget->id != snd_soc_dapm_value_mux)
                return -ENODEV;
 
-       if (!change)
-               return 0;
-
        /* find dapm widget path assoc with kcontrol */
        list_for_each_entry(path, &widget->dapm->card->paths, list) {
                if (path->kcontrol != kcontrol)
@@ -1742,9 +1738,10 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(snd_soc_dapm_mux_update_power);
 
 /* test and update the power status of a mixer or switch widget */
-static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
+int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
                                   struct snd_kcontrol *kcontrol, int connect)
 {
        struct snd_soc_dapm_path *path;
@@ -1773,6 +1770,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power);
 
 /* show dapm widget status in sys fs */
 static ssize_t dapm_widget_show(struct device *dev,
@@ -2357,7 +2355,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
                        update.val = val;
                        widget->dapm->update = &update;
 
-                       dapm_mixer_update_power(widget, kcontrol, connect);
+                       snd_soc_dapm_mixer_update_power(widget, kcontrol, connect);
 
                        widget->dapm->update = NULL;
                }
@@ -2448,7 +2446,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
                        update.val = val;
                        widget->dapm->update = &update;
 
-                       dapm_mux_update_power(widget, kcontrol, change, mux, e);
+                       snd_soc_dapm_mux_update_power(widget, kcontrol, mux, e);
 
                        widget->dapm->update = NULL;
                }
@@ -2509,8 +2507,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
 
                        widget->value = ucontrol->value.enumerated.item[0];
 
-                       dapm_mux_update_power(widget, kcontrol, change,
-                                             widget->value, e);
+                       snd_soc_dapm_mux_update_power(widget, kcontrol, widget->value, e);
                }
        }
 
@@ -2613,7 +2610,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
                        update.val = val;
                        widget->dapm->update = &update;
 
-                       dapm_mux_update_power(widget, kcontrol, change, mux, e);
+                       snd_soc_dapm_mux_update_power(widget, kcontrol, mux, e);
 
                        widget->dapm->update = NULL;
                }