From patchwork Tue Nov 19 11:07:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21619 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 581FD23FB4 for ; Tue, 19 Nov 2013 11:08:17 +0000 (UTC) Received: by mail-gg0-f199.google.com with SMTP id e27sf12257322gga.10 for ; Tue, 19 Nov 2013 03:08:17 -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=OAryH8pnWkzPVgND+uFj7QCo+iROWG5GO2PS2RyBpZQ=; b=ZP2OsKixE2VNXGGFl7acdzdrC7SOXrAYLRvzfOwlpFAxgc+u9F8sbYojlXpy27J/HX dUKE35iPRcknoZH50fuxJ5ThHiwYtgCE3+HTD9oQhZtjgT4lVXrZzufSOLIP3jBqWH8D 6s6wLUTwg+kstWJ+V/zrsfR4PCM7JQEVy5GxWo16WmV4iajrGfYuWr2zEQwYjOpo0on5 lnX/Ra0BmIY4NqZHpg8IOiMn3tUx6jCao0xr81OSP2IXkh+XP6Do7CzRvoHR0E801MID xkfmc0fHYThrwWDryAWUQ1aMXVQCLv6yo6HUx65CEYrfv26uLcl1bCAH8iMIW0OEVMS9 EUqA== X-Gm-Message-State: ALoCoQlIW9XXU947CFAwwH75Vr5hwxBWdF3/xAbse66fJKRjzR8w5crOvhkaQm+ZaJdcx2d1NYVk X-Received: by 10.58.37.3 with SMTP id u3mr10024065vej.6.1384859297102; Tue, 19 Nov 2013 03:08:17 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.98.99 with SMTP id eh3ls3117847qeb.68.gmail; Tue, 19 Nov 2013 03:08:17 -0800 (PST) X-Received: by 10.220.144.18 with SMTP id x18mr20497319vcu.15.1384859296992; Tue, 19 Nov 2013 03:08:16 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id wp10si7968559vdb.136.2013.11.19.03.08.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 03:08:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id if17so1121099vcb.11 for ; Tue, 19 Nov 2013 03:08:16 -0800 (PST) X-Received: by 10.220.253.66 with SMTP id mz2mr20947235vcb.10.1384859296900; Tue, 19 Nov 2013 03:08:16 -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 u4csp269506vcz; Tue, 19 Nov 2013 03:08:16 -0800 (PST) X-Received: by 10.60.44.178 with SMTP id f18mr6375891oem.43.1384859296225; Tue, 19 Nov 2013 03:08:16 -0800 (PST) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx.google.com with ESMTPS id f6si3991699obr.137.2013.11.19.03.08.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 03:08:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.219.54 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.219.54; Received: by mail-oa0-f54.google.com with SMTP id h16so2631865oag.41 for ; Tue, 19 Nov 2013 03:08:16 -0800 (PST) X-Received: by 10.182.49.166 with SMTP id v6mr24261468obn.13.1384859295952; Tue, 19 Nov 2013 03:08:15 -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.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 03:08:15 -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 06/10] ASoC: ux500_pcm: Extend Device Tree support to deal with DMA data Date: Tue, 19 Nov 2013 11:07:45 +0000 Message-Id: <1384859269-19801-7-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.220.180 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 Acked-by: Linus Walleij Signed-off-by: Lee Jones --- sound/soc/ux500/ux500_msp_i2s.c | 56 ++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 1ca8b08..7f2a4ac 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -646,6 +646,34 @@ 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 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; + + 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,30 +681,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; - } - } 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; + } 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; + } - dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__, - pdev->name, platform_data->id); - - 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) {