Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
[linux-2.6-block.git] / include / sound / soc.h
index fb955e69a78ea29f79bd4382b492bca009cd6fe7..7afb72ceac5628b5efbdb616bde8e123580e3260 100644 (file)
        .put = snd_soc_put_volsw, \
        .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
                                          max, invert, 0) }
+#define SOC_DOUBLE_STS(xname, reg, shift_left, shift_right, max, invert) \
+{                                                                      \
+       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),           \
+       .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,           \
+       .access = SNDRV_CTL_ELEM_ACCESS_READ |                          \
+               SNDRV_CTL_ELEM_ACCESS_VOLATILE,                         \
+       .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
+                                         max, invert, 0) }
 #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
 {      .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
        .info = snd_soc_info_volsw, \
                {.base = xbase, .num_regs = xregs,            \
                 .mask = xmask }) }
 
+/*
+ * SND_SOC_BYTES_EXT is deprecated, please USE SND_SOC_BYTES_TLV instead
+ */
 #define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \
 {      .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
        .info = snd_soc_bytes_info_ext, \
@@ -787,6 +798,7 @@ struct snd_soc_component {
        unsigned int registered_as_component:1;
 
        struct list_head list;
+       struct list_head list_aux; /* for auxiliary component of the card */
 
        struct snd_soc_dai_driver *dai_drv;
        int num_dai;
@@ -830,6 +842,9 @@ struct snd_soc_component {
        int (*probe)(struct snd_soc_component *);
        void (*remove)(struct snd_soc_component *);
 
+       /* machine specific init */
+       int (*init)(struct snd_soc_component *component);
+
 #ifdef CONFIG_DEBUG_FS
        void (*init_debugfs)(struct snd_soc_component *component);
        const char *debugfs_prefix;
@@ -1037,6 +1052,9 @@ struct snd_soc_dai_link {
 
        /* pmdown_time is ignored at stop */
        unsigned int ignore_pmdown_time:1;
+
+       struct list_head list; /* DAI link list of the soc card */
+       struct snd_soc_dobj dobj; /* For topology */
 };
 
 struct snd_soc_codec_conf {
@@ -1101,12 +1119,20 @@ struct snd_soc_card {
                                   struct snd_soc_dapm_context *dapm,
                                   enum snd_soc_bias_level level);
 
+       int (*add_dai_link)(struct snd_soc_card *,
+                           struct snd_soc_dai_link *link);
+       void (*remove_dai_link)(struct snd_soc_card *,
+                           struct snd_soc_dai_link *link);
+
        long pmdown_time;
 
        /* CPU <--> Codec DAI links  */
-       struct snd_soc_dai_link *dai_link;
-       int num_links;
-       struct snd_soc_pcm_runtime *rtd;
+       struct snd_soc_dai_link *dai_link;  /* predefined links only */
+       int num_links;  /* predefined links only */
+       struct list_head dai_link_list; /* all links */
+       int num_dai_links;
+
+       struct list_head rtd_list;
        int num_rtd;
 
        /* optional codec specific configuration */
@@ -1119,8 +1145,7 @@ struct snd_soc_card {
         */
        struct snd_soc_aux_dev *aux_dev;
        int num_aux_devs;
-       struct snd_soc_pcm_runtime *rtd_aux;
-       int num_aux_rtd;
+       struct list_head aux_comp_list;
 
        const struct snd_kcontrol_new *controls;
        int num_controls;
@@ -1201,6 +1226,9 @@ struct snd_soc_pcm_runtime {
        struct dentry *debugfs_dpcm_root;
        struct dentry *debugfs_dpcm_state;
 #endif
+
+       unsigned int num; /* 0-based and monotonic increasing */
+       struct list_head list; /* rtd list of the soc card */
 };
 
 /* mixer control */
@@ -1225,8 +1253,10 @@ struct soc_bytes_ext {
        struct snd_soc_dobj dobj;
 
        /* used for TLV byte control */
-       int (*get)(unsigned int __user *bytes, unsigned int size);
-       int (*put)(const unsigned int __user *bytes, unsigned int size);
+       int (*get)(struct snd_kcontrol *kcontrol, unsigned int __user *bytes,
+                       unsigned int size);
+       int (*put)(struct snd_kcontrol *kcontrol, const unsigned int __user *bytes,
+                       unsigned int size);
 };
 
 /* multi register control */
@@ -1523,6 +1553,7 @@ static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
        INIT_LIST_HEAD(&card->widgets);
        INIT_LIST_HEAD(&card->paths);
        INIT_LIST_HEAD(&card->dapm_list);
+       INIT_LIST_HEAD(&card->aux_comp_list);
 }
 
 static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
@@ -1644,6 +1675,14 @@ int snd_soc_of_get_dai_link_codecs(struct device *dev,
                                   struct device_node *of_node,
                                   struct snd_soc_dai_link *dai_link);
 
+int snd_soc_add_dai_link(struct snd_soc_card *card,
+                               struct snd_soc_dai_link *dai_link);
+void snd_soc_remove_dai_link(struct snd_soc_card *card,
+                            struct snd_soc_dai_link *dai_link);
+
+int snd_soc_register_dai(struct snd_soc_component *component,
+       struct snd_soc_dai_driver *dai_drv);
+
 #include <sound/soc-dai.h>
 
 #ifdef CONFIG_DEBUG_FS