Solved! Go to Solution.
Hello,
According to reference manual, the module can handle up to 4 context of audio channels with an independent time-base simultaneously.
Each context has an independent input/output sample memory, resampling ratio, prefilter coefficient FIFO, number of channels, and assigned datapath resources. It can be configured to start and stop at any time without affecting the processing of other contexts in flight, so it should be feasible.
There are no solutions implemented with for this specific use case but, I suggest you take a look on section 7.7 Asynchronous Sample Rate Converter (ASRC) on i.MX 8M Nano/i.MX 8M Plus of i.MX Linux Reference Manual to check the flow of calling ASRC to memory to peripheral and source code.
Best regards.
I needed to make a fairly simple change to reserve ASRC context between the Linux system and the DSP system. In my system, the DSP firmware was already hardcoded to use the first pair (the first context out of four). Since the Linux implementation was dynamically allocating contexts, I modified it to skip the first pair, which is reserved for the DSP. Interestingly, when reviewing the dts for underlying SDMA controllers, I found that they were already separated between these cores.
Here is the diff for the changes made in fsl_easrc.c:
diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index 4c724d00616f..7fd99dfb8cc1 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -1250,7 +1250,8 @@ static int fsl_easrc_request_context(int channels, struct fsl_asrc_pair *ctx)
spin_lock_irqsave(&easrc->lock, lock_flags);
- for (i = ASRC_PAIR_A; i < EASRC_CTX_MAX_NUM; i++) {
+ /* skip the first pair is reserved for the DSP core */
+ for (i = ASRC_PAIR_B; i < EASRC_CTX_MAX_NUM; i++) {
if (easrc->pair[i])
continue;
@@ -2054,7 +2055,8 @@ static __maybe_unused int fsl_easrc_runtime_resume(struct device *dev)
goto disable_mem_clk;
}
- for (i = ASRC_PAIR_A; i < EASRC_CTX_MAX_NUM; i++) {
+ /* skip the first pair is reserved for the DSP core */
+ for (i = ASRC_PAIR_B; i < EASRC_CTX_MAX_NUM; i++) {
ctx = easrc->pair[i];
if (!ctx)
continue;
This modification ensures that the first ASRC context is exclusively available for the DSP, while the Linux system utilizes the remaining contexts.
Comments or improvements on this approach are welcome.
Hello,
According to reference manual, the module can handle up to 4 context of audio channels with an independent time-base simultaneously.
Each context has an independent input/output sample memory, resampling ratio, prefilter coefficient FIFO, number of channels, and assigned datapath resources. It can be configured to start and stop at any time without affecting the processing of other contexts in flight, so it should be feasible.
There are no solutions implemented with for this specific use case but, I suggest you take a look on section 7.7 Asynchronous Sample Rate Converter (ASRC) on i.MX 8M Nano/i.MX 8M Plus of i.MX Linux Reference Manual to check the flow of calling ASRC to memory to peripheral and source code.
Best regards.