.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | #ifndef __SOUND_CONTROL_H |
---|
2 | 3 | #define __SOUND_CONTROL_H |
---|
3 | 4 | |
---|
4 | 5 | /* |
---|
5 | 6 | * Header file for control interface |
---|
6 | 7 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
---|
7 | | - * |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - * (at your option) any later version. |
---|
13 | | - * |
---|
14 | | - * This program is distributed in the hope that it will be useful, |
---|
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - * GNU General Public License for more details. |
---|
18 | | - * |
---|
19 | | - * You should have received a copy of the GNU General Public License |
---|
20 | | - * along with this program; if not, write to the Free Software |
---|
21 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
22 | | - * |
---|
23 | 8 | */ |
---|
24 | 9 | |
---|
25 | 10 | #include <linux/wait.h> |
---|
.. | .. |
---|
37 | 22 | unsigned int size, |
---|
38 | 23 | unsigned int __user *tlv); |
---|
39 | 24 | |
---|
| 25 | +/* internal flag for skipping validations */ |
---|
| 26 | +#ifdef CONFIG_SND_CTL_VALIDATION |
---|
| 27 | +#define SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK (1 << 27) |
---|
| 28 | +#define snd_ctl_skip_validation(info) \ |
---|
| 29 | + ((info)->access & SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK) |
---|
| 30 | +#else |
---|
| 31 | +#define SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK 0 |
---|
| 32 | +#define snd_ctl_skip_validation(info) true |
---|
| 33 | +#endif |
---|
| 34 | + |
---|
40 | 35 | enum { |
---|
41 | 36 | SNDRV_CTL_TLV_OP_READ = 0, |
---|
42 | 37 | SNDRV_CTL_TLV_OP_WRITE = 1, |
---|
.. | .. |
---|
47 | 42 | snd_ctl_elem_iface_t iface; /* interface identifier */ |
---|
48 | 43 | unsigned int device; /* device/client number */ |
---|
49 | 44 | unsigned int subdevice; /* subdevice (substream) number */ |
---|
50 | | - const unsigned char *name; /* ASCII name of item */ |
---|
| 45 | + const char *name; /* ASCII name of item */ |
---|
51 | 46 | unsigned int index; /* index of item */ |
---|
52 | 47 | unsigned int access; /* access rights */ |
---|
53 | 48 | unsigned int count; /* count of same elements */ |
---|
.. | .. |
---|
80 | 75 | unsigned long private_value; |
---|
81 | 76 | void *private_data; |
---|
82 | 77 | void (*private_free)(struct snd_kcontrol *kcontrol); |
---|
83 | | - struct snd_kcontrol_volatile vd[0]; /* volatile data */ |
---|
| 78 | + struct snd_kcontrol_volatile vd[]; /* volatile data */ |
---|
84 | 79 | }; |
---|
85 | 80 | |
---|
86 | 81 | #define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list) |
---|
.. | .. |
---|
193 | 188 | */ |
---|
194 | 189 | struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, |
---|
195 | 190 | const unsigned int *tlv); |
---|
196 | | -int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, |
---|
197 | | - unsigned int flags); |
---|
198 | | -/* optional flags for slave */ |
---|
199 | | -#define SND_CTL_SLAVE_NEED_UPDATE (1 << 0) |
---|
| 191 | +int _snd_ctl_add_follower(struct snd_kcontrol *master, |
---|
| 192 | + struct snd_kcontrol *follower, |
---|
| 193 | + unsigned int flags); |
---|
| 194 | +/* optional flags for follower */ |
---|
| 195 | +#define SND_CTL_FOLLOWER_NEED_UPDATE (1 << 0) |
---|
200 | 196 | |
---|
201 | 197 | /** |
---|
202 | | - * snd_ctl_add_slave - Add a virtual slave control |
---|
| 198 | + * snd_ctl_add_follower - Add a virtual follower control |
---|
203 | 199 | * @master: vmaster element |
---|
204 | | - * @slave: slave element to add |
---|
| 200 | + * @follower: follower element to add |
---|
205 | 201 | * |
---|
206 | | - * Add a virtual slave control to the given master element created via |
---|
| 202 | + * Add a virtual follower control to the given master element created via |
---|
207 | 203 | * snd_ctl_create_virtual_master() beforehand. |
---|
208 | 204 | * |
---|
209 | | - * All slaves must be the same type (returning the same information |
---|
| 205 | + * All followers must be the same type (returning the same information |
---|
210 | 206 | * via info callback). The function doesn't check it, so it's your |
---|
211 | 207 | * responsibility. |
---|
212 | 208 | * |
---|
.. | .. |
---|
218 | 214 | * Return: Zero if successful or a negative error code. |
---|
219 | 215 | */ |
---|
220 | 216 | static inline int |
---|
221 | | -snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) |
---|
| 217 | +snd_ctl_add_follower(struct snd_kcontrol *master, struct snd_kcontrol *follower) |
---|
222 | 218 | { |
---|
223 | | - return _snd_ctl_add_slave(master, slave, 0); |
---|
| 219 | + return _snd_ctl_add_follower(master, follower, 0); |
---|
224 | 220 | } |
---|
225 | 221 | |
---|
226 | 222 | /** |
---|
227 | | - * snd_ctl_add_slave_uncached - Add a virtual slave control |
---|
| 223 | + * snd_ctl_add_follower_uncached - Add a virtual follower control |
---|
228 | 224 | * @master: vmaster element |
---|
229 | | - * @slave: slave element to add |
---|
| 225 | + * @follower: follower element to add |
---|
230 | 226 | * |
---|
231 | | - * Add a virtual slave control to the given master. |
---|
232 | | - * Unlike snd_ctl_add_slave(), the element added via this function |
---|
| 227 | + * Add a virtual follower control to the given master. |
---|
| 228 | + * Unlike snd_ctl_add_follower(), the element added via this function |
---|
233 | 229 | * is supposed to have volatile values, and get callback is called |
---|
234 | 230 | * at each time queried from the master. |
---|
235 | 231 | * |
---|
.. | .. |
---|
240 | 236 | * Return: Zero if successful or a negative error code. |
---|
241 | 237 | */ |
---|
242 | 238 | static inline int |
---|
243 | | -snd_ctl_add_slave_uncached(struct snd_kcontrol *master, |
---|
244 | | - struct snd_kcontrol *slave) |
---|
| 239 | +snd_ctl_add_follower_uncached(struct snd_kcontrol *master, |
---|
| 240 | + struct snd_kcontrol *follower) |
---|
245 | 241 | { |
---|
246 | | - return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); |
---|
| 242 | + return _snd_ctl_add_follower(master, follower, SND_CTL_FOLLOWER_NEED_UPDATE); |
---|
247 | 243 | } |
---|
248 | 244 | |
---|
249 | 245 | int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl, |
---|
.. | .. |
---|
251 | 247 | void *private_data); |
---|
252 | 248 | void snd_ctl_sync_vmaster(struct snd_kcontrol *kctl, bool hook_only); |
---|
253 | 249 | #define snd_ctl_sync_vmaster_hook(kctl) snd_ctl_sync_vmaster(kctl, true) |
---|
254 | | -int snd_ctl_apply_vmaster_slaves(struct snd_kcontrol *kctl, |
---|
255 | | - int (*func)(struct snd_kcontrol *vslave, |
---|
256 | | - struct snd_kcontrol *slave, |
---|
257 | | - void *arg), |
---|
258 | | - void *arg); |
---|
| 250 | +int snd_ctl_apply_vmaster_followers(struct snd_kcontrol *kctl, |
---|
| 251 | + int (*func)(struct snd_kcontrol *vfollower, |
---|
| 252 | + struct snd_kcontrol *follower, |
---|
| 253 | + void *arg), |
---|
| 254 | + void *arg); |
---|
259 | 255 | |
---|
260 | 256 | /* |
---|
261 | 257 | * Helper functions for jack-detection controls |
---|