From patchwork Wed Jun 10 08:17:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 6577601 Return-Path: X-Original-To: patchwork-dmaengine@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 D4A789F3D1 for ; Wed, 10 Jun 2015 08:17:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 08B30205E4 for ; Wed, 10 Jun 2015 08:17:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 34AFE205C1 for ; Wed, 10 Jun 2015 08:17:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754179AbbFJIR2 (ORCPT ); Wed, 10 Jun 2015 04:17:28 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:23806 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754167AbbFJIRY (ORCPT ); Wed, 10 Jun 2015 04:17:24 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NPP00FWTZ0XKR10@mailout1.w1.samsung.com>; Wed, 10 Jun 2015 09:17:21 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-f0-5577f291210a Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 4B.50.05269.192F7755; Wed, 10 Jun 2015 09:17:21 +0100 (BST) Received: from localhost.localdomain ([10.252.80.64]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NPP00B0IZ0KV500@eusync4.samsung.com>; Wed, 10 Jun 2015 09:17:20 +0100 (BST) From: Krzysztof Kozlowski To: Vinod Koul , Dan Williams , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: gabriel@unseen.is, Marek Szyprowski , Laurent Pinchart , Maxime Ripard , Krzysztof Kozlowski , stable@vger.kernel.org Subject: [RFT PATCH] dmaengine: Fix choppy sound because of unimplemented resume Date: Wed, 10 Jun 2015 17:17:07 +0900 Message-id: <1433924227-28499-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Nd2Jn8pDDX6cYbSYPvUCo8XqqX9Z LeY/6GC1eP3C0GJi0x0Wi8u75rBZrD1yl91i66a9zBYLNj5itHjZt5/FgcvjyaaLjB6zO2ay eize85LJo2/LKkaPaes/snt83iQXwBbFZZOSmpNZllqkb5fAlfH0wmfWgskCFav3/WFsYDzA 28XIwSEhYCLx/5NrFyMnkCkmceHeerYuRi4OIYGljBJLjrdCOf8ZJSaeeMsMUsUmYCyxefkS NhBbRKCTUeLJiXqQImaQohN7ToIlhAUCJN41trOA2CwCqhKrln5jBbF5Bdwlbsw4xQixTk7i 5LHJrBMYuRcwMqxiFE0tTS4oTkrPNdIrTswtLs1L10vOz93ECAmmrzsYlx6zOsQowMGoxMPr kF0eKsSaWFZcmXuIUYKDWUmE98wjoBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHembvehwgJpCeW pGanphakFsFkmTg4pRoY15e5S68K8OOYP0vl2oMSRY74u127j9/gedw31fqdWPaWlG+NcsfO +5WbLo6fc3KV+MfO9a/eeqrPOJWWW1ab5P5YZNPNu6uirX//nMnwdlrwDtVAFvVdS9xLI38e e1P9mafKM4B7m/2upjDDJxK923V1uvoNWoWW1bqb3Wyavdil4UjyUwVbJZbijERDLeai4kQA FDDCRyICAAA= Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Some drivers implement only pause operation (no resuming). Example is pl330 where pause is needed for getting residuum. pl330 does not support resume operation, transfer must be stopped after pause. However for slaves this is exposed always as "pause and resume" which introduces subtle errors on Odroid U3 board (Exynos4412 with pl330). After adding pause function to pl330 driver the audio playback (utilizing DMA) gets choppy after some time (approximately 24 hours). Fix this by exposing "cmd_pause" if and only if pause and resume are implemented. Signed-off-by: Krzysztof Kozlowski Reported-by: gabriel@unseen.is Reported-by: Marek Szyprowski Cc: Fixes: 88987d2c7534 ("dmaengine: pl330: add DMA_PAUSE feature") Acked-by: Maxime Ripard --- Thanks for Marek Szyprowski for nailing the issue. Few drivers implement only pause (pl330, nbpfaxi, ipu_idmac). The fix was not extensively tested. I tested this only on pl330 with dmatest which actually does not pause the transfer. I am kindly asking for testing for other use cases, especially UART transfer and sound playback. Testing on these two other devices (nbpfaxi and ipu_idmac) could be useful as well. --- drivers/dma/dmaengine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 855dd6ccf09d..8208abe4e1d3 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -494,7 +494,11 @@ int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) caps->directions = device->directions; caps->residue_granularity = device->residue_granularity; - caps->cmd_pause = !!device->device_pause; + /* + * Some devices implement only pause (e.g. to get residuum) but no + * resume. However cmd_pause is advertised as pause AND resume. + */ + caps->cmd_pause = !!(device->device_pause && device->device_resume); caps->cmd_terminate = !!device->device_terminate_all; return 0;