From patchwork Thu Aug 9 15:47:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 10625 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 B0D0623E02 for ; Thu, 9 Aug 2012 15:48:21 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 7D57EA18A42 for ; Thu, 9 Aug 2012 15:48:21 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so585844ggn.11 for ; Thu, 09 Aug 2012 08:48:21 -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=9HuZW2uNwlnM5sU4JbTGmsftuTyjTXlqcX3MvW4iEHk=; b=lAj3Dq3pqYEyger0ZzhcZ0sWqbV473I8NN5BH/+hc3mhwUDoSvRoA0Pv5B3skXLHzD 3/zQU38Z5OaGYTT/SF71eSJ8Sx/AUqfBgOfkqacitQ7OfHvdAFcBMsQViawPXxjuTRDb W+nz5wkAUPZDohXscnj5rynN3WQaHqvty55uA4z/E4e3XSGZ84YoUckJghgyCAwvAJCR LZwtVS1NSyo6S5ucbkS2hO4nf85+P4XPsUdfDx3r+hhYxTNVj0YC8MGFaP1RM1X3r5sk Maa9Iv1vq1yqcX9cs3AEmLaOq2QQBtVJHSiLRP0fnWn/t2cMiOVWBNxvsO4Ejwes5QKW 5b/w== Received: by 10.50.181.136 with SMTP id dw8mr1582873igc.31.1344527300919; Thu, 09 Aug 2012 08:48:20 -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.200 with SMTP id ew8csp15236igc; Thu, 9 Aug 2012 08:48:19 -0700 (PDT) Received: by 10.180.93.68 with SMTP id cs4mr3923814wib.14.1344527299502; Thu, 09 Aug 2012 08:48:19 -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 ed3si2922594wib.27.2012.08.09.08.48.19 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Aug 2012 08:48:19 -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 ds11so531652wgb.31 for ; Thu, 09 Aug 2012 08:48:19 -0700 (PDT) Received: by 10.180.78.5 with SMTP id x5mr3933065wiw.13.1344527299044; Thu, 09 Aug 2012 08:48:19 -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 q4sm2278954wix.9.2012.08.09.08.48.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Aug 2012 08:48:18 -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, Lee Jones , alsa-devel@alsa-project.org Subject: [PATCH 06/22] ASoC: Ux500: Enable ux500 MSP driver for Device Tree Date: Thu, 9 Aug 2012 16:47:32 +0100 Message-Id: <1344527268-5964-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1344527268-5964-1-git-send-email-lee.jones@linaro.org> References: <1344527268-5964-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnwD+AhHZj8eWgcTwic7D7dr+YT15IoB5U6i5BMUq+7xSBP1+UHTjrpKndGIGQlomX/44Q+ 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 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;