Re: [PATCH 2/3] ASoC: wm8940: Rewrite code to set proper clocks

From: Lukasz Majewski
Date: Tue Jun 07 2022 - 08:13:28 EST


Hi Mark,

> On Mon, Jun 06, 2022 at 05:44:40PM +0200, Lukasz Majewski wrote:
> > Without this change, the wm8940 driver is not working when
> > set_sysclk callback (wm8940_set_dai_sysclk) is called with
> > freqency not listed in the switch clause.
>
> > This change adjusts this driver to allow non-standard frequency
> > set (just after the boot) being adjusted afterwards by the sound
> > system core code.
>
> I don't entirely follow the above - in what way might the core adjust
> the clocking, and why would we want to allow the use of invalid
> clocks? Surely that just makes error checking worse.

Hmm, it is a bit complicated.

When I enabed wm8940 support in mainline - the first call to
wm8940_set_dai_sysclk (the set_sysclk callback) required mclk = 11997070
frequency.

With the current code [1] the initialization of the codec returns
-EINVAL and the codec is not supported in the system:

asoc-simple-card: probe of sound failed with error -22



The approach used in this patch set to fix the above issue is based on
one already present in-tree for wm8974 codec.

>
> > Code in this commit is based on previous change done for wm8974
> > (SHA1: 51b2bb3f2568e6d9d81a001d38b8d70c2ba4af99).
>
> Please include human readable descriptions of things like commits and
> issues being discussed in e-mail in your mails, this makes them much
> easier for humans to read especially when they have no internet
> access.

Ok, I will add some more verbose description. The aforementioned SHA1
is referring to commit already in-tree, so you would find it easily
even without the Internet.

> I do frequently catch up on my mail on flights or while
> otherwise travelling so this is even more pressing for me than just
> being about making things a bit easier to read.

+1

Links:

[1] -
https://elixir.bootlin.com/linux/v5.18.1/source/sound/soc/codecs/wm8940.c#L614

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@xxxxxxx

Attachment: pgpt2zlBzgW1r.pgp
Description: OpenPGP digital signature