From patchwork Thu Sep 20 12:09:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1484091 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 207263FD40 for ; Thu, 20 Sep 2012 12:12:29 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TEfaA-0001SG-AU; Thu, 20 Sep 2012 12:10:14 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TEfZS-0001HM-4J for linux-arm-kernel@lists.infradead.org; Thu, 20 Sep 2012 12:09:31 +0000 Received: by wibhn17 with SMTP id hn17so388580wib.0 for ; Thu, 20 Sep 2012 05:09:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=t5b0J3mfMq7u6w26JGPhAtxxNNz29YNaFaQxd945dZw=; b=Y9Bemi8N+/7h3L5CZ4Wf17IjuhMiP3WT95Tjuvh8z/EUhxZYOx+S14jl2LBMqyaWWW NvVbLlfZwf0cK+s4TTbvXrDzv18HFnzqr2SzmKwyn8llo5FpFeYmlFh6WywejYw9yBVw ujkJHqqbpDi/+LR/5jNLX1lhvgGgPznjs0ieEp7Q8/rEqiwv3m9cIaqWQgIBhZckTkDf OOKwjZJU7Zi3oJ4nCU8oXm3IxLXKHnz/gRNqr0vRt/65IIWRJZEHIe5abrXkkFCeQHkr us2IYA/aQQWZo+JEI6JMNCrKu2dqpgroXqVZX+D2MAxn2bBWcbORHjWIa7W9acu63ylp C2pg== Received: by 10.180.98.200 with SMTP id ek8mr4176500wib.0.1348142969039; Thu, 20 Sep 2012 05:09:29 -0700 (PDT) Received: from localhost.localdomain (LPuteaux-156-14-44-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPS id o2sm10403731wiz.11.2012.09.20.05.09.27 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 05:09:28 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, broonie@opensource.wolfsonmicro.com Subject: [PATCH 3/7] ASoC: Ux500: Enable ux500 MSP driver for Device Tree Date: Thu, 20 Sep 2012 14:09:12 +0200 Message-Id: <1348142956-1872-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348142956-1872-1-git-send-email-lee.jones@linaro.org> References: <1348142956-1872-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnmKtXp4deBaCr/8xiAEtVb8yJUIBrnRx90EehFdRUy9RiuGiGpfAUVk1gGdOiKlSJAsawx X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: ola.o.lilja@stericsson.com, alsa-devel@alsa-project.org, linus.walleij@stericsson.com, arnd@arndb.de, STEricsson_nomadik_linux@list.st.com, Lee Jones X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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. Acked-by: Ola Lilja 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 057e28e..45e43b4 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -830,10 +830,16 @@ static int __devexit ux500_msp_drv_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id ux500_msp_i2s_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_i2s_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 12d7f56..e5c79ca 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 @@ -683,14 +684,29 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, { 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 (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;