xref: /openbmc/linux/include/sound/control.h (revision ae07eb9b)
11a59d1b8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
21da177e4SLinus Torvalds #ifndef __SOUND_CONTROL_H
31da177e4SLinus Torvalds #define __SOUND_CONTROL_H
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds /*
61da177e4SLinus Torvalds  *  Header file for control interface
7c1017a4cSJaroslav Kysela  *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
81da177e4SLinus Torvalds  */
91da177e4SLinus Torvalds 
10b69339baSIngo Molnar #include <linux/wait.h>
11088e861eSTakashi Iwai #include <linux/nospec.h>
121da177e4SLinus Torvalds #include <sound/asound.h>
131da177e4SLinus Torvalds 
141da177e4SLinus Torvalds #define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data)
151da177e4SLinus Torvalds 
1682e9bae6STakashi Iwai struct snd_kcontrol;
1782e9bae6STakashi Iwai typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo);
1882e9bae6STakashi Iwai typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
1982e9bae6STakashi Iwai typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
208aa9b586SJaroslav Kysela typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol,
210cea76f3STakashi Iwai 				    int op_flag, /* SNDRV_CTL_TLV_OP_XXX */
228aa9b586SJaroslav Kysela 				    unsigned int size,
238aa9b586SJaroslav Kysela 				    unsigned int __user *tlv);
248aa9b586SJaroslav Kysela 
25fbd3eb7fSTakashi Iwai /* internal flag for skipping validations */
261b7ec514STakashi Iwai #ifdef CONFIG_SND_CTL_DEBUG
2722d8de62SJaroslav Kysela #define SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK	(1 << 24)
28fbd3eb7fSTakashi Iwai #define snd_ctl_skip_validation(info) \
29fbd3eb7fSTakashi Iwai 	((info)->access & SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK)
30fbd3eb7fSTakashi Iwai #else
31fbd3eb7fSTakashi Iwai #define SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK	0
32fbd3eb7fSTakashi Iwai #define snd_ctl_skip_validation(info)		true
33fbd3eb7fSTakashi Iwai #endif
34fbd3eb7fSTakashi Iwai 
3522d8de62SJaroslav Kysela /* kernel only - LED bits */
3622d8de62SJaroslav Kysela #define SNDRV_CTL_ELEM_ACCESS_LED_SHIFT		25
3722d8de62SJaroslav Kysela #define SNDRV_CTL_ELEM_ACCESS_LED_MASK		(7<<25) /* kernel three bits - LED group */
3822d8de62SJaroslav Kysela #define SNDRV_CTL_ELEM_ACCESS_SPK_LED		(1<<25) /* kernel speaker (output) LED flag */
3922d8de62SJaroslav Kysela #define SNDRV_CTL_ELEM_ACCESS_MIC_LED		(2<<25) /* kernel microphone (input) LED flag */
4022d8de62SJaroslav Kysela 
410cea76f3STakashi Iwai enum {
420cea76f3STakashi Iwai 	SNDRV_CTL_TLV_OP_READ = 0,
430cea76f3STakashi Iwai 	SNDRV_CTL_TLV_OP_WRITE = 1,
440cea76f3STakashi Iwai 	SNDRV_CTL_TLV_OP_CMD = -1,
450cea76f3STakashi Iwai };
461da177e4SLinus Torvalds 
4782e9bae6STakashi Iwai struct snd_kcontrol_new {
481da177e4SLinus Torvalds 	snd_ctl_elem_iface_t iface;	/* interface identifier */
491da177e4SLinus Torvalds 	unsigned int device;		/* device/client number */
501da177e4SLinus Torvalds 	unsigned int subdevice;		/* subdevice (substream) number */
512a6eca16SArnd Bergmann 	const char *name;		/* ASCII name of item */
521da177e4SLinus Torvalds 	unsigned int index;		/* index of item */
531da177e4SLinus Torvalds 	unsigned int access;		/* access rights */
541da177e4SLinus Torvalds 	unsigned int count;		/* count of same elements */
551da177e4SLinus Torvalds 	snd_kcontrol_info_t *info;
561da177e4SLinus Torvalds 	snd_kcontrol_get_t *get;
571da177e4SLinus Torvalds 	snd_kcontrol_put_t *put;
588aa9b586SJaroslav Kysela 	union {
598aa9b586SJaroslav Kysela 		snd_kcontrol_tlv_rw_t *c;
600cb29ea0STakashi Iwai 		const unsigned int *p;
618aa9b586SJaroslav Kysela 	} tlv;
621da177e4SLinus Torvalds 	unsigned long private_value;
6382e9bae6STakashi Iwai };
641da177e4SLinus Torvalds 
6582e9bae6STakashi Iwai struct snd_kcontrol_volatile {
6682e9bae6STakashi Iwai 	struct snd_ctl_file *owner;	/* locked */
671da177e4SLinus Torvalds 	unsigned int access;	/* access rights */
6882e9bae6STakashi Iwai };
691da177e4SLinus Torvalds 
7082e9bae6STakashi Iwai struct snd_kcontrol {
711da177e4SLinus Torvalds 	struct list_head list;		/* list of controls */
7282e9bae6STakashi Iwai 	struct snd_ctl_elem_id id;
731da177e4SLinus Torvalds 	unsigned int count;		/* count of same elements */
741da177e4SLinus Torvalds 	snd_kcontrol_info_t *info;
751da177e4SLinus Torvalds 	snd_kcontrol_get_t *get;
761da177e4SLinus Torvalds 	snd_kcontrol_put_t *put;
778aa9b586SJaroslav Kysela 	union {
788aa9b586SJaroslav Kysela 		snd_kcontrol_tlv_rw_t *c;
790cb29ea0STakashi Iwai 		const unsigned int *p;
808aa9b586SJaroslav Kysela 	} tlv;
811da177e4SLinus Torvalds 	unsigned long private_value;
821da177e4SLinus Torvalds 	void *private_data;
8382e9bae6STakashi Iwai 	void (*private_free)(struct snd_kcontrol *kcontrol);
849ad06ebbSGustavo A. R. Silva 	struct snd_kcontrol_volatile vd[];	/* volatile data */
851da177e4SLinus Torvalds };
861da177e4SLinus Torvalds 
8782e9bae6STakashi Iwai #define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
881da177e4SLinus Torvalds 
8982e9bae6STakashi Iwai struct snd_kctl_event {
901da177e4SLinus Torvalds 	struct list_head list;	/* list of events */
9182e9bae6STakashi Iwai 	struct snd_ctl_elem_id id;
921da177e4SLinus Torvalds 	unsigned int mask;
9382e9bae6STakashi Iwai };
941da177e4SLinus Torvalds 
9582e9bae6STakashi Iwai #define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
961da177e4SLinus Torvalds 
9725d27edeSClemens Ladisch struct pid;
9825d27edeSClemens Ladisch 
9923c18d4bSTakashi Iwai enum {
10023c18d4bSTakashi Iwai 	SND_CTL_SUBDEV_PCM,
10123c18d4bSTakashi Iwai 	SND_CTL_SUBDEV_RAWMIDI,
10223c18d4bSTakashi Iwai 	SND_CTL_SUBDEV_ITEMS,
10323c18d4bSTakashi Iwai };
10423c18d4bSTakashi Iwai 
10582e9bae6STakashi Iwai struct snd_ctl_file {
1061da177e4SLinus Torvalds 	struct list_head list;		/* list of all control files */
10782e9bae6STakashi Iwai 	struct snd_card *card;
10825d27edeSClemens Ladisch 	struct pid *pid;
10923c18d4bSTakashi Iwai 	int preferred_subdevice[SND_CTL_SUBDEV_ITEMS];
1101da177e4SLinus Torvalds 	wait_queue_head_t change_sleep;
1111da177e4SLinus Torvalds 	spinlock_t read_lock;
1124a971e84STakashi Iwai 	struct snd_fasync *fasync;
1131da177e4SLinus Torvalds 	int subscribed;			/* read interface is activated */
1141da177e4SLinus Torvalds 	struct list_head events;	/* waiting events for read */
1151da177e4SLinus Torvalds };
1161da177e4SLinus Torvalds 
1173f0638a0SJaroslav Kysela struct snd_ctl_layer_ops {
1183f0638a0SJaroslav Kysela 	struct snd_ctl_layer_ops *next;
1193f0638a0SJaroslav Kysela 	const char *module_name;
1203f0638a0SJaroslav Kysela 	void (*lregister)(struct snd_card *card);
1213f0638a0SJaroslav Kysela 	void (*ldisconnect)(struct snd_card *card);
1223f0638a0SJaroslav Kysela 	void (*lnotify)(struct snd_card *card, unsigned int mask, struct snd_kcontrol *kctl, unsigned int ioff);
1233f0638a0SJaroslav Kysela };
1243f0638a0SJaroslav Kysela 
12582e9bae6STakashi Iwai #define snd_ctl_file(n) list_entry(n, struct snd_ctl_file, list)
1261da177e4SLinus Torvalds 
12782e9bae6STakashi Iwai typedef int (*snd_kctl_ioctl_func_t) (struct snd_card * card,
12882e9bae6STakashi Iwai 				      struct snd_ctl_file * control,
1291da177e4SLinus Torvalds 				      unsigned int cmd, unsigned long arg);
1301da177e4SLinus Torvalds 
13182e9bae6STakashi Iwai void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id);
1321fa4445fSJaroslav Kysela void snd_ctl_notify_one(struct snd_card * card, unsigned int mask, struct snd_kcontrol * kctl, unsigned int ioff);
1331da177e4SLinus Torvalds 
13482e9bae6STakashi Iwai struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data);
13582e9bae6STakashi Iwai void snd_ctl_free_one(struct snd_kcontrol * kcontrol);
13682e9bae6STakashi Iwai int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol);
13782e9bae6STakashi Iwai int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol);
13866b5b972SDimitris Papastamos int snd_ctl_replace(struct snd_card *card, struct snd_kcontrol *kcontrol, bool add_on_replace);
13982e9bae6STakashi Iwai int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
14082e9bae6STakashi Iwai int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
141966f015fSMaciej S. Szmigiero void snd_ctl_rename(struct snd_card *card, struct snd_kcontrol *kctl, const char *name);
1421fa4445fSJaroslav Kysela int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id, int active);
143b1e055f6STakashi Iwai struct snd_kcontrol *snd_ctl_find_numid_locked(struct snd_card *card, unsigned int numid);
14482e9bae6STakashi Iwai struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numid);
145b1e055f6STakashi Iwai struct snd_kcontrol *snd_ctl_find_id_locked(struct snd_card *card, const struct snd_ctl_elem_id *id);
1466723670aSTakashi Iwai struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card, const struct snd_ctl_elem_id *id);
1471da177e4SLinus Torvalds 
14868fa05d4STakashi Iwai /**
14968fa05d4STakashi Iwai  * snd_ctl_find_id_mixer - find the control instance with the given name string
15068fa05d4STakashi Iwai  * @card: the card instance
15168fa05d4STakashi Iwai  * @name: the name string
15268fa05d4STakashi Iwai  *
15368fa05d4STakashi Iwai  * Finds the control instance with the given name and
15468fa05d4STakashi Iwai  * @SNDRV_CTL_ELEM_IFACE_MIXER. Other fields are set to zero.
15568fa05d4STakashi Iwai  *
15668fa05d4STakashi Iwai  * This is merely a wrapper to snd_ctl_find_id().
15768fa05d4STakashi Iwai  *
15868fa05d4STakashi Iwai  * Return: The pointer of the instance if found, or %NULL if not.
15968fa05d4STakashi Iwai  */
16068fa05d4STakashi Iwai static inline struct snd_kcontrol *
snd_ctl_find_id_mixer(struct snd_card * card,const char * name)16168fa05d4STakashi Iwai snd_ctl_find_id_mixer(struct snd_card *card, const char *name)
16268fa05d4STakashi Iwai {
16368fa05d4STakashi Iwai 	struct snd_ctl_elem_id id = {};
16468fa05d4STakashi Iwai 
16568fa05d4STakashi Iwai 	id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
16668fa05d4STakashi Iwai 	strscpy(id.name, name, sizeof(id.name));
16768fa05d4STakashi Iwai 	return snd_ctl_find_id(card, &id);
16868fa05d4STakashi Iwai }
16968fa05d4STakashi Iwai 
17082e9bae6STakashi Iwai int snd_ctl_create(struct snd_card *card);
1711da177e4SLinus Torvalds 
1721da177e4SLinus Torvalds int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
1731da177e4SLinus Torvalds int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn);
1741da177e4SLinus Torvalds #ifdef CONFIG_COMPAT
1751da177e4SLinus Torvalds int snd_ctl_register_ioctl_compat(snd_kctl_ioctl_func_t fcn);
1761da177e4SLinus Torvalds int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn);
1771da177e4SLinus Torvalds #else
1781da177e4SLinus Torvalds #define snd_ctl_register_ioctl_compat(fcn)
1791da177e4SLinus Torvalds #define snd_ctl_unregister_ioctl_compat(fcn)
1801da177e4SLinus Torvalds #endif
1811da177e4SLinus Torvalds 
1823f0638a0SJaroslav Kysela int snd_ctl_request_layer(const char *module_name);
1833f0638a0SJaroslav Kysela void snd_ctl_register_layer(struct snd_ctl_layer_ops *lops);
1843f0638a0SJaroslav Kysela void snd_ctl_disconnect_layer(struct snd_ctl_layer_ops *lops);
1853f0638a0SJaroslav Kysela 
18623c18d4bSTakashi Iwai int snd_ctl_get_preferred_subdevice(struct snd_card *card, int type);
18723c18d4bSTakashi Iwai 
snd_ctl_get_ioffnum(struct snd_kcontrol * kctl,struct snd_ctl_elem_id * id)18882e9bae6STakashi Iwai static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
1891da177e4SLinus Torvalds {
190088e861eSTakashi Iwai 	unsigned int ioff = id->numid - kctl->id.numid;
191088e861eSTakashi Iwai 	return array_index_nospec(ioff, kctl->count);
1921da177e4SLinus Torvalds }
1931da177e4SLinus Torvalds 
snd_ctl_get_ioffidx(struct snd_kcontrol * kctl,struct snd_ctl_elem_id * id)19482e9bae6STakashi Iwai static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
1951da177e4SLinus Torvalds {
196088e861eSTakashi Iwai 	unsigned int ioff = id->index - kctl->id.index;
197088e861eSTakashi Iwai 	return array_index_nospec(ioff, kctl->count);
1981da177e4SLinus Torvalds }
1991da177e4SLinus Torvalds 
snd_ctl_get_ioff(struct snd_kcontrol * kctl,struct snd_ctl_elem_id * id)20082e9bae6STakashi Iwai static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
2011da177e4SLinus Torvalds {
2021da177e4SLinus Torvalds 	if (id->numid) {
2031da177e4SLinus Torvalds 		return snd_ctl_get_ioffnum(kctl, id);
2041da177e4SLinus Torvalds 	} else {
2051da177e4SLinus Torvalds 		return snd_ctl_get_ioffidx(kctl, id);
2061da177e4SLinus Torvalds 	}
2071da177e4SLinus Torvalds }
2081da177e4SLinus Torvalds 
snd_ctl_build_ioff(struct snd_ctl_elem_id * dst_id,struct snd_kcontrol * src_kctl,unsigned int offset)20982e9bae6STakashi Iwai static inline struct snd_ctl_elem_id *snd_ctl_build_ioff(struct snd_ctl_elem_id *dst_id,
21082e9bae6STakashi Iwai 						    struct snd_kcontrol *src_kctl,
2111da177e4SLinus Torvalds 						    unsigned int offset)
2121da177e4SLinus Torvalds {
2131da177e4SLinus Torvalds 	*dst_id = src_kctl->id;
2141da177e4SLinus Torvalds 	dst_id->index += offset;
2151da177e4SLinus Torvalds 	dst_id->numid += offset;
2161da177e4SLinus Torvalds 	return dst_id;
2171da177e4SLinus Torvalds }
2181da177e4SLinus Torvalds 
219b9ed4f2bSTakashi Iwai /*
2209600732bSClemens Ladisch  * Frequently used control callbacks/helpers
221b9ed4f2bSTakashi Iwai  */
222b9ed4f2bSTakashi Iwai int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol,
223b9ed4f2bSTakashi Iwai 			      struct snd_ctl_elem_info *uinfo);
224b9ed4f2bSTakashi Iwai int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol,
225b9ed4f2bSTakashi Iwai 				struct snd_ctl_elem_info *uinfo);
2269600732bSClemens Ladisch int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels,
2279600732bSClemens Ladisch 		      unsigned int items, const char *const names[]);
228b9ed4f2bSTakashi Iwai 
229e922b002STakashi Iwai /*
230e922b002STakashi Iwai  * virtual master control
231e922b002STakashi Iwai  */
232e922b002STakashi Iwai struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
233e922b002STakashi Iwai 						 const unsigned int *tlv);
2349ab0cb30STakashi Iwai int _snd_ctl_add_follower(struct snd_kcontrol *master,
2359ab0cb30STakashi Iwai 			  struct snd_kcontrol *follower,
236f5b1db63STakashi Iwai 			  unsigned int flags);
2379ab0cb30STakashi Iwai /* optional flags for follower */
2389ab0cb30STakashi Iwai #define SND_CTL_FOLLOWER_NEED_UPDATE	(1 << 0)
239f5b1db63STakashi Iwai 
24079c7cdd5STakashi Iwai /**
2419ab0cb30STakashi Iwai  * snd_ctl_add_follower - Add a virtual follower control
24279c7cdd5STakashi Iwai  * @master: vmaster element
2439ab0cb30STakashi Iwai  * @follower: follower element to add
24479c7cdd5STakashi Iwai  *
2459ab0cb30STakashi Iwai  * Add a virtual follower control to the given master element created via
24679c7cdd5STakashi Iwai  * snd_ctl_create_virtual_master() beforehand.
24779c7cdd5STakashi Iwai  *
2489ab0cb30STakashi Iwai  * All followers must be the same type (returning the same information
24925985edcSLucas De Marchi  * via info callback).  The function doesn't check it, so it's your
25079c7cdd5STakashi Iwai  * responsibility.
25179c7cdd5STakashi Iwai  *
25279c7cdd5STakashi Iwai  * Also, some additional limitations:
25379c7cdd5STakashi Iwai  * at most two channels,
25479c7cdd5STakashi Iwai  * logarithmic volume control (dB level) thus no linear volume,
25579c7cdd5STakashi Iwai  * master can only attenuate the volume without gain
256eb7c06e8SYacine Belkadi  *
257eb7c06e8SYacine Belkadi  * Return: Zero if successful or a negative error code.
25879c7cdd5STakashi Iwai  */
259f5b1db63STakashi Iwai static inline int
snd_ctl_add_follower(struct snd_kcontrol * master,struct snd_kcontrol * follower)2609ab0cb30STakashi Iwai snd_ctl_add_follower(struct snd_kcontrol *master, struct snd_kcontrol *follower)
261f5b1db63STakashi Iwai {
2629ab0cb30STakashi Iwai 	return _snd_ctl_add_follower(master, follower, 0);
263f5b1db63STakashi Iwai }
264f5b1db63STakashi Iwai 
265*ae07eb9bSTakashi Iwai int snd_ctl_add_followers(struct snd_card *card, struct snd_kcontrol *master,
266*ae07eb9bSTakashi Iwai 			  const char * const *list);
267*ae07eb9bSTakashi Iwai 
26879c7cdd5STakashi Iwai /**
2699ab0cb30STakashi Iwai  * snd_ctl_add_follower_uncached - Add a virtual follower control
27079c7cdd5STakashi Iwai  * @master: vmaster element
2719ab0cb30STakashi Iwai  * @follower: follower element to add
27279c7cdd5STakashi Iwai  *
2739ab0cb30STakashi Iwai  * Add a virtual follower control to the given master.
2749ab0cb30STakashi Iwai  * Unlike snd_ctl_add_follower(), the element added via this function
27579c7cdd5STakashi Iwai  * is supposed to have volatile values, and get callback is called
2761a6ab46fSMasanari Iida  * at each time queried from the master.
27779c7cdd5STakashi Iwai  *
27879c7cdd5STakashi Iwai  * When the control peeks the hardware values directly and the value
27979c7cdd5STakashi Iwai  * can be changed by other means than the put callback of the element,
28079c7cdd5STakashi Iwai  * this function should be used to keep the value always up-to-date.
281eb7c06e8SYacine Belkadi  *
282eb7c06e8SYacine Belkadi  * Return: Zero if successful or a negative error code.
28379c7cdd5STakashi Iwai  */
284f5b1db63STakashi Iwai static inline int
snd_ctl_add_follower_uncached(struct snd_kcontrol * master,struct snd_kcontrol * follower)2859ab0cb30STakashi Iwai snd_ctl_add_follower_uncached(struct snd_kcontrol *master,
2869ab0cb30STakashi Iwai 			      struct snd_kcontrol *follower)
287f5b1db63STakashi Iwai {
2889ab0cb30STakashi Iwai 	return _snd_ctl_add_follower(master, follower, SND_CTL_FOLLOWER_NEED_UPDATE);
289f5b1db63STakashi Iwai }
290e922b002STakashi Iwai 
2912ad787e9STakashi Iwai int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl,
2922ad787e9STakashi Iwai 			     void (*hook)(void *private_data, int),
2932ad787e9STakashi Iwai 			     void *private_data);
2941ca2f2ecSTakashi Iwai void snd_ctl_sync_vmaster(struct snd_kcontrol *kctl, bool hook_only);
2951ca2f2ecSTakashi Iwai #define snd_ctl_sync_vmaster_hook(kctl)	snd_ctl_sync_vmaster(kctl, true)
2969ab0cb30STakashi Iwai int snd_ctl_apply_vmaster_followers(struct snd_kcontrol *kctl,
2979ab0cb30STakashi Iwai 				    int (*func)(struct snd_kcontrol *vfollower,
2989ab0cb30STakashi Iwai 						struct snd_kcontrol *follower,
299d6c0615fSTakashi Iwai 						void *arg),
300a91d6612STakashi Iwai 				    void *arg);
3012ad787e9STakashi Iwai 
30235be544aSTakashi Iwai /*
30322d8de62SJaroslav Kysela  * Control LED trigger layer
30422d8de62SJaroslav Kysela  */
30522d8de62SJaroslav Kysela #define SND_CTL_LAYER_MODULE_LED	"snd-ctl-led"
30622d8de62SJaroslav Kysela 
30722d8de62SJaroslav Kysela #if IS_MODULE(CONFIG_SND_CTL_LED)
snd_ctl_led_request(void)30822d8de62SJaroslav Kysela static inline int snd_ctl_led_request(void) { return snd_ctl_request_layer(SND_CTL_LAYER_MODULE_LED); }
30922d8de62SJaroslav Kysela #else
snd_ctl_led_request(void)31022d8de62SJaroslav Kysela static inline int snd_ctl_led_request(void) { return 0; }
31122d8de62SJaroslav Kysela #endif
31222d8de62SJaroslav Kysela 
31322d8de62SJaroslav Kysela /*
31435be544aSTakashi Iwai  * Helper functions for jack-detection controls
31535be544aSTakashi Iwai  */
31635be544aSTakashi Iwai struct snd_kcontrol *
3172ba2dfa1SJie Yang snd_kctl_jack_new(const char *name, struct snd_card *card);
31835be544aSTakashi Iwai void snd_kctl_jack_report(struct snd_card *card,
31935be544aSTakashi Iwai 			  struct snd_kcontrol *kctl, bool status);
32035be544aSTakashi Iwai 
3211da177e4SLinus Torvalds #endif	/* __SOUND_CONTROL_H */
322