From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Aug 2018 13:45:34 +0200 (CEST) Received: from outils.crapouillou.net ([89.234.176.41]:40424 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23994702AbeHGLmnjrEUB (ORCPT ); Tue, 7 Aug 2018 13:42:43 +0200 From: Paul Cercueil To: Vinod Koul , Rob Herring , Mark Rutland , Ralf Baechle , Paul Burton , James Hogan , Zubair Lutfullah Kakakhel Cc: Paul Cercueil , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Daniel Silsby Subject: [PATCH v4 14/18] dmaengine: dma-jz4780: Further residue status fix Date: Tue, 7 Aug 2018 13:42:14 +0200 Message-Id: <20180807114218.20091-15-paul@crapouillou.net> In-Reply-To: <20180807114218.20091-1-paul@crapouillou.net> References: <20180807114218.20091-1-paul@crapouillou.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1533642162; bh=/+x6Hih2LqJF9rRR9YKSDlZBUCfXomzvcj+7FjvB06A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ktxQ+u1T4iAHHCWJ/C/QlTTnKhsgTnxDfoKobg6GWHNmEURm/01a6/kwtO0xJCmEgIw4cJAkbRS93c1A05GsuDsZHHy745ueMewXPtGla0UiGFryb2eb+Z8QefRa+ZxNbxfgdC5mwpAEcUAUFKKCv6envvXAn091G7Kkgg8SYMs= Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 65461 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: paul@crapouillou.net Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips From: Daniel Silsby Func jz4780_dma_desc_residue() expects the index to the next hw descriptor as its last parameter. Caller func jz4780_dma_tx_status(), however, applied modulus before passing it. When the current hw descriptor was last in the list, the index passed became zero. The resulting excess of reported residue especially caused problems with cyclic DMA transfer clients, i.e. ALSA AIC audio output, which rely on this for determining current DMA location within buffer. Combined with the recent and related residue-reporting fixes, spurious ALSA audio underruns on jz4770 hardware are now fixed. Signed-off-by: Daniel Silsby Signed-off-by: Paul Cercueil Tested-by: Mathieu Malaterre --- drivers/dma/dma-jz4780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) v2: No change v3: No change v4: Add my Signed-off-by diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index d03711834a44..351dc8268515 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c @@ -653,7 +653,7 @@ static enum dma_status jz4780_dma_tx_status(struct dma_chan *chan, to_jz4780_dma_desc(vdesc), 0); } else if (cookie == jzchan->desc->vdesc.tx.cookie) { txstate->residue = jz4780_dma_desc_residue(jzchan, jzchan->desc, - (jzchan->curr_hwdesc + 1) % jzchan->desc->count); + jzchan->curr_hwdesc + 1); } else txstate->residue = 0; -- 2.11.0