Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Michael Trimarchi <michael@amarulasolutions.com>
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: Re: [RFC PATCH] ASoC: omap-mcbsp: Add support for highter rate up to 384000
Date: Mon, 12 Aug 2013 18:36:16 +0300	[thread overview]
Message-ID: <520900F0.9080600@ti.com> (raw)
In-Reply-To: <20130810075325.GA12316@panicking>

On 08/10/2013 10:53 AM, Michael Trimarchi wrote:
> I found some time but I can't not test this patch now ;) too far from
> my office. The idea is to check with MAX_BCLK. There are two points
> that should cover slave and master mode. Is it the right direction?
> BTW Do you think that is better to have at soc level as a new constraint?

I would not bother with the bclk check for now. We did not had issues so far
and 48MHz is quite high anyways for our users so far.

> 
> Michael
> 
> diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
> index 7483efb..ea95ad2 100644
> --- a/sound/soc/omap/omap-mcbsp.c
> +++ b/sound/soc/omap/omap-mcbsp.c
> @@ -39,7 +39,9 @@
>  #include "mcbsp.h"
>  #include "omap-mcbsp.h"
>  
> -#define OMAP_MCBSP_RATES	(SNDRV_PCM_RATE_8000_96000)
> +#define OMAP_MCBSP_MAX_BCLK	48000000
> +#define OMAP_MCBSP_RATES	(SNDRV_PCM_RATE_8000_192000 |		\
> +				 SNDRV_PCM_RATE_KNOT)
>  
>  #define OMAP_MCBSP_SOC_SINGLE_S16_EXT(xname, xmin, xmax, \
>  	xhandler_get, xhandler_put) \
> @@ -225,10 +227,14 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
>  	struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
>  	struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs;
>  	struct snd_dmaengine_dai_dma_data *dma_data;
> -	int wlen, channels, wpf;
> +	int wlen, channels, wpf, bclk;
>  	int pkt_size = 0;
>  	unsigned int format, div, framesize, master;
>  
> +	bclk = snd_soc_params_to_bclk(params);
> +	if (bclk < 0 || bclk > OMAP_MCBSP_MAX_BCLK)
> +		return -EINVAL;
> +
>  	dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream);
>  	channels = params_channels(params);
>  
> @@ -326,7 +332,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
>  	/* In McBSP master modes, FRAME (i.e. sample rate) is generated
>  	 * by _counting_ BCLKs. Calculate frame size in BCLKs */
>  	master = mcbsp->fmt & SND_SOC_DAIFMT_MASTER_MASK;
> -	if (master ==	SND_SOC_DAIFMT_CBS_CFS) {
> +	if (master == SND_SOC_DAIFMT_CBS_CFS) {
>  		div = mcbsp->clk_div ? mcbsp->clk_div : 1;
>  		framesize = (mcbsp->in_freq / div) / params_rate(params);
>  
> @@ -500,6 +506,9 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
>  			return -EBUSY;
>  	}
>  
> +	if (freq > OMAP_MCBSP_MAX_BCLK)
> +		return -EINVAL;
> +
>  	mcbsp->in_freq = freq;
>  	regs->srgr2 &= ~CLKSM;
>  	regs->pcr0 &= ~SCLKME;
>>
>>>
>>> Michael
>>>
>>>>>  	},
>>>>>  	.capture = {
>>>>>  		.channels_min = 1,
>>>>>  		.channels_max = 16,
>>>>>  		.rates = OMAP_MCBSP_RATES,
>>>>> +		.rate_min = 8000,
>>>>> +		.rate_max = 384000,
>>>>
>>>> Same here, do not set these.
>>>>
>>>>>  		.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE,
>>>>>  	},
>>>>>  	.ops = &mcbsp_dai_ops,
>>>>>
>>>>
>>>>
>>>> -- 
>>>> Péter
>>>
>>
>>
>> -- 
>> Péter


-- 
Péter

  reply	other threads:[~2013-08-12 15:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07 18:28 [RFC PATCH] ASoC: omap-mcbsp: Add support for highter rate up to 384000 Michael Trimarchi
2013-08-08 10:51 ` Peter Ujfalusi
2013-08-08 11:04   ` Michael Trimarchi
2013-08-09  5:18     ` Peter Ujfalusi
2013-08-09  7:43       ` Michael Trimarchi
2013-08-10  7:53       ` Michael Trimarchi
2013-08-12 15:36         ` Peter Ujfalusi [this message]
2013-08-12 15:57           ` Michael Trimarchi

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=520900F0.9080600@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jarkko.nikula@bitmer.com \
    --cc=lgirdwood@gmail.com \
    --cc=michael@amarulasolutions.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox