From patchwork Wed Nov 6 10:16:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21374 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6FBEE20DB9 for ; Wed, 6 Nov 2013 10:17:09 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id q4sf17143438qcx.10 for ; Wed, 06 Nov 2013 02:17:09 -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=X0VVzuQbksQBE7yNJ8/GeaeN2pm4ApgEiZDXg595zGM=; b=fNUCqV8PrIzsiqWG206rbY7+Pqf506TXyMtPX9lVxOgy1QR/Qzv0hMTM4vnArfSDNK om9XHoxKKhQ7tORq82k8W9E1HKnSDfExZlDqGmRuDEUnsg6AnOIY8wj8CpVopfdAfzdS Cv/Gbf73RnMYpX9EbElocuQ/JwR3XM+ryHZ4A1GccFmHmk2AzmawfJneWTDSWShrFdUi zm1KkeOvFzwexqygb9aeTwbDL2K3j0lBGyTAa+fR281L6ddb4l+LONzAi5KJeYdrbLdy y3nldGxC6Ahq5RtkgpQTd31Nd7Xg6GEKRpe+Oo4aBGOZ30FZgRTAeeEB79K1u1lcXMw+ 8pQQ== X-Gm-Message-State: ALoCoQnDBzYEBKsJ5iVPZrfllH2k8ZyowdfbjKLPuNIeXMza3jYw/4ztQGYZ2OLFEUvVAJNYvbg+ X-Received: by 10.52.64.177 with SMTP id p17mr1346359vds.3.1383733029306; Wed, 06 Nov 2013 02:17:09 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.132.73 with SMTP id os9ls573807qeb.98.gmail; Wed, 06 Nov 2013 02:17:09 -0800 (PST) X-Received: by 10.58.144.168 with SMTP id sn8mr1698212veb.33.1383733029201; Wed, 06 Nov 2013 02:17:09 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id gw1si8172898vcb.62.2013.11.06.02.17.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 02:17:09 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 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.170; Received: by mail-ve0-f170.google.com with SMTP id oy12so3409831veb.15 for ; Wed, 06 Nov 2013 02:17:09 -0800 (PST) X-Received: by 10.58.23.33 with SMTP id j1mr1668555vef.27.1383733029102; Wed, 06 Nov 2013 02:17:09 -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 u4csp273222vcz; Wed, 6 Nov 2013 02:17:08 -0800 (PST) X-Received: by 10.50.17.9 with SMTP id k9mr1789347igd.3.1383733028543; Wed, 06 Nov 2013 02:17:08 -0800 (PST) Received: from mail-ie0-f175.google.com (mail-ie0-f175.google.com [209.85.223.175]) by mx.google.com with ESMTPS id hf3si3793323icc.66.2013.11.06.02.17.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 02:17:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.223.175 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.223.175; Received: by mail-ie0-f175.google.com with SMTP id aq17so17402561iec.34 for ; Wed, 06 Nov 2013 02:17:08 -0800 (PST) X-Received: by 10.50.61.205 with SMTP id s13mr1764580igr.29.1383733027959; Wed, 06 Nov 2013 02:17:07 -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 ka1sm13308397igb.7.2013.11.06.02.17.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 02:17:07 -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 11/13] ASoC: ux500: Store DMA data in the DAI differently in the pdata and DT case Date: Wed, 6 Nov 2013 10:16:23 +0000 Message-Id: <1383732985-18928-12-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1383732985-18928-1-git-send-email-lee.jones@linaro.org> References: <1383732985-18928-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.170 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 Signed-off-by: Lee Jones --- sound/soc/ux500/ux500_msp_dai.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index c6fb5cc..35187d8 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,51 @@ 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 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; }