From patchwork Tue Jul 31 13:38:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 10409 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2D3FC23E02 for ; Tue, 31 Jul 2012 13:39:30 +0000 (UTC) Received: from mail-qa0-f52.google.com (mail-qa0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id DED7CA18CFB for ; Tue, 31 Jul 2012 13:39:29 +0000 (UTC) Received: by qabj34 with SMTP id j34so1756172qab.11 for ; Tue, 31 Jul 2012 06:39:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=s6+Qu+54t34KSHMAszGKTJnfQzfaRHSqush2z0iREm8=; b=Sk9zY+nWPf0TNr6/VW9tu60G2jmf9cIYHBilHtsSmryj0O1U/ojHJqkqRf607oNhGT XcNX4i0lbuhLTiXUIKv6wqwEbIXdcGKryQfCMwWJzBlTE/5r69rooyVpMGXbFYczV6a7 OBqg95yJ7Gkc7lP4K6uc9QP5DTVd5VNLr2u8E0pGm2GPlNlWB/e1IcVfhEwdNIRy1TZE dojOUWwa6AFe4VLv3XzpAR2+iusnriIUX+0TIWBVuxan4iRC0mnOVTliJhIA7hlBpRNX gDHDPn/JFJZ8dfENT5ShePI//U3u8VW0HzztUXfu/OfX2sDbevDxLbFsNkNrN0bC3u4K M8kA== Received: by 10.50.213.39 with SMTP id np7mr1977839igc.51.1343741969169; Tue, 31 Jul 2012 06:39:29 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.87.40 with SMTP id u8csp143500igz; Tue, 31 Jul 2012 06:39:28 -0700 (PDT) Received: by 10.217.1.197 with SMTP id n47mr7385353wes.27.1343741967936; Tue, 31 Jul 2012 06:39:27 -0700 (PDT) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id r63si103836wed.123.2012.07.31.06.39.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 31 Jul 2012 06:39:27 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by weyu7 with SMTP id u7so5232592wey.37 for ; Tue, 31 Jul 2012 06:39:27 -0700 (PDT) Received: by 10.216.41.195 with SMTP id h45mr7987305web.74.1343741967402; Tue, 31 Jul 2012 06:39:27 -0700 (PDT) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id el6sm22252911wib.8.2012.07.31.06.39.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 31 Jul 2012 06:39:26 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, olalilja@yahoo.se, ola.o.lilja@stericsson.com, alsa-devel@alsa-project.org, lrg@ti.com, broonie@opensource.wolfsonmicro.com Cc: STEricsson_nomadik_linux@list.st.com, linus.walleij@stericsson.com, arnd@arndb.de, Lee Jones Subject: [PATCH 03/19] ASoC: Ux500: Enable ux500 MSP driver for Device Tree Date: Tue, 31 Jul 2012 14:38:57 +0100 Message-Id: <1343741953-17828-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343741953-17828-1-git-send-email-lee.jones@linaro.org> References: <1343741953-17828-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQkialozKUaK7JLi4EzFbS4NZgo3Q8MUdISK+QYy+3gr00/LYjRnDXi+s4drAAPK/lQJLYrH Register both parts of the MSP driver from Device Tree so that they are probed when Device Tree is enabled. Also, as there is platform data involved, we ensure that there is allocated memory to place the configuration into and that the correct information is extracted from the DT binary. Signed-off-by: Lee Jones --- sound/soc/ux500/ux500_msp_dai.c | 6 ++++++ sound/soc/ux500/ux500_msp_i2s.c | 22 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index 772cb19..0f7dd49 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -833,10 +833,16 @@ static int __devexit ux500_msp_drv_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id ux500_msp_i2c_match[] = { + { .compatible = "stericsson,ux500-msp-i2s", }, + {}, +}; + static struct platform_driver msp_i2s_driver = { .driver = { .name = "ux500-msp-i2s", .owner = THIS_MODULE, + .of_match_table = ux500_msp_i2c_match, }, .probe = ux500_msp_drv_probe, .remove = ux500_msp_drv_remove, diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 2cbfc54..5e0bf8c 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -692,16 +693,31 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, int ret = 0; struct resource *res = NULL; struct i2s_controller *i2s_cont; + struct device_node *np = pdev->dev.of_node; struct ux500_msp *msp; - dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__, - pdev->name, platform_data->id); - *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) + ret = -ENOMEM; + } + } else + if (!platform_data) + ret = -EINVAL; + + if (ret) + goto err_res; + + 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->dma_cfg_rx = platform_data->msp_i2s_dma_rx;