Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Looijmans <mike.looijmans@topic.nl>
To: alsa-devel@alsa-project.org
Subject: Re: Sample rates above 192000
Date: Wed, 17 Apr 2013 13:44:53 +0200	[thread overview]
Message-ID: <516E8B35.1010200@topic.nl> (raw)
In-Reply-To: <516E5B80.804@topic.nl>

Found the cause: snd_pcm_limit_hw_rates()

soc-code.c:soc_pcm_open() calculates the min/max rates for the given 
link, then passes the result to snd_pcm_limit_hw_rates which discards 
this and replaces it with incorrect data derived from the PCM flags.

The 3.8 kernel soc-core looks totally different, so I have no clue if 
this still applies.

If a codec defines rate_min=16000, rate_max=96000 and the DAI specifies 
flags for 8000..192000 Hz, then the resulting limits that it will apply 
are rate_min=8000 rate_max=192000. One would expect the more restrictive 
values to prevail. Similar, if both codec and dai specify 
rate_max=216000 then the resulting rate_max will surprisingly be set to 
192000.

I worked around the issue by simply adding a 204800 rate to the table of 
known rates.

Mike.


On 04/17/2013 10:21 AM, Mike Looijmans wrote:
> I'm trying to use "my" hardware at a 204800 sample rate. I've changed
> the DAI and codec limits to match. If I limit them to anything below
> 192kHz, everything behaves as expected and I can record at up to that
> rate, also if that rate is not a multiple of 48k or 44k1 (using
> "SNDRV_PCM_RATE_KNOT" constant).
>
> When I specifiy anything over 192000, I bump onto some ceiling, and I
> cannot figure out what's causing it. I patched alsa-utils to allow
>  >192000 already (there is a silly check on that in aplay.c which bails
> out early without asking the driver).
>
> # arecord -D hw:ADC8 --duration=5 -f S32_LE -c 2 -r 204800
> /tmp/recording.wav
> Recording WAVE '/tmp/recording.wav' : Signed 32 bit Little Endian, Rate
> 204800 Hz, Stereo
> Warning: rate is not accurate (requested = 204800Hz, got = 192000Hz)
>           please, try the plug plugin
> #
> # arecord -D hw:ADC8 --duration=5 -f S32_LE -c 2 -r 192000
> /tmp/recording.wav
> Recording WAVE '/tmp/recording.wav' : Signed 32 bit Little Endian, Rate
> 192000 Hz, Stereo
> #
>
>
> I also tried a "grep" on the kernel (i'm still on 2.3.7 though) source
> files on "192000" but found nothing that would limit the sample rate to
> that. I'm running out of ideas. How can I break this limit? Or where in
> the kernel can I find the part that calculates the max rate?
>
> Mike.

      reply	other threads:[~2013-04-17 11:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <516688D4.9040700@zonque.org>
2013-04-11 10:51 ` Enhance support for SigmaDSP chips Lars-Peter Clausen
2013-04-11 12:02   ` Daniel Mack
2013-04-11 12:53     ` Lars-Peter Clausen
2013-04-17  8:21       ` Sample rates above 192000 Mike Looijmans
2013-04-17 11:44         ` Mike Looijmans [this message]

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=516E8B35.1010200@topic.nl \
    --to=mike.looijmans@topic.nl \
    --cc=alsa-devel@alsa-project.org \
    /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