Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755003AbYCNNjx (ORCPT ); Fri, 14 Mar 2008 09:39:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752405AbYCNNjp (ORCPT ); Fri, 14 Mar 2008 09:39:45 -0400 Received: from mx1.suse.de ([195.135.220.2]:49594 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752284AbYCNNjo (ORCPT ); Fri, 14 Mar 2008 09:39:44 -0400 Date: Fri, 14 Mar 2008 14:39:42 +0100 Message-ID: From: Takashi Iwai To: Atsushi Nemoto 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 In-Reply-To: <20080314.222932.74752532.anemo@mba.ocn.ne.jp> References: <20080310.234306.15242180.anemo@mba.ocn.ne.jp> <20080314104445.32f4da40@hskinnemo-gx620.norway.atmel.com> <20080314.222932.74752532.anemo@mba.ocn.ne.jp> User-Agent: Wanderlust/2.15.5 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta28) (fuki) (+CVS-20070806) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1379 Lines: 39 At Fri, 14 Mar 2008 22:29:32 +0900 (JST), Atsushi Nemoto wrote: > > On Fri, 14 Mar 2008 10:44:45 +0100, Haavard Skinnemoen 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/