• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Greybus operations
3  *
4  * Copyright 2015-2016 Google Inc.
5  *
6  * Released under the GPLv2 only.
7  */
8 
9 #ifndef _GB_AUDIO_MANAGER_H_
10 #define _GB_AUDIO_MANAGER_H_
11 
12 #include <linux/kobject.h>
13 #include <linux/list.h>
14 
15 #define GB_AUDIO_MANAGER_NAME "gb_audio_manager"
16 #define GB_AUDIO_MANAGER_MODULE_NAME_LEN 64
17 #define GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "63"
18 
19 struct gb_audio_manager_module_descriptor {
20 	char name[GB_AUDIO_MANAGER_MODULE_NAME_LEN];
21 	int vid;
22 	int pid;
23 	int intf_id;
24 	unsigned int ip_devices;
25 	unsigned int op_devices;
26 };
27 
28 struct gb_audio_manager_module {
29 	struct kobject kobj;
30 	struct list_head list;
31 	int id;
32 	struct gb_audio_manager_module_descriptor desc;
33 };
34 
35 /*
36  * Creates a new gb_audio_manager_module_descriptor, using the specified
37  * descriptor.
38  *
39  * Returns a negative result on error, or the id of the newly created module.
40  *
41  */
42 int gb_audio_manager_add(struct gb_audio_manager_module_descriptor *desc);
43 
44 /*
45  * Removes a connected gb_audio_manager_module_descriptor for the specified ID.
46  *
47  * Returns zero on success, or a negative value on error.
48  */
49 int gb_audio_manager_remove(int id);
50 
51 /*
52  * Removes all connected gb_audio_modules
53  *
54  * Returns zero on success, or a negative value on error.
55  */
56 void gb_audio_manager_remove_all(void);
57 
58 /*
59  * Retrieves a gb_audio_manager_module_descriptor for the specified id.
60  * Returns the gb_audio_manager_module_descriptor structure,
61  * or NULL if there is no module with the specified ID.
62  */
63 struct gb_audio_manager_module *gb_audio_manager_get_module(int id);
64 
65 /*
66  * Decreases the refcount of the module, obtained by the get function.
67  * Modules are removed via gb_audio_manager_remove
68  */
69 void gb_audio_manager_put_module(struct gb_audio_manager_module *module);
70 
71 /*
72  * Dumps the module for the specified id
73  * Return 0 on success
74  */
75 int gb_audio_manager_dump_module(int id);
76 
77 /*
78  * Dumps all connected modules
79  */
80 void gb_audio_manager_dump_all(void);
81 
82 #endif /* _GB_AUDIO_MANAGER_H_ */
83