All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Baluta <daniel.baluta@gmail.com>
To: Zidan Wang <b50113@freescale.com>
Cc: Mark Brown <broonie@kernel.org>,
	Zidan Wang <zidan.wang@freescale.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>,
	tiwai@suse.de, Lars-Peter Clausen <lars@metafoo.de>,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	patches@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	shengjiu.wang@nxp.com, mihai.serban@nxp.com,
	viorel.suman@nxp.com
Subject: Re: [alsa-devel][PATCH v2 2/2] ASoC: wm8960: Let wm8960 driver configure its bit clock and frame clock
Date: Mon, 3 Apr 2017 16:16:23 +0300	[thread overview]
Message-ID: <CAEnQRZD0LuUiULNrv6RJQsr8ZZE+v2-qNC1Za9vXk5+TtB0dOw@mail.gmail.com> (raw)
In-Reply-To: <20150115133439.GA29323@b50113>

On Thu, Jan 15, 2015 at 3:34 PM, Zidan Wang <b50113@freescale.com> wrote:
> On Wed, Jan 14, 2015 at 07:27:03PM +0000, Mark Brown wrote:
>> On Wed, Jan 07, 2015 at 03:31:45PM +0800, Zidan Wang wrote:
>>
>> > +   for (i = 0; i < ARRAY_SIZE(dac_divs); ++i) {
>> > +           if (wm8960->sysclk == lrclk * dac_divs[i]) {
>> > +                   for (j = 0; j < ARRAY_SIZE(bclk_divs); ++j) {
>> > +                           if (wm8960->sysclk ==  wm8960->bclk *
>> > +                                           bclk_divs[j] / 10) {
>> > +                                   goto config_clock;
>> > +                           }
>> > +                   }
>> > +           }
>> > +   }
>> > +
>> > +   dev_err(codec->dev, "Unsupported sysclk %d\n", wm8960->sysclk);
>> > +   return;
>>
>> It's a bit awkward using the goto like this.  A more common way of
>> writing this is to change the above block to be
>>
>>       if (i == ARRAY_SIZE(dac_divs))
>>               /* return error */
>>
>> rather than skipping over the error.  Otherwise this looks good.
>
> Hi Mark,
>
> I found it can't generate bclk for S20_3LE data format.
>
> For 2 channel S20_3LE data format:
>
> bclk = fs * 20 * 2
> Sysclk = BCLKDIV * bclk = BCLKDIV * fs * 40
> Sysclk = DACDIV * fs * 256
>
> BCLKDIV/DACDIV = 256/40 = 32/5
>
> But BCLKDIV/DACDIV can't be 32/5. So I want to support tdm slot.
>
> bclk = fs * slot_width * slots * channal.
>
> Do you think it make sense, or any other ideas?

Reviving this question after two years :).

After "ASoC: codec: wm8960: Relax bit clock computation" patch

https://patchwork.kernel.org/patch/9636769/

we can now support S20_3LE for round rates like 8000, 16000,
32000 and 48000.

But not for 11025, 22050, 441000. Do you think it's worth exploring
"tdm slot" idea? I don't know exactly what it implies.

Another idea, is to completely remove support for S20_3LE since it
is not trivial to derive bitclk from sysclk.

What do you guys think?

Daniel.

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Baluta <daniel.baluta@gmail.com>
To: Zidan Wang <b50113@freescale.com>
Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>,
	Zidan Wang <zidan.wang@freescale.com>,
	tiwai@suse.de,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	shengjiu.wang@nxp.com, patches@opensource.wolfsonmicro.com,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	viorel.suman@nxp.com, mihai.serban@nxp.com,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Subject: Re: [PATCH v2 2/2] ASoC: wm8960: Let wm8960 driver configure its bit clock and frame clock
Date: Mon, 3 Apr 2017 16:16:23 +0300	[thread overview]
Message-ID: <CAEnQRZD0LuUiULNrv6RJQsr8ZZE+v2-qNC1Za9vXk5+TtB0dOw@mail.gmail.com> (raw)
In-Reply-To: <20150115133439.GA29323@b50113>

