]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/soc/soc-dapm.c
[ALSA] sound: fix export symbol typo
[linux-2.6-omap-h63xx.git] / sound / soc / soc-dapm.c
index 91d58b56470eebb2fa3a561f8d11f255a0ed0d22..c60200ccde60f83013a4caf1bd70bb39ee4d70af 100644 (file)
@@ -226,7 +226,7 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
                snd_soc_write(codec, widget->reg, new);
                pop_wait(POP_TIME);
        }
-       dbg("reg old %x new %x change %d\n", old, new, change);
+       dbg("reg %x old %x new %x change %d\n", widget->reg, old, new, change);
        return change;
 }
 
@@ -523,11 +523,13 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
                                        continue;
 
                                if (event == SND_SOC_DAPM_STREAM_START) {
-                                       ret = w->event(w, SND_SOC_DAPM_PRE_PMU);
+                                       ret = w->event(w,
+                                               NULL, SND_SOC_DAPM_PRE_PMU);
                                        if (ret < 0)
                                                return ret;
                                } else if (event == SND_SOC_DAPM_STREAM_STOP) {
-                                       ret = w->event(w, SND_SOC_DAPM_PRE_PMD);
+                                       ret = w->event(w,
+                                               NULL, SND_SOC_DAPM_PRE_PMD);
                                        if (ret < 0)
                                                return ret;
                                }
@@ -538,11 +540,13 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
                                        continue;
 
                                if (event == SND_SOC_DAPM_STREAM_START) {
-                                       ret = w->event(w, SND_SOC_DAPM_POST_PMU);
+                                       ret = w->event(w,
+                                               NULL, SND_SOC_DAPM_POST_PMU);
                                        if (ret < 0)
                                                return ret;
                                } else if (event == SND_SOC_DAPM_STREAM_STOP) {
-                                       ret = w->event(w, SND_SOC_DAPM_POST_PMD);
+                                       ret = w->event(w,
+                                               NULL, SND_SOC_DAPM_POST_PMD);
                                        if (ret < 0)
                                                return ret;
                                }
@@ -566,26 +570,30 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
                                        if (power) {
                                                /* power up event */
                                                if (w->event_flags & SND_SOC_DAPM_PRE_PMU) {
-                                                       ret = w->event(w, SND_SOC_DAPM_PRE_PMU);
+                                                       ret = w->event(w,
+                                                               NULL, SND_SOC_DAPM_PRE_PMU);
                                                        if (ret < 0)
                                                                return ret;
                                                }
                                                dapm_update_bits(w);
                                                if (w->event_flags & SND_SOC_DAPM_POST_PMU){
-                                                       ret = w->event(w, SND_SOC_DAPM_POST_PMU);
+                                                       ret = w->event(w,
+                                                               NULL, SND_SOC_DAPM_POST_PMU);
                                                        if (ret < 0)
                                                                return ret;
                                                }
                                        } else {
                                                /* power down event */
                                                if (w->event_flags & SND_SOC_DAPM_PRE_PMD) {
-                                                       ret = w->event(w, SND_SOC_DAPM_PRE_PMD);
+                                                       ret = w->event(w,
+                                                               NULL, SND_SOC_DAPM_PRE_PMD);
                                                        if (ret < 0)
                                                                return ret;
                                                }
                                                dapm_update_bits(w);
                                                if (w->event_flags & SND_SOC_DAPM_POST_PMD) {
-                                                       ret = w->event(w, SND_SOC_DAPM_POST_PMD);
+                                                       ret = w->event(w,
+                                                               NULL, SND_SOC_DAPM_POST_PMD);
                                                        if (ret < 0)
                                                                return ret;
                                                }
@@ -963,7 +971,6 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec)
 {
        struct snd_soc_dapm_widget *w;
 
-       mutex_lock(&codec->mutex);
        list_for_each_entry(w, &codec->dapm_widgets, list)
        {
                if (w->new)
@@ -998,7 +1005,6 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec)
        }
 
        dapm_power_widgets(codec, SND_SOC_DAPM_STREAM_NOP);
