From patchwork Fri Aug 24 14:01:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 10931 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 D847223E1B for ; Fri, 24 Aug 2012 14:02:20 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id B78A3A18949 for ; Fri, 24 Aug 2012 14:02:02 +0000 (UTC) Received: by iafj25 with SMTP id j25so1165440iaf.11 for ; Fri, 24 Aug 2012 07:02:19 -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=DGEHMaG7i32DVFL31G3+sU1eeOQTKnpO0RxI46mFLZc=; b=JqYPjD1CbDL76jdDP/hSPviXaTdHfLW/69FbFTSIRjSICr+YW+fkZJLFyFFqkphTGV Qa66Vakv1VGq3c7LJv4uC9KwFiAkMA/t3tQp3XGL4k2MM8gUPRIdFdRgl5e2zNRViJ/F Yt6CxgApZaM39l6++HYXDpQHmQR9cWc0bOfRnTvi9RThwW5aU+4ZBASjruGEBsOsl/0a a6TB7alqaRxe0WcY8iVFslllNz1Ehj9S7CgNtoK6ssSJrX/Tz+KNBqa7RTqOSjpFlMJx U4CWgRU9DLoEkk2AD0p2CKoJGu/IfPYh+ov0pbKiJk0Q9eoM5Cw3HVt7ql9MDCtug3ln +UfQ== Received: by 10.50.217.227 with SMTP id pb3mr2287999igc.28.1345816939692; Fri, 24 Aug 2012 07:02:19 -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.184.232 with SMTP id ex8csp321595igc; Fri, 24 Aug 2012 07:02:18 -0700 (PDT) Received: by 10.180.74.33 with SMTP id q1mr5855530wiv.4.1345816937329; Fri, 24 Aug 2012 07:02:17 -0700 (PDT) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx.google.com with ESMTPS id u8si5983973wia.35.2012.08.24.07.02.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Aug 2012 07:02:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.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 mail-wi0-f178.google.com with SMTP id hr14so704351wib.13 for ; Fri, 24 Aug 2012 07:02:16 -0700 (PDT) Received: by 10.180.103.136 with SMTP id fw8mr5769920wib.20.1345816936472; Fri, 24 Aug 2012 07:02:16 -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 eu4sm4556709wib.2.2012.08.24.07.02.15 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Aug 2012 07:02:15 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: STEricsson_nomadik_linux@list.st.com, linus.walleij@stericsson.com, arnd@arndb.de, broonie@opensource.wolfsonmicro.com, ola.o.lilja@stericsson.com, roger.xr.nilsson@stericsson.com, alsa-devel@alsa-project.org, Lee Jones Subject: [PATCH 03/17] ASoC: Ux500: Enable ux500 MSP driver for Device Tree Date: Fri, 24 Aug 2012 15:01:39 +0100 Message-Id: <1345816913-4113-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345816913-4113-1-git-send-email-lee.jones@linaro.org> References: <1345816913-4113-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQkO6WZlseTnrG4Lh/av2aH3fD6ttr2kbXEJ63j4YcLPs6l0eggZDZOl9iD8kO9e528V2EMH 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. CC: alsa-devel@alsa-project.org Acked-by: Linus Walleij 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 08813c5..cb7bdae 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 @@ -684,16 +685,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;