Merge branch 'topic/snd_card_new-err' into topic/asoc
[cascardo/linux.git] / include / sound / soc.h
index 9b930d3..0e77352 100644 (file)
        .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 }
@@ -154,6 +154,8 @@ enum snd_soc_bias_level {
        SND_SOC_BIAS_OFF,
 };
 
+struct snd_jack;
+struct snd_soc_card;
 struct snd_soc_device;
 struct snd_soc_pcm_stream;
 struct snd_soc_ops;
@@ -164,6 +166,8 @@ struct snd_soc_platform;
 struct snd_soc_codec;
 struct soc_enum;
 struct snd_soc_ac97_ops;
+struct snd_soc_jack;
+struct snd_soc_jack_pin;
 
 typedef int (*hw_write_t)(void *,const char* ,int);
 typedef int (*hw_read_t)(void *,char* ,int);
@@ -184,6 +188,13 @@ int snd_soc_init_card(struct snd_soc_device *socdev);
 int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
        const struct snd_pcm_hardware *hw);
 
+/* Jack reporting */
+int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
+                    struct snd_soc_jack *jack);
+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);
+
 /* codec IO */
 #define snd_soc_read(codec, reg) codec->read(codec, reg)
 #define snd_soc_write(codec, reg, value) codec->write(codec, reg, value)
@@ -203,6 +214,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,
@@ -211,8 +224,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,
@@ -239,6 +250,27 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
 int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
 
+/**
+ * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
+ *
+ * @pin:    name of the pin to update
+ * @mask:   bits to check for in reported jack status
+ * @invert: if non-zero then pin is enabled when status is not reported
+ */
+struct snd_soc_jack_pin {
+       struct list_head list;
+       const char *pin;
+       int mask;
+       bool invert;
+};
+
+struct snd_soc_jack {
+       struct snd_jack *jack;
+       struct snd_soc_card *card;
+       struct list_head pins;
+       int status;
+};
+
 /* SoC PCM stream information */
 struct snd_soc_pcm_stream {
        char *stream_name;
@@ -386,6 +418,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;
@@ -395,7 +429,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;
 };
@@ -414,17 +447,6 @@ struct soc_mixer_control {
 
 /* enumerated kcontrol */
 struct soc_enum {
-       unsigned short reg;
-       unsigned short reg2;
-       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;