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: 3146351 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 81EBDBEEB2 for ; Wed, 6 Nov 2013 10:59:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4AAC12024F for ; Wed, 6 Nov 2013 10:59:24 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D8582015B for ; Wed, 6 Nov 2013 10:59:19 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ve0Cs-0003RK-Pr; Wed, 06 Nov 2013 10:19:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ve0CC-0002SN-7i; Wed, 06 Nov 2013 10:18:44 +0000 Received: from mail-ie0-f181.google.com ([209.85.223.181]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ve0Ax-0002F0-GC for linux-arm-kernel@lists.infradead.org; Wed, 06 Nov 2013 10:17:29 +0000 Received: by mail-ie0-f181.google.com with SMTP id ar20so16573946iec.26 for ; Wed, 06 Nov 2013 02:17:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X0VVzuQbksQBE7yNJ8/GeaeN2pm4ApgEiZDXg595zGM=; b=ApkW5KmuD5Ctqi4ftbUPBiLu7kQcZ6yBg32I2GyJu2pWM9dVB4qjYRn59DObIknF+U /rywYSb1BWZJF2MEW7znwcL6I1dYev8szAsJpJH6dB9yUlks9+F+6pGym77KzgiArJPu l2LuU5b6cjT1iK82uAUMWjx1G8Cn8goJuFyrrw3vmKtPFBTPNllUGwwSuJWaTA2o5SBa IQ6rbDe5fhjLCpWWzUOCnNycihg768be5uXgb3478Kp6gAezwOYYHowDUI7I2zimbDj/ zNbI2H1E6vTJ1S4aUKm5c0B5MRnLlPVoWbMkdlv23nmMoivGjEeEy3/JdziJNI8sujLf qQAA== X-Gm-Message-State: ALoCoQnrpLZ4l8mWm/TAXTwr5JWIVofbyX6r3OBqW0TX8MtDKZB/9gOTHrZpYRk9B6+63Yzp1R2R 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131106_051727_608541_F597AEEA X-CRM114-Status: GOOD ( 15.87 ) X-Spam-Score: -2.6 (--) Cc: linus.walleij@linaro.org, Mark Brown , Lee Jones , alsa-devel@alsa-project.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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 Acked-by: Linus Walleij --- 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; }