diff options
author | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2018-10-07 21:52:53 +1100 |
---|---|---|
committer | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2018-10-26 17:27:37 +1100 |
commit | f834eb7b0799a4678639d2a9f71c1dc4352469ce (patch) | |
tree | 0be207d5be59bdbbd0560ba96cb03caecc9da71b /core.c | |
parent | aeb43d0374f4b1fb383da088b198de55f139a280 (diff) |
Move 'streams_sealed' to avirt_core
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
Diffstat (limited to 'core.c')
-rw-r--r-- | core.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -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; |