From patchwork Tue Jul 7 11:05:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Browaeys X-Patchwork-Id: 6732111 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 516899F38C for ; Tue, 7 Jul 2015 11:06:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 665DA206D7 for ; Tue, 7 Jul 2015 11:06:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA67E20713 for ; Tue, 7 Jul 2015 11:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756924AbbGGLF7 (ORCPT ); Tue, 7 Jul 2015 07:05:59 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:36197 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756886AbbGGLF6 (ORCPT ); Tue, 7 Jul 2015 07:05:58 -0400 Received: by wgbgr6 with SMTP id gr6so10641618wgb.3; Tue, 07 Jul 2015 04:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=hJmktn4JRHAFdCV0LcKEkl3JR9d3QzDYM8wSsG6pcHg=; b=HtKg9doV+BvO4hk9YPs5vj2AMgKY6FO2FqunAnUyWL7Nw29EG81I24PrLk9vprOBnY sEeys1R279g7ySYmpjjt/bUa79oEZq7ozR9hIRd7m0L3/x/D9DtdF+Trkke/haXw14jD zdRjW417A5qjcBMAKuW3ZDcyAvbyCVghQbA8jYf7d3QVRNnEMkquPDzE7XB+P+EUhDyj wHdfpm+AjDuS+TXpFdV8OgPdQG6oW7gHXuu536QrDshB+jAqt6taVVFEn71GP5WyDJOj M+l8IFoyjTG2iRrINU5e/Pxbb1/m1CZN4zJ0g/buyNDiLESCaqAJIEwhsSwzj7Oz0qhv IRQg== X-Received: by 10.180.19.69 with SMTP id c5mr64789465wie.13.1436267157480; Tue, 07 Jul 2015 04:05:57 -0700 (PDT) Received: from odroid.prahal.homelinux.net (ARouen-653-1-99-116.w82-126.abo.wanadoo.fr. [82.126.230.116]) by mx.google.com with ESMTPSA id wx9sm32808288wjb.6.2015.07.07.04.05.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Jul 2015 04:05:56 -0700 (PDT) From: Alban Browaeys X-Google-Original-From: Alban Browaeys To: Krzysztof Kozlowski , Vinod Koul , gabriel@unseen.is Cc: linux-samsung-soc@vger.kernel.org, dmaengine@vger.kernel.org, sylvester.nawrocki@gmail.com, Robert Baldyga , Marek Szyprowski , Alban Browaeys Subject: [PATCH] [RFC PATCH] dmaengine: pl330: residual - do not reset on last descriptor. Date: Tue, 7 Jul 2015 13:05:31 +0200 Message-Id: <1436267131-19556-1-git-send-email-prahal@yahoo.com> X-Mailer: git-send-email 2.1.4 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FORGED_MSGID_YAHOO, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Removed the residual rest to zero on last descriptor. Also set residue granularity to BURST instead of SEGMENT. This last item needs more investigation before I could give a rationale for it. Signed-off-by: Alban Browaeys Reported-by: gabriel@unseen.is Reported-by: Krzysztof Kozlowski Fixes: aee4d1fac887 ("dmaengine: pl330: improve pl330_tx_status() function") --- My older local version of the residue : https://github.com/prahal/linux/blob/odroid-3.19/drivers/dma/pl330.c#L2230 I took a second look at both and noticed that in the upstream version, I was not able to make sense of the "if desc->last then reset residual to zero" in the loop. Early tests gives a proper sound ouput with it removed. More tests are welcome, and it could be the flag change is wrong. There is also a bad interaction with pulseaudio when the buffer size is small : https://bugs.freedesktop.org/show_bug.cgi?id=84878. This might affect testing. --- drivers/dma/pl330.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index f513f77..0851f41 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2275,8 +2275,6 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, } break; } - if (desc->last) - residual = 0; } spin_unlock_irqrestore(&pch->lock, flags); @@ -2890,7 +2888,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pd->src_addr_widths = PL330_DMA_BUSWIDTHS; pd->dst_addr_widths = PL330_DMA_BUSWIDTHS; pd->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); - pd->residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; + pd->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; ret = dma_async_device_register(pd); if (ret) {