From patchwork Thu Dec 19 15:55:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 22645 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DBE3323FCA for ; Thu, 19 Dec 2013 15:55:42 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id ht17sf1409389vcb.2 for ; Thu, 19 Dec 2013 07:55:42 -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=InKCgyanymck4kmq4IHxKfsLIbazW50XkTaHaVyG6AY=; b=Ep9SAo2Nq3zGQQrfaMWk4PO0AKkD8XsqpV8jSPIuUj+EH+rAH63mCetZfIwZXcxIU6 +K1GRtJiWUZ6Z1vuXVmMrtYoZqpF26KLxsw+YSjlvDDi83FAKwb3n/HLMzu5yEuISKyQ HhboojOyY8LiIE2PLMwgzj5xO+Sjv1CXk5GEJTFuTcOlC5CIvUPWqkK4difrhRvVq12r 2Q/3QE31lRD5ZEtzLNz36N/Fh1p4wF/vcGVXjAMNjD6pfADKTX6mgF0xAeIlA2tIBeMS yZRbyKoA0Ce8rP0GorzI+8MnirGup9FTYo0dVZUllVP9SqOaWRRnKmtIZejgEp4zGorJ hyYw== X-Gm-Message-State: ALoCoQlcw/h5mfx0e3NVmiKYf1WJmLCSgTOXDpQyYjmq9K+MYsLNYrvg7ccsbeyNELdVJ7jaTLxh X-Received: by 10.58.118.231 with SMTP id kp7mr964697veb.36.1387468542077; Thu, 19 Dec 2013 07:55:42 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.76.72 with SMTP id i8ls400301qew.59.gmail; Thu, 19 Dec 2013 07:55:41 -0800 (PST) X-Received: by 10.220.88.204 with SMTP id b12mr1339387vcm.3.1387468541955; Thu, 19 Dec 2013 07:55:41 -0800 (PST) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id uw4si779446vec.77.2013.12.19.07.55.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 07:55:41 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.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.220.170; Received: by mail-vc0-f170.google.com with SMTP id la4so785930vcb.1 for ; Thu, 19 Dec 2013 07:55:41 -0800 (PST) X-Received: by 10.52.103.35 with SMTP id ft3mr1138636vdb.5.1387468541841; Thu, 19 Dec 2013 07:55:41 -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 ey3csp331350ved; Thu, 19 Dec 2013 07:55:41 -0800 (PST) X-Received: by 10.194.240.41 with SMTP id vx9mr2102031wjc.70.1387468540772; Thu, 19 Dec 2013 07:55:40 -0800 (PST) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by mx.google.com with ESMTPS id mc6si1666976wjb.154.2013.12.19.07.55.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 07:55:40 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.177 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.177; Received: by mail-wi0-f177.google.com with SMTP id cc10so2393210wib.16 for ; Thu, 19 Dec 2013 07:55:40 -0800 (PST) X-Received: by 10.194.93.105 with SMTP id ct9mr2195061wjb.6.1387468540199; Thu, 19 Dec 2013 07:55:40 -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.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 07:55:38 -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 07/11] ASoC: ux500_pcm: Extend Device Tree support to deal with DMA data Date: Thu, 19 Dec 2013 15:55:04 +0000 Message-Id: <1387468508-12286-8-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.220.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: , 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. 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) {