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: 11532 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 71D7E1B4E37 for ; Thu, 20 Sep 2012 12:09:33 +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 A8E343D098E3 for ; Thu, 20 Sep 2012 12:09:32 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id j25so1559381iaf.11 for ; Thu, 20 Sep 2012 05:09:32 -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=t5b0J3mfMq7u6w26JGPhAtxxNNz29YNaFaQxd945dZw=; b=oyJDdDlDDB86JxcL7oThWR6Nf2/yWspWlRanF2G/kXWYPovryaO9EdgE5G9erU9L2q PGLaheM2c8h6ykumO4WICYwXj8dkrm8Zi3EGkSIuRT1KISHo8WuPOl2gx3bP0cDxCk8r yOefIY5ullk0HjVq9K9+IanBKwJlOVS1fiopiIDXE3rPfeU854vkw6AArRmz4/WDSEqf PBZMsDufYVbPux2S2r+ycb0v+dgJsVPgmGD7b8S27sar1QlB5jynsx9xyPcYVrW2fu8f 8olVrZwdIBK1v2ae4kL2v+rIdpek322jK2KO84bonm2PLDaZ0JybuLVjc4AwJ8kZeSuc ltjg== Received: by 10.50.217.229 with SMTP id pb5mr1454254igc.28.1348142972440; Thu, 20 Sep 2012 05:09:32 -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 ex8csp71423igc; Thu, 20 Sep 2012 05:09:30 -0700 (PDT) Received: by 10.180.81.165 with SMTP id b5mr5578831wiy.17.1348142969537; Thu, 20 Sep 2012 05:09:29 -0700 (PDT) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id a6si41848249wix.26.2012.09.20.05.09.29 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 05:09:29 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.50 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-wg0-f50.google.com with SMTP id 16so1632733wgi.31 for ; Thu, 20 Sep 2012 05:09:29 -0700 (PDT) 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 Cc: STEricsson_nomadik_linux@list.st.com, linus.walleij@stericsson.com, arnd@arndb.de, ola.o.lilja@stericsson.com, alsa-devel@alsa-project.org, Lee Jones 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: ALoCoQkGBdlerGiN4BVPgRI2MUYUrgXCOzXsymmOV1HbT3ysSoV/UoPXftqTuF63aPruAAmF1XTe 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;