On Mon, Jan 10, 2022 at 09:24:38PM +0000, Robert Hancock wrote:
On Mon, 2022-01-10 at 20:31 +0000, Mark Brown wrote:
If the device is using mclk-fs then either there's a fixed sample rate (in which case simple-card probably ought to force it without the driver worrying) or the sysclk will vary in which case simple-card should be setting the sysclk to 0 when the card goes idle to clear any constraints (which as you say later it does).
It sounds like to fix that, simple-card needs to keep track of whether the DAI has a fixed clock rate or not. If it does, then it shouldn't be zeroing out the sysclk when closing the device as that's wiping out information that needs to be persistent. I guess if the frequency was read from a system-clock-frequency property then we know it is fixed. There are other cases where it could be a fixed rate, such as if the clock is connected to a fixed-clock. Maybe we need an explicit DT flag "system-clock-fixed" or something for those cases?
If the clock is fixed in the clock API we should arrange to be able to enumerate that from the clock API - we shouldn't be requiring redundant properties for something like that.
Then at least in the case where mclk-fs is set and one or more of the DAIs have a fixed rate, simple-card can add a constraint to restrict the sample rate to the fixed clock divided by mclk-fs?
Yes, however we figure out that sysclk is fixed.