From patchwork Wed Nov 6 10:16:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21373 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f199.google.com (mail-gg0-f199.google.com [209.85.161.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED4AD20DB9 for ; Wed, 6 Nov 2013 10:17:07 +0000 (UTC) Received: by mail-gg0-f199.google.com with SMTP id e27sf7062243gga.10 for ; Wed, 06 Nov 2013 02:17:07 -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=deLPsxgVbo2J8CjGJagCND3sNov4gXOHWLMB5CqAhmA=; b=JoDDi/UcVcC4PjMPicWjBt6P+uaIhVozPwloDRjTsmPp8IGPVJJePiCOroEJsN5Bgu X5I95mWmnWQsvEUT3dhBhsmJPjUlUDBc4MF+10ZDFn6McRHqCy0wBlm2Mop69FkHXmfp bVj99SgmUT71XIgk1L6PWX/8FDRr/P7n8PScoPig0vGOA0N0pqRxe0QAEfMPw5NOniiv MKBanseoyJLBGGIplts76g37zB0FbFMFcMPmTE+Qucx1yoo2f1gL8C63EBBLCdIEq6Mi BPSHv/d6XoO68Z11ahgfy3f2uG1XXAdvO0GCrSuaDGow6CgPVCtrEgW3OYbNqxXmdWkp 10Ug== X-Gm-Message-State: ALoCoQllnTMAuodLdAeD6PjVV8qHYPLW230TD1qY2F+RYK3oL4nAL1EnV9yk71vVIYqhyAVb9XCU X-Received: by 10.236.54.68 with SMTP id h44mr623207yhc.21.1383733027340; Wed, 06 Nov 2013 02:17:07 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.96.101 with SMTP id dr5ls626571qeb.80.gmail; Wed, 06 Nov 2013 02:17:07 -0800 (PST) X-Received: by 10.220.186.202 with SMTP id ct10mr1775938vcb.14.1383733027184; Wed, 06 Nov 2013 02:17:07 -0800 (PST) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id hs8si6832561veb.98.2013.11.06.02.17.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 02:17:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.181 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.181; Received: by mail-ve0-f181.google.com with SMTP id jz11so3342052veb.26 for ; Wed, 06 Nov 2013 02:17:07 -0800 (PST) X-Received: by 10.58.168.205 with SMTP id zy13mr1719867veb.19.1383733027115; Wed, 06 Nov 2013 02:17:07 -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 u4csp273216vcz; Wed, 6 Nov 2013 02:17:06 -0800 (PST) X-Received: by 10.50.13.9 with SMTP id d9mr19734937igc.25.1383733026489; Wed, 06 Nov 2013 02:17:06 -0800 (PST) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by mx.google.com with ESMTPS id hf3si3793548icc.40.2013.11.06.02.17.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 02:17:06 -0800 (PST) Received-SPF: neutral (google.com: 209.85.223.180 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.223.180; Received: by mail-ie0-f180.google.com with SMTP id e14so16477885iej.25 for ; Wed, 06 Nov 2013 02:17:06 -0800 (PST) X-Received: by 10.43.172.4 with SMTP id nw4mr1503426icc.25.1383733025868; Wed, 06 Nov 2013 02:17:05 -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.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 02:17:05 -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 10/13] ASoC: ux500_pcm: Extend Device Tree support to deal with DMA data Date: Wed, 6 Nov 2013 10:16:22 +0000 Message-Id: <1383732985-18928-11-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.181 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: , Soon we will strip out pdata support from the Ux500 set of ASoC drivers. When this happens it will have to supply a DMA slave_config to the dmaengine. At the moment a great deal of this comes from pdata via AUXDATA. We need to become independent of this soon. This patch starts the process by allocating memory for the associated data structures and fetches the MSP id used for const struct indexing. Cc: alsa-devel@alsa-project.org Cc: Mark Brown Signed-off-by: Lee Jones --- sound/soc/ux500/ux500_msp_i2s.c | 68 ++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 0a99372..2e916d1 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -646,6 +646,41 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir) } +int ux500_msp_i2s_of_init_msp(struct platform_device *pdev, + struct ux500_msp *msp, + struct msp_i2s_platform_data **platform_data) +{ + struct device_node *np = pdev->dev.of_node; + struct msp_i2s_platform_data *pdata; + + *platform_data = devm_kzalloc(&pdev->dev, + sizeof(struct msp_i2s_platform_data), + GFP_KERNEL); + pdata = *platform_data; + if (!pdata) + return -ENOMEM; + + msp->playback_dma_data.dma_cfg = devm_kzalloc(&pdev->dev, + sizeof(struct stedma40_chan_cfg), + GFP_KERNEL); + if (!msp->playback_dma_data.dma_cfg) + return -ENOMEM; + + msp->capture_dma_data.dma_cfg = devm_kzalloc(&pdev->dev, + sizeof(struct stedma40_chan_cfg), + GFP_KERNEL); + if (!msp->capture_dma_data.dma_cfg) + return -ENOMEM; + + if (of_property_read_u32(np, "id", &pdata->id)) { + dev_err(&pdev->dev, + "No 'id' property found in DT\n"); + return -EINVAL; + } + + return 0; +} + int ux500_msp_i2s_init_msp(struct platform_device *pdev, struct ux500_msp **msp_p, struct msp_i2s_platform_data *platform_data) @@ -653,37 +688,28 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, struct resource *res = NULL; struct device_node *np = pdev->dev.of_node; struct ux500_msp *msp; + int ret; *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL); msp = *msp_p; if (!msp) return -ENOMEM; - if (np) { - if (!platform_data) { - platform_data = devm_kzalloc(&pdev->dev, - sizeof(struct msp_i2s_platform_data), GFP_KERNEL); - if (!platform_data) - return -ENOMEM; - - if (!of_property_read_u32(np, "id", - &platform_data->id)) { - dev_err(&pdev->dev, - "No 'id' property found in DT\n"); - return -EINVAL; - } - } - } else - if (!platform_data) + if (!platform_data) { + if (np) { + ret = ux500_msp_i2s_of_init_msp(pdev, msp, + &platform_data); + if (ret) + return ret; + } else return -EINVAL; - - dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__, - pdev->name, platform_data->id); + } else { + msp->playback_dma_data.dma_cfg = platform_data->msp_i2s_dma_tx; + msp->capture_dma_data.dma_cfg = platform_data->msp_i2s_dma_rx; + } msp->id = platform_data->id; msp->dev = &pdev->dev; - msp->playback_dma_data.dma_cfg = platform_data->msp_i2s_dma_tx; - msp->capture_dma_data.dma_cfg = platform_data->msp_i2s_dma_rx; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) {