On Fri, Mar 16, 2012 at 06:01:44PM -0400, Trent Piepho wrote:
On Fri, Mar 16, 2012 at 3:22 PM, Mark Brown
There's a way to do this, and it's the way that the WM8988 driver is doing it - obviously you'll have different criteria for choosing constraints but the actual application of the constraints is going to be done in the same way.
Since the constraint is based on the current configuration of another DAI, the two DAIs need some way to query each other's parameters. The
Since they're both provided by the same driver this is trivial.
And as I said before, ALSA doesn't handle this 100%. There is a race if both streams are initialized at the same time. If you open one
Yes, I did reply to your previous mail about that pointing out that this is impossible...
I think what's necessary is for ALSA to let hw_params return an error code that means lets the driver say, "Sorry, the constraints have changed and the hw_params you have chosen are no longer valid. Here are new constraints, please try again."
Thinking about this slightly further than in my reply to Lars-Peter a few minutes ago...
I think just returning -EINVAL on bad parameters (which is pretty much what we do) is sufficient for this if the driver is good about keeping the constraints up to date. Applications should already be able to take the hint, though I imagine most of them wouldn't trust the drivers to provide accurate constraints and aren't as widely deployed as PulseAudio (which forced fixing the DMA stuff by virtue of everyone using it). Though just spinning a small number of times will probably deal with lying drivers well enough.
We could still generate an event but I'm now even less sure it's worth drivers doing anything special about this.