hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/sound/core.h
....@@ -1,25 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 #ifndef __SOUND_CORE_H
23 #define __SOUND_CORE_H
34
45 /*
56 * Main header file for the ALSA driver
67 * Copyright (c) 1994-2001 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
- *
238 */
249
2510 #include <linux/device.h>
....@@ -29,6 +14,7 @@
2914 #include <linux/pm.h> /* pm_message_t */
3015 #include <linux/stringify.h>
3116 #include <linux/printk.h>
17
+#include <linux/android_kabi.h>
3218
3319 /* number of supported soundcards */
3420 #ifdef CONFIG_SND_DYNAMIC_MINORS
....@@ -76,6 +62,8 @@
7662 int (*dev_free)(struct snd_device *dev);
7763 int (*dev_register)(struct snd_device *dev);
7864 int (*dev_disconnect)(struct snd_device *dev);
65
+
66
+ ANDROID_KABI_RESERVE(1);
7967 };
8068
8169 struct snd_device {
....@@ -84,7 +72,9 @@
8472 enum snd_device_state state; /* state of the device */
8573 enum snd_device_type type; /* device type */
8674 void *device_data; /* device structure */
87
- struct snd_device_ops *ops; /* operations */
75
+ const struct snd_device_ops *ops; /* operations */
76
+
77
+ ANDROID_KABI_RESERVE(1);
8878 };
8979
9080 #define snd_device(n) list_entry(n, struct snd_device, list)
....@@ -120,7 +110,6 @@
120110 struct list_head ctl_files; /* active control files */
121111
122112 struct snd_info_entry *proc_root; /* root for soundcard specific files */
123
- struct snd_info_entry *proc_id; /* the card id */
124113 struct proc_dir_entry *proc_root_link; /* number link to real id */
125114
126115 struct list_head files_list; /* all files associated to this card */
....@@ -133,10 +122,11 @@
133122 struct device card_dev; /* cardX object for sysfs */
134123 const struct attribute_group *dev_groups[4]; /* assigned sysfs attr */
135124 bool registered; /* card_dev is registered? */
125
+ int sync_irq; /* assigned irq, used for PCM sync */
136126 wait_queue_head_t remove_sleep;
137
- int offline; /* if this sound card is offline */
138
- unsigned long offline_change;
139
- wait_queue_head_t offline_poll_wait;
127
+
128
+ size_t total_pcm_alloc_bytes; /* total amount of allocated buffers */
129
+ struct mutex memory_mutex; /* protection for the above */
140130
141131 #ifdef CONFIG_PM
142132 unsigned int power_state; /* power state */
....@@ -147,6 +137,9 @@
147137 struct snd_mixer_oss *mixer_oss;
148138 int mixer_oss_change_count;
149139 #endif
140
+
141
+ ANDROID_KABI_RESERVE(1);
142
+ ANDROID_KABI_RESERVE(2);
150143 };
151144
152145 #define dev_to_snd_card(p) container_of(p, struct snd_card, card_dev)
....@@ -182,6 +175,8 @@
182175 void *private_data; /* private data for f_ops->open */
183176 struct device *dev; /* device for sysfs */
184177 struct snd_card *card_ptr; /* assigned card instance */
178
+
179
+ ANDROID_KABI_RESERVE(1);
185180 };
186181
187182 /* return a device pointer linked to each sound device as a parent */
....@@ -230,7 +225,6 @@
230225
231226 /* init.c */
232227
233
-extern struct snd_card *snd_cards[SNDRV_CARDS];
234228 int snd_card_locked(int card);
235229 #if IS_ENABLED(CONFIG_SND_MIXER_OSS)
236230 #define SND_MIXER_OSS_NOTIFY_REGISTER 0
....@@ -255,21 +249,34 @@
255249 int snd_component_add(struct snd_card *card, const char *component);
256250 int snd_card_file_add(struct snd_card *card, struct file *file);
257251 int snd_card_file_remove(struct snd_card *card, struct file *file);
258
-#define snd_card_unref(card) put_device(&(card)->card_dev)
259
-void snd_card_change_online_state(struct snd_card *card, int online);
252
+
253
+struct snd_card *snd_card_ref(int card);
254
+
255
+/**
256
+ * snd_card_unref - Unreference the card object
257
+ * @card: the card object to unreference
258
+ *
259
+ * Call this function for the card object that was obtained via snd_card_ref()
260
+ * or snd_lookup_minor_data().
261
+ */
262
+static inline void snd_card_unref(struct snd_card *card)
263
+{
264
+ put_device(&card->card_dev);
265
+}
260266
261267 #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
262268
263269 /* device.c */
264270
265271 int snd_device_new(struct snd_card *card, enum snd_device_type type,
266
- void *device_data, struct snd_device_ops *ops);
272
+ void *device_data, const struct snd_device_ops *ops);
267273 int snd_device_register(struct snd_card *card, void *device_data);
268274 int snd_device_register_all(struct snd_card *card);
269275 void snd_device_disconnect(struct snd_card *card, void *device_data);
270276 void snd_device_disconnect_all(struct snd_card *card);
271277 void snd_device_free(struct snd_card *card, void *device_data);
272278 void snd_device_free_all(struct snd_card *card);
279
+int snd_device_get_state(struct snd_card *card, void *device_data);
273280
274281 /* isadma.c */
275282
....@@ -335,7 +342,8 @@
335342 #define snd_BUG() WARN(1, "BUG?\n")
336343
337344 /**
338
- * Suppress high rates of output when CONFIG_SND_DEBUG is enabled.
345
+ * snd_printd_ratelimit - Suppress high rates of output when
346
+ * CONFIG_SND_DEBUG is enabled.
339347 */
340348 #define snd_printd_ratelimit() printk_ratelimit()
341349
....@@ -448,4 +456,12 @@
448456 }
449457 #endif
450458
459
+/* async signal helpers */
460
+struct snd_fasync;
461
+
462
+int snd_fasync_helper(int fd, struct file *file, int on,
463
+ struct snd_fasync **fasyncp);
464
+void snd_kill_fasync(struct snd_fasync *fasync, int signal, int poll);
465
+void snd_fasync_free(struct snd_fasync *fasync);
466
+
451467 #endif /* __SOUND_CORE_H */