diff options
Diffstat (limited to 'core.h')
-rw-r--r-- | core.h | 62 |
1 files changed, 62 insertions, 0 deletions
@@ -23,10 +23,17 @@ struct snd_avirt_core { struct class *class; struct platform_device *plat_dev; struct config_group *stream_group; + struct config_group *route_group; unsigned int stream_count; bool streams_sealed; }; +struct snd_avirt_audiopath_obj { + struct kobject kobj; + struct list_head list; + struct snd_avirt_audiopath *path; +}; + /** * snd_avirt_configfs_init - Initialise the configfs system * @core: The snd_avirt_core pointer @@ -41,6 +48,34 @@ int __init snd_avirt_configfs_init(struct snd_avirt_core *core); void __exit snd_avirt_configfs_exit(struct snd_avirt_core *core); /** + * snd_avirt_sysfs_init - Initialise the sysfs system + * @core: The snd_avirt_core pointer + * @return: 0 on success, negative ERRNO on failure + */ +int __init snd_avirt_sysfs_init(struct snd_avirt_core *core); + +/** + * snd_avirt_sysfs_exit - Clean up and exit the sysfs system + * @core: The snd_avirt_core pointer + */ +void __exit snd_avirt_sysfs_exit(struct snd_avirt_core *core); + +/** + * snd_avirt_audiopath_obj - creates an Audio Path object, assigns the kset + * and registers it with sysfs. + * @uid: Unique ID of the Audio Path + * @return: Pointer to the Audio Path object or NULL if it failed. + */ +struct snd_avirt_audiopath_obj *snd_avirt_audiopath_create_obj(const char *uid); + +/** + * snd_avirt_audiopath_destroy_obj - destroys an Audio Path object, deregisters + * it with sysfs + * @name: the Audio Path object + */ +void snd_avirt_audiopath_destroy_obj(struct snd_avirt_audiopath_obj *p); + +/** * snd_avirt_streams_seal - Register the sound card to user space * @return: 0 on success, negative ERRNO on failure */ @@ -68,6 +103,13 @@ struct snd_avirt_stream *snd_avirt_stream_find_by_device(unsigned int device); */ struct snd_avirt_stream *snd_avirt_stream_create(const char *name, int direction); +/** + * snd_avirt_stream_set_map - Set Audio Path mapping for a given stream + * @stream: The stream to assign the mapping to. + * @map: The Audio Path UID to map the stream to. + * @return: 0 on success, negative ERRNO on failure + */ +int snd_avirt_stream_set_map(struct snd_avirt_stream *stream, const char *map); /** * snd_avirt_audiopath_get - retrieves the Audio Path by it's UID @@ -77,6 +119,15 @@ struct snd_avirt_stream *snd_avirt_stream_create(const char *name, struct snd_avirt_audiopath *snd_avirt_audiopath_get(const char *uid); /** + * snd_avirt_route_create - Create audio route + * @name: The name designated to the audio route + * @direction: The PCM direction (SNDRV_PCM_STREAM_PLAYBACK or + * SNDRV_PCM_STREAM_CAPTURE) + * @return: The newly created audio route if successful, or an error pointer + */ +struct snd_avirt_route *snd_avirt_route_create(const char *name, int direction); + +/** * snd_avirt_stream_from_config_item - Convert config_item to a snd_avirt_stream * @item: The config_item to convert from * @return: The item's snd_avirt_stream if successful, NULL otherwise @@ -87,4 +138,15 @@ snd_avirt_stream_from_config_item(struct config_item *item) return item ? container_of(item, struct snd_avirt_stream, item) : NULL; } +/** + * snd_avirt_route_from_config_item - Convert config_item to a snd_avirt_route + * @item: The config_item to convert from + * @return: The item's snd_avirt_stream if successful, NULL otherwise + */ +static inline struct snd_avirt_route * +snd_avirt_route_from_config_item(struct config_item *item) +{ + return item ? container_of(item, struct snd_avirt_route, item) : NULL; +} + #endif /* __SOUND_AVIRT_CORE_H */ |