I have recently run into some problems using SPDIF on iMX6. I first noticed the issue when reading the ALSA “RX Sample Rate” control to determine if the SPDIF receiver is locked and what the sample rate is. Sometimes this returns a seemingly random value. While trying to debug this I noticed that reading from the SPDIF registers themselves in the kernel or via the user space regmap debug interface often seems to give random values.
Even though the sabresd board does not have SPDIF in or out connections I managed to trigger similar symptoms on the sabresd board.
1. sabresd board with iMX6 Quad
2. mainline kernel v4.2
3. patch device tree to enable spdif (patch file attached)
The SPDIF interface should then be available on ALSA device hw:1,0.
Run speaker-test to generate output on SPDIF:
speaker-test -Dhw:1,0 -fS24_LE -c2 -r44100
While running speaker-test monitor the values in /proc/sys/debug/regmap/2004000.spdif/registers and you can see some registers changing that should be constant.
watch -n0 -d=cumulative cat registers
This will highlight registers that are changing. Some of them include status bits which are expected to change. Some registers such as 0x50 should be constant but are not. It can take a couple minutes to see the unexpected changes.
Or you can do something like:
while true; do grep "50:" registers | grep -v 188; done
On my system register 50 usually returns 00000188. By running the above command you can see that sometimes it returns a different corrupted value. Using printk's in the spdif kernel driver I can also see this issue so it isn't just a quirk of the regmap debug interface.
I also duplicated the same issue on a custom iMX6 Solo board. However, on an iMX6 Sololite board everything seems okay. In either case audio out and in is generally working but I can't monitor the RX status correctly.
Does anyone have any ideas why this is happening?
Original Attachment has been moved to: sabresd_dt_spdif.patch.zip