From patchwork Wed Jun 12 07:57:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 17814 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f200.google.com (mail-ye0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3769723903 for ; Wed, 12 Jun 2013 07:58:25 +0000 (UTC) Received: by mail-ye0-f200.google.com with SMTP id r9sf8372991yen.7 for ; Wed, 12 Jun 2013 00:58:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=EGNf8jAwgYZQBFKURRXQCmIgvY0NyKWgankeIz9UeME=; b=KzKkpcAYetp+oKfQ30Iow7kBTbH4MjEIaIOFLPuiRlFds6WaZSm+sbJXFWMOjeTH39 aOJI2f8O9usvnN4ybgH0msXn3Tex4q39X+zu2ZnUGJenPhz/hvBzIcn3fZtVHErHPFbs GBaQHmCj7zWLYfIE5kZQfUp+COKPM9RVlERutSeipjfyfFHqG/BKpcEhdm287zV0IYcj B3qtPtMVQ1rMjHhkvOvRDuGsfZ2bI7BS7Q7wouzFVYPWE4EkXDNUJwUrL4spGxNSWjF6 OpYFp2ufQONiVaNHKPrTOX/EuIl7BNVlDaK2QpMgPuW0jF986egWJrAlRaArnwqACF/y rH/g== X-Received: by 10.236.70.170 with SMTP id p30mr11013040yhd.5.1371023904975; Wed, 12 Jun 2013 00:58:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.39.3 with SMTP id l3ls1249397qek.62.gmail; Wed, 12 Jun 2013 00:58:24 -0700 (PDT) X-Received: by 10.220.112.76 with SMTP id v12mr9338202vcp.63.1371023904800; Wed, 12 Jun 2013 00:58:24 -0700 (PDT) Received: from mail-vb0-x233.google.com (mail-vb0-x233.google.com [2607:f8b0:400c:c02::233]) by mx.google.com with ESMTPS id bj6si8249138vcb.7.2013.06.12.00.58.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Jun 2013 00:58:24 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::233 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::233; Received: by mail-vb0-f51.google.com with SMTP id x17so5956137vbf.10 for ; Wed, 12 Jun 2013 00:58:24 -0700 (PDT) X-Received: by 10.220.192.138 with SMTP id dq10mr9400030vcb.23.1371023904628; Wed, 12 Jun 2013 00:58:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.191.99 with SMTP id gx3csp134434vec; Wed, 12 Jun 2013 00:58:22 -0700 (PDT) X-Received: by 10.15.111.75 with SMTP id ci51mr20386277eeb.7.1371023902303; Wed, 12 Jun 2013 00:58:22 -0700 (PDT) Received: from mail-ea0-x22d.google.com (mail-ea0-x22d.google.com [2a00:1450:4013:c01::22d]) by mx.google.com with ESMTPS id w7si14210961eel.74.2013.06.12.00.58.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Jun 2013 00:58:22 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4013:c01::22d is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=2a00:1450:4013:c01::22d; Received: by mail-ea0-f173.google.com with SMTP id g15so6607900eak.32 for ; Wed, 12 Jun 2013 00:58:21 -0700 (PDT) X-Received: by 10.14.180.4 with SMTP id i4mr11761315eem.148.1371023901776; Wed, 12 Jun 2013 00:58:21 -0700 (PDT) Received: from localhost ([2a01:2003:1:1e74:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPSA id y44sm35093628eel.10.2013.06.12.00.58.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 12 Jun 2013 00:58:21 -0700 (PDT) From: Fabio Baltieri To: Mark Brown Cc: Liam Girdwood , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Linus Walleij , Lee Jones , Ola Lilja , Fabio Baltieri Subject: [PATCH 3/3] ASoC: ux500: Add DMA slave config prepare routine Date: Wed, 12 Jun 2013 09:57:59 +0200 Message-Id: <1371023879-21884-4-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1371023879-21884-1-git-send-email-fabio.baltieri@linaro.org> References: <1371023879-21884-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQmhSlmo0QK9rNTuBgrbJjzQ8WZhc0PNjzgWyqhPuQsa2ygwcBT0WdHzEfA9Y310LbgOvbJi X-Original-Sender: fabio.baltieri@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::233 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Implement a DMA slave config prepare routine, as until now the MSP driver depended on the DMA controller completing the channel configuration on its own, but this is not the case anymore since the recent DMA driver updates. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/ux500_pcm.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index b6e5ae2..5f01c19 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c @@ -103,10 +103,40 @@ static struct dma_chan *ux500_pcm_request_chan(struct snd_soc_pcm_runtime *rtd, return snd_dmaengine_pcm_request_channel(stedma40_filter, dma_cfg); } +static int ux500_pcm_prepare_slave_config(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct dma_slave_config *slave_config) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct ux500_msp_dma_params *dma_params; + struct stedma40_chan_cfg *dma_cfg; + int ret; + + dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); + dma_cfg = dma_params->dma_cfg; + + ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config); + if (ret) + return ret; + + slave_config->dst_maxburst = 4; + slave_config->dst_addr_width = dma_cfg->dst_info.data_width; + slave_config->src_maxburst = 4; + slave_config->src_addr_width = dma_cfg->src_info.data_width; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + slave_config->dst_addr = dma_params->tx_rx_addr; + else + slave_config->src_addr = dma_params->tx_rx_addr; + + return 0; +} + static const struct snd_dmaengine_pcm_config ux500_dmaengine_pcm_config = { .pcm_hardware = &ux500_pcm_hw, .compat_request_channel = ux500_pcm_request_chan, .prealloc_buffer_size = 128 * 1024, + .prepare_slave_config = ux500_pcm_prepare_slave_config, }; int ux500_pcm_register_platform(struct platform_device *pdev)