On Wed, Jan 01, 2014 at 09:10:15PM +0100, Lars-Peter Clausen wrote:
This seems all to be very hackish. We clearly need to fix that DPCM only considers the constraints of the FE DAI though.
Yes. Or otherwise make sure they get fed in anyway.
The digital domain of a sound card can be thought of as a pipeline which mostly operates on one sample at a time. The samples have two main
to change the width. What we are interested in is for which parameters on the PCM side are we able to build up a pipeline that satisfies all constraints of all the components in the pipeline. I think this can be done by walking the DAPM graph and collect the constraints associated with the components in the path (The graph walking only has to be done when components are added or removed). E.g. build up a list of all the the DAIs that are reachable from a PCM and then use the constraints of those DAIs for the PCM.
This is sort of the direction I'd been thinking in but there's a couple of extra bits to consider here. The big one is that we have devices with constraints that aren't connected to the routing so just walking DAPM isn't sufficient - for example, a constraint like "all the DACs have to be in the same domain at the same rate". This makes the collecting all the constraints harder and routing dependent.
What I'd been thinking of was annotating the DAPM graph with digital domain objects (registering a list of digital domains each of which has some DAPM objects anyway) and then using the DAPM graph to flow through both settings when streams start and constraints when we're trying to figure out those. I started implementing this but didn't get much beyond registration.
While we are at it we should probably also reduce the separation between DPCM and clasic PCM as clasic PCM is just a special case (static routes) of DPCM.
I'd been thinking of that in the other direction - moving things out of DPCM and into DAPM or ASoC specific stuff so that the ALSA level PCM interface is more hidden, making dynamic PCM less tied to PCM. The stuff with handling sample sizes rather than formats is going in that general direction. I'm not sure this doesn't boil down to the same thing as you're suggesting when they're implemented though.