Merge branch 'topic/misc' into for-linus
[safe/jmp/linux-2.6] / include / sound / soc.h
index 9c3ef6a..a40bc6f 100644 (file)
@@ -16,6 +16,8 @@
 #include <linux/platform_device.h>
 #include <linux/types.h>
 #include <linux/workqueue.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/control.h>
        .private_value = (unsigned long)&xenum }
 #define SOC_VALUE_ENUM(xname, xenum) \
 {      .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
-       .info = snd_soc_info_value_enum_double, \
+       .info = snd_soc_info_enum_double, \
        .get = snd_soc_get_value_enum_double, \
        .put = snd_soc_put_value_enum_double, \
        .private_value = (unsigned long)&xenum }
@@ -168,6 +170,9 @@ struct soc_enum;
 struct snd_soc_ac97_ops;
 struct snd_soc_jack;
 struct snd_soc_jack_pin;
+#ifdef CONFIG_GPIOLIB
+struct snd_soc_jack_gpio;
+#endif
 
 typedef int (*hw_write_t)(void *,const char* ,int);
 typedef int (*hw_read_t)(void *,char* ,int);
@@ -194,6 +199,12 @@ int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
                          struct snd_soc_jack_pin *pins);
+#ifdef CONFIG_GPIOLIB
+int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
+                       struct snd_soc_jack_gpio *gpios);
+void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
+                       struct snd_soc_jack_gpio *gpios);
+#endif
 
 /* codec IO */
 #define snd_soc_read(codec, reg) codec->read(codec, reg)
@@ -214,6 +225,8 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
  */
 struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
        void *data, char *long_name);
+int snd_soc_add_controls(struct snd_soc_codec *codec,
+       const struct snd_kcontrol_new *controls, int num_controls);
 int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_info *uinfo);
 int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
@@ -222,8 +235,6 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
 int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
-int snd_soc_info_value_enum_double(struct snd_kcontrol *kcontrol,
-       struct snd_ctl_elem_info *uinfo);
 int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
 int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
@@ -264,6 +275,27 @@ struct snd_soc_jack_pin {
        bool invert;
 };
 
+/**
+ * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
+ *
+ * @gpio:         gpio number
+ * @name:         gpio name
+ * @report:       value to report when jack detected
+ * @invert:       report presence in low state
+ * @debouce_time: debouce time in ms
+ */
+#ifdef CONFIG_GPIOLIB
+struct snd_soc_jack_gpio {
+       unsigned int gpio;
+       const char *name;
+       int report;
+       int invert;
+       int debounce_time;
+       struct snd_soc_jack *jack;
+       struct work_struct work;
+};
+#endif
+
 struct snd_soc_jack {
        struct snd_jack *jack;
        struct snd_soc_card *card;
@@ -418,6 +450,8 @@ struct snd_soc_card {
 
        struct snd_soc_device *socdev;
 
+       struct snd_soc_codec *codec;
+
        struct snd_soc_platform *platform;
        struct delayed_work delayed_work;
        struct work_struct deferred_resume_work;
@@ -427,7 +461,6 @@ struct snd_soc_card {
 struct snd_soc_device {
        struct device *dev;
        struct snd_soc_card *card;
-       struct snd_soc_codec *codec;
        struct snd_soc_codec_device *codec_dev;
        void *codec_data;
 };
@@ -451,17 +484,6 @@ struct soc_enum {
        unsigned char shift_l;
        unsigned char shift_r;
        unsigned int max;
-       const char **texts;
-       void *dapm;
-};
-
-/* semi enumerated kcontrol */
-struct soc_value_enum {
-       unsigned short reg;
-       unsigned short reg2;
-       unsigned char shift_l;
-       unsigned char shift_r;
-       unsigned int max;
        unsigned int mask;
        const char **texts;
        const unsigned int *values;