From patchwork Wed Sep 11 06:08:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Padmavathi Venna X-Patchwork-Id: 2870921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A373ABF43F for ; Wed, 11 Sep 2013 06:10:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4FF020381 for ; Wed, 11 Sep 2013 06:10:22 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8FC8520378 for ; Wed, 11 Sep 2013 06:10:21 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJdcQ-0000XT-6G; Wed, 11 Sep 2013 06:09:38 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJdcB-0003dC-P5; Wed, 11 Sep 2013 06:09:23 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJdbr-0003Z0-Er for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2013 06:09:06 +0000 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MSY0071S6C0AYP0@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2013 15:08:38 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 80.AD.22755.4E800325; Wed, 11 Sep 2013 15:08:36 +0900 (KST) X-AuditID: cbfee68f-b7f656d0000058e3-f3-523008e4d9d0 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 81.B5.05832.4E800325; Wed, 11 Sep 2013 15:08:36 +0900 (KST) Received: from padma-linuxpc.sisodomain.com ([107.108.83.35]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MSY00EHK6E1FP70@mmp2.samsung.com>; Wed, 11 Sep 2013 15:08:36 +0900 (KST) From: Padmavathi Venna To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, padma.v@samsung.com, padma.kvr@gmail.com Subject: [PATCH 2/3] ARM: SAMSUNG: Add residue DMA operation. Date: Wed, 11 Sep 2013 11:38:04 +0530 Message-id: <1378879685-5352-3-git-send-email-padma.v@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1378879685-5352-1-git-send-email-padma.v@samsung.com> References: <1378879685-5352-1-git-send-email-padma.v@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGIsWRmVeSWpSXmKPExsWyRsSkWvcJh0GQwa/fqhZ/Jx1jt5j68Amb xfwTt9gsehdcZbPY9Pgaq8WM8/uYLL5u2c1o0b5sDqvF75vf2SwurvjCZPGybz+LA7fH71+T GD1mN1xk8dg56y67x+I9L5k8Nq3qZPPYvKTeo2/LKkaPz5vkAjiiuGxSUnMyy1KL9O0SuDJu TN3EXvBIsOLv3fAGxld8XYwcHBICJhI7upm7GDmBTDGJC/fWs3UxcnEICSxllPjSMYEFImEi sez2X6jEdEaJEx3/2CGcHiaJJ40XmUEmsQnoSLScdQFpEBEol7j/8AErSA2zwCRGicu3FrKC JIQFbCUePtoANpVFQFVi3+317CA2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EiurUovy44tKc1KLDzEmAx01kVlKNDkf mCLySuINjU3MTY1NLU0sTMwsSRNWEuc92GodKCSQnliSmp2aWpBaBLOFiYNTqoHRR9f6RtrH R99qjv5LEd3H7KmTnaDd5qOsnn1L7OICu0BfvvbvdvfKGL7O4fodlR+XfCEtrq5R5llG4Lyf 237pnF05d+UUh8i19dIfVpX+uCH6JV4lsuf2/RtxIQf9rco0M2a+c5lv+LZ66vmt/FM7Lpxq /GrOr1Cgf81j/h1TEXarTTdPvF+oxFKckWioxVxUnAgAznKi1AcDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130911_020903_839802_558CD6A6 X-CRM114-Status: GOOD ( 14.16 ) X-Spam-Score: -7.6 (-------) Cc: kgene.kim@samsung.com, arnd@arndb.de, sbkim73@samsung.com, vinod.koul@intel.com, broonie@kernel.org, dgreid@chromium.org, olofj@chromium.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dylan Reid Add a new dma op, residue. It returns the count of bytes left to be transfered by the dma. This is useful for Audio, the Samsung dma ASoC layer will use this to provide an accurate update to the hw_ptr that is exported to user space. ASoC wants large transfers to reduce the amount of wakeups, but needs to be able to know how much audio has been played for latency estimates. Signed-off-by: Dylan Reid Reviewed-by: Olof Johansson Signed-off-by: Padmavathi Venna --- arch/arm/plat-samsung/dma-ops.c | 14 ++++++++++++++ arch/arm/plat-samsung/include/plat/dma-ops.h | 1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-samsung/dma-ops.c b/arch/arm/plat-samsung/dma-ops.c index ec0d731..bfc6c1a 100644 --- a/arch/arm/plat-samsung/dma-ops.c +++ b/arch/arm/plat-samsung/dma-ops.c @@ -122,6 +122,19 @@ static inline int samsung_dmadev_flush(unsigned ch) return dmaengine_terminate_all((struct dma_chan *)ch); } +static unsigned samsung_dmadev_residue(unsigned ch) +{ + struct dma_chan *chan = (struct dma_chan *)ch; + enum dma_status ret; + struct dma_tx_state state; + + ret = chan->device->device_tx_status(chan, chan->cookie, &state); + if (ret == DMA_SUCCESS) /* Transfer complete. */ + return 0; + + return state.residue; +} + static struct samsung_dma_ops dmadev_ops = { .request = samsung_dmadev_request, .release = samsung_dmadev_release, @@ -131,6 +144,7 @@ static struct samsung_dma_ops dmadev_ops = { .started = NULL, .flush = samsung_dmadev_flush, .stop = samsung_dmadev_flush, + .residue = samsung_dmadev_residue, }; void *samsung_dmadev_get_ops(void) diff --git a/arch/arm/plat-samsung/include/plat/dma-ops.h b/arch/arm/plat-samsung/include/plat/dma-ops.h index ce6d763..82eac53 100644 --- a/arch/arm/plat-samsung/include/plat/dma-ops.h +++ b/arch/arm/plat-samsung/include/plat/dma-ops.h @@ -47,6 +47,7 @@ struct samsung_dma_ops { int (*started)(unsigned ch); int (*flush)(unsigned ch); int (*stop)(unsigned ch); + unsigned (*residue)(unsigned ch); }; extern void *samsung_dmadev_get_ops(void);