diff options
author | Marcus Cooper <codekipper@gmail.com> | 2016-07-30 11:56:38 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-08-12 07:00:34 -0400 |
commit | 2f6963cb52bee440105f732b3411f18e38ed6e52 (patch) | |
tree | 034e22d1d1f3d2ce9cc50616f8997443df0847a6 | |
parent | fbb016a25dd0f4160df90bb1319e64e8209c7619 (diff) |
ASoC: sunxi: compatibility for sun6i to SPDIF
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its
reset is controlled via a separate reset controller.
The DMA also complains when the maxburst is set to 4 so it's been adjusted
to 8 which suites both the older and newer SoCs.
Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/sunxi/sun4i-spdif.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c index 0b04fb02125c..88fbb3a1e660 100644 --- a/sound/soc/sunxi/sun4i-spdif.c +++ b/sound/soc/sunxi/sun4i-spdif.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/pm_runtime.h> | 31 | #include <linux/pm_runtime.h> |
32 | #include <linux/reset.h> | ||
32 | #include <sound/dmaengine_pcm.h> | 33 | #include <sound/dmaengine_pcm.h> |
33 | #include <sound/pcm_params.h> | 34 | #include <sound/pcm_params.h> |
34 | #include <sound/soc.h> | 35 | #include <sound/soc.h> |
@@ -162,6 +163,7 @@ struct sun4i_spdif_dev { | |||
162 | struct platform_device *pdev; | 163 | struct platform_device *pdev; |
163 | struct clk *spdif_clk; | 164 | struct clk *spdif_clk; |
164 | struct clk *apb_clk; | 165 | struct clk *apb_clk; |
166 | struct reset_control *rst; | ||
165 | struct snd_soc_dai_driver cpu_dai_drv; | 167 | struct snd_soc_dai_driver cpu_dai_drv; |
166 | struct regmap *regmap; | 168 | struct regmap *regmap; |
167 | struct snd_dmaengine_dai_dma_data dma_params_tx; | 169 | struct snd_dmaengine_dai_dma_data dma_params_tx; |
@@ -411,6 +413,7 @@ static const struct snd_soc_dapm_route dit_routes[] = { | |||
411 | 413 | ||
412 | static const struct of_device_id sun4i_spdif_of_match[] = { | 414 | static const struct of_device_id sun4i_spdif_of_match[] = { |
413 | { .compatible = "allwinner,sun4i-a10-spdif", }, | 415 | { .compatible = "allwinner,sun4i-a10-spdif", }, |
416 | { .compatible = "allwinner,sun6i-a31-spdif", }, | ||
414 | { /* sentinel */ } | 417 | { /* sentinel */ } |
415 | }; | 418 | }; |
416 | MODULE_DEVICE_TABLE(of, sun4i_spdif_of_match); | 419 | MODULE_DEVICE_TABLE(of, sun4i_spdif_of_match); |
@@ -482,11 +485,23 @@ static int sun4i_spdif_probe(struct platform_device *pdev) | |||
482 | } | 485 | } |
483 | 486 | ||
484 | host->dma_params_tx.addr = res->start + SUN4I_SPDIF_TXFIFO; | 487 | host->dma_params_tx.addr = res->start + SUN4I_SPDIF_TXFIFO; |
485 | host->dma_params_tx.maxburst = 4; | 488 | host->dma_params_tx.maxburst = 8; |
486 | host->dma_params_tx.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | 489 | host->dma_params_tx.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; |
487 | 490 | ||
488 | platform_set_drvdata(pdev, host); | 491 | platform_set_drvdata(pdev, host); |
489 | 492 | ||
493 | if (of_device_is_compatible(pdev->dev.of_node, | ||
494 | "allwinner,sun6i-a31-spdif")) { | ||
495 | host->rst = devm_reset_control_get_optional(&pdev->dev, NULL); | ||
496 | if (IS_ERR(host->rst) && PTR_ERR(host->rst) == -EPROBE_DEFER) { | ||
497 | ret = -EPROBE_DEFER; | ||
498 | dev_err(&pdev->dev, "Failed to get reset: %d\n", ret); | ||
499 | goto err_disable_apb_clk; | ||
500 | } | ||
501 | if (!IS_ERR(host->rst)) | ||
502 | reset_control_deassert(host->rst); | ||
503 | } | ||
504 | |||
490 | ret = devm_snd_soc_register_component(&pdev->dev, | 505 | ret = devm_snd_soc_register_component(&pdev->dev, |
491 | &sun4i_spdif_component, &sun4i_spdif_dai, 1); | 506 | &sun4i_spdif_component, &sun4i_spdif_dai, 1); |
492 | if (ret) | 507 | if (ret) |