diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2013-08-14 06:27:33 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-08-22 14:58:14 -0400 |
commit | eb63231830360f5acfea5dd2b545d7a14476bc3a (patch) | |
tree | 977dfa41e24df445afb6341d9341003fc96f2cbd /sound | |
parent | e4065f3ff122e35cfc760d9a712564f3d9ef3a49 (diff) |
ASoc: kirkwood: add DT support to the mvebu audio subsystem
This patch adds DT support to the audio subsystem of the mvebu family
(Kirkwood, Dove, Armada 370).
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/kirkwood/kirkwood-i2s.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index e5f3f7a9ea26..7fce340ab3ef 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <sound/pcm_params.h> | 22 | #include <sound/pcm_params.h> |
23 | #include <sound/soc.h> | 23 | #include <sound/soc.h> |
24 | #include <linux/platform_data/asoc-kirkwood.h> | 24 | #include <linux/platform_data/asoc-kirkwood.h> |
25 | #include <linux/of.h> | ||
26 | |||
25 | #include "kirkwood.h" | 27 | #include "kirkwood.h" |
26 | 28 | ||
27 | #define DRV_NAME "mvebu-audio" | 29 | #define DRV_NAME "mvebu-audio" |
@@ -453,6 +455,7 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) | |||
453 | struct snd_soc_dai_driver *soc_dai = &kirkwood_i2s_dai; | 455 | struct snd_soc_dai_driver *soc_dai = &kirkwood_i2s_dai; |
454 | struct kirkwood_dma_data *priv; | 456 | struct kirkwood_dma_data *priv; |
455 | struct resource *mem; | 457 | struct resource *mem; |
458 | struct device_node *np = pdev->dev.of_node; | ||
456 | int err; | 459 | int err; |
457 | 460 | ||
458 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); | 461 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
@@ -473,14 +476,16 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) | |||
473 | return -ENXIO; | 476 | return -ENXIO; |
474 | } | 477 | } |
475 | 478 | ||
476 | if (!data) { | 479 | if (np) { |
477 | dev_err(&pdev->dev, "no platform data ?!\n"); | 480 | priv->burst = 128; /* might be 32 or 128 */ |
481 | } else if (data) { | ||
482 | priv->burst = data->burst; | ||
483 | } else { | ||
484 | dev_err(&pdev->dev, "no DT nor platform data ?!\n"); | ||
478 | return -EINVAL; | 485 | return -EINVAL; |
479 | } | 486 | } |
480 | 487 | ||
481 | priv->burst = data->burst; | 488 | priv->clk = devm_clk_get(&pdev->dev, np ? "internal" : NULL); |
482 | |||
483 | priv->clk = devm_clk_get(&pdev->dev, NULL); | ||
484 | if (IS_ERR(priv->clk)) { | 489 | if (IS_ERR(priv->clk)) { |
485 | dev_err(&pdev->dev, "no clock\n"); | 490 | dev_err(&pdev->dev, "no clock\n"); |
486 | return PTR_ERR(priv->clk); | 491 | return PTR_ERR(priv->clk); |
@@ -507,7 +512,7 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) | |||
507 | priv->ctl_rec = KIRKWOOD_RECCTL_SIZE_24; | 512 | priv->ctl_rec = KIRKWOOD_RECCTL_SIZE_24; |
508 | 513 | ||
509 | /* Select the burst size */ | 514 | /* Select the burst size */ |
510 | if (data->burst == 32) { | 515 | if (priv->burst == 32) { |
511 | priv->ctl_play |= KIRKWOOD_PLAYCTL_BURST_32; | 516 | priv->ctl_play |= KIRKWOOD_PLAYCTL_BURST_32; |
512 | priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_32; | 517 | priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_32; |
513 | } else { | 518 | } else { |
@@ -552,12 +557,21 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev) | |||
552 | return 0; | 557 | return 0; |
553 | } | 558 | } |
554 | 559 | ||
560 | #ifdef CONFIG_OF | ||
561 | static struct of_device_id mvebu_audio_of_match[] = { | ||
562 | { .compatible = "marvell,mvebu-audio" }, | ||
563 | { } | ||
564 | }; | ||
565 | MODULE_DEVICE_TABLE(of, mvebu_audio_of_match); | ||
566 | #endif | ||
567 | |||
555 | static struct platform_driver kirkwood_i2s_driver = { | 568 | static struct platform_driver kirkwood_i2s_driver = { |
556 | .probe = kirkwood_i2s_dev_probe, | 569 | .probe = kirkwood_i2s_dev_probe, |
557 | .remove = kirkwood_i2s_dev_remove, | 570 | .remove = kirkwood_i2s_dev_remove, |
558 | .driver = { | 571 | .driver = { |
559 | .name = DRV_NAME, | 572 | .name = DRV_NAME, |
560 | .owner = THIS_MODULE, | 573 | .owner = THIS_MODULE, |
574 | .of_match_table = of_match_ptr(mvebu_audio_of_match), | ||
561 | }, | 575 | }, |
562 | }; | 576 | }; |
563 | 577 | ||