You mean a converter to match the electrical levels of an SPDIF or the data format is also different?
The data format is different. It could be theoretically possible to fake a SPDIF format over I2S, but this means lot of work and there is a big chance of a total fail.
Oh boy, that was an addicting sentence! Because of that, I have done some googling and learning during past couple of nights, and I'd say that SPDIF is quite doable with raspberry.
The related links that ultimately convinced me:
http://scanlime.org/2011/04/spdif-digit ... ontroller/
In principle, following steps would need to be done:
I2S driver should be configured to 6.144Mbit/s or 5.6448Mbit/s or 4.096Mbit/s bit rate depending on sampling frequency (48k,44.1k,32k are supported by SPDIF). This seem to be possible.
SPDIF requires continuous bitstream. Also this seem to be possible with BCM chipset by correctly configuring CH1POS and CH2POS.
Then, one would have to wrap samples around SPDIF headers and apply BMC encoding. This is where I expected to write some code .. but no. There seem to be something what could be used as a base:
Now, the question (from 100% kernel/alsa newbie). Where should SPDIF encapsulation code belong to in Linux kernel / ALSA architecture? Looks like the alsa soc dai/machine/codec code is not the place. Is it alsa pcm filter plugin or something similar -- where is the last place where sample data can still be modified before passing it over to hardware?
It should be rather easy to prototype this by modifying i2s driver code and pre-generate some audio into spdif bitstream on PC and feed that to raspberry i2s output. And of course the toslink transceiver has to be added.
Now, next step would be to go buy and build some hardware (which is typically the step where my projects tend to stall