From patchwork Thu Dec 19 15:55:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 22646 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BDEFA23FCA for ; Thu, 19 Dec 2013 15:55:45 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf3119732pdi.6 for ; Thu, 19 Dec 2013 07:55:45 -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=xuP8cF9zPU16bxiZ9B45xszawrdxhpZrlRItjhlL9K4=; b=mm+pcaU+kMciqPGcJ1VSmV1YULy1YyflBeOEVHBU0JDX3J1nDqvlgqnKRmljRvq5D2 2plhlHC5PwumEsfh9R5FsOKbg4avwX9/D0/bq2al8SV2UYkuMlnUgw/+5nYJBIGwxkA5 W+RQ8Zf6wtgimg1KxJY9SVBfqD/XFr1PvlNwfUcOuSEbQy89IPxnape+EEoTwAGEaSqr 0/q1EAhwWhiW7BkBmdUSR6/ZNhkOzFlBhwn1Zn5V+qtpm+6TtAPYfTet990Mbe5Q75xf lRoRONi7PXK/aWP/j2CgaPhttFwrTIiqQW/mzP3MvcT/GyrTN70fI/rXVKqGrnBy+MFZ eb6g== X-Gm-Message-State: ALoCoQmxUXimjr+Rgw/suMTYk7p+2qnZFTVDwyYPvB2PaGf7J1JArb9yJ+a0EalCJZph12yyhA+O X-Received: by 10.66.142.11 with SMTP id rs11mr946377pab.37.1387468544947; Thu, 19 Dec 2013 07:55:44 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.62.199 with SMTP id a7ls428222qes.87.gmail; Thu, 19 Dec 2013 07:55:44 -0800 (PST) X-Received: by 10.220.17.131 with SMTP id s3mr930056vca.20.1387468544811; Thu, 19 Dec 2013 07:55:44 -0800 (PST) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id a6si778944vdp.65.2013.12.19.07.55.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 07:55:44 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.169 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.169; Received: by mail-ve0-f169.google.com with SMTP id c14so804786vea.28 for ; Thu, 19 Dec 2013 07:55:44 -0800 (PST) X-Received: by 10.52.229.39 with SMTP id sn7mr1151523vdc.2.1387468544731; Thu, 19 Dec 2013 07:55:44 -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.59.13.131 with SMTP id ey3csp331353ved; Thu, 19 Dec 2013 07:55:44 -0800 (PST) X-Received: by 10.194.62.8 with SMTP id u8mr2149295wjr.68.1387468543744; Thu, 19 Dec 2013 07:55:43 -0800 (PST) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx.google.com with ESMTPS id lg4si2426790wic.29.2013.12.19.07.55.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 07:55:43 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.182 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.182; Received: by mail-we0-f182.google.com with SMTP id q59so1278287wes.27 for ; Thu, 19 Dec 2013 07:55:43 -0800 (PST) X-Received: by 10.180.188.141 with SMTP id ga13mr3343135wic.55.1387468543334; Thu, 19 Dec 2013 07:55:43 -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 ko3sm279236wjb.23.2013.12.19.07.55.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 07:55:41 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linus.walleij@linaro.org, broonie@kernel.org, alsa-devel@alsa-project.org, Lee Jones Subject: [PATCH 08/11] ASoC: ux500: Store DMA data in the DAI differently in the pdata and DT case Date: Thu, 19 Dec 2013 15:55:05 +0000 Message-Id: <1387468508-12286-9-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1387468508-12286-1-git-send-email-lee.jones@linaro.org> References: <1387468508-12286-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.169 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. 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 bc042cc..f4d607a 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 msp_i2s_platform_data *pdata = dai->dev->platform_data; + int ret; - dai->playback_dma_data = &drvdata->msp->playback_dma_data; - dai->capture_dma_data = &drvdata->msp->capture_dma_data; + if (!pdata) { + 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; }