1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Copyright 2015-2016 Google Inc.
8 #ifndef _GB_AUDIO_MANAGER_H_
9 #define _GB_AUDIO_MANAGER_H_
11 #include <linux/kobject.h>
12 #include <linux/list.h>
14 #define GB_AUDIO_MANAGER_NAME "gb_audio_manager"
15 #define GB_AUDIO_MANAGER_MODULE_NAME_LEN 64
16 #define GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "63"
18 struct gb_audio_manager_module_descriptor {
19 char name[GB_AUDIO_MANAGER_MODULE_NAME_LEN];
23 unsigned int ip_devices;
24 unsigned int op_devices;
27 struct gb_audio_manager_module {
29 struct list_head list;
31 struct gb_audio_manager_module_descriptor desc;
35 * Creates a new gb_audio_manager_module_descriptor, using the specified
38 * Returns a negative result on error, or the id of the newly created module.
41 int gb_audio_manager_add(struct gb_audio_manager_module_descriptor *desc);
44 * Removes a connected gb_audio_manager_module_descriptor for the specified ID.
46 * Returns zero on success, or a negative value on error.
48 int gb_audio_manager_remove(int id);
51 * Removes all connected gb_audio_modules
53 * Returns zero on success, or a negative value on error.
55 void gb_audio_manager_remove_all(void);
58 * Retrieves a gb_audio_manager_module_descriptor for the specified id.
59 * Returns the gb_audio_manager_module_descriptor structure,
60 * or NULL if there is no module with the specified ID.
62 struct gb_audio_manager_module *gb_audio_manager_get_module(int id);
65 * Decreases the refcount of the module, obtained by the get function.
66 * Modules are removed via gb_audio_manager_remove
68 void gb_audio_manager_put_module(struct gb_audio_manager_module *module);
71 * Dumps the module for the specified id
74 int gb_audio_manager_dump_module(int id);
77 * Dumps all connected modules
79 void gb_audio_manager_dump_all(void);
81 #endif /* _GB_AUDIO_MANAGER_H_ */