summaryrefslogtreecommitdiffstats
path: root/core.h
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2019-03-01 17:32:37 +1100
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2019-03-05 10:33:28 +1100
commitda4c2a5619c60cd4dab733bb23a33ed373c78c77 (patch)
treeadcddd53e1981b5a31aa721b8fb98d24ec4d5958 /core.h
parentdda7b36122998602a11462398fc0072c0f418bd5 (diff)
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 <mark.farrugia@fiberdyne.com.au>
Diffstat (limited to 'core.h')
-rw-r--r--core.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/core.h b/core.h
index e83631f..e4fb7a4 100644
--- a/core.h
+++ b/core.h
@@ -23,6 +23,7 @@ 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;
};
@@ -118,6 +119,15 @@ int snd_avirt_stream_set_map(struct snd_avirt_stream *stream, const char *map);
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
@@ -128,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 */