All of lore.kernel.org
 help / color / mirror / Atom feed
From: "S.j. Wang" <shengjiu.wang@nxp.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: "lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"perex@perex.cz" <perex@perex.cz>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"kstewart@linuxfoundation.org" <kstewart@linuxfoundation.org>,
	"allison@lohutok.net" <allison@lohutok.net>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"info@metux.net" <info@metux.net>,
	"ckeepax@opensource.wolfsonmicro.com" 
	<ckeepax@opensource.wolfsonmicro.com>,
	"patches@opensource.cirrus.com" <patches@opensource.cirrus.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: wm8960: Remove bitclk relax condition
Date: Wed, 3 Mar 2021 03:03:57 +0000	[thread overview]
Message-ID: <VI1PR0402MB33424B6B9D35C1D280BA161AE3989@VI1PR0402MB3342.eurprd04.prod.outlook.com> (raw)

> >
> > Using a higher bitclk then expected doesn't always work.
> > Here is an example:
> >
> > aplay -Dhw:0,0 -d 5 -r 48000 -f S24_LE -c 2 audio48k24b2c.wav
> >
> > In this case, the required bitclk is 48000 * 24 * 2 = 2304000 but the
> > closest bitclk that can be derived is 3072000. Since the clock is
> > faster than expected, it will start to send bytes from the next
> > channel so the sound will be corrupted.
> >
> > Fixes: 82bab88910ee ("ASoC: codec: wm8960: Relax bit clock computation
> > when using PLL")
> > Fixes: 3c01b9ee2ab9 ("ASoC: codec: wm8960: Relax bit clock
> > computation")
> > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> 
> I think this is probably going to need a much more involved fix.
> The problem is that there are systems that depend on this behaviour, so you
> can't just flat out revert it. And to be fair the I2S specification says that bit
> clock can run at a higher rate than required for the data, so the behaviour is
> correct as well.
> 
> Probably the best solution here is to add additional contraints from the
> machine driver on which rates/bit depths/channels are supported.
> 
Just double check the issue, the real reason is in below:

    The call sequence in wm8960_configure_clocking is

       ret = wm8960_configure_sysclk();
       if (ret >= 0)
            goto configure_clock;

       ....

       ret = wm8960_configure_pll();

    configure_clock:
       ...

    wm8960_configure_sysclk is called before wm8960_configure_pll, as
    there is bitclk relax on both functions, so wm8960_configure_sysclk
    always return success, then wm8960_configure_pll() never be called.

    So bitclk relax condition should be removed in wm8960_configure_sysclk,
    That wm8960_configure_pll can be called, and there is also bitclk relax
    function in wm8960_configure_pll.

I will update and resend this patch.

Best regards
Wang shengjiu



WARNING: multiple messages have this Message-ID (diff)
From: "S.j. Wang" <shengjiu.wang@nxp.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: "kstewart@linuxfoundation.org" <kstewart@linuxfoundation.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"patches@opensource.cirrus.com" <patches@opensource.cirrus.com>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"info@metux.net" <info@metux.net>,
	"ckeepax@opensource.wolfsonmicro.com"
	<ckeepax@opensource.wolfsonmicro.com>,
	"allison@lohutok.net" <allison@lohutok.net>
Subject: Re: [PATCH] ASoC: wm8960: Remove bitclk relax condition
Date: Wed, 3 Mar 2021 03:03:57 +0000	[thread overview]
Message-ID: <VI1PR0402MB33424B6B9D35C1D280BA161AE3989@VI1PR0402MB3342.eurprd04.prod.outlook.com> (raw)

> >
> > Using a higher bitclk then expected doesn't always work.
> > Here is an example:
> >
> > aplay -Dhw:0,0 -d 5 -r 48000 -f S24_LE -c 2 audio48k24b2c.wav
> >
> > In this case, the required bitclk is 48000 * 24 * 2 = 2304000 but the
> > closest bitclk that can be derived is 3072000. Since the clock is
> > faster than expected, it will start to send bytes from the next
> > channel so the sound will be corrupted.
> >
> > Fixes: 82bab88910ee ("ASoC: codec: wm8960: Relax bit clock computation
> > when using PLL")
> > Fixes: 3c01b9ee2ab9 ("ASoC: codec: wm8960: Relax bit clock
> > computation")
> > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> 
> I think this is probably going to need a much more involved fix.
> The problem is that there are systems that depend on this behaviour, so you
> can't just flat out revert it. And to be fair the I2S specification says that bit
> clock can run at a higher rate than required for the data, so the behaviour is
> correct as well.
> 
> Probably the best solution here is to add additional contraints from the
> machine driver on which rates/bit depths/channels are supported.
> 
Just double check the issue, the real reason is in below:

    The call sequence in wm8960_configure_clocking is

       ret = wm8960_configure_sysclk();
       if (ret >= 0)
            goto configure_clock;

       ....

       ret = wm8960_configure_pll();

    configure_clock:
       ...

    wm8960_configure_sysclk is called before wm8960_configure_pll, as
    there is bitclk relax on both functions, so wm8960_configure_sysclk
    always return success, then wm8960_configure_pll() never be called.

    So bitclk relax condition should be removed in wm8960_configure_sysclk,
    That wm8960_configure_pll can be called, and there is also bitclk relax
    function in wm8960_configure_pll.

I will update and resend this patch.

Best regards
Wang shengjiu



             reply	other threads:[~2021-03-03 11:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  3:03 S.j. Wang [this message]
2021-03-03  3:03 ` [PATCH] ASoC: wm8960: Remove bitclk relax condition S.j. Wang
  -- strict thread matches above, loose matches on Subject: below --
2021-03-02 11:18 Shengjiu Wang
2021-03-02 13:19 ` Charles Keepax
2021-03-02 13:19   ` Charles Keepax

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR0402MB33424B6B9D35C1D280BA161AE3989@VI1PR0402MB3342.eurprd04.prod.outlook.com \
    --to=shengjiu.wang@nxp.com \
    --cc=allison@lohutok.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=info@metux.net \
    --cc=kstewart@linuxfoundation.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=tglx@linutronix.de \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.