2019-12-11 12:01:04

by Shengjiu Wang

[permalink] [raw]
Subject: [PATCH] ASoC: wm8962: fix lambda value

According to user manual, it is required that FLL_LAMBDA > 0
in all cases (Integer and Franctional modes).

Fixes: 9a76f1ff6e29 ("ASoC: Add initial WM8962 CODEC driver")
Signed-off-by: Shengjiu Wang <[email protected]>
---
sound/soc/codecs/wm8962.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 3e5c69fbc33a..d9d59f45833f 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2788,7 +2788,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,

if (target % Fref == 0) {
fll_div->theta = 0;
- fll_div->lambda = 0;
+ fll_div->lambda = 1;
} else {
gcd_fll = gcd(target, fratio * Fref);

@@ -2858,7 +2858,7 @@ static int wm8962_set_fll(struct snd_soc_component *component, int fll_id, int s
return -EINVAL;
}

- if (fll_div.theta || fll_div.lambda)
+ if (fll_div.theta)
fll1 |= WM8962_FLL_FRAC;

/* Stop the FLL while we reconfigure */
--
2.21.0


2019-12-12 16:52:10

by Charles Keepax

[permalink] [raw]
Subject: Re: [PATCH] ASoC: wm8962: fix lambda value

On Wed, Dec 11, 2019 at 07:57:22PM +0800, Shengjiu Wang wrote:
> According to user manual, it is required that FLL_LAMBDA > 0
> in all cases (Integer and Franctional modes).
>
> Fixes: 9a76f1ff6e29 ("ASoC: Add initial WM8962 CODEC driver")
> Signed-off-by: Shengjiu Wang <[email protected]>
> ---
> sound/soc/codecs/wm8962.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
> index 3e5c69fbc33a..d9d59f45833f 100644
> --- a/sound/soc/codecs/wm8962.c
> +++ b/sound/soc/codecs/wm8962.c
> @@ -2788,7 +2788,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
>
> if (target % Fref == 0) {
> fll_div->theta = 0;
> - fll_div->lambda = 0;
> + fll_div->lambda = 1;
> } else {
> gcd_fll = gcd(target, fratio * Fref);
>
> @@ -2858,7 +2858,7 @@ static int wm8962_set_fll(struct snd_soc_component *component, int fll_id, int s
> return -EINVAL;
> }
>
> - if (fll_div.theta || fll_div.lambda)
> + if (fll_div.theta)
> fll1 |= WM8962_FLL_FRAC;

How well tested is this change, and is it addressing an issue you
have observed? I agree this does better fit the datasheet just a
little nervous as its an older part that has seen a lot of usage.

Thanks,
Charles

2019-12-12 16:55:26

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] ASoC: wm8962: fix lambda value

On Thu, Dec 12, 2019 at 04:48:35PM +0000, Charles Keepax wrote:
> On Wed, Dec 11, 2019 at 07:57:22PM +0800, Shengjiu Wang wrote:
> > According to user manual, it is required that FLL_LAMBDA > 0
> > in all cases (Integer and Franctional modes).

> How well tested is this change, and is it addressing an issue you
> have observed? I agree this does better fit the datasheet just a
> little nervous as its an older part that has seen a lot of usage.

I've got a feeling that requirement might've been added in later
versions of the datasheet...


Attachments:
(No filename) (554.00 B)
signature.asc (499.00 B)
Download all attachments

2019-12-13 03:10:18

by Shengjiu Wang

[permalink] [raw]
Subject: Re: [alsa-devel] [PATCH] ASoC: wm8962: fix lambda value

Hi

On Fri, Dec 13, 2019 at 12:54 AM Mark Brown <[email protected]> wrote:
>
> On Thu, Dec 12, 2019 at 04:48:35PM +0000, Charles Keepax wrote:
> > On Wed, Dec 11, 2019 at 07:57:22PM +0800, Shengjiu Wang wrote:
> > > According to user manual, it is required that FLL_LAMBDA > 0
> > > in all cases (Integer and Franctional modes).
>
> > How well tested is this change, and is it addressing an issue you
> > have observed? I agree this does better fit the datasheet just a
> > little nervous as its an older part that has seen a lot of usage.
>
> I've got a feeling that requirement might've been added in later
> versions of the datasheet...

We encounter an issue that when Integer mode, the lambda=theta=0,
the output sound is slower than expected. After change lambda=1
the issue is gone.

Best regards
Wang Shengjiu

2019-12-13 10:59:28

by Charles Keepax

[permalink] [raw]
Subject: Re: [alsa-devel] [PATCH] ASoC: wm8962: fix lambda value

On Fri, Dec 13, 2019 at 11:09:09AM +0800, Shengjiu Wang wrote:
> Hi
>
> On Fri, Dec 13, 2019 at 12:54 AM Mark Brown <[email protected]> wrote:
> >
> > On Thu, Dec 12, 2019 at 04:48:35PM +0000, Charles Keepax wrote:
> > > On Wed, Dec 11, 2019 at 07:57:22PM +0800, Shengjiu Wang wrote:
> > > > According to user manual, it is required that FLL_LAMBDA > 0
> > > > in all cases (Integer and Franctional modes).
> >
> > > How well tested is this change, and is it addressing an issue you
> > > have observed? I agree this does better fit the datasheet just a
> > > little nervous as its an older part that has seen a lot of usage.
> >
> > I've got a feeling that requirement might've been added in later
> > versions of the datasheet...
>
> We encounter an issue that when Integer mode, the lambda=theta=0,
> the output sound is slower than expected. After change lambda=1
> the issue is gone.
>

Cool alright if there is a real issue here, then we should be
getting it fixed.

Acked-by: Charles Keepax <[email protected]>

Thanks,
Charles

2019-12-13 12:07:02

by Fabio Estevam

[permalink] [raw]
Subject: Re: [alsa-devel] [PATCH] ASoC: wm8962: fix lambda value

Hi Shengjiu,

On Fri, Dec 13, 2019 at 12:10 AM Shengjiu Wang <[email protected]> wrote:

> We encounter an issue that when Integer mode, the lambda=theta=0,
> the output sound is slower than expected. After change lambda=1
> the issue is gone.

This is important information and it would be nice to have it included
in the commit log.

Thanks