]> Pileus Git - ~andy/linux/commitdiff
ASoC: dapm: Add regulator member to struct dapm_widget
authorLiam Girdwood <lrg@ti.com>
Fri, 9 Mar 2012 17:20:16 +0000 (17:20 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 1 Apr 2012 10:28:22 +0000 (11:28 +0100)
Currently DAPM widgets use the private data for their regulator.
Add a regulator * for widgets to use instead of private data.

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 64302384dea3283798c2865b45e36d70c362708f..7562b8fb69740de80b13a84c989264717578b7bc 100644 (file)
@@ -324,6 +324,7 @@ struct snd_soc_dapm_path;
 struct snd_soc_dapm_pin;
 struct snd_soc_dapm_route;
 struct snd_soc_dapm_context;
+struct regulator;
 
 int dapm_reg_event(struct snd_soc_dapm_widget *w,
                   struct snd_kcontrol *kcontrol, int event);
@@ -487,6 +488,7 @@ struct snd_soc_dapm_widget {
        struct snd_soc_dapm_context *dapm;
 
        void *priv;                             /* widget specific data */
+       struct regulator *regulator;            /* attached regulator */
 
        /* dapm control */
        short reg;                                              /* negative reg = no direct dapm */
index de001698825d53973626d50aade9c38a6cbc289a..42602ddea24389dc6d40cfd805039b07dba85f70 100644 (file)
@@ -861,9 +861,9 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
                   struct snd_kcontrol *kcontrol, int event)
 {
        if (SND_SOC_DAPM_EVENT_ON(event))
-               return regulator_enable(w->priv);
+               return regulator_enable(w->regulator);
        else
-               return regulator_disable_deferred(w->priv, w->shift);
+               return regulator_disable_deferred(w->regulator, w->shift);
 }
 EXPORT_SYMBOL_GPL(dapm_regulator_event);
 
@@ -2768,9 +2768,9 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
 
        switch (w->id) {
        case snd_soc_dapm_regulator_supply:
-               w->priv = devm_regulator_get(dapm->dev, w->name);
-               if (IS_ERR(w->priv)) {
-                       ret = PTR_ERR(w->priv);
+               w->regulator = devm_regulator_get(dapm->dev, w->name);
+               if (IS_ERR(w->regulator)) {
+                       ret = PTR_ERR(w->regulator);
                        dev_err(dapm->dev, "Failed to request %s: %d\n",
                                w->name, ret);
                        return NULL;