Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 |
| 2 | * |
| 3 | * soc-component.h |
| 4 | * |
Kuninori Morimoto | 4510821 | 2020-06-04 17:08:24 +0900 | [diff] [blame] | 5 | * Copyright (C) 2019 Renesas Electronics Corp. |
| 6 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 7 | */ |
| 8 | #ifndef __SOC_COMPONENT_H |
| 9 | #define __SOC_COMPONENT_H |
| 10 | |
| 11 | #include <sound/soc.h> |
| 12 | |
| 13 | /* |
| 14 | * Component probe and remove ordering levels for components with runtime |
| 15 | * dependencies. |
| 16 | */ |
| 17 | #define SND_SOC_COMP_ORDER_FIRST -2 |
| 18 | #define SND_SOC_COMP_ORDER_EARLY -1 |
| 19 | #define SND_SOC_COMP_ORDER_NORMAL 0 |
| 20 | #define SND_SOC_COMP_ORDER_LATE 1 |
| 21 | #define SND_SOC_COMP_ORDER_LAST 2 |
| 22 | |
| 23 | #define for_each_comp_order(order) \ |
| 24 | for (order = SND_SOC_COMP_ORDER_FIRST; \ |
| 25 | order <= SND_SOC_COMP_ORDER_LAST; \ |
| 26 | order++) |
| 27 | |
| 28 | /* component interface */ |
Kuninori Morimoto | c6cb522 | 2020-04-20 16:07:50 +0900 | [diff] [blame] | 29 | struct snd_compress_ops { |
| 30 | int (*open)(struct snd_soc_component *component, |
| 31 | struct snd_compr_stream *stream); |
| 32 | int (*free)(struct snd_soc_component *component, |
| 33 | struct snd_compr_stream *stream); |
| 34 | int (*set_params)(struct snd_soc_component *component, |
| 35 | struct snd_compr_stream *stream, |
| 36 | struct snd_compr_params *params); |
| 37 | int (*get_params)(struct snd_soc_component *component, |
| 38 | struct snd_compr_stream *stream, |
| 39 | struct snd_codec *params); |
| 40 | int (*set_metadata)(struct snd_soc_component *component, |
| 41 | struct snd_compr_stream *stream, |
| 42 | struct snd_compr_metadata *metadata); |
| 43 | int (*get_metadata)(struct snd_soc_component *component, |
| 44 | struct snd_compr_stream *stream, |
| 45 | struct snd_compr_metadata *metadata); |
| 46 | int (*trigger)(struct snd_soc_component *component, |
| 47 | struct snd_compr_stream *stream, int cmd); |
| 48 | int (*pointer)(struct snd_soc_component *component, |
| 49 | struct snd_compr_stream *stream, |
| 50 | struct snd_compr_tstamp *tstamp); |
| 51 | int (*copy)(struct snd_soc_component *component, |
| 52 | struct snd_compr_stream *stream, char __user *buf, |
| 53 | size_t count); |
| 54 | int (*mmap)(struct snd_soc_component *component, |
| 55 | struct snd_compr_stream *stream, |
| 56 | struct vm_area_struct *vma); |
| 57 | int (*ack)(struct snd_soc_component *component, |
| 58 | struct snd_compr_stream *stream, size_t bytes); |
| 59 | int (*get_caps)(struct snd_soc_component *component, |
| 60 | struct snd_compr_stream *stream, |
| 61 | struct snd_compr_caps *caps); |
| 62 | int (*get_codec_caps)(struct snd_soc_component *component, |
| 63 | struct snd_compr_stream *stream, |
| 64 | struct snd_compr_codec_caps *codec); |
| 65 | }; |
| 66 | |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 67 | struct snd_soc_component_driver { |
| 68 | const char *name; |
| 69 | |
| 70 | /* Default control and setup, added after probe() is run */ |
| 71 | const struct snd_kcontrol_new *controls; |
| 72 | unsigned int num_controls; |
| 73 | const struct snd_soc_dapm_widget *dapm_widgets; |
| 74 | unsigned int num_dapm_widgets; |
| 75 | const struct snd_soc_dapm_route *dapm_routes; |
| 76 | unsigned int num_dapm_routes; |
| 77 | |
| 78 | int (*probe)(struct snd_soc_component *component); |
| 79 | void (*remove)(struct snd_soc_component *component); |
| 80 | int (*suspend)(struct snd_soc_component *component); |
| 81 | int (*resume)(struct snd_soc_component *component); |
| 82 | |
| 83 | unsigned int (*read)(struct snd_soc_component *component, |
| 84 | unsigned int reg); |
| 85 | int (*write)(struct snd_soc_component *component, |
| 86 | unsigned int reg, unsigned int val); |
| 87 | |
| 88 | /* pcm creation and destruction */ |
Kuninori Morimoto | c64bfc9 | 2019-10-02 14:30:59 +0900 | [diff] [blame] | 89 | int (*pcm_construct)(struct snd_soc_component *component, |
| 90 | struct snd_soc_pcm_runtime *rtd); |
| 91 | void (*pcm_destruct)(struct snd_soc_component *component, |
| 92 | struct snd_pcm *pcm); |
| 93 | |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 94 | /* component wide operations */ |
| 95 | int (*set_sysclk)(struct snd_soc_component *component, |
| 96 | int clk_id, int source, unsigned int freq, int dir); |
| 97 | int (*set_pll)(struct snd_soc_component *component, int pll_id, |
| 98 | int source, unsigned int freq_in, unsigned int freq_out); |
| 99 | int (*set_jack)(struct snd_soc_component *component, |
| 100 | struct snd_soc_jack *jack, void *data); |
| 101 | |
| 102 | /* DT */ |
| 103 | int (*of_xlate_dai_name)(struct snd_soc_component *component, |
| 104 | struct of_phandle_args *args, |
| 105 | const char **dai_name); |
| 106 | int (*of_xlate_dai_id)(struct snd_soc_component *comment, |
| 107 | struct device_node *endpoint); |
| 108 | void (*seq_notifier)(struct snd_soc_component *component, |
| 109 | enum snd_soc_dapm_type type, int subseq); |
| 110 | int (*stream_event)(struct snd_soc_component *component, int event); |
| 111 | int (*set_bias_level)(struct snd_soc_component *component, |
| 112 | enum snd_soc_bias_level level); |
| 113 | |
Kuninori Morimoto | e2cb4a1 | 2019-10-02 14:30:48 +0900 | [diff] [blame] | 114 | int (*open)(struct snd_soc_component *component, |
| 115 | struct snd_pcm_substream *substream); |
| 116 | int (*close)(struct snd_soc_component *component, |
| 117 | struct snd_pcm_substream *substream); |
| 118 | int (*ioctl)(struct snd_soc_component *component, |
| 119 | struct snd_pcm_substream *substream, |
| 120 | unsigned int cmd, void *arg); |
| 121 | int (*hw_params)(struct snd_soc_component *component, |
| 122 | struct snd_pcm_substream *substream, |
| 123 | struct snd_pcm_hw_params *params); |
| 124 | int (*hw_free)(struct snd_soc_component *component, |
| 125 | struct snd_pcm_substream *substream); |
| 126 | int (*prepare)(struct snd_soc_component *component, |
| 127 | struct snd_pcm_substream *substream); |
| 128 | int (*trigger)(struct snd_soc_component *component, |
| 129 | struct snd_pcm_substream *substream, int cmd); |
Takashi Iwai | 1e5ddb6 | 2019-11-21 20:07:09 +0100 | [diff] [blame] | 130 | int (*sync_stop)(struct snd_soc_component *component, |
| 131 | struct snd_pcm_substream *substream); |
Kuninori Morimoto | e2cb4a1 | 2019-10-02 14:30:48 +0900 | [diff] [blame] | 132 | snd_pcm_uframes_t (*pointer)(struct snd_soc_component *component, |
| 133 | struct snd_pcm_substream *substream); |
| 134 | int (*get_time_info)(struct snd_soc_component *component, |
Baolin Wang | fcae40c | 2018-04-24 20:06:08 +0800 | [diff] [blame] | 135 | struct snd_pcm_substream *substream, struct timespec64 *system_ts, |
| 136 | struct timespec64 *audio_ts, |
Kuninori Morimoto | e2cb4a1 | 2019-10-02 14:30:48 +0900 | [diff] [blame] | 137 | struct snd_pcm_audio_tstamp_config *audio_tstamp_config, |
| 138 | struct snd_pcm_audio_tstamp_report *audio_tstamp_report); |
| 139 | int (*copy_user)(struct snd_soc_component *component, |
| 140 | struct snd_pcm_substream *substream, int channel, |
| 141 | unsigned long pos, void __user *buf, |
| 142 | unsigned long bytes); |
| 143 | struct page *(*page)(struct snd_soc_component *component, |
| 144 | struct snd_pcm_substream *substream, |
| 145 | unsigned long offset); |
| 146 | int (*mmap)(struct snd_soc_component *component, |
| 147 | struct snd_pcm_substream *substream, |
| 148 | struct vm_area_struct *vma); |
| 149 | |
Kuninori Morimoto | c6cb522 | 2020-04-20 16:07:50 +0900 | [diff] [blame] | 150 | const struct snd_compress_ops *compress_ops; |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 151 | |
| 152 | /* probe ordering - for components with runtime dependencies */ |
| 153 | int probe_order; |
| 154 | int remove_order; |
| 155 | |
| 156 | /* |
| 157 | * signal if the module handling the component should not be removed |
| 158 | * if a pcm is open. Setting this would prevent the module |
| 159 | * refcount being incremented in probe() but allow it be incremented |
| 160 | * when a pcm is opened and decremented when it is closed. |
| 161 | */ |
| 162 | unsigned int module_get_upon_open:1; |
| 163 | |
| 164 | /* bits */ |
| 165 | unsigned int idle_bias_on:1; |
| 166 | unsigned int suspend_bias_off:1; |
| 167 | unsigned int use_pmdown_time:1; /* care pmdown_time at stop */ |
| 168 | unsigned int endianness:1; |
| 169 | unsigned int non_legacy_dai_naming:1; |
| 170 | |
| 171 | /* this component uses topology and ignore machine driver FEs */ |
| 172 | const char *ignore_machine; |
| 173 | const char *topology_name_prefix; |
| 174 | int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd, |
| 175 | struct snd_pcm_hw_params *params); |
| 176 | bool use_dai_pcm_id; /* use DAI link PCM ID as PCM device number */ |
| 177 | int be_pcm_base; /* base device ID for all BE PCMs */ |
| 178 | }; |
| 179 | |
| 180 | struct snd_soc_component { |
| 181 | const char *name; |
| 182 | int id; |
| 183 | const char *name_prefix; |
| 184 | struct device *dev; |
| 185 | struct snd_soc_card *card; |
| 186 | |
| 187 | unsigned int active; |
| 188 | |
| 189 | unsigned int suspended:1; /* is in suspend PM state */ |
| 190 | |
| 191 | struct list_head list; |
| 192 | struct list_head card_aux_list; /* for auxiliary bound components */ |
| 193 | struct list_head card_list; |
| 194 | |
| 195 | const struct snd_soc_component_driver *driver; |
| 196 | |
| 197 | struct list_head dai_list; |
| 198 | int num_dai; |
| 199 | |
| 200 | struct regmap *regmap; |
| 201 | int val_bytes; |
| 202 | |
| 203 | struct mutex io_mutex; |
| 204 | |
| 205 | /* attached dynamic objects */ |
| 206 | struct list_head dobj_list; |
| 207 | |
| 208 | /* |
| 209 | * DO NOT use any of the fields below in drivers, they are temporary and |
| 210 | * are going to be removed again soon. If you use them in driver code |
| 211 | * the driver will be marked as BROKEN when these fields are removed. |
| 212 | */ |
| 213 | |
| 214 | /* Don't use these, use snd_soc_component_get_dapm() */ |
| 215 | struct snd_soc_dapm_context dapm; |
| 216 | |
| 217 | /* machine specific init */ |
| 218 | int (*init)(struct snd_soc_component *component); |
| 219 | |
Kuninori Morimoto | 51aff91 | 2020-09-28 09:01:04 +0900 | [diff] [blame] | 220 | /* function mark */ |
| 221 | struct snd_pcm_substream *mark_module; |
| 222 | struct snd_pcm_substream *mark_open; |
Kuninori Morimoto | 3a36a64 | 2020-09-29 13:31:41 +0900 | [diff] [blame] | 223 | struct snd_pcm_substream *mark_hw_params; |
Kuninori Morimoto | 939a5cf | 2020-09-28 09:01:17 +0900 | [diff] [blame] | 224 | void *mark_pm; |
Kuninori Morimoto | 51aff91 | 2020-09-28 09:01:04 +0900 | [diff] [blame] | 225 | |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 226 | #ifdef CONFIG_DEBUG_FS |
| 227 | struct dentry *debugfs_root; |
| 228 | const char *debugfs_prefix; |
| 229 | #endif |
| 230 | }; |
| 231 | |
| 232 | #define for_each_component_dais(component, dai)\ |
| 233 | list_for_each_entry(dai, &(component)->dai_list, list) |
| 234 | #define for_each_component_dais_safe(component, dai, _dai)\ |
| 235 | list_for_each_entry_safe(dai, _dai, &(component)->dai_list, list) |
| 236 | |
| 237 | /** |
| 238 | * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is |
| 239 | * embedded in |
| 240 | * @dapm: The DAPM context to cast to the component |
| 241 | * |
| 242 | * This function must only be used on DAPM contexts that are known to be part of |
| 243 | * a component (e.g. in a component driver). Otherwise the behavior is |
| 244 | * undefined. |
| 245 | */ |
| 246 | static inline struct snd_soc_component *snd_soc_dapm_to_component( |
| 247 | struct snd_soc_dapm_context *dapm) |
| 248 | { |
| 249 | return container_of(dapm, struct snd_soc_component, dapm); |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * snd_soc_component_get_dapm() - Returns the DAPM context associated with a |
| 254 | * component |
| 255 | * @component: The component for which to get the DAPM context |
| 256 | */ |
| 257 | static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm( |
| 258 | struct snd_soc_component *component) |
| 259 | { |
| 260 | return &component->dapm; |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level |
| 265 | * @component: The COMPONENT for which to initialize the DAPM bias level |
| 266 | * @level: The DAPM level to initialize to |
| 267 | * |
| 268 | * Initializes the COMPONENT DAPM bias level. See snd_soc_dapm_init_bias_level() |
| 269 | */ |
| 270 | static inline void |
| 271 | snd_soc_component_init_bias_level(struct snd_soc_component *component, |
| 272 | enum snd_soc_bias_level level) |
| 273 | { |
| 274 | snd_soc_dapm_init_bias_level( |
| 275 | snd_soc_component_get_dapm(component), level); |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level |
| 280 | * @component: The COMPONENT for which to get the DAPM bias level |
| 281 | * |
| 282 | * Returns: The current DAPM bias level of the COMPONENT. |
| 283 | */ |
| 284 | static inline enum snd_soc_bias_level |
| 285 | snd_soc_component_get_bias_level(struct snd_soc_component *component) |
| 286 | { |
| 287 | return snd_soc_dapm_get_bias_level( |
| 288 | snd_soc_component_get_dapm(component)); |
| 289 | } |
| 290 | |
| 291 | /** |
| 292 | * snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level |
| 293 | * @component: The COMPONENT for which to set the level |
| 294 | * @level: The level to set to |
| 295 | * |
| 296 | * Forces the COMPONENT bias level to a specific state. See |
| 297 | * snd_soc_dapm_force_bias_level(). |
| 298 | */ |
| 299 | static inline int |
| 300 | snd_soc_component_force_bias_level(struct snd_soc_component *component, |
| 301 | enum snd_soc_bias_level level) |
| 302 | { |
| 303 | return snd_soc_dapm_force_bias_level( |
| 304 | snd_soc_component_get_dapm(component), |
| 305 | level); |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * snd_soc_dapm_kcontrol_component() - Returns the component associated to a |
| 310 | * kcontrol |
| 311 | * @kcontrol: The kcontrol |
| 312 | * |
| 313 | * This function must only be used on DAPM contexts that are known to be part of |
| 314 | * a COMPONENT (e.g. in a COMPONENT driver). Otherwise the behavior is undefined |
| 315 | */ |
| 316 | static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component( |
| 317 | struct snd_kcontrol *kcontrol) |
| 318 | { |
| 319 | return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol)); |
| 320 | } |
| 321 | |
| 322 | /** |
| 323 | * snd_soc_component_cache_sync() - Sync the register cache with the hardware |
| 324 | * @component: COMPONENT to sync |
| 325 | * |
| 326 | * Note: This function will call regcache_sync() |
| 327 | */ |
| 328 | static inline int snd_soc_component_cache_sync( |
| 329 | struct snd_soc_component *component) |
| 330 | { |
| 331 | return regcache_sync(component->regmap); |
| 332 | } |
| 333 | |
Kuninori Morimoto | 257c4da | 2020-06-04 17:07:54 +0900 | [diff] [blame] | 334 | void snd_soc_component_set_aux(struct snd_soc_component *component, |
| 335 | struct snd_soc_aux_dev *aux); |
| 336 | int snd_soc_component_init(struct snd_soc_component *component); |
Kuninori Morimoto | 536aba1 | 2020-06-04 17:06:32 +0900 | [diff] [blame] | 337 | |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 338 | /* component IO */ |
Kuninori Morimoto | cf6e26c | 2020-06-16 14:19:41 +0900 | [diff] [blame] | 339 | unsigned int snd_soc_component_read(struct snd_soc_component *component, |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 340 | unsigned int reg); |
| 341 | int snd_soc_component_write(struct snd_soc_component *component, |
| 342 | unsigned int reg, unsigned int val); |
| 343 | int snd_soc_component_update_bits(struct snd_soc_component *component, |
| 344 | unsigned int reg, unsigned int mask, |
| 345 | unsigned int val); |
| 346 | int snd_soc_component_update_bits_async(struct snd_soc_component *component, |
| 347 | unsigned int reg, unsigned int mask, |
| 348 | unsigned int val); |
| 349 | void snd_soc_component_async_complete(struct snd_soc_component *component); |
| 350 | int snd_soc_component_test_bits(struct snd_soc_component *component, |
| 351 | unsigned int reg, unsigned int mask, |
| 352 | unsigned int value); |
| 353 | |
| 354 | /* component wide operations */ |
| 355 | int snd_soc_component_set_sysclk(struct snd_soc_component *component, |
| 356 | int clk_id, int source, |
| 357 | unsigned int freq, int dir); |
| 358 | int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id, |
| 359 | int source, unsigned int freq_in, |
| 360 | unsigned int freq_out); |
| 361 | int snd_soc_component_set_jack(struct snd_soc_component *component, |
| 362 | struct snd_soc_jack *jack, void *data); |
| 363 | |
Kuninori Morimoto | 9d415fb | 2019-07-26 13:51:35 +0900 | [diff] [blame] | 364 | void snd_soc_component_seq_notifier(struct snd_soc_component *component, |
| 365 | enum snd_soc_dapm_type type, int subseq); |
Kuninori Morimoto | 8e2a990 | 2019-07-26 13:51:39 +0900 | [diff] [blame] | 366 | int snd_soc_component_stream_event(struct snd_soc_component *component, |
| 367 | int event); |
Kuninori Morimoto | 7951b146 | 2019-07-26 13:51:43 +0900 | [diff] [blame] | 368 | int snd_soc_component_set_bias_level(struct snd_soc_component *component, |
| 369 | enum snd_soc_bias_level level); |
Kuninori Morimoto | 9d415fb | 2019-07-26 13:51:35 +0900 | [diff] [blame] | 370 | |
Kuninori Morimoto | c7d75b5 | 2020-06-04 17:06:22 +0900 | [diff] [blame] | 371 | void snd_soc_component_setup_regmap(struct snd_soc_component *component); |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 372 | #ifdef CONFIG_REGMAP |
| 373 | void snd_soc_component_init_regmap(struct snd_soc_component *component, |
| 374 | struct regmap *regmap); |
| 375 | void snd_soc_component_exit_regmap(struct snd_soc_component *component); |
| 376 | #endif |
| 377 | |
Kuninori Morimoto | 4a81e8f | 2019-07-26 13:49:54 +0900 | [diff] [blame] | 378 | #define snd_soc_component_module_get_when_probe(component)\ |
Kuninori Morimoto | 51aff91 | 2020-09-28 09:01:04 +0900 | [diff] [blame] | 379 | snd_soc_component_module_get(component, NULL, 0) |
| 380 | #define snd_soc_component_module_get_when_open(component, substream) \ |
| 381 | snd_soc_component_module_get(component, substream, 1) |
Kuninori Morimoto | 4a81e8f | 2019-07-26 13:49:54 +0900 | [diff] [blame] | 382 | int snd_soc_component_module_get(struct snd_soc_component *component, |
Kuninori Morimoto | 51aff91 | 2020-09-28 09:01:04 +0900 | [diff] [blame] | 383 | struct snd_pcm_substream *substream, |
Kuninori Morimoto | 4a81e8f | 2019-07-26 13:49:54 +0900 | [diff] [blame] | 384 | int upon_open); |
| 385 | #define snd_soc_component_module_put_when_remove(component) \ |
Kuninori Morimoto | 51aff91 | 2020-09-28 09:01:04 +0900 | [diff] [blame] | 386 | snd_soc_component_module_put(component, NULL, 0, 0) |
| 387 | #define snd_soc_component_module_put_when_close(component, substream, rollback) \ |
| 388 | snd_soc_component_module_put(component, substream, 1, rollback) |
Kuninori Morimoto | 4a81e8f | 2019-07-26 13:49:54 +0900 | [diff] [blame] | 389 | void snd_soc_component_module_put(struct snd_soc_component *component, |
Kuninori Morimoto | 51aff91 | 2020-09-28 09:01:04 +0900 | [diff] [blame] | 390 | struct snd_pcm_substream *substream, |
| 391 | int upon_open, int rollback); |
Kuninori Morimoto | 4a81e8f | 2019-07-26 13:49:54 +0900 | [diff] [blame] | 392 | |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 393 | static inline void snd_soc_component_set_drvdata(struct snd_soc_component *c, |
| 394 | void *data) |
| 395 | { |
| 396 | dev_set_drvdata(c->dev, data); |
| 397 | } |
| 398 | |
| 399 | static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c) |
| 400 | { |
| 401 | return dev_get_drvdata(c->dev); |
| 402 | } |
| 403 | |
Kuninori Morimoto | 488b2ca | 2020-05-15 09:46:42 +0900 | [diff] [blame] | 404 | static inline unsigned int |
| 405 | snd_soc_component_active(struct snd_soc_component *component) |
| 406 | { |
| 407 | return component->active; |
| 408 | } |
| 409 | |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 410 | /* component pin */ |
| 411 | int snd_soc_component_enable_pin(struct snd_soc_component *component, |
| 412 | const char *pin); |
| 413 | int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component, |
| 414 | const char *pin); |
| 415 | int snd_soc_component_disable_pin(struct snd_soc_component *component, |
| 416 | const char *pin); |
| 417 | int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component, |
| 418 | const char *pin); |
| 419 | int snd_soc_component_nc_pin(struct snd_soc_component *component, |
| 420 | const char *pin); |
| 421 | int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component, |
| 422 | const char *pin); |
| 423 | int snd_soc_component_get_pin_status(struct snd_soc_component *component, |
| 424 | const char *pin); |
| 425 | int snd_soc_component_force_enable_pin(struct snd_soc_component *component, |
| 426 | const char *pin); |
| 427 | int snd_soc_component_force_enable_pin_unlocked( |
| 428 | struct snd_soc_component *component, |
| 429 | const char *pin); |
| 430 | |
Kuninori Morimoto | ae2f484 | 2019-07-26 13:50:01 +0900 | [diff] [blame] | 431 | /* component driver ops */ |
| 432 | int snd_soc_component_open(struct snd_soc_component *component, |
| 433 | struct snd_pcm_substream *substream); |
Kuninori Morimoto | 3672beb | 2019-07-26 13:50:07 +0900 | [diff] [blame] | 434 | int snd_soc_component_close(struct snd_soc_component *component, |
Kuninori Morimoto | 51aff91 | 2020-09-28 09:01:04 +0900 | [diff] [blame] | 435 | struct snd_pcm_substream *substream, |
| 436 | int rollback); |
Kuninori Morimoto | 66c5157 | 2019-07-26 13:50:34 +0900 | [diff] [blame] | 437 | void snd_soc_component_suspend(struct snd_soc_component *component); |
Kuninori Morimoto | 9a840cb | 2019-07-26 13:51:08 +0900 | [diff] [blame] | 438 | void snd_soc_component_resume(struct snd_soc_component *component); |
Kuninori Morimoto | e40fadb | 2019-07-26 13:51:13 +0900 | [diff] [blame] | 439 | int snd_soc_component_is_suspended(struct snd_soc_component *component); |
Kuninori Morimoto | 08e837d | 2019-07-26 13:51:17 +0900 | [diff] [blame] | 440 | int snd_soc_component_probe(struct snd_soc_component *component); |
Kuninori Morimoto | 03b34dd | 2019-07-26 13:51:22 +0900 | [diff] [blame] | 441 | void snd_soc_component_remove(struct snd_soc_component *component); |
Kuninori Morimoto | 2c7b170 | 2019-07-26 13:51:26 +0900 | [diff] [blame] | 442 | int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component, |
| 443 | struct device_node *ep); |
Kuninori Morimoto | a2a3417 | 2019-07-26 13:51:31 +0900 | [diff] [blame] | 444 | int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component, |
| 445 | struct of_phandle_args *args, |
| 446 | const char **dai_name); |
Kuninori Morimoto | a4e427c | 2020-11-13 13:15:20 +0900 | [diff] [blame] | 447 | int snd_soc_component_compr_open(struct snd_compr_stream *cstream, |
| 448 | struct snd_soc_component **last); |
Kuninori Morimoto | dbde5e21 | 2020-11-13 13:15:26 +0900 | [diff] [blame] | 449 | void snd_soc_component_compr_free(struct snd_compr_stream *cstream, |
| 450 | struct snd_soc_component *last); |
Kuninori Morimoto | 08aee25 | 2020-11-13 13:15:33 +0900 | [diff] [blame] | 451 | int snd_soc_component_compr_trigger(struct snd_compr_stream *cstream, int cmd); |
Kuninori Morimoto | ff08cf8 | 2020-11-13 13:15:49 +0900 | [diff] [blame] | 452 | int snd_soc_component_compr_set_params(struct snd_compr_stream *cstream, |
| 453 | struct snd_compr_params *params); |
Kuninori Morimoto | 77c221e | 2020-11-13 13:15:56 +0900 | [diff] [blame] | 454 | int snd_soc_component_compr_get_params(struct snd_compr_stream *cstream, |
| 455 | struct snd_codec *params); |
Kuninori Morimoto | d67fcb2 | 2020-11-13 13:16:03 +0900 | [diff] [blame] | 456 | int snd_soc_component_compr_get_caps(struct snd_compr_stream *cstream, |
| 457 | struct snd_compr_caps *caps); |
Kuninori Morimoto | 0f6fe09 | 2020-11-13 13:16:11 +0900 | [diff] [blame] | 458 | int snd_soc_component_compr_get_codec_caps(struct snd_compr_stream *cstream, |
| 459 | struct snd_compr_codec_caps *codec); |
Kuninori Morimoto | 0506b88 | 2020-11-13 13:16:17 +0900 | [diff] [blame^] | 460 | int snd_soc_component_compr_ack(struct snd_compr_stream *cstream, size_t bytes); |
Kuninori Morimoto | ae2f484 | 2019-07-26 13:50:01 +0900 | [diff] [blame] | 461 | |
Kuninori Morimoto | 0035e25 | 2019-07-26 13:51:47 +0900 | [diff] [blame] | 462 | int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream); |
Kuninori Morimoto | 96a4790 | 2019-07-26 13:51:51 +0900 | [diff] [blame] | 463 | int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream, |
| 464 | unsigned int cmd, void *arg); |
Takashi Iwai | 1e5ddb6 | 2019-11-21 20:07:09 +0100 | [diff] [blame] | 465 | int snd_soc_pcm_component_sync_stop(struct snd_pcm_substream *substream); |
Kuninori Morimoto | 82d81f5 | 2019-07-26 13:51:56 +0900 | [diff] [blame] | 466 | int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream, |
| 467 | int channel, unsigned long pos, |
| 468 | void __user *buf, unsigned long bytes); |
Kuninori Morimoto | 9c712e4 | 2019-07-26 13:52:00 +0900 | [diff] [blame] | 469 | struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream, |
| 470 | unsigned long offset); |
Kuninori Morimoto | 205875e | 2019-07-26 13:52:04 +0900 | [diff] [blame] | 471 | int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream, |
| 472 | struct vm_area_struct *vma); |
Kuninori Morimoto | b2b2afb | 2019-11-18 10:50:32 +0900 | [diff] [blame] | 473 | int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd); |
| 474 | void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd); |
Kuninori Morimoto | 4f39514 | 2020-06-04 17:06:58 +0900 | [diff] [blame] | 475 | int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream); |
Kuninori Morimoto | e1bafa8 | 2020-06-04 17:07:11 +0900 | [diff] [blame] | 476 | int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream, |
Kuninori Morimoto | 3a36a64 | 2020-09-29 13:31:41 +0900 | [diff] [blame] | 477 | struct snd_pcm_hw_params *params); |
Kuninori Morimoto | 0475111 | 2020-06-04 17:07:24 +0900 | [diff] [blame] | 478 | void snd_soc_pcm_component_hw_free(struct snd_pcm_substream *substream, |
Kuninori Morimoto | 3a36a64 | 2020-09-29 13:31:41 +0900 | [diff] [blame] | 479 | int rollback); |
Kuninori Morimoto | 32fd120 | 2020-06-04 17:07:40 +0900 | [diff] [blame] | 480 | int snd_soc_pcm_component_trigger(struct snd_pcm_substream *substream, |
| 481 | int cmd); |
Kuninori Morimoto | 939a5cf | 2020-09-28 09:01:17 +0900 | [diff] [blame] | 482 | int snd_soc_pcm_component_pm_runtime_get(struct snd_soc_pcm_runtime *rtd, |
| 483 | void *stream); |
| 484 | void snd_soc_pcm_component_pm_runtime_put(struct snd_soc_pcm_runtime *rtd, |
| 485 | void *stream, int rollback); |
Kuninori Morimoto | 0035e25 | 2019-07-26 13:51:47 +0900 | [diff] [blame] | 486 | |
Kuninori Morimoto | 4ff1fef | 2019-07-26 13:49:48 +0900 | [diff] [blame] | 487 | #endif /* __SOC_COMPONENT_H */ |