RE: [PATCH] ASoC: da7219: Use clk_round_rate to handle enabled bclk/wclk case

From: Adam Thomson
Date: Mon Apr 29 2019 - 05:16:33 EST


On 27 April 2019 18:20, Mark Brown wrote:

> On Fri, Apr 26, 2019 at 01:59:24PM +0100, Adam Thomson wrote:
>
> > + /*
> > + * Rounding the rate here avoids failure trying to set a new
> > + * rate on an already enabled wclk. In that instance this will
> > + * just set the same rate as is currently in use, and so should
> > + * continue without problem.
> > + */
> > + sr = clk_round_rate(wclk, sr);
> > ret = clk_set_rate(wclk, sr);
> > if (ret) {
> > dev_err(component->dev,
>
> Don't we need to validate that the rounded rate is actually viable for
> the parameters we're trying to set here? If there's missing constraints
> causing something to try to do something unsupportable then we should
> return an error rather than silently accept.

Thanks for directing my gaze to this again. Actually I don't think the SR should
be rounded at all. If it doesn't match exactly it should fail so I'll remove the
rounding here. Not sure what my brain was doing there.

For the BCLK rate, I'll see what checking can be added there to make sure the
word length is compatible with the 'rounded' BCLK rate.