summaryrefslogtreecommitdiffstats
path: root/sysfs.c
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-01 17:32:37 +1100
commit8ce739b235362ca810a5e25fef58e7400ba679b4 (patch)
treecc3e83ec9f9055ce1a13142a2f44ad25aed022ab /sysfs.c
parent763bbd2abc251d351746bfddfbac9d39a74e4492 (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 'sysfs.c')
-rw-r--r--sysfs.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sysfs.c b/sysfs.c
index b7d28f5..29f9b5d 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -115,15 +115,42 @@ static ssize_t version_show(struct snd_avirt_audiopath_obj *audiopath_obj,
audiopath->version[1], audiopath->version[2]);
}
+static ssize_t route_from_ap_show(struct snd_avirt_audiopath_obj *audiopath_obj,
+ struct snd_avirt_audiopath_attribute *attr,
+ char *buf)
+{
+ struct snd_avirt_audiopath *audiopath = audiopath_obj->path;
+
+ if (audiopath->route_from_ap)
+ return sprintf(buf, "%s\n", audiopath->route_from_ap->uid);
+
+ return 0;
+}
+
+static ssize_t route_to_ap_show(struct snd_avirt_audiopath_obj *audiopath_obj,
+ struct snd_avirt_audiopath_attribute *attr,
+ char *buf)
+{
+ struct snd_avirt_audiopath *audiopath = audiopath_obj->path;
+
+ if (audiopath->route_to_ap)
+ return sprintf(buf, "%s\n", audiopath->route_to_ap->uid);
+
+ return 0;
+}
static struct snd_avirt_audiopath_attribute snd_avirt_audiopath_attrs[] = {
__ATTR_RO(name),
__ATTR_RO(version),
+ __ATTR_RO(route_from_ap),
+ __ATTR_RO(route_to_ap),
};
static struct attribute *snd_avirt_audiopath_def_attrs[] = {
&snd_avirt_audiopath_attrs[0].attr,
&snd_avirt_audiopath_attrs[1].attr,
+ &snd_avirt_audiopath_attrs[2].attr,
+ &snd_avirt_audiopath_attrs[3].attr,
NULL,
};