diff options
author | Stephen Warren <swarren@nvidia.com> | 2011-11-29 20:36:48 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-30 04:38:13 -0500 |
commit | bf55499e6ee927e047feed85349365481289bd75 (patch) | |
tree | 1a66f9005fffdeb8669c7af55375cd91b9a01a75 /sound/soc/tegra | |
parent | b00adf76a6fa492c39f8225fc42debc01bbbdc1d (diff) |
ASoC: Tegra I2S: Add device tree binding
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/tegra')
-rw-r--r-- | sound/soc/tegra/tegra_i2s.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index ca4d0c0a913e..33509de52540 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <linux/io.h> | 38 | #include <linux/io.h> |
39 | #include <linux/of.h> | ||
39 | #include <mach/iomap.h> | 40 | #include <mach/iomap.h> |
40 | #include <sound/core.h> | 41 | #include <sound/core.h> |
41 | #include <sound/pcm.h> | 42 | #include <sound/pcm.h> |
@@ -331,6 +332,8 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) | |||
331 | { | 332 | { |
332 | struct tegra_i2s * i2s; | 333 | struct tegra_i2s * i2s; |
333 | struct resource *mem, *memregion, *dmareq; | 334 | struct resource *mem, *memregion, *dmareq; |
335 | u32 of_dma[2]; | ||
336 | u32 dma_ch; | ||
334 | int ret; | 337 | int ret; |
335 | 338 | ||
336 | i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra_i2s), GFP_KERNEL); | 339 | i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra_i2s), GFP_KERNEL); |
@@ -360,9 +363,16 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) | |||
360 | 363 | ||
361 | dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 364 | dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
362 | if (!dmareq) { | 365 | if (!dmareq) { |
363 | dev_err(&pdev->dev, "No DMA resource\n"); | 366 | if (of_property_read_u32_array(pdev->dev.of_node, |
364 | ret = -ENODEV; | 367 | "nvidia,dma-request-selector", |
365 | goto err_clk_put; | 368 | of_dma, 2) < 0) { |
369 | dev_err(&pdev->dev, "No DMA resource\n"); | ||
370 | ret = -ENODEV; | ||
371 | goto err_clk_put; | ||
372 | } | ||
373 | dma_ch = of_dma[1]; | ||
374 | } else { | ||
375 | dma_ch = dmareq->start; | ||
366 | } | 376 | } |
367 | 377 | ||
368 | memregion = devm_request_mem_region(&pdev->dev, mem->start, | 378 | memregion = devm_request_mem_region(&pdev->dev, mem->start, |
@@ -383,12 +393,12 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) | |||
383 | i2s->capture_dma_data.addr = mem->start + TEGRA_I2S_FIFO2; | 393 | i2s->capture_dma_data.addr = mem->start + TEGRA_I2S_FIFO2; |
384 | i2s->capture_dma_data.wrap = 4; | 394 | i2s->capture_dma_data.wrap = 4; |
385 | i2s->capture_dma_data.width = 32; | 395 | i2s->capture_dma_data.width = 32; |
386 | i2s->capture_dma_data.req_sel = dmareq->start; | 396 | i2s->capture_dma_data.req_sel = dma_ch; |
387 | 397 | ||
388 | i2s->playback_dma_data.addr = mem->start + TEGRA_I2S_FIFO1; | 398 | i2s->playback_dma_data.addr = mem->start + TEGRA_I2S_FIFO1; |
389 | i2s->playback_dma_data.wrap = 4; | 399 | i2s->playback_dma_data.wrap = 4; |
390 | i2s->playback_dma_data.width = 32; | 400 | i2s->playback_dma_data.width = 32; |
391 | i2s->playback_dma_data.req_sel = dmareq->start; | 401 | i2s->playback_dma_data.req_sel = dma_ch; |
392 | 402 | ||
393 | i2s->reg_ctrl = TEGRA_I2S_CTRL_FIFO_FORMAT_PACKED; | 403 | i2s->reg_ctrl = TEGRA_I2S_CTRL_FIFO_FORMAT_PACKED; |
394 | 404 | ||
@@ -422,10 +432,16 @@ static int __devexit tegra_i2s_platform_remove(struct platform_device *pdev) | |||
422 | return 0; | 432 | return 0; |
423 | } | 433 | } |
424 | 434 | ||
435 | static const struct of_device_id tegra_i2s_of_match[] __devinitconst = { | ||
436 | { .compatible = "nvidia,tegra20-i2s", }, | ||
437 | {}, | ||
438 | }; | ||
439 | |||
425 | static struct platform_driver tegra_i2s_driver = { | 440 | static struct platform_driver tegra_i2s_driver = { |
426 | .driver = { | 441 | .driver = { |
427 | .name = DRV_NAME, | 442 | .name = DRV_NAME, |
428 | .owner = THIS_MODULE, | 443 | .owner = THIS_MODULE, |
444 | .of_match_table = tegra_i2s_of_match, | ||
429 | }, | 445 | }, |
430 | .probe = tegra_i2s_platform_probe, | 446 | .probe = tegra_i2s_platform_probe, |
431 | .remove = __devexit_p(tegra_i2s_platform_remove), | 447 | .remove = __devexit_p(tegra_i2s_platform_remove), |
@@ -436,3 +452,4 @@ MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); | |||
436 | MODULE_DESCRIPTION("Tegra I2S ASoC driver"); | 452 | MODULE_DESCRIPTION("Tegra I2S ASoC driver"); |
437 | MODULE_LICENSE("GPL"); | 453 | MODULE_LICENSE("GPL"); |
438 | MODULE_ALIAS("platform:" DRV_NAME); | 454 | MODULE_ALIAS("platform:" DRV_NAME); |
455 | MODULE_DEVICE_TABLE(of, tegra_i2s_of_match); | ||