I originally posted the following to reddit. I've added it here for context on why I did this.
So for a while I've viewed the 2 magical overlay files as binary blobs (they are) with no source code.
So I started reading the documentation about device trees and managed to decompile them. So here's what I found.
Hypothesis
The dpi24
overlay looks like it's a copy of the old stock dpi24 overlay (the one before they standardized) but without pins 18 and 19. So it uses pins 0-27 excluding 18,19.
Proof
I compile the newest stock dpi24 overlay but slightly modified to remove pins 18 and 19 from the list. I compile it and install it. I reboot. It works! I now have the newer version of the retroflag magical file #1
Hypothesis
The pwm-audio-pi-zero
overlay looks like it is the custom one from this article but using pins 18 and 19 for the left and right channel instead of that article's 13 and 18. The function also seems to be set to 2 2 instead of 4 2.
Proof
I copy the file from the article. I modify it to be consistent with the new standard. I change the pins and function. I compile it and install it. Reboot. Do the sound test speaker-test -c2 -tw
. It works! I now have the newer version of the retroflag magical file #2
They've managed to jam both a DPI screen (that usually takes over almost all the GPIO pins, including the audio pins) and Stereo Audio output into the same set of GPIO pins normally taken up by the DPI screen. People said it couldn't be done but retroflag did it and this is how they did it: They use mode 6 (666 with gaps) which frees up pins 10,11,18,19,26,27. They then grab two of those pins for audio.
What's funny is that it is called dpi24 but it isn't 24bit color. It really should be called dpi18-666-cfg2 or something. It's colorful enough for me. I'd rather have audio than "true color" ;)
Also: I wasted a bunch of time doing a bunch of reverse engineering of a bunch of stuff when I could have asked retroflag for the dts files. But hey, I learned a lot in the process. Still got a lot to learn.
Cheers.