Re: [PATCH v3] ASoC: wm8524: enable constraints when sysclk is configured.

From: Shengjiu Wang
Date: Tue Jun 24 2025 - 04:24:44 EST


On Sat, Jun 21, 2025 at 12:02 AM Charles Keepax
<ckeepax@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Jun 20, 2025 at 01:42:20PM +0100, Mark Brown wrote:
> > On Fri, Jun 20, 2025 at 09:42:58AM +0100, Charles Keepax wrote:
> > > On Fri, Jun 20, 2025 at 09:26:00AM +0100, Charles Keepax wrote:
> >
> > > > This is kinda the opposite of what I was hoping we could do. The
> > > > idea was to make sure we returned an error if we can't support
> > > > the given rate. So if we don't have the constraint, we check the
> > > > value in hw_params. This looks like it checks in hw_params only
> > > > in the case the constraint existed, but in that case there is no
> > > > need to check because we had the constraint.
> >
> > > Although perhaps I am mistaken here, I guess is the clock has
> > > been set by the machine driver then we would pass this check.
> > > Would it perhaps make more sense to return an error rather than
> > > zero here?
> >
> > The link hw_params() should be run before the CODEC ones so we would be
> > able to insist on the clocks having been configured first.
> >
> > Or I wonder if it might be easier to just implement clock API support in
> > the driver and if we get a MCLK we set it to a sensible value here?
> > That wouldn't work if the MCLK is coming from the other DAI though.
> > Also I'm really not sure how this bikeshed fits into the design concept
> > here.
>
> I think clock framework stuff is probably more work than makes
> sense here.
>
> If you are happy with this as is I don't object to it getting
> merged, ultimately if the machine driver doesn't configure the
> clock that is a bug in the machine driver and it will likely be
> relatively obvious audibily so the returning an error is really
> just a nice to have.

The code here wants to avoid returning an error when the machine driver
doesn't configure the sysclk. As wm8524 is a slave codec, it don't have
any registers to be configured, it can work without sysclk configured.

Maybe we can release this flexibility for wm8524?

Best regards
Shengjiu Wang

>
> Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
>
> Thanks,
> Charles