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.