From 8ce739b235362ca810a5e25fef58e7400ba679b4 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 --- sound/avirt.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/avirt.h b/sound/avirt.h index cb9a61e..138d0ca 100644 --- a/sound/avirt.h +++ b/sound/avirt.h @@ -36,9 +36,12 @@ struct snd_avirt_stream_array; /* Forward declaration */ typedef int (*snd_avirt_audiopath_configure)( struct snd_card *card, struct snd_avirt_stream_array *stream_array); +typedef void (*snd_avirt_pcm_exttrigger)(void); + /** * AVIRT Audio Path info */ +typedef struct snd_avirt_audiopath snd_avirt_audiopath; struct snd_avirt_audiopath { const char *uid; /* Unique identifier */ const char *name; /* Pretty name */ @@ -47,8 +50,24 @@ struct snd_avirt_audiopath { const struct snd_pcm_ops *pcm_playback_ops; /* ALSA PCM playback ops */ const struct snd_pcm_ops *pcm_capture_ops; /* ALSA PCM capture ops */ snd_avirt_audiopath_configure configure; /* Config callback function */ - + snd_avirt_pcm_exttrigger pcm_exttrigger; void *context; + + // MUST be at the end + struct snd_avirt_audiopath *route_from_ap; + struct snd_avirt_audiopath *route_to_ap; +}; + +/** + * Audio routing + */ +struct snd_avirt_route { + char name[MAX_NAME_LEN]; + unsigned int channels; + unsigned int direction; + struct snd_avirt_audiopath *from_ap; + struct snd_avirt_audiopath *to_ap; + struct config_item item; }; /** -- cgit 1.2.3-korg