This would be the easiest and cleanest solution.Xavier_S wrote: ↑Fri Nov 16, 2018 4:49 pm1- Let my clock source behave as a gateway inbetween the RPi and DAC, acting as a clock master for both sides. This involves creating a new dai_link to connect my clock source to the Justboom DAC, and then relaying information between both dai_links. Although my intuition tells me that this would be the clever way to go, I am not sure right now how to achieve this, so I didn't go that way for the moment.
In ASoC terms this is called a codec-codec link. It's often used to add in sample rate converters or DSPs into the chain.
Basically you need to create a codec driver with 2 audio interfaces. One interface is connected to bcm2835, the other one to the pcm512x. Define the number of channels, formats etc of that codec to match the ones supported by pcm512x.
When you play a stream ASoC will "negotiate" the parameters (samplerate etc) of the bcm2835-codec link with your codec but for the codec-pcm512x link you have to do it manually.
This is rather easy to do though:
In your machine/soundcard driver you define the 2 dai links, in the codec-pcm512x link you add a .params struct for the second link configuration which you set in your soundcard's .hwparams function to match the stream params.
ASoC first calls hwparams of the soundcard driver and then hwparams on all the codecs. So you don't need to do much in your soundcard driver, just define the dai links and implement the rather simple hwparams function. In your codec driver implement hwparams to setup the clock and you should be done.
Have a look at the rpi-cirrus driver (in sound/soc/bcm) how this can be implemented. The driver is rather complex but you can ignore about 95% of the code - only look at the dai link setup and hwparams where rpi_cirrus_dai_link2_params is set up.
The Cirrus Logic audio card uses 2 codecs, the first audio interface of the WM5102 is connected to the RPi, the second interface of the WM5102 is connected to a WM8804 to provide SPDIF input and output.
Although the wm5102 / arizona driver is quite a beast you can look at sound/soc/wm5102 as an example how to register multiple audio interfaces. It's not complicated, just define 2 dais with different names and ids in the snd_soc_dai_driver array that's passed to snd_soc_register_component
Edit: forgot to add, you probably don't need any I2C reference in your soundcard driver, only your codec driver needs to have that. So you can instantiate that codec driver via devicetree as usual.