From a7258efca5cad5ce831c71d30c2f0861a18a40e2 Mon Sep 17 00:00:00 2001 From: Inha Song Date: Wed, 30 Apr 2014 20:09:09 +0900 Subject: ASoC: samsung: Modify i2s driver to support idma i2s-sec driver uses the internal dma. Because ASoC idma devices are not registered as platform device, asoc_idma_platform_register() should be called for idma registration. Change-Id: Iaf7b0c0e3cdf66f4eda720cd705cf802c391d76b Signed-off-by: Inha Song --- sound/soc/samsung/i2s.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index a486c45b86a..4d26f605e38 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -994,7 +995,8 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) if (i2s->quirks & QUIRK_SEC_DAI) idma_reg_addr_init(i2s->addr, - i2s->sec_dai->idma_playback.dma_addr); + i2s->sec_dai->idma_playback.dma_addr, + i2s->sec_dai->idma_playback.irq); probe_exit: /* Reset any constraint on RFS and BFS */ @@ -1145,7 +1147,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) struct s3c_audio_pdata *i2s_pdata = pdev->dev.platform_data; struct samsung_i2s *i2s_cfg = NULL; struct resource *res; - u32 regs_base, quirks = 0, idma_addr = 0; + u32 regs_base, quirks = 0, idma_addr = 0, idma_irq = 0; struct device_node *np = pdev->dev.of_node; enum samsung_dai_type samsung_dai_type; int ret = 0; @@ -1159,10 +1161,12 @@ static int samsung_i2s_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Unable to get drvdata\n"); return -EFAULT; } + snd_soc_register_component(&sec_dai->pdev->dev, &samsung_i2s_component, &sec_dai->i2s_dai_drv, 1); - asoc_dma_platform_register(&pdev->dev); + asoc_idma_platform_register(&pdev->dev); + return 0; } @@ -1219,6 +1223,14 @@ static int samsung_i2s_probe(struct platform_device *pdev) return -EINVAL; } } + + idma_irq = irq_of_parse_and_map(np, 0); + if (idma_irq == NO_IRQ) { + if (quirks & QUIRK_SEC_DAI) { + dev_err(&pdev->dev, "idma irq is not specified"); + return -EINVAL; + } + } } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -1273,6 +1285,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai->base = regs_base; sec_dai->quirks = quirks; sec_dai->idma_playback.dma_addr = idma_addr; + sec_dai->idma_playback.irq = idma_irq; sec_dai->pri_dai = pri_dai; pri_dai->sec_dai = sec_dai; } @@ -1318,7 +1331,11 @@ static int samsung_i2s_remove(struct platform_device *pdev) i2s->pri_dai = NULL; i2s->sec_dai = NULL; - asoc_dma_platform_unregister(&pdev->dev); + if (other) + asoc_idma_platform_unregister(&pdev->dev); + else + asoc_dma_platform_unregister(&pdev->dev); + snd_soc_unregister_component(&pdev->dev); return 0; -- cgit v1.2.3