summaryrefslogtreecommitdiffstats
path: root/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'core.c')
-rw-r--r--core.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/core.c b/core.c
index 96a4686..d925eae 100644
--- a/core.c
+++ b/core.c
@@ -32,6 +32,7 @@ extern struct snd_pcm_ops pcm_ops;
static struct avirt_core core = {
.stream_count = 0,
+ .streams_sealed = false,
};
struct avirt_coreinfo coreinfo = {
@@ -245,6 +246,11 @@ int avirt_audiopath_register(struct avirt_audiopath *audiopath,
audiopath->hw->periods_max);
list_add_tail(&audiopath_obj->list, &audiopath_list);
+ // If we have already sealed the streams, configure this AP
+ if (core.streams_sealed)
+ audiopath->configure(core.card, core.stream_group,
+ core.stream_count);
+
*info = &coreinfo;
return 0;
@@ -356,10 +362,14 @@ struct avirt_stream *__avirt_stream_create(const char *name, int direction)
int __avirt_card_register(void)
{
int err = 0;
-
struct avirt_audiopath_obj *ap_obj;
- list_for_each_entry(ap_obj, &audiopath_list, list)
- {
+
+ if (core.streams_sealed) {
+ pr_err("Streams already sealed!\n");
+ return -1;
+ }
+
+ list_for_each_entry (ap_obj, &audiopath_list, list) {
pr_info("Calling configure for AP uid: %s\n",
ap_obj->path->uid);
ap_obj->path->configure(core.stream_group, core.stream_count);
@@ -371,9 +381,16 @@ int __avirt_card_register(void)
snd_card_free(core.card);
}
+ core.streams_sealed = true;
+
return err;
}
+bool __avirt_streams_sealed(void)
+{
+ return core.streams_sealed;
+}
+
struct avirt_stream *__avirt_stream_find_by_device(unsigned int device)
{
struct avirt_stream *stream;