On Thu, Jan 15, 2015 at 3:34 PM, Zidan Wang <b50113@freescale.com> wrote:
> On Wed, Jan 14, 2015 at 07:27:03PM +0000, Mark Brown wrote:
>> On Wed, Jan 07, 2015 at 03:31:45PM +0800, Zidan Wang wrote:
>>
>> > +   for (i = 0; i < ARRAY_SIZE(dac_divs); ++i) {
>> > +           if (wm8960->sysclk == lrclk * dac_divs[i]) {
>> > +                   for (j = 0; j < ARRAY_SIZE(bclk_divs); ++j) {
>> > +                           if (wm8960->sysclk ==  wm8960->bclk *
>> > +                                           bclk_divs[j] / 10) {
>> > +                                   goto config_clock;
>> > +                           }
>> > +                   }
>> > +           }
>> > +   }
>> > +
>> > +   dev_err(codec->dev, "Unsupported sysclk %d\n", wm8960->sysclk);
>> > +   return;
>>
>> It's a bit awkward using the goto like this.  A more common way of
>> writing this is to change the above block to be
>>
>>       if (i == ARRAY_SIZE(dac_divs))
>>               /* return error */
>>
>> rather than skipping over the error.  Otherwise this looks good.
>
> Hi Mark,
>
> I found it can't generate bclk for S20_3LE data format.
>
> For 2 channel S20_3LE data format:
>
> bclk = fs * 20 * 2
> Sysclk = BCLKDIV * bclk = BCLKDIV * fs * 40
> Sysclk = DACDIV * fs * 256
>
> BCLKDIV/DACDIV = 256/40 = 32/5
>
> But BCLKDIV/DACDIV can't be 32/5. So I want to support tdm slot.
>
> bclk = fs * slot_width * slots * channal.
>
> Do you think it make sense, or any other ideas?

Reviving this question after two years :).

After "ASoC: codec: wm8960: Relax bit clock computation" patch

https://patchwork.kernel.org/patch/9636769/

we can now support S20_3LE for round rates like 8000, 16000,
32000 and 48000.

But not for 11025, 22050, 441000. Do you think it's worth exploring
"tdm slot" idea? I don't know exactly what it implies.

Another idea, is to completely remove support for S20_3LE since it
is not trivial to derive bitclk from sysclk.

What do you guys think?

Daniel.

  reply	other threads:[~2017-04-03 13:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07  7:31 [alsa-devel][PATCH v2 1/2] ASoC: wm8960: Let wm8960 codec driver manage its own MCLK Zidan Wang
2015-01-07  7:31 ` Zidan Wang
2015-01-07  7:31 ` [alsa-devel][PATCH v2 2/2] ASoC: wm8960: Let wm8960 driver configure its bit clock and frame clock Zidan Wang
2015-01-07  7:31   ` Zidan Wang
2015-01-14 19:27   ` Mark Brown
2015-01-15 13:34     ` Zidan Wang
2015-01-15 13:34       ` [PATCH " Zidan Wang
2017-04-03 13:16       ` Daniel Baluta [this message]
2017-04-03 13:16         ` Daniel Baluta
2017-04-03 13:34         ` [alsa-devel][PATCH " Charles Keepax
2017-04-03 13:34           ` [PATCH " Charles Keepax
2017-04-03 13:39           ` [alsa-devel][PATCH " Daniel Baluta
2017-04-03 13:39             ` [PATCH " Daniel Baluta
2017-04-03 13:54             ` [alsa-devel][PATCH " Charles Keepax
2017-04-03 13:54               ` [PATCH " Charles Keepax
2017-04-04  7:55               ` [alsa-devel][PATCH " Daniel Baluta
2017-04-04  7:55                 ` [PATCH " Daniel Baluta
2017-04-04  8:55                 ` [alsa-devel][PATCH " Charles Keepax
2017-04-04  8:55                   ` [PATCH " Charles Keepax
2015-01-14 19:19 ` [alsa-devel][PATCH v2 1/2] ASoC: wm8960: Let wm8960 codec driver manage its own MCLK Mark Brown
2015-01-14 19:19   ` [PATCH " Mark Brown

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=CAEnQRZD0LuUiULNrv6RJQsr8ZZE+v2-qNC1Za9vXk5+TtB0dOw@mail.gmail.com \
    --to=daniel.baluta@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b50113@freescale.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihai.serban@nxp.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=shengjiu.wang@nxp.com \
    --cc=tiwai@suse.de \
    --cc=viorel.suman@nxp.com \
    --cc=zidan.wang@freescale.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.