xref: /openbmc/linux/include/sound/soc-component.h (revision 9a840cbac77a90e8406296aaa132ebf2c84ed9e3)
14ff1fef1SKuninori Morimoto /* SPDX-License-Identifier: GPL-2.0
24ff1fef1SKuninori Morimoto  *
34ff1fef1SKuninori Morimoto  * soc-component.h
44ff1fef1SKuninori Morimoto  *
54ff1fef1SKuninori Morimoto  * Copyright (c) 2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
64ff1fef1SKuninori Morimoto  *
74ff1fef1SKuninori Morimoto  * This program is free software; you can redistribute it and/or modify
84ff1fef1SKuninori Morimoto  * it under the terms of the GNU General Public License version 2 as
94ff1fef1SKuninori Morimoto  * published by the Free Software Foundation.
104ff1fef1SKuninori Morimoto  */
114ff1fef1SKuninori Morimoto #ifndef __SOC_COMPONENT_H
124ff1fef1SKuninori Morimoto #define __SOC_COMPONENT_H
134ff1fef1SKuninori Morimoto 
144ff1fef1SKuninori Morimoto #include <sound/soc.h>
154ff1fef1SKuninori Morimoto 
164ff1fef1SKuninori Morimoto /*
174ff1fef1SKuninori Morimoto  * Component probe and remove ordering levels for components with runtime
184ff1fef1SKuninori Morimoto  * dependencies.
194ff1fef1SKuninori Morimoto  */
204ff1fef1SKuninori Morimoto #define SND_SOC_COMP_ORDER_FIRST	-2
214ff1fef1SKuninori Morimoto #define SND_SOC_COMP_ORDER_EARLY	-1
224ff1fef1SKuninori Morimoto #define SND_SOC_COMP_ORDER_NORMAL	 0
234ff1fef1SKuninori Morimoto #define SND_SOC_COMP_ORDER_LATE		 1
244ff1fef1SKuninori Morimoto #define SND_SOC_COMP_ORDER_LAST		 2
254ff1fef1SKuninori Morimoto 
264ff1fef1SKuninori Morimoto #define for_each_comp_order(order)		\
274ff1fef1SKuninori Morimoto 	for (order  = SND_SOC_COMP_ORDER_FIRST;	\
284ff1fef1SKuninori Morimoto 	     order <= SND_SOC_COMP_ORDER_LAST;	\
294ff1fef1SKuninori Morimoto 	     order++)
304ff1fef1SKuninori Morimoto 
314ff1fef1SKuninori Morimoto /* component interface */
324ff1fef1SKuninori Morimoto struct snd_soc_component_driver {
334ff1fef1SKuninori Morimoto 	const char *name;
344ff1fef1SKuninori Morimoto 
354ff1fef1SKuninori Morimoto 	/* Default control and setup, added after probe() is run */
364ff1fef1SKuninori Morimoto 	const struct snd_kcontrol_new *controls;
374ff1fef1SKuninori Morimoto 	unsigned int num_controls;
384ff1fef1SKuninori Morimoto 	const struct snd_soc_dapm_widget *dapm_widgets;
394ff1fef1SKuninori Morimoto 	unsigned int num_dapm_widgets;
404ff1fef1SKuninori Morimoto 	const struct snd_soc_dapm_route *dapm_routes;
414ff1fef1SKuninori Morimoto 	unsigned int num_dapm_routes;
424ff1fef1SKuninori Morimoto 
434ff1fef1SKuninori Morimoto 	int (*probe)(struct snd_soc_component *component);
444ff1fef1SKuninori Morimoto 	void (*remove)(struct snd_soc_component *component);
454ff1fef1SKuninori Morimoto 	int (*suspend)(struct snd_soc_component *component);
464ff1fef1SKuninori Morimoto 	int (*resume)(struct snd_soc_component *component);
474ff1fef1SKuninori Morimoto 
484ff1fef1SKuninori Morimoto 	unsigned int (*read)(struct snd_soc_component *component,
494ff1fef1SKuninori Morimoto 			     unsigned int reg);
504ff1fef1SKuninori Morimoto 	int (*write)(struct snd_soc_component *component,
514ff1fef1SKuninori Morimoto 		     unsigned int reg, unsigned int val);
524ff1fef1SKuninori Morimoto 
534ff1fef1SKuninori Morimoto 	/* pcm creation and destruction */
544ff1fef1SKuninori Morimoto 	int (*pcm_new)(struct snd_soc_pcm_runtime *rtd);
554ff1fef1SKuninori Morimoto 	void (*pcm_free)(struct snd_pcm *pcm);
564ff1fef1SKuninori Morimoto 
574ff1fef1SKuninori Morimoto 	/* component wide operations */
584ff1fef1SKuninori Morimoto 	int (*set_sysclk)(struct snd_soc_component *component,
594ff1fef1SKuninori Morimoto 			  int clk_id, int source, unsigned int freq, int dir);
604ff1fef1SKuninori Morimoto 	int (*set_pll)(struct snd_soc_component *component, int pll_id,
614ff1fef1SKuninori Morimoto 		       int source, unsigned int freq_in, unsigned int freq_out);
624ff1fef1SKuninori Morimoto 	int (*set_jack)(struct snd_soc_component *component,
634ff1fef1SKuninori Morimoto 			struct snd_soc_jack *jack,  void *data);
644ff1fef1SKuninori Morimoto 
654ff1fef1SKuninori Morimoto 	/* DT */
664ff1fef1SKuninori Morimoto 	int (*of_xlate_dai_name)(struct snd_soc_component *component,
674ff1fef1SKuninori Morimoto 				 struct of_phandle_args *args,
684ff1fef1SKuninori Morimoto 				 const char **dai_name);
694ff1fef1SKuninori Morimoto 	int (*of_xlate_dai_id)(struct snd_soc_component *comment,
704ff1fef1SKuninori Morimoto 			       struct device_node *endpoint);
714ff1fef1SKuninori Morimoto 	void (*seq_notifier)(struct snd_soc_component *component,
724ff1fef1SKuninori Morimoto 			     enum snd_soc_dapm_type type, int subseq);
734ff1fef1SKuninori Morimoto 	int (*stream_event)(struct snd_soc_component *component, int event);
744ff1fef1SKuninori Morimoto 	int (*set_bias_level)(struct snd_soc_component *component,
754ff1fef1SKuninori Morimoto 			      enum snd_soc_bias_level level);
764ff1fef1SKuninori Morimoto 
774ff1fef1SKuninori Morimoto 	const struct snd_pcm_ops *ops;
784ff1fef1SKuninori Morimoto 	const struct snd_compr_ops *compr_ops;
794ff1fef1SKuninori Morimoto 
804ff1fef1SKuninori Morimoto 	/* probe ordering - for components with runtime dependencies */
814ff1fef1SKuninori Morimoto 	int probe_order;
824ff1fef1SKuninori Morimoto 	int remove_order;
834ff1fef1SKuninori Morimoto 
844ff1fef1SKuninori Morimoto 	/*
854ff1fef1SKuninori Morimoto 	 * signal if the module handling the component should not be removed
864ff1fef1SKuninori Morimoto 	 * if a pcm is open. Setting this would prevent the module
874ff1fef1SKuninori Morimoto 	 * refcount being incremented in probe() but allow it be incremented
884ff1fef1SKuninori Morimoto 	 * when a pcm is opened and decremented when it is closed.
894ff1fef1SKuninori Morimoto 	 */
904ff1fef1SKuninori Morimoto 	unsigned int module_get_upon_open:1;
914ff1fef1SKuninori Morimoto 
924ff1fef1SKuninori Morimoto 	/* bits */
934ff1fef1SKuninori Morimoto 	unsigned int idle_bias_on:1;
944ff1fef1SKuninori Morimoto 	unsigned int suspend_bias_off:1;
954ff1fef1SKuninori Morimoto 	unsigned int use_pmdown_time:1; /* care pmdown_time at stop */
964ff1fef1SKuninori Morimoto 	unsigned int endianness:1;
974ff1fef1SKuninori Morimoto 	unsigned int non_legacy_dai_naming:1;
984ff1fef1SKuninori Morimoto 
994ff1fef1SKuninori Morimoto 	/* this component uses topology and ignore machine driver FEs */
1004ff1fef1SKuninori Morimoto 	const char *ignore_machine;
1014ff1fef1SKuninori Morimoto 	const char *topology_name_prefix;
1024ff1fef1SKuninori Morimoto 	int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
1034ff1fef1SKuninori Morimoto 				  struct snd_pcm_hw_params *params);
1044ff1fef1SKuninori Morimoto 	bool use_dai_pcm_id;	/* use DAI link PCM ID as PCM device number */
1054ff1fef1SKuninori Morimoto 	int be_pcm_base;	/* base device ID for all BE PCMs */
1064ff1fef1SKuninori Morimoto };
1074ff1fef1SKuninori Morimoto 
1084ff1fef1SKuninori Morimoto struct snd_soc_component {
1094ff1fef1SKuninori Morimoto 	const char *name;
1104ff1fef1SKuninori Morimoto 	int id;
1114ff1fef1SKuninori Morimoto 	const char *name_prefix;
1124ff1fef1SKuninori Morimoto 	struct device *dev;
1134ff1fef1SKuninori Morimoto 	struct snd_soc_card *card;
1144ff1fef1SKuninori Morimoto 
1154ff1fef1SKuninori Morimoto 	unsigned int active;
1164ff1fef1SKuninori Morimoto 
1174ff1fef1SKuninori Morimoto 	unsigned int suspended:1; /* is in suspend PM state */
1184ff1fef1SKuninori Morimoto 
1194ff1fef1SKuninori Morimoto 	struct list_head list;
1204ff1fef1SKuninori Morimoto 	struct list_head card_aux_list; /* for auxiliary bound components */
1214ff1fef1SKuninori Morimoto 	struct list_head card_list;
1224ff1fef1SKuninori Morimoto 
1234ff1fef1SKuninori Morimoto 	const struct snd_soc_component_driver *driver;
1244ff1fef1SKuninori Morimoto 
1254ff1fef1SKuninori Morimoto 	struct list_head dai_list;
1264ff1fef1SKuninori Morimoto 	int num_dai;
1274ff1fef1SKuninori Morimoto 
1284ff1fef1SKuninori Morimoto 	struct regmap *regmap;
1294ff1fef1SKuninori Morimoto 	int val_bytes;
1304ff1fef1SKuninori Morimoto 
1314ff1fef1SKuninori Morimoto 	struct mutex io_mutex;
1324ff1fef1SKuninori Morimoto 
1334ff1fef1SKuninori Morimoto 	/* attached dynamic objects */
1344ff1fef1SKuninori Morimoto 	struct list_head dobj_list;
1354ff1fef1SKuninori Morimoto 
1364ff1fef1SKuninori Morimoto 	/*
1374ff1fef1SKuninori Morimoto 	 * DO NOT use any of the fields below in drivers, they are temporary and
1384ff1fef1SKuninori Morimoto 	 * are going to be removed again soon. If you use them in driver code
1394ff1fef1SKuninori Morimoto 	 * the driver will be marked as BROKEN when these fields are removed.
1404ff1fef1SKuninori Morimoto 	 */
1414ff1fef1SKuninori Morimoto 
1424ff1fef1SKuninori Morimoto 	/* Don't use these, use snd_soc_component_get_dapm() */
1434ff1fef1SKuninori Morimoto 	struct snd_soc_dapm_context dapm;
1444ff1fef1SKuninori Morimoto 
1454ff1fef1SKuninori Morimoto 	/* machine specific init */
1464ff1fef1SKuninori Morimoto 	int (*init)(struct snd_soc_component *component);
1474ff1fef1SKuninori Morimoto 
1484ff1fef1SKuninori Morimoto #ifdef CONFIG_DEBUG_FS
1494ff1fef1SKuninori Morimoto 	struct dentry *debugfs_root;
1504ff1fef1SKuninori Morimoto 	const char *debugfs_prefix;
1514ff1fef1SKuninori Morimoto #endif
1524ff1fef1SKuninori Morimoto };
1534ff1fef1SKuninori Morimoto 
1544ff1fef1SKuninori Morimoto #define for_each_component_dais(component, dai)\
1554ff1fef1SKuninori Morimoto 	list_for_each_entry(dai, &(component)->dai_list, list)
1564ff1fef1SKuninori Morimoto #define for_each_component_dais_safe(component, dai, _dai)\
1574ff1fef1SKuninori Morimoto 	list_for_each_entry_safe(dai, _dai, &(component)->dai_list, list)
1584ff1fef1SKuninori Morimoto 
1594ff1fef1SKuninori Morimoto /**
1604ff1fef1SKuninori Morimoto  * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
1614ff1fef1SKuninori Morimoto  *  embedded in
1624ff1fef1SKuninori Morimoto  * @dapm: The DAPM context to cast to the component
1634ff1fef1SKuninori Morimoto  *
1644ff1fef1SKuninori Morimoto  * This function must only be used on DAPM contexts that are known to be part of
1654ff1fef1SKuninori Morimoto  * a component (e.g. in a component driver). Otherwise the behavior is
1664ff1fef1SKuninori Morimoto  * undefined.
1674ff1fef1SKuninori Morimoto  */
1684ff1fef1SKuninori Morimoto static inline struct snd_soc_component *snd_soc_dapm_to_component(
1694ff1fef1SKuninori Morimoto 	struct snd_soc_dapm_context *dapm)
1704ff1fef1SKuninori Morimoto {
1714ff1fef1SKuninori Morimoto 	return container_of(dapm, struct snd_soc_component, dapm);
1724ff1fef1SKuninori Morimoto }
1734ff1fef1SKuninori Morimoto 
1744ff1fef1SKuninori Morimoto /**
1754ff1fef1SKuninori Morimoto  * snd_soc_component_get_dapm() - Returns the DAPM context associated with a
1764ff1fef1SKuninori Morimoto  *  component
1774ff1fef1SKuninori Morimoto  * @component: The component for which to get the DAPM context
1784ff1fef1SKuninori Morimoto  */
1794ff1fef1SKuninori Morimoto static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
1804ff1fef1SKuninori Morimoto 	struct snd_soc_component *component)
1814ff1fef1SKuninori Morimoto {
1824ff1fef1SKuninori Morimoto 	return &component->dapm;
1834ff1fef1SKuninori Morimoto }
1844ff1fef1SKuninori Morimoto 
1854ff1fef1SKuninori Morimoto /**
1864ff1fef1SKuninori Morimoto  * snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level
1874ff1fef1SKuninori Morimoto  * @component: The COMPONENT for which to initialize the DAPM bias level
1884ff1fef1SKuninori Morimoto  * @level: The DAPM level to initialize to
1894ff1fef1SKuninori Morimoto  *
1904ff1fef1SKuninori Morimoto  * Initializes the COMPONENT DAPM bias level. See snd_soc_dapm_init_bias_level()
1914ff1fef1SKuninori Morimoto  */
1924ff1fef1SKuninori Morimoto static inline void
1934ff1fef1SKuninori Morimoto snd_soc_component_init_bias_level(struct snd_soc_component *component,
1944ff1fef1SKuninori Morimoto 				  enum snd_soc_bias_level level)
1954ff1fef1SKuninori Morimoto {
1964ff1fef1SKuninori Morimoto 	snd_soc_dapm_init_bias_level(
1974ff1fef1SKuninori Morimoto 		snd_soc_component_get_dapm(component), level);
1984ff1fef1SKuninori Morimoto }
1994ff1fef1SKuninori Morimoto 
2004ff1fef1SKuninori Morimoto /**
2014ff1fef1SKuninori Morimoto  * snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level
2024ff1fef1SKuninori Morimoto  * @component: The COMPONENT for which to get the DAPM bias level
2034ff1fef1SKuninori Morimoto  *
2044ff1fef1SKuninori Morimoto  * Returns: The current DAPM bias level of the COMPONENT.
2054ff1fef1SKuninori Morimoto  */
2064ff1fef1SKuninori Morimoto static inline enum snd_soc_bias_level
2074ff1fef1SKuninori Morimoto snd_soc_component_get_bias_level(struct snd_soc_component *component)
2084ff1fef1SKuninori Morimoto {
2094ff1fef1SKuninori Morimoto 	return snd_soc_dapm_get_bias_level(
2104ff1fef1SKuninori Morimoto 		snd_soc_component_get_dapm(component));
2114ff1fef1SKuninori Morimoto }
2124ff1fef1SKuninori Morimoto 
2134ff1fef1SKuninori Morimoto /**
2144ff1fef1SKuninori Morimoto  * snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level
2154ff1fef1SKuninori Morimoto  * @component: The COMPONENT for which to set the level
2164ff1fef1SKuninori Morimoto  * @level: The level to set to
2174ff1fef1SKuninori Morimoto  *
2184ff1fef1SKuninori Morimoto  * Forces the COMPONENT bias level to a specific state. See
2194ff1fef1SKuninori Morimoto  * snd_soc_dapm_force_bias_level().
2204ff1fef1SKuninori Morimoto  */
2214ff1fef1SKuninori Morimoto static inline int
2224ff1fef1SKuninori Morimoto snd_soc_component_force_bias_level(struct snd_soc_component *component,
2234ff1fef1SKuninori Morimoto 				   enum snd_soc_bias_level level)
2244ff1fef1SKuninori Morimoto {
2254ff1fef1SKuninori Morimoto 	return snd_soc_dapm_force_bias_level(
2264ff1fef1SKuninori Morimoto 		snd_soc_component_get_dapm(component),
2274ff1fef1SKuninori Morimoto 		level);
2284ff1fef1SKuninori Morimoto }
2294ff1fef1SKuninori Morimoto 
2304ff1fef1SKuninori Morimoto /**
2314ff1fef1SKuninori Morimoto  * snd_soc_dapm_kcontrol_component() - Returns the component associated to a
2324ff1fef1SKuninori Morimoto  * kcontrol
2334ff1fef1SKuninori Morimoto  * @kcontrol: The kcontrol
2344ff1fef1SKuninori Morimoto  *
2354ff1fef1SKuninori Morimoto  * This function must only be used on DAPM contexts that are known to be part of
2364ff1fef1SKuninori Morimoto  * a COMPONENT (e.g. in a COMPONENT driver). Otherwise the behavior is undefined
2374ff1fef1SKuninori Morimoto  */
2384ff1fef1SKuninori Morimoto static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component(
2394ff1fef1SKuninori Morimoto 	struct snd_kcontrol *kcontrol)
2404ff1fef1SKuninori Morimoto {
2414ff1fef1SKuninori Morimoto 	return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol));
2424ff1fef1SKuninori Morimoto }
2434ff1fef1SKuninori Morimoto 
2444ff1fef1SKuninori Morimoto /**
2454ff1fef1SKuninori Morimoto  * snd_soc_component_cache_sync() - Sync the register cache with the hardware
2464ff1fef1SKuninori Morimoto  * @component: COMPONENT to sync
2474ff1fef1SKuninori Morimoto  *
2484ff1fef1SKuninori Morimoto  * Note: This function will call regcache_sync()
2494ff1fef1SKuninori Morimoto  */
2504ff1fef1SKuninori Morimoto static inline int snd_soc_component_cache_sync(
2514ff1fef1SKuninori Morimoto 	struct snd_soc_component *component)
2524ff1fef1SKuninori Morimoto {
2534ff1fef1SKuninori Morimoto 	return regcache_sync(component->regmap);
2544ff1fef1SKuninori Morimoto }
2554ff1fef1SKuninori Morimoto 
2564ff1fef1SKuninori Morimoto /* component IO */
2574ff1fef1SKuninori Morimoto int snd_soc_component_read(struct snd_soc_component *component,
2584ff1fef1SKuninori Morimoto 			   unsigned int reg, unsigned int *val);
2594ff1fef1SKuninori Morimoto unsigned int snd_soc_component_read32(struct snd_soc_component *component,
2604ff1fef1SKuninori Morimoto 				      unsigned int reg);
2614ff1fef1SKuninori Morimoto int snd_soc_component_write(struct snd_soc_component *component,
2624ff1fef1SKuninori Morimoto 			    unsigned int reg, unsigned int val);
2634ff1fef1SKuninori Morimoto int snd_soc_component_update_bits(struct snd_soc_component *component,
2644ff1fef1SKuninori Morimoto 				  unsigned int reg, unsigned int mask,
2654ff1fef1SKuninori Morimoto 				  unsigned int val);
2664ff1fef1SKuninori Morimoto int snd_soc_component_update_bits_async(struct snd_soc_component *component,
2674ff1fef1SKuninori Morimoto 					unsigned int reg, unsigned int mask,
2684ff1fef1SKuninori Morimoto 					unsigned int val);
2694ff1fef1SKuninori Morimoto void snd_soc_component_async_complete(struct snd_soc_component *component);
2704ff1fef1SKuninori Morimoto int snd_soc_component_test_bits(struct snd_soc_component *component,
2714ff1fef1SKuninori Morimoto 				unsigned int reg, unsigned int mask,
2724ff1fef1SKuninori Morimoto 				unsigned int value);
2734ff1fef1SKuninori Morimoto 
2744ff1fef1SKuninori Morimoto /* component wide operations */
2754ff1fef1SKuninori Morimoto int snd_soc_component_set_sysclk(struct snd_soc_component *component,
2764ff1fef1SKuninori Morimoto 				 int clk_id, int source,
2774ff1fef1SKuninori Morimoto 				 unsigned int freq, int dir);
2784ff1fef1SKuninori Morimoto int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id,
2794ff1fef1SKuninori Morimoto 			      int source, unsigned int freq_in,
2804ff1fef1SKuninori Morimoto 			      unsigned int freq_out);
2814ff1fef1SKuninori Morimoto int snd_soc_component_set_jack(struct snd_soc_component *component,
2824ff1fef1SKuninori Morimoto 			       struct snd_soc_jack *jack, void *data);
2834ff1fef1SKuninori Morimoto 
2844ff1fef1SKuninori Morimoto #ifdef CONFIG_REGMAP
2854ff1fef1SKuninori Morimoto void snd_soc_component_init_regmap(struct snd_soc_component *component,
2864ff1fef1SKuninori Morimoto 				   struct regmap *regmap);
2874ff1fef1SKuninori Morimoto void snd_soc_component_exit_regmap(struct snd_soc_component *component);
2884ff1fef1SKuninori Morimoto #endif
2894ff1fef1SKuninori Morimoto 
2904a81e8f3SKuninori Morimoto #define snd_soc_component_module_get_when_probe(component)\
2914a81e8f3SKuninori Morimoto 	snd_soc_component_module_get(component, 0)
2924a81e8f3SKuninori Morimoto #define snd_soc_component_module_get_when_open(component)	\
2934a81e8f3SKuninori Morimoto 	snd_soc_component_module_get(component, 1)
2944a81e8f3SKuninori Morimoto int snd_soc_component_module_get(struct snd_soc_component *component,
2954a81e8f3SKuninori Morimoto 				 int upon_open);
2964a81e8f3SKuninori Morimoto #define snd_soc_component_module_put_when_remove(component)	\
2974a81e8f3SKuninori Morimoto 	snd_soc_component_module_put(component, 0)
2984a81e8f3SKuninori Morimoto #define snd_soc_component_module_put_when_close(component)	\
2994a81e8f3SKuninori Morimoto 	snd_soc_component_module_put(component, 1)
3004a81e8f3SKuninori Morimoto void snd_soc_component_module_put(struct snd_soc_component *component,
3014a81e8f3SKuninori Morimoto 				  int upon_open);
3024a81e8f3SKuninori Morimoto 
3034ff1fef1SKuninori Morimoto static inline void snd_soc_component_set_drvdata(struct snd_soc_component *c,
3044ff1fef1SKuninori Morimoto 						 void *data)
3054ff1fef1SKuninori Morimoto {
3064ff1fef1SKuninori Morimoto 	dev_set_drvdata(c->dev, data);
3074ff1fef1SKuninori Morimoto }
3084ff1fef1SKuninori Morimoto 
3094ff1fef1SKuninori Morimoto static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c)
3104ff1fef1SKuninori Morimoto {
3114ff1fef1SKuninori Morimoto 	return dev_get_drvdata(c->dev);
3124ff1fef1SKuninori Morimoto }
3134ff1fef1SKuninori Morimoto 
3144ff1fef1SKuninori Morimoto static inline bool snd_soc_component_is_active(
3154ff1fef1SKuninori Morimoto 	struct snd_soc_component *component)
3164ff1fef1SKuninori Morimoto {
3174ff1fef1SKuninori Morimoto 	return component->active != 0;
3184ff1fef1SKuninori Morimoto }
3194ff1fef1SKuninori Morimoto 
3204ff1fef1SKuninori Morimoto /* component pin */
3214ff1fef1SKuninori Morimoto int snd_soc_component_enable_pin(struct snd_soc_component *component,
3224ff1fef1SKuninori Morimoto 				 const char *pin);
3234ff1fef1SKuninori Morimoto int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,
3244ff1fef1SKuninori Morimoto 					  const char *pin);
3254ff1fef1SKuninori Morimoto int snd_soc_component_disable_pin(struct snd_soc_component *component,
3264ff1fef1SKuninori Morimoto 				  const char *pin);
3274ff1fef1SKuninori Morimoto int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component,
3284ff1fef1SKuninori Morimoto 					   const char *pin);
3294ff1fef1SKuninori Morimoto int snd_soc_component_nc_pin(struct snd_soc_component *component,
3304ff1fef1SKuninori Morimoto 			     const char *pin);
3314ff1fef1SKuninori Morimoto int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component,
3324ff1fef1SKuninori Morimoto 				      const char *pin);
3334ff1fef1SKuninori Morimoto int snd_soc_component_get_pin_status(struct snd_soc_component *component,
3344ff1fef1SKuninori Morimoto 				     const char *pin);
3354ff1fef1SKuninori Morimoto int snd_soc_component_force_enable_pin(struct snd_soc_component *component,
3364ff1fef1SKuninori Morimoto 				       const char *pin);
3374ff1fef1SKuninori Morimoto int snd_soc_component_force_enable_pin_unlocked(
3384ff1fef1SKuninori Morimoto 	struct snd_soc_component *component,
3394ff1fef1SKuninori Morimoto 	const char *pin);
3404ff1fef1SKuninori Morimoto 
341ae2f4849SKuninori Morimoto /* component driver ops */
342ae2f4849SKuninori Morimoto int snd_soc_component_open(struct snd_soc_component *component,
343ae2f4849SKuninori Morimoto 			   struct snd_pcm_substream *substream);
3443672beb8SKuninori Morimoto int snd_soc_component_close(struct snd_soc_component *component,
3453672beb8SKuninori Morimoto 			    struct snd_pcm_substream *substream);
3466d537233SKuninori Morimoto int snd_soc_component_prepare(struct snd_soc_component *component,
3476d537233SKuninori Morimoto 			      struct snd_pcm_substream *substream);
348245c539aSKuninori Morimoto int snd_soc_component_hw_params(struct snd_soc_component *component,
349245c539aSKuninori Morimoto 				struct snd_pcm_substream *substream,
350245c539aSKuninori Morimoto 				struct snd_pcm_hw_params *params);
351eae7136aSKuninori Morimoto int snd_soc_component_hw_free(struct snd_soc_component *component,
352eae7136aSKuninori Morimoto 			      struct snd_pcm_substream *substream);
3535693d50cSKuninori Morimoto int snd_soc_component_trigger(struct snd_soc_component *component,
3545693d50cSKuninori Morimoto 			      struct snd_pcm_substream *substream,
3555693d50cSKuninori Morimoto 			      int cmd);
35666c51573SKuninori Morimoto void snd_soc_component_suspend(struct snd_soc_component *component);
357*9a840cbaSKuninori Morimoto void snd_soc_component_resume(struct snd_soc_component *component);
358ae2f4849SKuninori Morimoto 
3594ff1fef1SKuninori Morimoto #endif /* __SOC_COMPONENT_H */
360