On Thu, Nov 23, 2017 at 03:51:19PM +0100, Ricard Wanderlof wrote:
I'm studying a hardware implementation where an S/PDIF receiver is on the same I2S connection as codec. Essentially, the S/PDIF receiver echos the I2S capture data from the codec unless there is a digital input signal which it can lock on to. For playback, the I2S output from the CPU DAI goes directly to the codec.
I take it this is a TDM setup?
I'm a bit at a loss for how to model this in ALSA. I know it's possible to have multiple codecs on a card, but those cases seem to be either separate codecs for the left and right channels, or separate codecs for capture and playback. In my case the playback codec is always the same, but the capture codec can switch between the two avilable input methods (more or less automatically if the S/PDIF receiver is so configured).
The capture CODEC is the problem here. If we had digital domain stuff working well then we could model this easily enough by showing a loopback within the S/PDIF chip but that's not there yet. As it is it sounds like the easiest thing is just going to be to ignore the S/PDIF CODEC in software and fudge things by telling the SoC to read the TDM slot that it is sending on. That way the regular CODEC will get set up normally and the S/PDIF device can transparently handle the switching.