From patchwork Wed Nov 23 01:21:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 127195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 23556100B2B for ; Wed, 23 Nov 2011 12:22:08 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753814Ab1KWBWH (ORCPT ); Tue, 22 Nov 2011 20:22:07 -0500 Received: from avon.wwwdotorg.org ([70.85.31.133]:34647 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759391Ab1KWBWH (ORCPT ); Tue, 22 Nov 2011 20:22:07 -0500 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id C7DB7631A; Tue, 22 Nov 2011 18:24:48 -0700 (MST) Received: from localhost.localdomain (searspoint.nvidia.com [216.228.112.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id D6CD7E4620; Tue, 22 Nov 2011 18:22:03 -0700 (MST) From: Stephen Warren To: Mark Brown , Liam Girdwood , Olof Johansson , Colin Cross Cc: alsa-devel@alsa-project.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree-discuss@lists.ozlabs.org, Mike Rapoport , John Bonesio , Grant Likely , Marc Dietrich , Leon Romanovsky , Peter De Schrijver , Rob Herring , Ian Lartey , Dimitris Papastamos , Stephen Warren Subject: [PATCH 11/17] ASoC: Tegra I2S: Add device tree binding Date: Tue, 22 Nov 2011 18:21:19 -0700 Message-Id: <1322011285-4002-12-git-send-email-swarren@nvidia.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1322011285-4002-1-git-send-email-swarren@nvidia.com> References: <1322011285-4002-1-git-send-email-swarren@nvidia.com> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Signed-off-by: Stephen Warren --- .../devicetree/bindings/sound/tegra20-i2s.txt | 16 +++++++++++ sound/soc/tegra/tegra_i2s.c | 29 ++++++++++++++++--- 2 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/tegra20-i2s.txt diff --git a/Documentation/devicetree/bindings/sound/tegra20-i2s.txt b/Documentation/devicetree/bindings/sound/tegra20-i2s.txt new file mode 100644 index 0000000..d38abdc --- /dev/null +++ b/Documentation/devicetree/bindings/sound/tegra20-i2s.txt @@ -0,0 +1,16 @@ +NVIDIA Tegra 20 I2S controller + +Required properties: +- compatible : "nvidia,tegra20-i2s" +- reg : Should contain I2S registers location and length +- interrupts : Should contain I2S interrupt +- dma-channel : The Tegra DMA controller's channel ID for this I2S controller + +Example: + +i2s@70002800 { + compatible = "nvidia,tegra20-i2s"; + reg = <0x70002800 0x200>; + interrupts = < 45 >; + dma-channel = < 2 >; +}; diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index 3c0cbd2..b4e19a5 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -332,6 +333,7 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) struct tegra_i2s * i2s; struct resource *mem, *memregion, *dmareq; int ret; + u32 dma_ch; i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra_i2s), GFP_KERNEL); if (!i2s) { @@ -360,9 +362,19 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!dmareq) { - dev_err(&pdev->dev, "No DMA resource\n"); - ret = -ENODEV; - goto err_clk_put; + /* + * FIXME: Perhaps there should be a standard binding for this + * that ends up creating the IORESOURCE_DMA resource for us. + */ + if (of_property_read_u32(pdev->dev.of_node, + "nvidia,dma-channels", + &dma_ch) < 0) { + dev_err(&pdev->dev, "No DMA resource\n"); + ret = -ENODEV; + goto err_clk_put; + } + } else { + dma_ch = dmareq->start; } memregion = devm_request_mem_region(&pdev->dev, mem->start, @@ -383,12 +395,12 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) i2s->capture_dma_data.addr = mem->start + TEGRA_I2S_FIFO2; i2s->capture_dma_data.wrap = 4; i2s->capture_dma_data.width = 32; - i2s->capture_dma_data.req_sel = dmareq->start; + i2s->capture_dma_data.req_sel = dma_ch; i2s->playback_dma_data.addr = mem->start + TEGRA_I2S_FIFO1; i2s->playback_dma_data.wrap = 4; i2s->playback_dma_data.width = 32; - i2s->playback_dma_data.req_sel = dmareq->start; + i2s->playback_dma_data.req_sel = dma_ch; i2s->reg_ctrl = TEGRA_I2S_CTRL_FIFO_FORMAT_PACKED; @@ -422,10 +434,16 @@ static int __devexit tegra_i2s_platform_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id tegra_i2s_of_match[] __devinitconst = { + { .compatible = "nvidia,tegra20-i2s", }, + {}, +}; + static struct platform_driver tegra_i2s_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, + .of_match_table = tegra_i2s_of_match, }, .probe = tegra_i2s_platform_probe, .remove = __devexit_p(tegra_i2s_platform_remove), @@ -436,3 +454,4 @@ MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra I2S ASoC driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:" DRV_NAME); +MODULE_DEVICE_TABLE(of, tegra_i2s_of_match);