]> err.no Git - linux-2.6/blobdiff - sound/soc/soc-dapm.c
[NETFILTER]: ctnetlink: add support for NAT sequence adjustments
[linux-2.6] / sound / soc / soc-dapm.c
index 2c2c27f4e9c0c7bdc7169fd7d52094dbc96f6536..29a546fecacf28fead8e36648dcf18e53a8e4852 100644 (file)
@@ -24,7 +24,7 @@
  *    o Automatic Mic Bias support
  *    o Jack insertion power event initiation - e.g. hp insertion will enable
  *      sinks, dacs, etc
- *    o Delayed powerdown of audio susbsytem to reduce pops between a quick
+ *    o Delayed powerdown of audio susbsystem to reduce pops between a quick
  *      device reopen.
  *
  *  Todo:
@@ -63,7 +63,7 @@
 #define POP_DEBUG 0
 #if POP_DEBUG
 #define POP_TIME 500 /* 500 msecs - change if pop debug is too fast */
-#define pop_wait(time) schedule_timeout_interruptible(msecs_to_jiffies(time))
+#define pop_wait(time) schedule_timeout_uninterruptible(msecs_to_jiffies(time))
 #define pop_dbg(format, arg...) printk(format, ## arg); pop_wait(POP_TIME)
 #else
 #define pop_dbg(format, arg...)
@@ -87,16 +87,10 @@ module_param(dapm_status, int, 0);
 MODULE_PARM_DESC(dapm_status, "enable DPM sysfs entries");
 
 /* create a new dapm widget */
-static struct snd_soc_dapm_widget *dapm_cnew_widget(
+static inline struct snd_soc_dapm_widget *dapm_cnew_widget(
        const struct snd_soc_dapm_widget *_widget)
 {
-       struct snd_soc_dapm_widget* widget;
-       widget = kmalloc(sizeof(struct snd_soc_dapm_widget), GFP_KERNEL);
-       if (!widget)
-               return NULL;
-
-       memcpy(widget, _widget, sizeof(struct snd_soc_dapm_widget));
-       return widget;
+       return kmemdup(_widget, sizeof(*_widget), GFP_KERNEL);
 }
 
 /* set up initial codec paths */
@@ -463,7 +457,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget)
  *  o Input pin to Output pin (bypass, sidetone)
  *  o DAC to ADC (loopback).
  */
-int dapm_power_widgets(struct snd_soc_codec *codec, int event)
+static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
 {
        struct snd_soc_dapm_widget *w;
        int in, out, i, c = 1, *seq = NULL, ret = 0, power_change, power;
@@ -651,7 +645,6 @@ static void dbg_dump_dapm(struct snd_soc_codec* codec, const char *action)
                                                        p->source->name);
                                }
                                list_for_each_entry(p, &w->sinks, list_source) {
-                                       p = list_entry(lp, struct snd_soc_dapm_path, list_source);
                                        if (p->connect)
                                                printk(" out %s %s\n", p->name ? p->name : "static",
                                                        p->sink->name);
@@ -664,8 +657,9 @@ static void dbg_dump_dapm(struct snd_soc_codec* codec, const char *action)
 #endif
 
 /* test and update the power status of a mux widget */
-int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
-       struct snd_kcontrol *kcontrol, int mask, int val, struct soc_enum* e)
+static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
+                                struct snd_kcontrol *kcontrol, int mask,
+                                int val, struct soc_enum* e)
 {
        struct snd_soc_dapm_path *path;
        int found = 0;
@@ -697,11 +691,11 @@ int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(dapm_mux_update_power);
 
 /* test and update the power status of a mixer widget */
-int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
-       struct snd_kcontrol *kcontrol, int reg, int val_mask, int val, int invert)
+static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
+                                  struct snd_kcontrol *kcontrol, int reg,
+                                  int val_mask, int val, int invert)
 {
        struct snd_soc_dapm_path *path;
        int found = 0;
@@ -733,7 +727,6 @@ int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(dapm_mixer_update_power);
 
 /* show dapm widget status in sys fs */
 static ssize_t dapm_widget_show(struct device *dev,
@@ -808,7 +801,7 @@ static void snd_soc_dapm_sys_remove(struct device *dev)
 }
 
 /* free all dapm widgets and resources */
-void dapm_free_widgets(struct snd_soc_codec *codec)
+static void dapm_free_widgets(struct snd_soc_codec *codec)
 {
        struct snd_soc_dapm_widget *w, *next_w;
        struct snd_soc_dapm_path *p, *next_p;
@@ -889,13 +882,15 @@ int snd_soc_dapm_connect_input(struct snd_soc_codec *codec, const char *sink,
        if (wsink->id == snd_soc_dapm_input) {
                if (wsource->id == snd_soc_dapm_micbias ||
                        wsource->id == snd_soc_dapm_mic ||
-                       wsink->id == snd_soc_dapm_line)
+                       wsink->id == snd_soc_dapm_line ||
+                       wsink->id == snd_soc_dapm_output)
                        wsink->ext = 1;
        }
        if (wsource->id == snd_soc_dapm_output) {
                if (wsink->id == snd_soc_dapm_spk ||
                        wsink->id == snd_soc_dapm_hp ||
-                       wsink->id == snd_soc_dapm_line)
+                       wsink->id == snd_soc_dapm_line ||
+                       wsink->id == snd_soc_dapm_input)
                        wsource->ext = 1;
        }
 
@@ -1240,6 +1235,9 @@ int snd_soc_dapm_stream_event(struct snd_soc_codec *codec,
 {
        struct snd_soc_dapm_widget *w;
 
+       if (stream == NULL)
+               return 0;
+
        mutex_lock(&codec->mutex);
        list_for_each_entry(w, &codec->dapm_widgets, list)
        {