From patchwork Tue Nov 19 11:07:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21620 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC47623FB4 for ; Tue, 19 Nov 2013 11:08:19 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id e5sf12275937ggk.4 for ; Tue, 19 Nov 2013 03:08:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=c4Sby0bIphFag27OtFofw92wamVWsOwti9xBJQvIj+I=; b=FFfZUWt69lob6r97M2bMCCYeKh7b/JgSd19ycho6zf5o/kqssHLZ0LMUG4H/b6M5Wl xpx0StWUrnKGiMzkRF0dMgpEW0AcpBq8K3HzukSA0llHv20cg+mI3ASZZz1nM45gg0R1 tdySoNEwmT8WvY/CMbWQZogpkoQu9bVHOiZ8Sjr5rU2ITdQH8aTwxbpbR/eqlSCUeeVF lsN86NKDI0UqhY+dVlmPrn8b7CSGRNT2U8APp6Bb0r1alg3UmON+wZf80tNHXD6k8m5d EgCGe58HqCwg9mhXMNd2Op5qEuEuc3sl0r1W1LaBiPBW/CbuPouhRuGqv5UGu9o3AKxr kEYA== X-Gm-Message-State: ALoCoQmHDQ3X9pBtUl1WKURSUfWqI+72TboAXnYp0pG3J+6JJ9CjMylgIfUzWMh6YOtDc+nIEbEq X-Received: by 10.224.160.208 with SMTP id o16mr753244qax.8.1384859299556; Tue, 19 Nov 2013 03:08:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.2.225 with SMTP id 1ls3072666qex.61.gmail; Tue, 19 Nov 2013 03:08:19 -0800 (PST) X-Received: by 10.221.39.195 with SMTP id tn3mr20476043vcb.2.1384859299454; Tue, 19 Nov 2013 03:08:19 -0800 (PST) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id 1si7994288vel.112.2013.11.19.03.08.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 03:08:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id jy13so6135375veb.9 for ; Tue, 19 Nov 2013 03:08:19 -0800 (PST) X-Received: by 10.52.98.194 with SMTP id ek2mr17185570vdb.11.1384859299379; Tue, 19 Nov 2013 03:08:19 -0800 (PST) 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.220.174.196 with SMTP id u4csp269508vcz; Tue, 19 Nov 2013 03:08:19 -0800 (PST) X-Received: by 10.60.58.71 with SMTP id o7mr1197355oeq.51.1384859298615; Tue, 19 Nov 2013 03:08:18 -0800 (PST) Received: from mail-oa0-f48.google.com (mail-oa0-f48.google.com [209.85.219.48]) by mx.google.com with ESMTPS id t5si15127295oem.105.2013.11.19.03.08.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 03:08:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.219.48 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.219.48; Received: by mail-oa0-f48.google.com with SMTP id n16so8630919oag.35 for ; Tue, 19 Nov 2013 03:08:17 -0800 (PST) X-Received: by 10.182.29.98 with SMTP id j2mr8490151obh.30.1384859297866; Tue, 19 Nov 2013 03:08:17 -0800 (PST) Received: from localhost.localdomain (cpc15-aztw25-2-0-cust493.aztw.cable.virginm.net. [92.233.57.238]) by mx.google.com with ESMTPSA id d8sm34904086oeu.6.2013.11.19.03.08.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 03:08:17 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linus.walleij@linaro.org, Lee Jones , alsa-devel@alsa-project.org, Mark Brown Subject: [PATCH 07/10] ASoC: ux500: Store DMA data in the DAI differently in the pdata and DT case Date: Tue, 19 Nov 2013 11:07:46 +0000 Message-Id: <1384859269-19801-8-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1384859269-19801-1-git-send-email-lee.jones@linaro.org> References: <1384859269-19801-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.178 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: , In this patch we do two things. Firstly, instead of open coding the store of DMA data in to the DAI for later use, we use the API provided. Secondly we create and store similar DMA data for the DT case, only this time we use 'struct snd_dmaengine_dai_dma_data' which is provided by the core for this very reason. Cc: alsa-devel@alsa-project.org Cc: Mark Brown Acked-by: Linus Walleij Signed-off-by: Lee Jones --- sound/soc/ux500/ux500_msp_dai.c | 42 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index c6fb5cc..8d1b01f 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -17,12 +17,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include "ux500_msp_i2s.h" #include "ux500_msp_dai.h" @@ -654,16 +656,52 @@ static int ux500_msp_dai_trigger(struct snd_pcm_substream *substream, return ret; } +static int ux500_msp_dai_of_probe(struct snd_soc_dai *dai) +{ + struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); + struct snd_dmaengine_dai_dma_data *playback_dma_data; + struct snd_dmaengine_dai_dma_data *capture_dma_data; + + playback_dma_data = devm_kzalloc(dai->dev, + sizeof(*playback_dma_data), + GFP_KERNEL); + if (!playback_dma_data) + return -ENOMEM; + + capture_dma_data = devm_kzalloc(dai->dev, + sizeof(*capture_dma_data), + GFP_KERNEL); + if (!capture_dma_data) + return -ENOMEM; + + playback_dma_data->addr = drvdata->msp->playback_dma_data.tx_rx_addr; + capture_dma_data->addr = drvdata->msp->capture_dma_data.tx_rx_addr; + + playback_dma_data->maxburst = 4; + capture_dma_data->maxburst = 4; + + snd_soc_dai_init_dma_data(dai, playback_dma_data, capture_dma_data); + + return 0; +} + static int ux500_msp_dai_probe(struct snd_soc_dai *dai) { struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); + struct device_node *np = dai->dev->of_node; + int ret; - dai->playback_dma_data = &drvdata->msp->playback_dma_data; - dai->capture_dma_data = &drvdata->msp->capture_dma_data; + if (np) { + ret = ux500_msp_dai_of_probe(dai); + return ret; + } drvdata->msp->playback_dma_data.data_size = drvdata->slot_width; drvdata->msp->capture_dma_data.data_size = drvdata->slot_width; + snd_soc_dai_init_dma_data(dai, + &drvdata->msp->playback_dma_data, + &drvdata->msp->capture_dma_data); return 0; }