Merge remote-tracking branches 'asoc/topic/topology', 'asoc/topic/twl6040', 'asoc...
[deliverable/linux.git] / include / sound / soc.h
index fcb312b3f25809e781098e2bd2514ae89f59329f..93df8bf9d54a9e1b9502836faec752b4c6aa20b0 100644 (file)
@@ -27,6 +27,7 @@
 #include <sound/compress_driver.h>
 #include <sound/control.h>
 #include <sound/ac97_codec.h>
+#include <sound/soc-topology.h>
 
 /*
  * Convenience kcontrol builders
 #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \
 {      .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
        .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues}
-#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \
-       SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues)
+#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \
+       SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xitems, xtexts, xvalues)
+#define SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \
+{      .reg = xreg, .shift_l = xshift, .shift_r = xshift, \
+       .mask = xmask, .items = xitems, .texts = xtexts, \
+       .values = xvalues, .autodisable = 1}
 #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \
        SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts)
 #define SOC_ENUM(xname, xenum) \
                                                        ARRAY_SIZE(xtexts), xtexts, xvalues)
 #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
        SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
+
+#define SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
+       const struct soc_enum name = SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, \
+               xshift, xmask, ARRAY_SIZE(xtexts), xtexts, xvalues)
+
 #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \
        const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts)
 
@@ -387,8 +397,20 @@ int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
 int snd_soc_register_card(struct snd_soc_card *card);
 int snd_soc_unregister_card(struct snd_soc_card *card);
 int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card);
+#ifdef CONFIG_PM_SLEEP
 int snd_soc_suspend(struct device *dev);
 int snd_soc_resume(struct device *dev);
+#else
+static inline int snd_soc_suspend(struct device *dev)
+{
+       return 0;
+}
+
+static inline int snd_soc_resume(struct device *dev)
+{
+       return 0;
+}
+#endif
 int snd_soc_poweroff(struct device *dev);
 int snd_soc_register_platform(struct device *dev,
                const struct snd_soc_platform_driver *platform_drv);
@@ -755,6 +777,9 @@ struct snd_soc_component {
 
        struct mutex io_mutex;
 
+       /* attached dynamic objects */
+       struct list_head dobj_list;
+
 #ifdef CONFIG_DEBUG_FS
        struct dentry *debugfs_root;
 #endif
@@ -807,7 +832,7 @@ struct snd_soc_codec {
        /* component */
        struct snd_soc_component component;
 
-       /* dapm */
+       /* Don't access this directly, use snd_soc_codec_get_dapm() */
        struct snd_soc_dapm_context dapm;
 
 #ifdef CONFIG_DEBUG_FS
@@ -949,6 +974,24 @@ struct snd_soc_dai_link {
 
        enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */
 
+       /* codec/machine specific init - e.g. add machine controls */
+       int (*init)(struct snd_soc_pcm_runtime *rtd);
+
+       /* optional hw_params re-writing for BE and FE sync */
+       int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
+                       struct snd_pcm_hw_params *params);
+
+       /* machine stream operations */
+       const struct snd_soc_ops *ops;
+       const struct snd_soc_compr_ops *compr_ops;
+
+       /* For unidirectional dai links */
+       bool playback_only;
+       bool capture_only;
+
+       /* Mark this pcm with non atomic ops */
+       bool nonatomic;
+
        /* Keep DAI active over suspend */
        unsigned int ignore_suspend:1;
 
@@ -957,9 +1000,6 @@ struct snd_soc_dai_link {
        unsigned int symmetric_channels:1;
        unsigned int symmetric_samplebits:1;
 
-       /* Mark this pcm with non atomic ops */
-       bool nonatomic;
-
        /* Do not create a PCM for this DAI link (Backend link) */
        unsigned int no_pcm:1;
 
@@ -970,23 +1010,11 @@ struct snd_soc_dai_link {
        unsigned int dpcm_capture:1;
        unsigned int dpcm_playback:1;
 
+       /* DPCM used FE & BE merged format */
+       unsigned int dpcm_merged_format:1;
+
        /* pmdown_time is ignored at stop */
        unsigned int ignore_pmdown_time:1;
-
-       /* codec/machine specific init - e.g. add machine controls */
-       int (*init)(struct snd_soc_pcm_runtime *rtd);
-
-       /* optional hw_params re-writing for BE and FE sync */
-       int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
-                       struct snd_pcm_hw_params *params);
-
-       /* machine stream operations */
-       const struct snd_soc_ops *ops;
-       const struct snd_soc_compr_ops *compr_ops;
-
-       /* For unidirectional dai links */
-       bool playback_only;
-       bool capture_only;
 };
 
 struct snd_soc_codec_conf {
@@ -1099,6 +1127,9 @@ struct snd_soc_card {
        struct list_head dapm_list;
        struct list_head dapm_dirty;
 
+       /* attached dynamic objects */
+       struct list_head dobj_list;
+
        /* Generic DAPM context for the card */
        struct snd_soc_dapm_context dapm;
        struct snd_soc_dapm_stats dapm_stats;
@@ -1158,6 +1189,7 @@ struct soc_mixer_control {
        unsigned int sign_bit;
        unsigned int invert:1;
        unsigned int autodisable:1;
+       struct snd_soc_dobj dobj;
 };
 
 struct soc_bytes {
@@ -1168,6 +1200,8 @@ struct soc_bytes {
 
 struct soc_bytes_ext {
        int max;
+       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);
@@ -1188,6 +1222,8 @@ struct soc_enum {
        unsigned int mask;
        const char * const *texts;
        const unsigned int *values;
+       unsigned int autodisable:1;
+       struct snd_soc_dobj dobj;
 };
 
 /**
@@ -1269,6 +1305,58 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
        return component->dapm_ptr;
 }
 
+/**
+ * snd_soc_codec_get_dapm() - Returns the DAPM context for the CODEC
+ * @codec: The CODEC for which to get the DAPM context
+ *
+ * Note: Use this function instead of directly accessing the CODEC's dapm field
+ */
+static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm(
+       struct snd_soc_codec *codec)
+{
+       return &codec->dapm;
+}
+
+/**
+ * snd_soc_dapm_init_bias_level() - Initialize CODEC DAPM bias level
+ * @dapm: The CODEC for which to initialize the DAPM bias level
+ * @level: The DAPM level to initialize to
+ *
+ * Initializes the CODEC DAPM bias level. See snd_soc_dapm_init_bias_level().
+ */
+static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec,
+       enum snd_soc_bias_level level)
+{
+       snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level);
+}
+
+/**
+ * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level
+ * @codec: The CODEC for which to get the DAPM bias level
+ *
+ * Returns: The current DAPM bias level of the CODEC.
+ */
+static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level(
+       struct snd_soc_codec *codec)
+{
+       return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec));
+}
+
+/**
+ * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level
+ * @codec: The CODEC for which to set the level
+ * @level: The level to set to
+ *
+ * Forces the CODEC bias level to a specific state. See
+ * snd_soc_dapm_force_bias_level().
+ */
+static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec,
+       enum snd_soc_bias_level level)
+{
+       return snd_soc_dapm_force_bias_level(snd_soc_codec_get_dapm(codec),
+               level);
+}
+
 /**
  * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol
  * @kcontrol: The kcontrol
This page took 0.026693 seconds and 5 git commands to generate.