|
Using a custom dt plugin and re-compiling the 6.1-sun50iw9 kernel to include the sun4i-spdif and spdif-transmitter kernel modules, I got the SPDIF output (pin PH4) available in alsa.
I noticed that only 16 bit sample format was available, which is due to the sun4i-spdif driver using the wrong macros for composing the SUN4I_FORMATS (line 529) SNDRV_FORMAT_XXX should be SNDRV_FMTBIT. After fixing that, the 16 bit and 24 bit formats are available (20 bit isn't supported by the spdif-transmitter module, but that should be easy to fix as well).
When I play a 16 bit sound to SPDIF, the output does turn on and the waveforms look like the biphase-mark signal, but the sound runs 2 times too slow (a 10 second 48K sound takes 20 seconds to play). When playing a 24 bit sound, it runs 4 time too slow. Also the SPDIF signal is not recognised as a valid signal by a SPDIF receiver.
I see that the DMA is configured as a 2-byte buswidth slave, which is insufficient for the 24 bit (and 20 bit) sample format. The DMA engine doesn't support 3-byte slave, so I guess the 20 and 24 bit sample formats must use 32 bit buswidth slave, padding the 20 and 24 bit samples to 32 bits before copying to the DMA buffer. I don't see this handled appropriately in the sun4i-spdif driver.
What can cause the 2 times too slow 16 bit sample format playing? I guess this causes the invalid SPDIF output signal.
Anybody know how to fix the 20 and 24 bit formats so it is compatible with the DMA capabilities? |
|