Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Adam Rosenberg <adam@alcorn.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: Constraining the number of frames per period
Date: Fri, 22 Oct 2010 08:38:11 +0200	[thread overview]
Message-ID: <4CC13153.7040002@ladisch.de> (raw)
In-Reply-To: <AANLkTikAf+o7e-=hosi+dwEywK-Mt5UTvJtqzT=i_5Fz@mail.gmail.com>

Adam Rosenberg wrote:
> I am trying to constrain the number of frames per period (not the number of
> periods).  The DMA transfer creates an interrupt every 512 frames (1 frame =
> 16 channels with 32bits per channel) .  I am having a difficult time
> understanding how to properly write the ALSA driver so that it will work
> with many different formats and between 1 and 2 channels.

Using period_bytes_min/max doesn't work for this situation; these fields
are intended for hardware that has constraints on the number of bytes.

Set the snd_pcm_hardware fields so that all sample formats are supported.
In the PCM devive's open callback, add another constraint by calling
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 512, 512);

>     // the max number of bytes in one PCM stream
>     // must allow for a minimum of 4 periods with
>     // 512 frames per period and up to 2 channels of
>     // 32 bit data per frame
>     .buffer_bytes_max = 32768,  // this value allows 8 periods of the max frame size

Are the minimum 4 and maximum 8 periods actual hardware constraints?


Regards,
Clemens

  reply	other threads:[~2010-10-22  6:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 14:43 Constraining the number of frames per period Adam Rosenberg
2010-10-21 14:50 ` Jaroslav Kysela
2010-10-21 21:15   ` Adam Rosenberg
2010-10-22  6:38     ` Clemens Ladisch [this message]
2010-10-22 20:45       ` Adam Rosenberg
2010-10-25  7:48         ` Clemens Ladisch

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=4CC13153.7040002@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=adam@alcorn.com \
    --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