Loading include/sound/soc.h +94 −0 Original line number Diff line number Diff line Loading @@ -480,6 +480,8 @@ int devm_snd_soc_register_component(struct device *dev, const struct snd_soc_component_driver *component_driver, struct snd_soc_dai_driver *dai_drv, int num_dai); void snd_soc_unregister_component(struct device *dev); struct snd_soc_component *snd_soc_lookup_component(struct device *dev, const char *driver_name); int snd_soc_cache_init(struct snd_soc_codec *codec); int snd_soc_cache_exit(struct snd_soc_codec *codec); Loading Loading @@ -800,6 +802,10 @@ struct snd_soc_component_driver { int (*suspend)(struct snd_soc_component *); int (*resume)(struct snd_soc_component *); /* pcm creation and destruction */ int (*pcm_new)(struct snd_soc_pcm_runtime *); void (*pcm_free)(struct snd_pcm *); /* component wide operations */ int (*set_sysclk)(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir); Loading @@ -817,10 +823,22 @@ struct snd_soc_component_driver { void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type, int subseq); int (*stream_event)(struct snd_soc_component *, int event); int (*set_bias_level)(struct snd_soc_component *component, enum snd_soc_bias_level level); const struct snd_pcm_ops *ops; const struct snd_compr_ops *compr_ops; /* probe ordering - for components with runtime dependencies */ int probe_order; int remove_order; /* bits */ unsigned int idle_bias_on:1; unsigned int suspend_bias_off:1; unsigned int pmdown_time:1; /* care pmdown_time at stop */ unsigned int endianness:1; unsigned int non_legacy_dai_naming:1; }; struct snd_soc_component { Loading Loading @@ -877,6 +895,8 @@ struct snd_soc_component { void (*remove)(struct snd_soc_component *); int (*suspend)(struct snd_soc_component *); int (*resume)(struct snd_soc_component *); int (*pcm_new)(struct snd_soc_component *, struct snd_soc_pcm_runtime *); void (*pcm_free)(struct snd_soc_component *, struct snd_pcm *); int (*set_sysclk)(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir); Loading @@ -884,6 +904,8 @@ struct snd_soc_component { int source, unsigned int freq_in, unsigned int freq_out); int (*set_jack)(struct snd_soc_component *component, struct snd_soc_jack *jack, void *data); int (*set_bias_level)(struct snd_soc_component *component, enum snd_soc_bias_level level); /* machine specific init */ int (*init)(struct snd_soc_component *component); Loading Loading @@ -1417,6 +1439,21 @@ static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec, snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level); } /** * snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level * @component: The COMPONENT for which to initialize the DAPM bias level * @level: The DAPM level to initialize to * * Initializes the COMPONENT DAPM bias level. See snd_soc_dapm_init_bias_level(). */ static inline void snd_soc_component_init_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { snd_soc_dapm_init_bias_level( snd_soc_component_get_dapm(component), level); } /** * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level * @codec: The CODEC for which to get the DAPM bias level Loading @@ -1429,6 +1466,19 @@ static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level( return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec)); } /** * snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level * @component: The COMPONENT for which to get the DAPM bias level * * Returns: The current DAPM bias level of the COMPONENT. */ static inline enum snd_soc_bias_level snd_soc_component_get_bias_level(struct snd_soc_component *component) { return snd_soc_dapm_get_bias_level( snd_soc_component_get_dapm(component)); } /** * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level * @codec: The CODEC for which to set the level Loading @@ -1444,6 +1494,23 @@ static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec, level); } /** * snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level * @component: The COMPONENT for which to set the level * @level: The level to set to * * Forces the COMPONENT bias level to a specific state. See * snd_soc_dapm_force_bias_level(). */ static inline int snd_soc_component_force_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { return snd_soc_dapm_force_bias_level( snd_soc_component_get_dapm(component), level); } /** * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol * @kcontrol: The kcontrol Loading @@ -1457,6 +1524,19 @@ static inline struct snd_soc_codec *snd_soc_dapm_kcontrol_codec( return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol)); } /** * snd_soc_dapm_kcontrol_component() - Returns the component associated to a kcontrol * @kcontrol: The kcontrol * * This function must only be used on DAPM contexts that are known to be part of * a COMPONENT (e.g. in a COMPONENT driver). Otherwise the behavior is undefined. */ static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component( struct snd_kcontrol *kcontrol) { return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol)); } /* codec IO */ unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg, Loading @@ -1473,9 +1553,23 @@ static inline int snd_soc_cache_sync(struct snd_soc_codec *codec) return regcache_sync(codec->component.regmap); } /** * snd_soc_component_cache_sync() - Sync the register cache with the hardware * @component: COMPONENT to sync * * Note: This function will call regcache_sync() */ static inline int snd_soc_component_cache_sync( struct snd_soc_component *component) { return regcache_sync(component->regmap); } /* component IO */ int snd_soc_component_read(struct snd_soc_component *component, unsigned int reg, unsigned int *val); unsigned int snd_soc_component_read32(struct snd_soc_component *component, unsigned int reg); int snd_soc_component_write(struct snd_soc_component *component, unsigned int reg, unsigned int val); int snd_soc_component_update_bits(struct snd_soc_component *component, Loading Loading
include/sound/soc.h +94 −0 Original line number Diff line number Diff line Loading @@ -480,6 +480,8 @@ int devm_snd_soc_register_component(struct device *dev, const struct snd_soc_component_driver *component_driver, struct snd_soc_dai_driver *dai_drv, int num_dai); void snd_soc_unregister_component(struct device *dev); struct snd_soc_component *snd_soc_lookup_component(struct device *dev, const char *driver_name); int snd_soc_cache_init(struct snd_soc_codec *codec); int snd_soc_cache_exit(struct snd_soc_codec *codec); Loading Loading @@ -800,6 +802,10 @@ struct snd_soc_component_driver { int (*suspend)(struct snd_soc_component *); int (*resume)(struct snd_soc_component *); /* pcm creation and destruction */ int (*pcm_new)(struct snd_soc_pcm_runtime *); void (*pcm_free)(struct snd_pcm *); /* component wide operations */ int (*set_sysclk)(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir); Loading @@ -817,10 +823,22 @@ struct snd_soc_component_driver { void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type, int subseq); int (*stream_event)(struct snd_soc_component *, int event); int (*set_bias_level)(struct snd_soc_component *component, enum snd_soc_bias_level level); const struct snd_pcm_ops *ops; const struct snd_compr_ops *compr_ops; /* probe ordering - for components with runtime dependencies */ int probe_order; int remove_order; /* bits */ unsigned int idle_bias_on:1; unsigned int suspend_bias_off:1; unsigned int pmdown_time:1; /* care pmdown_time at stop */ unsigned int endianness:1; unsigned int non_legacy_dai_naming:1; }; struct snd_soc_component { Loading Loading @@ -877,6 +895,8 @@ struct snd_soc_component { void (*remove)(struct snd_soc_component *); int (*suspend)(struct snd_soc_component *); int (*resume)(struct snd_soc_component *); int (*pcm_new)(struct snd_soc_component *, struct snd_soc_pcm_runtime *); void (*pcm_free)(struct snd_soc_component *, struct snd_pcm *); int (*set_sysclk)(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir); Loading @@ -884,6 +904,8 @@ struct snd_soc_component { int source, unsigned int freq_in, unsigned int freq_out); int (*set_jack)(struct snd_soc_component *component, struct snd_soc_jack *jack, void *data); int (*set_bias_level)(struct snd_soc_component *component, enum snd_soc_bias_level level); /* machine specific init */ int (*init)(struct snd_soc_component *component); Loading Loading @@ -1417,6 +1439,21 @@ static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec, snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level); } /** * snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level * @component: The COMPONENT for which to initialize the DAPM bias level * @level: The DAPM level to initialize to * * Initializes the COMPONENT DAPM bias level. See snd_soc_dapm_init_bias_level(). */ static inline void snd_soc_component_init_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { snd_soc_dapm_init_bias_level( snd_soc_component_get_dapm(component), level); } /** * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level * @codec: The CODEC for which to get the DAPM bias level Loading @@ -1429,6 +1466,19 @@ static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level( return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec)); } /** * snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level * @component: The COMPONENT for which to get the DAPM bias level * * Returns: The current DAPM bias level of the COMPONENT. */ static inline enum snd_soc_bias_level snd_soc_component_get_bias_level(struct snd_soc_component *component) { return snd_soc_dapm_get_bias_level( snd_soc_component_get_dapm(component)); } /** * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level * @codec: The CODEC for which to set the level Loading @@ -1444,6 +1494,23 @@ static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec, level); } /** * snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level * @component: The COMPONENT for which to set the level * @level: The level to set to * * Forces the COMPONENT bias level to a specific state. See * snd_soc_dapm_force_bias_level(). */ static inline int snd_soc_component_force_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { return snd_soc_dapm_force_bias_level( snd_soc_component_get_dapm(component), level); } /** * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol * @kcontrol: The kcontrol Loading @@ -1457,6 +1524,19 @@ static inline struct snd_soc_codec *snd_soc_dapm_kcontrol_codec( return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol)); } /** * snd_soc_dapm_kcontrol_component() - Returns the component associated to a kcontrol * @kcontrol: The kcontrol * * This function must only be used on DAPM contexts that are known to be part of * a COMPONENT (e.g. in a COMPONENT driver). Otherwise the behavior is undefined. */ static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component( struct snd_kcontrol *kcontrol) { return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol)); } /* codec IO */ unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg, Loading @@ -1473,9 +1553,23 @@ static inline int snd_soc_cache_sync(struct snd_soc_codec *codec) return regcache_sync(codec->component.regmap); } /** * snd_soc_component_cache_sync() - Sync the register cache with the hardware * @component: COMPONENT to sync * * Note: This function will call regcache_sync() */ static inline int snd_soc_component_cache_sync( struct snd_soc_component *component) { return regcache_sync(component->regmap); } /* component IO */ int snd_soc_component_read(struct snd_soc_component *component, unsigned int reg, unsigned int *val); unsigned int snd_soc_component_read32(struct snd_soc_component *component, unsigned int reg); int snd_soc_component_write(struct snd_soc_component *component, unsigned int reg, unsigned int val); int snd_soc_component_update_bits(struct snd_soc_component *component, Loading