summaryrefslogtreecommitdiffstats
path: root/core.c
AgeCommit message (Collapse)AuthorFilesLines
2019-04-08Refactor 'sealed' to 'configured'Mark Farrugia1-12/+18
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-04-01Add 'internal' streams for routing, revamp stream finalisationMark Farrugia1-20/+83
Uses the ALSA internal PCM API to create streams purely used for internal routing purposes. Adds the 'try_complete' functions for both streams and routes in an attempt to standardize the finalization of a stream or route object. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-03-27Rework routing systemMark Farrugia1-12/+201
- Add 'route' to snd_avirt_stream, remove from audio path - Add route checking - ensure that source ap and ink ap have compatible hw params - Add private data support for both source and sink Audio Paths, to ensure that the PCM can hold multiple private data(s). - Add ability to use copy_kernel and exttriggers from AVIRT instead of from Audio Paths - Reintroduce pcm_trigger and pcm_prepare, so that they may be called appropriately from AVIRT, rather than child Audio Paths. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-03-27Remove snd_avirt_pcm_period_elapsed, format tidyMark Farrugia1-0/+6
We do not need this wrapper function any longer, can use snd_pcm_period_elapsed instead. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-03-01Restructure streams_seal algorithm, formatting fixes.Mark Farrugia1-11/+11
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-03-01Add ability to route audio between audio pathsMark Farrugia1-0/+22
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>
2019-03-01Move sysfs functionality to sysfs.cMark Farrugia1-174/+9
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-03-01Refactor avirt_private_freeMark Farrugia1-4/+5
Explicitly define callback type, refactor name Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-01-30Fix configure callback logging, tidy unused variablesMark Farrugia1-6/+6
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-01-29Rework setting the AVIRT map, and stream creationMark Farrugia1-35/+70
To ensure that a stream is able to change it's mapping (before card is sealed), we cannot create the stream PCM upon setting the mapping. This had to be reworked to allow multiple setting of the mapping if so required. The PCM ops table for a given stream is now allocated and stored in the snd_avirt_stream struct, to allow retrieval and manipulation upon mapping change. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-01-29Make snd_avirt_stream_get an exported functionMark Farrugia1-1/+3
Clean up logging Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2019-01-04Create PCM devices as soon as the AVIRT map is setguppy_6.99.4guppy/6.99.46.99.4Mark Farrugia1-12/+5
We no longer need to wait until the card is sealed to create the PCM device. We can create it right away. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-12-17Make card discoverable at module loadguppy_6.99.3guppy/6.99.36.99.3Mark Farrugia1-6/+8
We can achieve this using the snd_device_register function Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-12-13Ensure that PCM callback 'close' is never NULLMark Farrugia1-1/+0
ALSA requires a 'close' callback. It does not have any checks internally to not call a NULL callback. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-11-28Add null check for supplied Audio Path PCM opsguppy_6.99.2guppy/6.99.26.99.2Mark Farrugia1-0/+6
This was not being checked, and resulted in kernel panic when null Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-11-20Ensure snd_avirt_private_free is not called if NULLMark Farrugia1-4/+4
We only want to call the snd_avirt_private_free callback if it is set. Some Audio Paths may only set the private data, and not the private free callback, so we need to accommodate for this. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-11-13Rework PCM ops callback mechanismMark Farrugia1-8/+36
- Fix issues regarding PCM ops callbacks via AVIRT - As PCMs are created, the PCM ops are set according to the Audio Path's needs. A default PCM ops table is applied for all PCMs, which includes callbacks such as open, and hw_free, since AVIRT requires these for intermediate processing, whether or not a given Audio Path may need them. - Separate PCM ops into separate playback and capture ops tables Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-11-13Refactor/tidy snd_avirt_private_dataMark Farrugia1-5/+6
Make void* audiopath a struct and_avirt_audiopath, standardize naming in the struct Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-11-09Only call 'configure' cb if there are streams for Audio Pathflounder_6.0.2flounder/6.0.26.0.2Mark Farrugia1-5/+5
We only want to call the Audio Path 'configure' callback when there is at least 1 stream mapped to that Audio Path. Change the return of snd_avirt_streams_get to return the number of mapped streams for a given Audio Path. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-11-08Add private data structure to PCM for audio path managementJames O'Shannessy1-0/+23
Expand upon the private data structure currently used by avirt to allow audio paths to store own user data to PCM implementation. Signed-off-by: James O'Shannessy <james.oshannessy@fiberdyne.com.au>
2018-11-02Transform AVIRT into platform driverMark Farrugia1-25/+63
Like aloop, we need to be able to find AVIRT by-path as platform-snd_avirt.0. The 4a-mixer uses this method to find cards. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-11-02Refactor some variables for better readabilityMark Farrugia1-9/+9
avirt_class can become avirt, SND_AVIRTUAL_DRIVER becomes SND_AVIRT_DRIVER Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-11-01Only expose streams mapped to audiopaths on configure() cbMark Farrugia1-44/+44
When the configure() callback occurs for each audiopath, we only want those streams that are mapped to the given audiopath to be exposed to the audiopath. E.g. only streams mapped to loopback should be propagated to loopback via configure() callback, rather than all streams. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-31Remove coreinfo, absorb version info into coreMark Farrugia1-9/+4
Since coreinfo only has version info, and this is not being used at all, we can absorb the version info into the private avirt_core structure. We could in future implement a function to retrieve the version, when, and if, it is required. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Refactor all avirt_ symbols to have have snd prefix, as per Linux soundMark Farrugia1-98/+99
This will aid the eventual migration the the upstream mainline Linux kernel Fix some checkpatch warnings, and other compiler warnings Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Refactor core_internal.h to core.hMark Farrugia1-1/+1
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Move system-leavel header to sound directoryMark Farrugia1-2/+1
Change include guards to reflect Linux sound driver format Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Remove unused MODULE_SUPPORTED_DEVICE macros, removed obsolete commentsMark Farrugia1-3/+1
Added debug macros for Dummy AP Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Update license headersMark Farrugia1-4/+4
All license headers need to be uniform across AVIRT Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Fix module authors/descriptionsMark Farrugia1-3/+4
These need to be in the format the Linux expects, and uniform across AVIRT Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Fix DO_AUDIOPATH_CB, remove unused PCM cbs for nowMark Farrugia1-0/+1
We don't want to return inside the macro call necessarily. Some PCM cbs require differing return values. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Refactor avirt_card_register, move PCM creation to it.Mark Farrugia1-21/+51
When creating the PCMs we need information regarding the stream's mapping. For the loopback, we need to add both playback and capture substreams. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Refactor to use new DINFO macrosMark Farrugia1-18/+18
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Remove blocksize from audiopathMark Farrugia1-3/+2
This is no longer needed in AVIRT, since it is only actually used for the ADSP Audio Path. Clean up white space, add function documentation, remove out of place debug prints Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Move 'streams_sealed' to avirt_coreMark Farrugia1-3/+20
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Ensure no buffer overflow when setting card descriptionMark Farrugia1-3/+4
Sanity guard the sound card string buffers with strncpy Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Clean up sound card on module exitMark Farrugia1-0/+1
Sound card was not being free'd properly on module exit. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Add configfs interface, revamp stream groupingMark Farrugia1-204/+150
Add additional callbacks for audio path configuring, after card has been sealed. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Fix memory freeing of capture/playback streamsMark Farrugia1-4/+4
Since playback and capture streams are not always assigned, we do not want to error when one or the other is not present for free'ing. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Refactor top-level AVIRT API to be avirt_<subject>_<action>Mark Farrugia1-8/+8
This makes for a more organized function/variable naming convention Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Create avirt_stream structure in place of old config structuresMark Farrugia1-44/+74
Remove unnecessary extra memory allocation with the old config structures. We can store the snd_pcm pointer, which contains lots of info already. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Add 'uid' field to AP, store AP in PCM private data, fix helper macrosMark Farrugia1-14/+19
We want to use a UID when registering APs, that must start with "ap_", and acts as a unique identifier for each AP. To move forward with the adoption of routing PCMs to differing APs, we now store the AP in the PCM private data - set at pcm_open. A fix to the helper macros now allows additional args to be passed in for inclusion to the debug string Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Fix warnings generated by checkpatch.plMark Farrugia1-6/+7
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Remove remnant debug printMark Farrugia1-1/+0
Remove leftover debug prints that are no longer needed. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Move ALSA info into coreinfo, for export to Audio PathsMark Farrugia1-10/+3
Remove the avirt_alsa_driver Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Add additional NULL checksMark Farrugia1-3/+2
Check for NULL pointers before free'ing memory on cleanup of AVIRT Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Fix initialization of the audiopath_listMark Farrugia1-4/+1
This wasn't being initialised properly, and NULL audiopaths were not being detected. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Loopback progressJames O'Shannessy1-6/+12
Loopback currently reads from dma_area but the initial copy from playback to capture has not been implemented. Signed-off-by: James O'Shannessy <james.oshannessy@fiberdyne.com.au>
2018-10-26Update licensingMark Farrugia1-1/+1
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
2018-10-26Public push of AVIRT.James O'Shannessy1-0/+495
Follow readme for building in/out of tree for Ubuntu/AGL/etc. Signed-off-by: James O'Shannessy <james.oshannessy@fiberdyne.com.au>