Hello,
While working on an imx8mn-evk board used with an AUD-EXP-42448 sound card (which use a cs42448 chip), I encountered some regressions on my applications when upgrading the kernel from linux-imx 5.4.70 to linux-imx 6.1.1.
The imx board receives audio data from the sound card, data that is then processed through the Pipewire sound server and other sound processing software.s, before being sent back to the sound card.
As this setup requires an RT kernel, the linux-imx kernel is patched with the closest available RT patch of the mainline linux.
While using the linux-imx kernel 5.4.70, there was no specific problem. I use the mainline RT patch 5.4.70-rt40.
After upgrading to linux-imx 6.1.1 and using the mainline RT patch 6.1-rc7-rt5 (as there is no patch for the linux 6.1.1), the output audio gets noise that wasn't there with the previous kernel.
I tried multiple ideas to investigate the problem :
- use a loopback in Pipewire between the input and output audio, then do the same with a Jack server. Same problem occurs in both cases.
- test the RT capabilities with cyclictest, with 100 millions cycles (~5H) : maximum latency is 109 us, which doesn't lead to a clear RT malfunction.
- use arecord and aplay either by their own or pipelined to mimic a loopback. Both cases work without problem.
- use alsaloop. With a period size of 256 samples, there is the problem of noise, but with a greater size, the sound is clear.
- trace CPU usage with LTTng. CPU is not overloaded at all, and SDMA IRQs regarding the sound card playback and capture stream are occurring at regular intervals coherent with latencies.
- use the SAI in synchronous mode. Doesn't change anything.
- give a sinus as input and observe the output signal. It is the same sinus but discontinued, with some part skipped (see attached picture below)

The fact we can work-around the issue by increasing the alsa period size makes it look like a latency/real-time issue. However the cyclictest results don't show a clear regression on this point. The issue is reproduced on a standard linux-imx 6.1 without RT patch applied, in a standard configuration.
What is the path recommended by NXP to enable RT behaviour on a linux-imx kernel? Is there a possibility that a difference between mainline and linux-imx causes RT issues?
Regards.