From patchwork Tue May 24 18:50:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Gardiner X-Patchwork-Id: 813262 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4OIrMoE005363 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 24 May 2011 18:53:43 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4OIpg4v014626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 24 May 2011 13:51:42 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id p4OIpexs013681; Tue, 24 May 2011 13:51:40 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 2BE278063A; Tue, 24 May 2011 13:51:15 -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 D6DE080632 for ; Tue, 24 May 2011 13:50:31 -0500 (CDT) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflp51.itg.ti.com (8.13.7/8.13.8) with ESMTP id p4OIoVWh022941 for ; Tue, 24 May 2011 13:50:31 -0500 (CDT) Received: from psmtp.com (na3sys009amx193.postini.com [74.125.149.174]) by white.ext.ti.com (8.13.7/8.13.7) with SMTP id p4OIoUre022874 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 24 May 2011 13:50:30 -0500 Received: from na3sys009aog112.obsmtp.com ([209.85.212.52]) (using TLSv1) by na3sys009amx193.postini.com ([74.125.148.10]) with SMTP; Tue, 24 May 2011 18:50:30 GMT Received: from mail-vw0-f52.google.com ([209.85.212.52]) (using TLSv1) by na3sys009aob112.postini.com ([74.125.148.12]) with SMTP ID DSNKTdv99TePXHkIZ+Hbrvwbhn0D6VF1/k1C@postini.com; Tue, 24 May 2011 11:50:30 PDT Received: by mail-vw0-f52.google.com with SMTP id 16so7629877vws.11 for ; Tue, 24 May 2011 11:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nanometrics.ca; s=google; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=ddxzvZ0QTmhr4A/p7ULge8HOXAfOG6jI1pRuqLGf4p8=; b=iLSCcLw1ej4ycAgBp8jz44F0O9c5qNfdX3Xc/Fxgj5lVp33lv0aELmYJwA5oY7m0wP +Bq8fgfCCw6PELQKRGIfAtc8lDKd2E92jbcBpMpy10boLpYJ2sMqG0CvN6pVKL6Jfx/X yfvwZIo9OpB0RtdjhhmCg0t57CxdZx14hI05U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=nanometrics.ca; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=LdceJ38PZI9ysQu3IQAqWM+f/UxhpXG5/op/NTmwa+rVVYoL/78Y85xvYyTSRpNt0t gAeJVUkbHOeK6a9aHGuq1sw7WL+yLhGBsOMAzezOTtmhX5p0ZaOqoBBvkCP/VamWmAzI XRZ1qu9kvCTMhWnRo2QBmp12xYDfDTsyLA0sk= Received: by 10.220.13.8 with SMTP id z8mr1096674vcz.275.1306263029676; Tue, 24 May 2011 11:50:29 -0700 (PDT) Received: from localhost.localdomain ([206.191.47.130]) by mx.google.com with ESMTPS id d18sm1646004vcs.40.2011.05.24.11.50.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 May 2011 11:50:28 -0700 (PDT) From: Ben Gardiner To: Mark Brown , Sekhar Nori , Liam Girdwood , alsa-devel@alsa-project.org, davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 5/6] ASoC: davinci-pcm: extract period elapsed functions Date: Tue, 24 May 2011 14:50:19 -0400 Message-Id: <370afaeca1dbc55213db8a8df1f8b0b46c076af3.1306258759.git.bengardiner@nanometrics.ca> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: References: X-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: Steven Faludi X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 24 May 2011 18:53:43 +0000 (UTC) Extract functions that modify the prtd->period member in preparation for conversion to BATCH mode playback. Signed-off-by: Ben Gardiner Reviewed-by: Steven Faludi --- sound/soc/davinci/davinci-pcm.c | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 5d9269a..fedca81 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -155,6 +155,22 @@ struct davinci_runtime_data { struct edmacc_param ram_params; }; +static void davinci_pcm_period_elapsed(struct snd_pcm_substream *substream) +{ + struct davinci_runtime_data *prtd = substream->runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + + prtd->period++; + if (unlikely(prtd->period >= runtime->periods)) + prtd->period = 0; +} + +static void davinci_pcm_period_reset(struct snd_pcm_substream *substream) +{ + struct davinci_runtime_data *prtd = substream->runtime->private_data; + + prtd->period = 0; +} /* * Not used with ping/pong */ @@ -216,9 +232,7 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) edma_set_transfer_params(link, acnt, fifo_level, count, fifo_level, ABSYNC); - prtd->period++; - if (unlikely(prtd->period >= runtime->periods)) - prtd->period = 0; + davinci_pcm_period_elapsed(substream); } static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data) @@ -591,7 +605,7 @@ static int davinci_pcm_prepare(struct snd_pcm_substream *substream) return 0; } - prtd->period = 0; + davinci_pcm_period_reset(substream); davinci_pcm_enqueue_dma(substream); /* Copy self-linked parameter RAM entry into master channel */