On Wed, Sep 21, 2022 at 10:37:06AM +0800, Jason Zhu wrote:
在 2022/9/20 20:47, Mark Brown 写道:
On Tue, Sep 20, 2022 at 11:45:45AM +0800, Jason Zhu wrote:
Sometimes we need to make some dais alive when close the card, like VAD, so these functions must be exported so that they can be called.
I'm not sure I fully understand the use case here - why wouldn't the core know about the audio stream being kept active? For something like VAD I'd expect this to be just working like a normal audio path, if there's a DSP consuming the audio stream then it'll keep everything open. If there is a good use case I suspect it'll be clearer if you send the users along with this patch.
Thanks. For example, we use the VAD(Voice Activity Detect) & PDM( Pulse Density Modulation) to record sound>. The PDM is used to record and copy data to DDR memory by DMA when the system is alive. The VAD is used to detect voice from PDM and copy data to sram (The sram is small) when the system is sleep. If the VAD detect specific sound, wake up the system and continue to record sound. The data can not be lost in this process. So we attach VAD & PDM in the same card, then close the card and wake up VAD & PDM again when the system is goto sleep. Like these code:
This sounds like a very normal thing with a standard audio stream - other devices have similar VAD stuff without needing to open code access to the PCM operations?
When the system is waked up, open the sound card. The data in sram is copied firstly and close the vad. Then use the DMA to move data to DDR memory from PDM.
Generally things just continue to stream the voice data through the same VAD stream IIRC - switching just adds complexity here, you don't have to deal with joining the VAD and regular streams up for one thing.