IMX6QP Using SDMA to link ASRC with SPDIF in Linux

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

IMX6QP Using SDMA to link ASRC with SPDIF in Linux

Jump to solution
633 Views
camilio69
Contributor II

Using mainline Linux kernel 5.10 with the sdma-imx6q firware version 3.5 (but may be true for other versions).

When configuring a SDMA between SPDIF and ASRC, the code uses the p_2_p (named also per_2_per) script for SDMA, which is documented in the Ref. Manual A.3.2.5.

In the documentation, there is a bit 10 (SPDIF) in R7 INFO register which is not well documented, and not used in Linux source code. Setting this bit (by modifying kernel source code) allows the SDMA to work in the direction ASRC -> SPDIF TX, but not in the reverse direction.

After disassembling the firmware, it appears that when this bit is set, the script reads the source always at the same address, but alternate the destination between address+0 and address+4, which is appropriate for SPDIF writing (Left and Right sample), but not for SPDIF reading.

Going further, I found the bit 13 and 14 of the R7 INFO register (documented as MUST BE 0) can select either the source or the destination to have almost the same behavior as the SPDIF bit, or the reverse. However, there is a difference in error handling : using those 2 undocumented bit will give a bad count of left word to copy in case of error (but only if error).

For anyone interested, I attach a patch to make it work, it just needs you to give in the device tree the spdif handle to the sdma node (ie &sdma { spdif=<&spdif>; }; ).

As it took me a week to figure this out, I suspect this might help others !

Labels (3)
0 Kudos
1 Solution
610 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

Thank you for sharing, it should be helpfull to others!

BR,
Aldo.

View solution in original post

0 Kudos
1 Reply
611 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

Thank you for sharing, it should be helpfull to others!

BR,
Aldo.

0 Kudos