[alsa-devel] ASoC:Question rate constraint between the dais

Trent Piepho tpiepho at gmail.com
Thu Mar 15 22:28:13 CET 2012


On Thu, Mar 15, 2012 at 1:53 PM, Mark Brown
<broonie at opensource.wolfsonmicro.com> wrote:
> On Thu, Mar 15, 2012 at 03:23:04PM +0530, Ramesh Babu wrote:
>> I need to make sure that all simultaneous playback and capture (across the
>> all dai_links) needs to be of same frequency family.
>> If the sampling frequency of  a new request is different from ongoing
>> playback/capture, then it needs to be rejected.
>
>> How do I handle it in machine driver?
>
> Why do you need to do this in the machine driver?  Such a constraint
> sounds like it's coming from one of the chips in the system rather than
> from the machine itself so it'd seem sensible for the chip itself to
> impose the constraint so that other machines don't need to replicate the
> code.
>
> See wm8988 for an example of adding sample rate constraints, obviously
> you can change the criteria dynamically.

There is a race when the constraints change dynamically.  See the
fsl_ssi.c driver and the sample size constraint in synchronous mode.

Say you have two substreams that must be at the same rate.  The first
pcm substream opens, gets a constraint based on current conditions.
If no other substreams are initialized, then this is a range of sample
rates.  Now a second substream opens, before the first is initialized,
and gets the same constraints of a range of sample rates.  The second
stream initializes and starts.  This means the first substream must
now be constrained to be the same sample rate as the second.  But
those constraints were set when the first stream opened.  There's no
way to change them now.


More information about the Alsa-devel mailing list