From da4c2a5619c60cd4dab733bb23a33ed373c78c77 Mon Sep 17 00:00:00 2001 From: Mark Farrugia Date: Fri, 1 Mar 2019 17:32:37 +1100 Subject: Add ability to route audio between audio paths Configfs interface for adding 'routes' is added, and allows two audio paths to chain together particular inputs/outputs, allowing for multistage audio driver handling. A particular use-case is that of an ADSP driver. We can feed in audio to it, and capture the processed, and/or mixed, audio at it's output, and direct to another audio path driver, such as the UNICENS audio driver. Signed-off-by: Mark Farrugia --- core.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'core.c') diff --git a/core.c b/core.c index fd74b08..e1b056e 100644 --- a/core.c +++ b/core.c @@ -265,6 +265,28 @@ int snd_avirt_audiopath_deregister(struct snd_avirt_audiopath *audiopath) } EXPORT_SYMBOL_GPL(snd_avirt_audiopath_deregister); +/** + * 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) +{ + struct snd_avirt_route *route; + + route = kzalloc(sizeof(*route), GFP_KERNEL); + if (!route) + return ERR_PTR(-ENOMEM); + + strcpy(route->name, name); + route->channels = 0; + route->direction = direction; + + return route; +} + /** * snd_avirt_stream_create - Create audio stream, including it's ALSA PCM device * @name: The name designated to the audio stream -- cgit 1.2.3-korg