-       mutex_unlock(&codec->mutex);
        return 0;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets);
@@ -1095,13 +1101,17 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
        dapm_mixer_update_power(widget, kcontrol, reg, val_mask, val, invert);
        if (widget->event) {
                if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
-                       ret = widget->event(widget, SND_SOC_DAPM_PRE_REG);
-                       if (ret < 0)
+                       ret = widget->event(widget, kcontrol,
+                                               SND_SOC_DAPM_PRE_REG);
+                       if (ret < 0) {
+                               ret = 1;
                                goto out;
+                       }
                }
                ret = snd_soc_update_bits(widget->codec, reg, val_mask, val);
                if (widget->event_flags & SND_SOC_DAPM_POST_REG)
-                       ret = widget->event(widget, SND_SOC_DAPM_POST_REG);
+                       ret = widget->event(widget, kcontrol,
+                                               SND_SOC_DAPM_POST_REG);
        } else
                ret = snd_soc_update_bits(widget->codec, reg, val_mask, val);
 
@@ -1176,13 +1186,15 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
        dapm_mux_update_power(widget, kcontrol, mask, mux, e);
        if (widget->event) {
                if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
-                       ret = widget->event(widget, SND_SOC_DAPM_PRE_REG);
+                       ret = widget->event(widget,
+                               kcontrol, SND_SOC_DAPM_PRE_REG);
                        if (ret < 0)
                                goto out;
                }
                ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
                if (widget->event_flags & SND_SOC_DAPM_POST_REG)
-                       ret = widget->event(widget, SND_SOC_DAPM_POST_REG);
+                       ret = widget->event(widget,
+                               kcontrol, SND_SOC_DAPM_POST_REG);
        } else
                ret = snd_soc_update_bits(widget->codec, e->reg, mask, val);
 
@@ -1276,7 +1288,7 @@ int snd_soc_dapm_stream_event(struct snd_soc_codec *codec,
        mutex_unlock(&codec->mutex);
 
        dapm_power_widgets(codec, event);
-       dump_dapm(codec, __FUNCTION__);
+       dump_dapm(codec, __func__);
        return 0;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_stream_event);
@@ -1297,9 +1309,9 @@ int snd_soc_dapm_device_event(struct snd_soc_device *socdev, int event)
        struct snd_soc_machine *machine = socdev->machine;
 
        if (machine->dapm_event)
-                               machine->dapm_event(machine, event);
+               machine->dapm_event(machine, event);
        if (codec->dapm_event)
-                               codec->dapm_event(codec, event);
+               codec->dapm_event(codec, event);
        return 0;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_device_event);
@@ -1322,13 +1334,37 @@ int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec,
        list_for_each_entry(w, &codec->dapm_widgets, list) {
                if (!strcmp(w->name, endpoint)) {
                        w->connected = status;
+                       return 0;
                }
        }
 
-       return 0;
+       return -ENODEV;
 }
 EXPORT_SYMBOL_GPL(snd_soc_dapm_set_endpoint);
 
+/**
+ * snd_soc_dapm_get_endpoint_status - get audio endpoint status
+ * @codec: audio codec
+ * @endpoint: audio signal endpoint (or start point)
+ *
+ * Get audio endpoint status - connected or disconnected.
+ *
+ * Returns status
+ */
+int snd_soc_dapm_get_endpoint_status(struct snd_soc_codec *codec,
+       char *endpoint)
+{
+       struct snd_soc_dapm_widget *w;
+
+       list_for_each_entry(w, &codec->dapm_widgets, list) {
+               if (!strcmp(w->name, endpoint))
+                       return w->connected;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_get_endpoint_status);
+
 /**
  * snd_soc_dapm_free - free dapm resources
  * @socdev: SoC device