From patchwork Tue May 14 15:03:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 2568231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 507E7DF24C for ; Tue, 14 May 2013 17:39:56 +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 1UcGoc-0007v4-IE; Tue, 14 May 2013 15:07:11 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcGln-0000r6-Pk; Tue, 14 May 2013 15:04:03 +0000 Received: from mail-pd0-f172.google.com ([209.85.192.172]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UcGll-0000px-Dt for linux-arm-kernel@lists.infradead.org; Tue, 14 May 2013 15:04:02 +0000 Received: by mail-pd0-f172.google.com with SMTP id 6so507049pdd.17 for ; Tue, 14 May 2013 08:03:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=i3KaqT4bmEhoBlEZtHtP/H8ASqQqDE3Ywk1cubWW6KE=; b=aHmFmVILjHkyiezH8NNA7hn0mCY0m/ASt5f5kmu8+1noxfQdnGYsFtTRklItP2v2vA D70OKGleyo0acQBzAOUQjivtLMJyKaCm+sNA+/2ZMR60ByqgIz3nvLF1cujIpc8+OsVP /Qrv/9EVw5TDcXnsrivWOl4AUw5RXYZA7WoYFaHoz0R9UfE//Ivqb6yRk5L84q7tU2t+ WSSak1dDWOiERRlTlLB5oZXpg/WDK9ONNBoPp3aM36VHcdwsqfdeqMhvYvsFwSBoIfub YkYV+/YeiDWl3RATVtDhLA+6SAivphRlylAIhaQpGpq5Og43BtxNqkWYXTMgYHZUge4/ R1rg== X-Received: by 10.68.237.74 with SMTP id va10mr34530735pbc.76.1368543819064; Tue, 14 May 2013 08:03:39 -0700 (PDT) Received: from localhost.localdomain ([60.2.93.19]) by mx.google.com with ESMTPSA id k2sm19794085pat.7.2013.05.14.08.03.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 14 May 2013 08:03:38 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: vinod.koul@intel.com Subject: [PATCH] dmaengine: sirf: set dma residue based on the current dma transfer position Date: Tue, 14 May 2013 23:03:20 +0800 Message-Id: <1368543800-20430-1-git-send-email-Baohua.Song@csr.com> X-Mailer: git-send-email 1.7.4.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130514_110401_552688_BACB88A7 X-CRM114-Status: UNSURE ( 9.62 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (21cnbao[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.192.172 listed in list.dnswl.org] 0.8 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [60.2.93.19 listed in dnsbl.sorbs.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Rongjun Ying , workgroup.linux@csr.com, linux-arm-kernel@lists.infradead.org, Barry Song 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 From: Rongjun Ying read SIRFSOC_DMA_CH_ADDR register to get current dma transfer position, then update dma residue so that things like ALSA drivers work as ALSA drivers need the right residue value. Signed-off-by: Rongjun Ying Signed-off-by: Barry Song --- drivers/dma/sirf-dma.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c index 1765a0a..716b23e 100644 --- a/drivers/dma/sirf-dma.c +++ b/drivers/dma/sirf-dma.c @@ -466,12 +466,29 @@ static enum dma_status sirfsoc_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { + struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(chan); struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan); unsigned long flags; enum dma_status ret; + struct sirfsoc_dma_desc *sdesc; + int cid = schan->chan.chan_id; + unsigned long dma_pos; + unsigned long dma_request_bytes; + unsigned long residue; spin_lock_irqsave(&schan->lock, flags); + + sdesc = list_first_entry(&schan->active, struct sirfsoc_dma_desc, + node); + dma_request_bytes = (sdesc->xlen + 1) * (sdesc->ylen + 1) * + (sdesc->width * SIRFSOC_DMA_WORD_LEN); + ret = dma_cookie_status(chan, cookie, txstate); + dma_pos = readl_relaxed(sdma->base + cid * 0x10 + SIRFSOC_DMA_CH_ADDR) + << 2; + residue = dma_request_bytes - (dma_pos - sdesc->addr); + dma_set_residue(txstate, residue); + spin_unlock_irqrestore(&schan->lock, flags); return ret;