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 | |
| 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>
| -rw-r--r-- | Documentation/devicetree/bindings/sound/mvebu-audio.txt | 29 | ||||
| -rw-r--r-- | sound/soc/kirkwood/kirkwood-i2s.c | 26 |
2 files changed, 49 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/sound/mvebu-audio.txt b/Documentation/devicetree/bindings/sound/mvebu-audio.txt new file mode 100644 index 000000000000..7e5fd37c1b3f --- /dev/null +++ b/Documentation/devicetree/bindings/sound/mvebu-audio.txt | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | * mvebu (Kirkwood, Dove, Armada 370) audio controller | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | |||
| 5 | - compatible: "marvell,mvebu-audio" | ||
| 6 | |||
| 7 | - reg: physical base address of the controller and length of memory mapped | ||
| 8 | region. | ||
| 9 | |||
| 10 | - interrupts: list of two irq numbers. | ||
| 11 | The first irq is used for data flow and the second one is used for errors. | ||
| 12 | |||
| 13 | - clocks: one or two phandles. | ||
| 14 | The first one is mandatory and defines the internal clock. | ||
| 15 | The second one is optional and defines an external clock. | ||
| 16 | |||
| 17 | - clock-names: names associated to the clocks: | ||
| 18 | "internal" for the internal clock | ||
| 19 | "extclk" for the external clock | ||
| 20 | |||
| 21 | Example: | ||
| 22 | |||
| 23 | i2s1: audio-controller@b4000 { | ||
| 24 | compatible = "marvell,mvebu-audio"; | ||
| 25 | reg = <0xb4000 0x2210>; | ||
| 26 | interrupts = <21>, <22>; | ||
| 27 | clocks = <&gate_clk 13>; | ||
| 28 | clock-names = "internal"; | ||
| 29 | }; | ||
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 | ||
