X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fsound%2Fsoc.h;h=9952254974b395f69327ca05cfebe69b0587367b;hb=70a7ca34dbdcc6f0ed332baf2b308bab2871424a;hp=3eb92ef6c83f5de38d1a39eab524810fddd4a584;hpb=ab4e57446ff2e0a5c154cb703595d574130dc919;p=firefly-linux-kernel-4.4.55.git diff --git a/include/sound/soc.h b/include/sound/soc.h index 3eb92ef6c83f..9952254974b3 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -222,10 +222,8 @@ enum snd_soc_bias_level { struct snd_jack; struct snd_soc_card; -struct snd_soc_device; struct snd_soc_pcm_stream; struct snd_soc_ops; -struct snd_soc_dai_mode; struct snd_soc_pcm_runtime; struct snd_soc_dai; struct snd_soc_dai_driver; @@ -235,7 +233,6 @@ struct snd_soc_platform_driver; struct snd_soc_codec; struct snd_soc_codec_driver; struct soc_enum; -struct snd_soc_ac97_ops; struct snd_soc_jack; struct snd_soc_jack_pin; struct snd_soc_cache_ops; @@ -256,16 +253,18 @@ enum snd_soc_control_type { }; enum snd_soc_compress_type { - SND_SOC_NO_COMPRESSION, + SND_SOC_FLAT_COMPRESSION = 1, SND_SOC_LZO_COMPRESSION, SND_SOC_RBTREE_COMPRESSION }; +int snd_soc_register_card(struct snd_soc_card *card); +int snd_soc_unregister_card(struct snd_soc_card *card); int snd_soc_register_platform(struct device *dev, struct snd_soc_platform_driver *platform_drv); void snd_soc_unregister_platform(struct device *dev); int snd_soc_register_codec(struct device *dev, - struct snd_soc_codec_driver *codec_drv, + const struct snd_soc_codec_driver *codec_drv, struct snd_soc_dai_driver *dai_drv, int num_dai); void snd_soc_unregister_codec(struct device *dev); int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); @@ -279,6 +278,10 @@ int snd_soc_cache_write(struct snd_soc_codec *codec, unsigned int reg, unsigned int value); int snd_soc_cache_read(struct snd_soc_codec *codec, unsigned int reg, unsigned int *value); +int snd_soc_default_volatile_register(struct snd_soc_codec *codec, + unsigned int reg); +int snd_soc_default_readable_register(struct snd_soc_codec *codec, + unsigned int reg); /* Utility functions to get clock rates from various things */ int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); @@ -369,6 +372,22 @@ int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol, int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +/** + * struct snd_soc_reg_access - Describes whether a given register is + * readable, writable or volatile. + * + * @reg: the register number + * @read: whether this register is readable + * @write: whether this register is writable + * @vol: whether this register is volatile + */ +struct snd_soc_reg_access { + u16 reg; + u16 read; + u16 write; + u16 vol; +}; + /** * struct snd_soc_jack_pin - Describes a pin to update based on jack detection * @@ -437,6 +456,7 @@ struct snd_soc_ops { /* SoC cache ops */ struct snd_soc_cache_ops { + const char *name; enum snd_soc_compress_type id; int (*init)(struct snd_soc_codec *codec); int (*exit)(struct snd_soc_codec *codec); @@ -453,13 +473,17 @@ struct snd_soc_codec { const char *name_prefix; int id; struct device *dev; - struct snd_soc_codec_driver *driver; + const struct snd_soc_codec_driver *driver; struct mutex mutex; struct snd_soc_card *card; struct list_head list; struct list_head card_list; int num_dai; + enum snd_soc_compress_type compress_type; + size_t reg_size; /* reg_cache_size * reg_word_size */ + int (*volatile_register)(struct snd_soc_codec *, unsigned int); + int (*readable_register)(struct snd_soc_codec *, unsigned int); /* runtime */ struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ @@ -471,12 +495,16 @@ struct snd_soc_codec { unsigned int ac97_registered:1; /* Codec has been AC97 registered */ unsigned int ac97_created:1; /* Codec has been created by SoC */ unsigned int sysfs_registered:1; /* codec has been sysfs registered */ + unsigned int cache_init:1; /* codec cache has been initialized */ /* codec IO */ void *control_data; /* codec control (i2c/3wire) data */ hw_write_t hw_write; unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); + unsigned int (*read)(struct snd_soc_codec *, unsigned int); + int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); void *reg_cache; + const void *reg_def_copy; const struct snd_soc_cache_ops *cache_ops; struct mutex cache_rw_mutex; @@ -505,12 +533,14 @@ struct snd_soc_codec_driver { 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); - int (*readable_register)(unsigned int); + int (*volatile_register)(struct snd_soc_codec *, unsigned int); + int (*readable_register)(struct snd_soc_codec *, unsigned int); short reg_cache_size; short reg_cache_step; short reg_word_size; const void *reg_cache_default; + short reg_access_size; + const struct snd_soc_reg_access *reg_access_default; enum snd_soc_compress_type compress_type; /* codec bias level */ @@ -578,9 +608,28 @@ struct snd_soc_dai_link { struct snd_soc_ops *ops; }; -struct snd_soc_prefix_map { +struct snd_soc_codec_conf { const char *dev_name; + + /* + * optional map of kcontrol, widget and path name prefixes that are + * associated per device + */ const char *name_prefix; + + /* + * set this to the desired compression type if you want to + * override the one supplied in codec->driver->compress_type + */ + enum snd_soc_compress_type compress_type; +}; + +struct snd_soc_aux_dev { + const char *name; /* Codec name */ + const char *codec_name; /* for multi-codec */ + + /* codec/machine specific init - e.g. add machine controls */ + int (*init)(struct snd_soc_dapm_context *dapm); }; /* SoC card */ @@ -608,6 +657,8 @@ struct snd_soc_card { /* callbacks */ int (*set_bias_level)(struct snd_soc_card *, enum snd_soc_bias_level level); + int (*set_bias_level_post)(struct snd_soc_card *, + enum snd_soc_bias_level level); long pmdown_time; @@ -617,12 +668,18 @@ struct snd_soc_card { struct snd_soc_pcm_runtime *rtd; int num_rtd; + /* optional codec specific configuration */ + struct snd_soc_codec_conf *codec_conf; + int num_configs; + /* - * optional map of kcontrol, widget and path name prefixes that are - * associated per device + * optional auxiliary devices such as amplifiers or codecs with DAI + * link unused */ - struct snd_soc_prefix_map *prefix_map; - int num_prefixes; + struct snd_soc_aux_dev *aux_dev; + int num_aux_devs; + struct snd_soc_pcm_runtime *rtd_aux; + int num_aux_rtd; struct work_struct deferred_resume_work; @@ -631,6 +688,10 @@ struct snd_soc_card { struct list_head platform_dev_list; struct list_head dai_dev_list; + struct list_head widgets; + struct list_head paths; + struct list_head dapm_list; + #ifdef CONFIG_DEBUG_FS struct dentry *debugfs_card_root; struct dentry *debugfs_pop_time; @@ -720,6 +781,20 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd) return dev_get_drvdata(&rtd->dev); } +static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) +{ + INIT_LIST_HEAD(&card->dai_dev_list); + INIT_LIST_HEAD(&card->codec_dev_list); + INIT_LIST_HEAD(&card->platform_dev_list); + INIT_LIST_HEAD(&card->widgets); + INIT_LIST_HEAD(&card->paths); + INIT_LIST_HEAD(&card->dapm_list); +} + #include +#ifdef CONFIG_DEBUG_FS +extern struct dentry *snd_soc_debugfs_root; +#endif + #endif