EASRC with iMX8MPlus - Simultaneous use from CPU and DSP?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EASRC with iMX8MPlus - Simultaneous use from CPU and DSP?

Jump to solution
225 Views
praveen_yaramada
Contributor II
Hello iMX Developers,

 According to the IMX8MP_RM, specifically section 14.5, the EASRC block contains 4 independent contexts. My query revolves around the practical usage of these contexts across both the ARM CPU and HiFi4 DSP simultaneously.
 
 Is it possible for these contexts to be allocated and used concurrently by the CPU and DSP? Specifically, I am considering a scenario where two contexts (e.g., Context 2 and 3) might be reserved exclusively for DSP operations. This would potentially involve modifying the device tree / driver (of `/dev/mxc_asrc`) on the CPU side to recognize only Contexts 0 and 1 as available for its operations.
 
Can anyone confirm if such a configuration is feasible, or share insights on any necessary steps or considerations to achieve this setup?
 
Thank you in advance for your assistance and insights.
0 Kudos
Reply
1 Solution
181 Views
JorgeCas
NXP TechSupport
NXP TechSupport

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.

View solution in original post

0 Kudos
Reply
2 Replies
108 Views
praveen_yaramada
Contributor II

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.

0 Kudos
Reply
182 Views
JorgeCas
NXP TechSupport
NXP TechSupport

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.

0 Kudos
Reply