On Mon, Nov 24, 2008 at 03:45:33PM +0200, Jarkko Nikula wrote:
My problem was this kind of switching correct to do in machine driver?
cpu_dai->playback.channels_min = 1; cpu_dai->playback.channels_max = 1; cpu_dai->capture.channels_min = 1; cpu_dai->capture.channels_max = 1;
No, these should be constant. Any dynamic constraints should be applied with the constraints API.
Defining channels_min = 1 in omap_mcbsp_dai initializer would cause that link is then switching between mono/stereo depending what user space is asking.
Yes.
Like "aplay -c 1 /dev/urandom" causes that all machines having codec with "channels_min = 1" and "channels_max = 2" would cause incorrect mono link configuration where alsalib should do the mono->stereo conversion instead and vice versa for pure mono link.
So, this is a bit messy at the moment since we don't really have any DAPM-style routing on the digital side yet. What most of these codecs should probably be doing is declaring a 2 channel minimuim - normally that's what they require as a wire format even if they only actually use the data from one of those channels.
This will be less efficient when these devices are used in a mono configuration but is safer until we can map out the digital side better in software; it's roughly what you're trying to do here on the CPU side.