From patchwork Fri Mar 11 11:06:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Francois Moine X-Patchwork-Id: 8564951 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 06287C0553 for ; Fri, 11 Mar 2016 11:35:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2679E202B8 for ; Fri, 11 Mar 2016 11:35:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D6D420272 for ; Fri, 11 Mar 2016 11:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752166AbcCKLfL (ORCPT ); Fri, 11 Mar 2016 06:35:11 -0500 Received: from smtp5-g21.free.fr ([212.27.42.5]:40638 "EHLO smtp5-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752032AbcCKLfL (ORCPT ); Fri, 11 Mar 2016 06:35:11 -0500 Received: from localhost (unknown [IPv6:2a01:e35:2f5c:9de0:6b55:87da:4920:b782]) by smtp5-g21.free.fr (Postfix) with ESMTP id 3A811D4812F; Fri, 11 Mar 2016 12:31:11 +0100 (CET) X-Mailbox-Line: From f93e8df4615322cb4b0c54983578096fce2ad0d5 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Jean-Francois Moine Date: Fri, 11 Mar 2016 12:06:53 +0100 Subject: [PATCH v2 4/5] dmaengine: sun6i: Set system values to memory burst and bus width To: Vinod Koul , Maxime Ripard , Chen-Yu Tsai Cc: Jens Kuske , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org 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,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 When defining the DMA transfer, the sound PCM DMA engine sets only the burst and bus width values of the device. This was making the audio transfers to be rejected because of invalid values on the memory side. Signed-off-by: Jean-Francois Moine --- drivers/dma/sun6i-dma.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index 7c98c0d..0563fb3 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c @@ -504,6 +504,22 @@ static irqreturn_t sun6i_dma_interrupt(int irq, void *dev_id) return ret; } +static void sanitize_config(struct dma_slave_config *sconfig, + enum dma_transfer_direction direction) +{ + if (direction == DMA_MEM_TO_DEV) { + if (sconfig->src_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) + sconfig->src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + if (!sconfig->src_maxburst) + sconfig->src_maxburst = 8; + } else { // DMA_DEV_TO_MEM + if (sconfig->dst_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) + sconfig->dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + if (!sconfig->dst_maxburst) + sconfig->dst_maxburst = 8; + } +} + static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, size_t len, unsigned long flags) @@ -585,6 +601,8 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_slave_sg( if (!txd) return NULL; + sanitize_config(sconfig, dir); + for_each_sg(sgl, sg, sg_len, i) { v_lli = dma_pool_alloc(sdev->pool, GFP_NOWAIT, &p_lli); if (!v_lli)