]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/sound/soc.h
ASoC: Allow DAI links to be kept active over suspend
[net-next-2.6.git] / include / sound / soc.h
index 5d234a8c2506c74df25d5fbc7f9220c0bdb106ad..8326fc3db1cf12c3b419498d9985ddab3164372c 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <linux/platform_device.h>
 #include <linux/types.h>
+#include <linux/notifier.h>
 #include <linux/workqueue.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
@@ -212,6 +213,7 @@ struct snd_soc_dai_mode;
 struct snd_soc_pcm_runtime;
 struct snd_soc_dai;
 struct snd_soc_platform;
+struct snd_soc_dai_link;
 struct snd_soc_codec;
 struct soc_enum;
 struct snd_soc_ac97_ops;
@@ -260,6 +262,10 @@ 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);
+void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
+                                   struct notifier_block *nb);
+void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
+                                     struct notifier_block *nb);
 #ifdef CONFIG_GPIOLIB
 int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
                        struct snd_soc_jack_gpio *gpios);
@@ -320,6 +326,8 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
 int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
+int snd_soc_limit_volume(struct snd_soc_codec *codec,
+       const char *name, int max);
 
 /**
  * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
@@ -363,6 +371,7 @@ struct snd_soc_jack {
        struct snd_soc_card *card;
        struct list_head pins;
        int status;
+       struct blocking_notifier_head notifier;
 };
 
 /* SoC PCM stream information */
@@ -374,7 +383,8 @@ struct snd_soc_pcm_stream {
        unsigned int rate_max;          /* max rate */
        unsigned int channels_min;      /* min channels */
        unsigned int channels_max;      /* max channels */
-       unsigned int active:1;          /* stream is in use */
+       unsigned int active;            /* stream is in use */
+       void *dma_data;                 /* used by platform code */
 };
 
 /* SoC audio ops */
@@ -406,7 +416,7 @@ struct snd_soc_codec {
        struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
        unsigned int active;
        unsigned int pcm_devs;
-       void *private_data;
+       void *drvdata;
 
        /* codec IO */
        void *control_data; /* codec control (i2c/3wire) data */
@@ -461,14 +471,21 @@ struct snd_soc_platform {
 
        int (*probe)(struct platform_device *pdev);
        int (*remove)(struct platform_device *pdev);
-       int (*suspend)(struct snd_soc_dai *dai);
-       int (*resume)(struct snd_soc_dai *dai);
+       int (*suspend)(struct snd_soc_dai_link *dai_link);
+       int (*resume)(struct snd_soc_dai_link *dai_link);
 
        /* pcm creation and destruction */
        int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
                struct snd_pcm *);
        void (*pcm_free)(struct snd_pcm *);
 
+       /*
+        * For platform caused delay reporting.
+        * Optional.
+        */
+       snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
+               struct snd_soc_dai *);
+
        /* platform stream ops */
        struct snd_pcm_ops *pcm_ops;
 };
@@ -488,6 +505,9 @@ struct snd_soc_dai_link  {
        /* codec/machine specific init - e.g. add machine controls */
        int (*init)(struct snd_soc_codec *codec);
 
+       /* Keep DAI active over suspend */
+       unsigned int ignore_suspend:1;
+
        /* Symmetry requirements */
        unsigned int symmetric_rates:1;
 
@@ -582,6 +602,17 @@ static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
        return codec->write(codec, reg, val);
 }
 
+static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
+                                            void *data)
+{
+       codec->drvdata = data;
+}
+
+static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
+{
+       return codec->drvdata;
+}
+
 #include <sound/soc-dai.h>
 
 #endif