Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Greybus operations
0004  *
0005  * Copyright 2015-2016 Google Inc.
0006  */
0007 
0008 #ifndef _GB_AUDIO_MANAGER_H_
0009 #define _GB_AUDIO_MANAGER_H_
0010 
0011 #include <linux/kobject.h>
0012 #include <linux/list.h>
0013 
0014 #define GB_AUDIO_MANAGER_NAME "gb_audio_manager"
0015 #define GB_AUDIO_MANAGER_MODULE_NAME_LEN 64
0016 #define GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "63"
0017 
0018 struct gb_audio_manager_module_descriptor {
0019     char name[GB_AUDIO_MANAGER_MODULE_NAME_LEN];
0020     int vid;
0021     int pid;
0022     int intf_id;
0023     unsigned int ip_devices;
0024     unsigned int op_devices;
0025 };
0026 
0027 struct gb_audio_manager_module {
0028     struct kobject kobj;
0029     struct list_head list;
0030     int id;
0031     struct gb_audio_manager_module_descriptor desc;
0032 };
0033 
0034 /*
0035  * Creates a new gb_audio_manager_module_descriptor, using the specified
0036  * descriptor.
0037  *
0038  * Returns a negative result on error, or the id of the newly created module.
0039  *
0040  */
0041 int gb_audio_manager_add(struct gb_audio_manager_module_descriptor *desc);
0042 
0043 /*
0044  * Removes a connected gb_audio_manager_module_descriptor for the specified ID.
0045  *
0046  * Returns zero on success, or a negative value on error.
0047  */
0048 int gb_audio_manager_remove(int id);
0049 
0050 /*
0051  * Removes all connected gb_audio_modules
0052  *
0053  * Returns zero on success, or a negative value on error.
0054  */
0055 void gb_audio_manager_remove_all(void);
0056 
0057 /*
0058  * Retrieves a gb_audio_manager_module_descriptor for the specified id.
0059  * Returns the gb_audio_manager_module_descriptor structure,
0060  * or NULL if there is no module with the specified ID.
0061  */
0062 struct gb_audio_manager_module *gb_audio_manager_get_module(int id);
0063 
0064 /*
0065  * Decreases the refcount of the module, obtained by the get function.
0066  * Modules are removed via gb_audio_manager_remove
0067  */
0068 void gb_audio_manager_put_module(struct gb_audio_manager_module *module);
0069 
0070 /*
0071  * Dumps the module for the specified id
0072  * Return 0 on success
0073  */
0074 int gb_audio_manager_dump_module(int id);
0075 
0076 /*
0077  * Dumps all connected modules
0078  */
0079 void gb_audio_manager_dump_all(void);
0080 
0081 #endif /* _GB_AUDIO_MANAGER_H_ */