ASoC: Factor out I2C 8 bit address 16 bit data I/O
[safe/jmp/linux-2.6] / include / sound / soc.h
index 6ab80bf..4a5846e 100644 (file)
@@ -187,10 +187,25 @@ typedef int (*hw_read_t)(void *,char* ,int);
 
 extern struct snd_ac97_bus_ops soc_ac97_ops;
 
+enum snd_soc_control_type {
+       SND_SOC_CUSTOM,
+       SND_SOC_I2C,
+       SND_SOC_SPI,
+};
+
 int snd_soc_register_platform(struct snd_soc_platform *platform);
 void snd_soc_unregister_platform(struct snd_soc_platform *platform);
 int snd_soc_register_codec(struct snd_soc_codec *codec);
 void snd_soc_unregister_codec(struct snd_soc_codec *codec);
+int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg);
+int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
+                              int addr_bits, int data_bits,
+                              enum snd_soc_control_type control);
+
+#ifdef CONFIG_PM
+int snd_soc_suspend_device(struct device *dev);
+int snd_soc_resume_device(struct device *dev);
+#endif
 
 /* pcm <-> DAI connect */
 void snd_soc_free_pcms(struct snd_soc_device *socdev);
@@ -214,15 +229,11 @@ 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)
-#define snd_soc_write(codec, reg, value) codec->write(codec, reg, value)
-
 /* codec register bit access */
 int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
-                               unsigned short mask, unsigned short value);
+                               unsigned int mask, unsigned int value);
 int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
-                               unsigned short mask, unsigned short value);
+                               unsigned int mask, unsigned int value);
 
 int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
        struct snd_ac97_bus_ops *ops, int num);
@@ -339,6 +350,7 @@ struct snd_soc_codec {
        struct module *owner;
        struct mutex mutex;
        struct device *dev;
+       struct snd_soc_device *socdev;
 
        struct list_head list;
 
@@ -359,8 +371,9 @@ struct snd_soc_codec {
        int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
        int (*display_register)(struct snd_soc_codec *, char *,
                                size_t, unsigned int);
+       int (*volatile_register)(unsigned int);
        hw_write_t hw_write;
-       hw_read_t hw_read;
+       unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
        void *reg_cache;
        short reg_cache_size;
        short reg_cache_step;
@@ -504,6 +517,19 @@ struct soc_enum {
        void *dapm;
 };
 
+/* codec IO */
+static inline unsigned int snd_soc_read(struct snd_soc_codec *codec,
+                                       unsigned int reg)
+{
+       return codec->read(codec, reg);
+}
+
+static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
+                                        unsigned int reg, unsigned int val)
+{
+       return codec->write(codec, reg, val);
+}
+
 #include <sound/soc-dai.h>
 
 #endif