From patchwork Thu Aug 6 23:55:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 39739 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n76NuKhm010303 for ; Thu, 6 Aug 2009 23:56:20 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n76NuFDm031934 for ; Thu, 6 Aug 2009 18:56:20 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n76NuELM021370 for ; Thu, 6 Aug 2009 18:56:14 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id D0FDE80790 for ; Thu, 6 Aug 2009 18:55:57 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id C1DF380627 for ; Thu, 6 Aug 2009 18:55:35 -0500 (CDT) Received: from white.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id n76NtZ2H017754 for ; Thu, 6 Aug 2009 18:55:35 -0500 (CDT) Received: from mail181-tx2-R.bigfish.com (mail-tx2.bigfish.com [65.55.88.114]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id n76NtUGc019017 for ; Thu, 6 Aug 2009 18:55:35 -0500 Received: from mail181-tx2 (localhost.localdomain [127.0.0.1]) by mail181-tx2-R.bigfish.com (Postfix) with ESMTP id F2B0FF904AA for ; Thu, 6 Aug 2009 23:55:29 +0000 (UTC) X-SpamScore: 0 X-BigFish: vps0(zzzz1202hzzz2dh64h) X-Spam-TCS-SCL: 3:0 X-MS-Exchange-Organization-Antispam-Report: OrigIP: 63.231.195.113; Service: EHS Received: by mail181-tx2 (MessageSwitch) id 1249602928249729_26433; Thu, 6 Aug 2009 23:55:28 +0000 (UCT) Received: from mpls-qmqp-02.inet.qwest.net (mpls-qmqp-02.inet.qwest.net [63.231.195.113]) by mail181-tx2.bigfish.com (Postfix) with ESMTP id 2D41D15D804D for ; Thu, 6 Aug 2009 23:55:28 +0000 (UTC) Received: from localhost (unknown [67.42.45.38]) by mpls-qmqp-02.inet.qwest.net (Postfix) with ESMTP id 7B2EF53BDB3; Thu, 6 Aug 2009 23:55:24 +0000 (UTC) Received: by localhost (Postfix, from userid 1002) id 9E7405880F6; Thu, 6 Aug 2009 16:55:35 -0700 (MST) From: Troy Kisky To: davinci-linux-open-source@linux.davincidsp.com Date: Thu, 6 Aug 2009 16:55:32 -0700 Message-Id: <1249602935-1267-2-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1249602935-1267-1-git-send-email-troy.kisky@boundarydevices.com> References: <1249602935-1267-1-git-send-email-troy.kisky@boundarydevices.com> Cc: alsa-devel@alsa-project.org, broonie@sirena.org.uk Subject: [PATCH 2/5] ASoC: DaVinci: pcm, constrain buffer size to multiple of period X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com The dma setup code assumes that the buffer size is a multiple of the period size. Signed-off-by: Troy Kisky --- sound/soc/davinci/davinci-pcm.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index fbda8ef..a294711 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -244,6 +244,11 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream) int ret = 0; snd_soc_set_runtime_hwparams(substream, &davinci_pcm_hardware); + /* ensure that buffer size is a multiple of period size */ + ret = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + if (ret < 0) + return ret; prtd = kzalloc(sizeof(struct davinci_runtime_data), GFP_KERNEL); if (prtd == NULL)