Skip to contentSkip to conversation

ASoC: S3C64XX: USE DMA info from platform data

PATCH Applied [email protected] 3 participants 4 messages Dec 9, 2009 – Jan 28, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 4/7 ASoC: S3C64XX: USE DMA info from platform data

From: Jassi Brar <[email protected]>

Instead of hardcoding DMA channel numbers and address, for each controller in the driver, let the information be read from platform data.

---
 sound/soc/s3c24xx/s3c64xx-i2s.c |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)
sound/soc/s3c24xx/s3c64xx-i2s.c +21 -10
index 93ed3aa..8ca3c1d 100644
@@ -147,6 +147,7 @@ static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev)
 {
 	struct s3c_i2sv2_info *i2s;
 	struct snd_soc_dai *dai;
+	struct resource *res;
 	int ret;
 
 	if (pdev->id >= MAX_I2SV3) {
@@ -174,17 +175,27 @@ static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev)
 	i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id];
 	i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id];
 
-	if (pdev->id == 0) {
-		i2s->dma_capture->channel = DMACH_I2S0_IN;
-		i2s->dma_capture->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISRXD;
-		i2s->dma_playback->channel = DMACH_I2S0_OUT;
-		i2s->dma_playback->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISTXD;
-	} else {
-		i2s->dma_capture->channel = DMACH_I2S1_IN;
-		i2s->dma_capture->dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISRXD;
-		i2s->dma_playback->channel = DMACH_I2S1_OUT;
-		i2s->dma_playback->dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISTXD;
+	res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "Unable to get I2S-TX dma resource\n");
+		return -ENXIO;
 	}
+	i2s->dma_playback->channel = res->start;
+
+	res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+	if (!res) {
+		dev_err(&pdev->dev, "Unable to get I2S-RX dma resource\n");
+		return -ENXIO;
+	}
+	i2s->dma_capture->channel = res->start;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "Unable to get I2S SFR address\n");
+		return -ENXIO;
+	}
+	i2s->dma_capture->dma_addr = res->start + S3C2412_IISRXD;
+	i2s->dma_playback->dma_addr = res->start + S3C2412_IISTXD;
 
 	i2s->dma_capture->client = &s3c64xx_dma_client_in;
 	i2s->dma_capture->dma_size = 4;
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 6 lines · On Wed, Dec 09, 2009 at 01:29:38PM +0900, [email protected] wrote:

From: Jassi Brar <[email protected]>

Instead of hardcoding DMA channel numbers and address, for each controller in the driver, let the information be read from platform data.

OK, but this needs to go along with the arch/arm side to avoid breaking the driver.

#2 lore raw
Quoted 10 lines · Mark Brown
Quoted 6 lines · On Wed, Dec 09, 2009 at 01:29:38PM +0900, [email protected] wrote:

From: Jassi Brar <[email protected]>

Instead of hardcoding DMA channel numbers and address, for each controller in the driver, let the information be read from platform data.

OK, but this needs to go along with the arch/arm side to avoid breaking the driver.

I've applied the arch/arm side of the patch already, as this was quite eassy to do. It is then a case of whether I should take the patch to remove it from sound/soc/s3c24xx/s3c64xx-i2s.c or should we wait until my/rmk's tree has been merged into the mainline?

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
author
#3 lore raw
Quoted 9 lines · Ben Dooks
Quoted 8 lines · Mark Brown
Quoted 6 lines · On Wed, Dec 09, 2009 at 01:29:38PM +0900, [email protected] wrote:

From: Jassi Brar <[email protected]>

Instead of hardcoding DMA channel numbers and address, for each controller in the driver, let the information be read from platform data.

Quoted 7 lines
Quoted 2 lines

OK, but this needs to go along with the arch/arm side to avoid breaking the driver.

I've applied the arch/arm side of the patch already, as this was quite eassy to do. It is then a case of whether I should take the patch to remove it from sound/soc/s3c24xx/s3c64xx-i2s.c or should we wait until my/rmk's tree has been merged into the mainline?

btw, patch 5/7 http://mailman.alsa-project.org/pipermail/alsa-devel/2009-December/023782.html
is pending too for the same reason.
ofcourse, I will resend as you decide how to proceed.
thanks