All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Daniel Baluta <daniel.baluta@nxp.com>
Cc: alsa-devel@alsa-project.org, shengjiu.wang@freescale.com,
	patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com,
	linux-kernel@vger.kernel.org, broonie@kernel.org,
	viorel.suman@nxp.com, mihai.serban@nxp.com, tiwai@suse.com
Subject: Re: [RFC PATCH] ASoC: wm8960: Use physical width for bclk
Date: Wed, 15 Mar 2017 09:19:01 +0000	[thread overview]
Message-ID: <20170315091901.GF6986@localhost.localdomain> (raw)
In-Reply-To: <1489510622-30981-1-git-send-email-daniel.baluta@nxp.com>

On Tue, Mar 14, 2017 at 06:57:02PM +0200, Daniel Baluta wrote:
> bclk is derived from sysclk with the help of bclk_divs. Anyhow, for
> S20_3LE format there is no bclk_divs that could be used to derive
> an exact bclk.
> 
> We can fix this by using storage size instead the exact
> number of bits of the sample when computing bclk.
> 
> With this approach we can play S20_3LE encoded files at the cost of
> some unused BCLK cycles for S20_3LE and S24_LE.
> 
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> ---
>  sound/soc/codecs/wm8960.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
> index e1429e3..18ca5fc 100644
> --- a/sound/soc/codecs/wm8960.c
> +++ b/sound/soc/codecs/wm8960.c
> @@ -722,7 +722,8 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
>  	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
>  	int i;
>  
> -	wm8960->bclk = snd_soc_params_to_bclk(params);
> +	wm8960->bclk = params_physical_width(params) *
> +		params_channels(params) * params_rate(params);
>  	if (params_channels(params) == 1)
>  		wm8960->bclk *= 2;

Would quite like to see Mark's thoughts on this. Feels a bit to
me (although I am not certain) like we are solving the problem in
the wrong place, isn't this really setting the desired BCLK and
then in wm8960_configure_clocking we should set the lowest BCLK
we can that is greater than or equal to the desired.

Thanks,
Charles

WARNING: multiple messages have this Message-ID (diff)
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Daniel Baluta <daniel.baluta@nxp.com>
Cc: <lgirdwood@gmail.com>, <broonie@kernel.org>, <tiwai@suse.com>,
	<patches@opensource.wolfsonmicro.com>,
	<alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
	<shengjiu.wang@freescale.com>, <mihai.serban@nxp.com>,
	<viorel.suman@nxp.com>
Subject: Re: [RFC PATCH] ASoC: wm8960: Use physical width for bclk
Date: Wed, 15 Mar 2017 09:19:01 +0000	[thread overview]
Message-ID: <20170315091901.GF6986@localhost.localdomain> (raw)
In-Reply-To: <1489510622-30981-1-git-send-email-daniel.baluta@nxp.com>

On Tue, Mar 14, 2017 at 06:57:02PM +0200, Daniel Baluta wrote:
> bclk is derived from sysclk with the help of bclk_divs. Anyhow, for
> S20_3LE format there is no bclk_divs that could be used to derive
> an exact bclk.
> 
> We can fix this by using storage size instead the exact
> number of bits of the sample when computing bclk.
> 
> With this approach we can play S20_3LE encoded files at the cost of
> some unused BCLK cycles for S20_3LE and S24_LE.
> 
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> ---
>  sound/soc/codecs/wm8960.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
> index e1429e3..18ca5fc 100644
> --- a/sound/soc/codecs/wm8960.c
> +++ b/sound/soc/codecs/wm8960.c
> @@ -722,7 +722,8 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
>  	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
>  	int i;
>  
> -	wm8960->bclk = snd_soc_params_to_bclk(params);
> +	wm8960->bclk = params_physical_width(params) *
> +		params_channels(params) * params_rate(params);
>  	if (params_channels(params) == 1)
>  		wm8960->bclk *= 2;

Would quite like to see Mark's thoughts on this. Feels a bit to
me (although I am not certain) like we are solving the problem in
the wrong place, isn't this really setting the desired BCLK and
then in wm8960_configure_clocking we should set the lowest BCLK
we can that is greater than or equal to the desired.

Thanks,
Charles

  reply	other threads:[~2017-03-15  9:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14 16:57 [RFC PATCH] ASoC: wm8960: Use physical width for bclk Daniel Baluta
2017-03-14 16:57 ` Daniel Baluta
2017-03-15  9:19 ` Charles Keepax [this message]
2017-03-15  9:19   ` Charles Keepax
2017-03-15 11:43   ` Daniel Baluta
2017-03-15 11:43     ` Daniel Baluta
2017-03-15 13:33   ` Mark Brown
2017-03-15 13:33     ` Mark Brown
2017-03-15 15:11     ` Daniel Baluta
2017-03-15 15:11       ` [alsa-devel] " Daniel Baluta

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=20170315091901.GF6986@localhost.localdomain \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihai.serban@nxp.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=shengjiu.wang@freescale.com \
    --cc=tiwai@suse.com \
    --cc=viorel.suman@nxp.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.