public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: haavard.skinnemoen@atmel.com, linux-kernel@vger.kernel.org,
	hcegtvedt@atmel.com, avictor.za@gmail.com
Subject: Re: [PATCH] at73c213: Fix DMA size at the end of DMA buffer
Date: Fri, 14 Mar 2008 14:39:42 +0100	[thread overview]
Message-ID: <s5hzlt1s9up.wl%tiwai@suse.de> (raw)
In-Reply-To: <20080314.222932.74752532.anemo@mba.ocn.ne.jp>

At Fri, 14 Mar 2008 22:29:32 +0900 (JST),
Atsushi Nemoto wrote:
> 
> On Fri, 14 Mar 2008 10:44:45 +0100, Haavard Skinnemoen <haavard.skinnemoen@atmel.com> wrote:
> > > +		size = runtime->period_size * runtime->channels;
> > > +		if (next_period == runtime->periods - 1)
> > > +			size += (runtime->buffer_size % runtime->period_size)
> > > +				* runtime->channels;
> > 
> > Ow. That looks expensive. Isn't there any way we can force the client
> > to select sane values of buffer_size and period_size?
> 
> Well, I suppose it is not _too_ expensive. :)
> 
> > It seems like a reasonable demand that buffer_size is a multiple of
> > period_size, doesn't it?
> 
> But actually it can happen.  And I gave up understanding how are these
> parameters determined...  If there were any way the driver can enforce
> that constraint, it would be better fix.
> 
> Iwai-san, any comments from alsa guru?

Add the following constraint in the open callback:

	err = snd_pcm_hw_constraint_integer(runtime,
					SNDRV_PCM_HW_PARAM_PERIODS);
	if (err < 0)
		return err;

This will guarantee that the period size fits with the buffer size.


Takashi

  reply	other threads:[~2008-03-14 13:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-10 14:43 [PATCH] at73c213: Fix DMA size at the end of DMA buffer Atsushi Nemoto
2008-03-14  9:44 ` Haavard Skinnemoen
2008-03-14 13:29   ` Atsushi Nemoto
2008-03-14 13:39     ` Takashi Iwai [this message]
2008-03-17 13:00       ` Atsushi Nemoto
2008-03-17 13:21         ` Takashi Iwai
2008-03-17 13:32           ` Atsushi Nemoto
2008-03-17 13:54             ` Takashi Iwai

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=s5hzlt1s9up.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=avictor.za@gmail.com \
    --cc=haavard.skinnemoen@atmel.com \
    --cc=hcegtvedt@atmel.com \
    --cc=linux-kernel@vger.kernel.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