diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-06-07 12:38:56 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-06-07 12:38:56 -0400 |
commit | 9eb34302681d3f6cf0b186aae31ba08cbd5f22fb (patch) | |
tree | 4cae22049ea71aa548c885671fe252d1bd8248fe | |
parent | 9d7db2b2cb507f31ff29e339e9ed2f825edb555d (diff) | |
parent | 04c09a15f5c3a1f468cb8daf570eec3af21940ed (diff) |
Merge branch 'for-2.6.36' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6 into topic/asoc
-rw-r--r-- | arch/arm/plat-mxc/include/mach/ssi.h | 3 | ||||
-rw-r--r-- | sound/soc/Kconfig | 1 | ||||
-rw-r--r-- | sound/soc/Makefile | 1 | ||||
-rw-r--r-- | sound/soc/atmel/atmel-pcm.c | 1 | ||||
-rw-r--r-- | sound/soc/atmel/atmel_ssc_dai.c | 1 | ||||
-rw-r--r-- | sound/soc/au1x/psc-ac97.c | 13 | ||||
-rw-r--r-- | sound/soc/au1x/psc-i2s.c | 13 | ||||
-rw-r--r-- | sound/soc/au1x/psc.h | 1 | ||||
-rw-r--r-- | sound/soc/ep93xx/Kconfig | 9 | ||||
-rw-r--r-- | sound/soc/ep93xx/Makefile | 8 | ||||
-rw-r--r-- | sound/soc/ep93xx/ep93xx-i2s.c | 487 | ||||
-rw-r--r-- | sound/soc/ep93xx/ep93xx-i2s.h | 18 | ||||
-rw-r--r-- | sound/soc/ep93xx/ep93xx-pcm.c | 319 | ||||
-rw-r--r-- | sound/soc/ep93xx/ep93xx-pcm.h | 22 | ||||
-rw-r--r-- | sound/soc/imx/Kconfig | 20 | ||||
-rw-r--r-- | sound/soc/imx/Makefile | 2 | ||||
-rw-r--r-- | sound/soc/imx/eukrea-tlv320.c | 135 | ||||
-rw-r--r-- | sound/soc/imx/imx-ssi.c | 11 | ||||
-rw-r--r-- | sound/soc/kirkwood/kirkwood-i2s.c | 1 | ||||
-rw-r--r-- | sound/soc/nuc900/nuc900-ac97.c | 32 | ||||
-rw-r--r-- | sound/soc/nuc900/nuc900-audio.h (renamed from sound/soc/nuc900/nuc900-auido.h) | 4 | ||||
-rw-r--r-- | sound/soc/nuc900/nuc900-pcm.c | 18 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c-ac97.c | 1 | ||||
-rw-r--r-- | sound/soc/s6000/s6000-i2s.c | 38 |
24 files changed, 1080 insertions, 79 deletions
diff --git a/arch/arm/plat-mxc/include/mach/ssi.h b/arch/arm/plat-mxc/include/mach/ssi.h index c34ded523f10..63f3c2804239 100644 --- a/arch/arm/plat-mxc/include/mach/ssi.h +++ b/arch/arm/plat-mxc/include/mach/ssi.h | |||
@@ -10,6 +10,9 @@ struct imx_ssi_platform_data { | |||
10 | unsigned int flags; | 10 | unsigned int flags; |
11 | #define IMX_SSI_DMA (1 << 0) | 11 | #define IMX_SSI_DMA (1 << 0) |
12 | #define IMX_SSI_USE_AC97 (1 << 1) | 12 | #define IMX_SSI_USE_AC97 (1 << 1) |
13 | #define IMX_SSI_NET (1 << 2) | ||
14 | #define IMX_SSI_SYN (1 << 3) | ||
15 | #define IMX_SSI_USE_I2S_SLAVE (1 << 4) | ||
13 | void (*ac97_reset) (struct snd_ac97 *ac97); | 16 | void (*ac97_reset) (struct snd_ac97 *ac97); |
14 | void (*ac97_warm_reset)(struct snd_ac97 *ac97); | 17 | void (*ac97_warm_reset)(struct snd_ac97 *ac97); |
15 | }; | 18 | }; |
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 5e68ac880832..d35f848db6b5 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig | |||
@@ -28,6 +28,7 @@ source "sound/soc/atmel/Kconfig" | |||
28 | source "sound/soc/au1x/Kconfig" | 28 | source "sound/soc/au1x/Kconfig" |
29 | source "sound/soc/blackfin/Kconfig" | 29 | source "sound/soc/blackfin/Kconfig" |
30 | source "sound/soc/davinci/Kconfig" | 30 | source "sound/soc/davinci/Kconfig" |
31 | source "sound/soc/ep93xx/Kconfig" | ||
31 | source "sound/soc/fsl/Kconfig" | 32 | source "sound/soc/fsl/Kconfig" |
32 | source "sound/soc/imx/Kconfig" | 33 | source "sound/soc/imx/Kconfig" |
33 | source "sound/soc/nuc900/Kconfig" | 34 | source "sound/soc/nuc900/Kconfig" |
diff --git a/sound/soc/Makefile b/sound/soc/Makefile index 05d5d340968e..97661b747b91 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile | |||
@@ -6,6 +6,7 @@ obj-$(CONFIG_SND_SOC) += atmel/ | |||
6 | obj-$(CONFIG_SND_SOC) += au1x/ | 6 | obj-$(CONFIG_SND_SOC) += au1x/ |
7 | obj-$(CONFIG_SND_SOC) += blackfin/ | 7 | obj-$(CONFIG_SND_SOC) += blackfin/ |
8 | obj-$(CONFIG_SND_SOC) += davinci/ | 8 | obj-$(CONFIG_SND_SOC) += davinci/ |
9 | obj-$(CONFIG_SND_SOC) += ep93xx/ | ||
9 | obj-$(CONFIG_SND_SOC) += fsl/ | 10 | obj-$(CONFIG_SND_SOC) += fsl/ |
10 | obj-$(CONFIG_SND_SOC) += imx/ | 11 | obj-$(CONFIG_SND_SOC) += imx/ |
11 | obj-$(CONFIG_SND_SOC) += nuc900/ | 12 | obj-$(CONFIG_SND_SOC) += nuc900/ |
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c index f6b3cc04b34b..dc5249fba85c 100644 --- a/sound/soc/atmel/atmel-pcm.c +++ b/sound/soc/atmel/atmel-pcm.c | |||
@@ -77,7 +77,6 @@ struct atmel_runtime_data { | |||
77 | size_t period_size; | 77 | size_t period_size; |
78 | 78 | ||
79 | dma_addr_t period_ptr; /* physical address of next period */ | 79 | dma_addr_t period_ptr; /* physical address of next period */ |
80 | int periods; /* period index of period_ptr */ | ||
81 | 80 | ||
82 | /* PDC register save */ | 81 | /* PDC register save */ |
83 | u32 pdc_xpr_save; | 82 | u32 pdc_xpr_save; |
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index 0b59806905d1..c85844d4845b 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c | |||
@@ -549,7 +549,6 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
549 | printk(KERN_WARNING "atmel_ssc_dai: unsupported DAI format 0x%x\n", | 549 | printk(KERN_WARNING "atmel_ssc_dai: unsupported DAI format 0x%x\n", |
550 | ssc_p->daifmt); | 550 | ssc_p->daifmt); |
551 | return -EINVAL; | 551 | return -EINVAL; |
552 | break; | ||
553 | } | 552 | } |
554 | pr_debug("atmel_ssc_hw_params: " | 553 | pr_debug("atmel_ssc_hw_params: " |
555 | "RCMR=%08x RFMR=%08x TCMR=%08x TFMR=%08x\n", | 554 | "RCMR=%08x RFMR=%08x TCMR=%08x TFMR=%08x\n", |
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index a61ccd2d505f..d14a5a91a465 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c | |||
@@ -375,12 +375,10 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) | |||
375 | } | 375 | } |
376 | 376 | ||
377 | ret = -EBUSY; | 377 | ret = -EBUSY; |
378 | wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, | 378 | if (!request_mem_region(r->start, resource_size(r), pdev->name)) |
379 | "au1xpsc_ac97"); | ||
380 | if (!wd->ioarea) | ||
381 | goto out0; | 379 | goto out0; |
382 | 380 | ||
383 | wd->mmio = ioremap(r->start, 0xffff); | 381 | wd->mmio = ioremap(r->start, resource_size(r)); |
384 | if (!wd->mmio) | 382 | if (!wd->mmio) |
385 | goto out1; | 383 | goto out1; |
386 | 384 | ||
@@ -410,8 +408,7 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) | |||
410 | 408 | ||
411 | snd_soc_unregister_dai(&au1xpsc_ac97_dai); | 409 | snd_soc_unregister_dai(&au1xpsc_ac97_dai); |
412 | out1: | 410 | out1: |
413 | release_resource(wd->ioarea); | 411 | release_mem_region(r->start, resource_size(r)); |
414 | kfree(wd->ioarea); | ||
415 | out0: | 412 | out0: |
416 | kfree(wd); | 413 | kfree(wd); |
417 | return ret; | 414 | return ret; |
@@ -420,6 +417,7 @@ out0: | |||
420 | static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) | 417 | static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) |
421 | { | 418 | { |
422 | struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); | 419 | struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); |
420 | struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
423 | 421 | ||
424 | if (wd->dmapd) | 422 | if (wd->dmapd) |
425 | au1xpsc_pcm_destroy(wd->dmapd); | 423 | au1xpsc_pcm_destroy(wd->dmapd); |
@@ -433,8 +431,7 @@ static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) | |||
433 | au_sync(); | 431 | au_sync(); |
434 | 432 | ||
435 | iounmap(wd->mmio); | 433 | iounmap(wd->mmio); |
436 | release_resource(wd->ioarea); | 434 | release_mem_region(r->start, resource_size(r)); |
437 | kfree(wd->ioarea); | ||
438 | kfree(wd); | 435 | kfree(wd); |
439 | 436 | ||
440 | au1xpsc_ac97_workdata = NULL; /* MDEV */ | 437 | au1xpsc_ac97_workdata = NULL; /* MDEV */ |
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 495be6e71931..737b2384f6c5 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c | |||
@@ -321,12 +321,10 @@ static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | ret = -EBUSY; | 323 | ret = -EBUSY; |
324 | wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, | 324 | if (!request_mem_region(r->start, resource_size(r), pdev->name)) |
325 | "au1xpsc_i2s"); | ||
326 | if (!wd->ioarea) | ||
327 | goto out0; | 325 | goto out0; |
328 | 326 | ||
329 | wd->mmio = ioremap(r->start, 0xffff); | 327 | wd->mmio = ioremap(r->start, resource_size(r)); |
330 | if (!wd->mmio) | 328 | if (!wd->mmio) |
331 | goto out1; | 329 | goto out1; |
332 | 330 | ||
@@ -362,8 +360,7 @@ static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev) | |||
362 | 360 | ||
363 | snd_soc_unregister_dai(&au1xpsc_i2s_dai); | 361 | snd_soc_unregister_dai(&au1xpsc_i2s_dai); |
364 | out1: | 362 | out1: |
365 | release_resource(wd->ioarea); | 363 | release_mem_region(r->start, resource_size(r)); |
366 | kfree(wd->ioarea); | ||
367 | out0: | 364 | out0: |
368 | kfree(wd); | 365 | kfree(wd); |
369 | return ret; | 366 | return ret; |
@@ -372,6 +369,7 @@ out0: | |||
372 | static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) | 369 | static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) |
373 | { | 370 | { |
374 | struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); | 371 | struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); |
372 | struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
375 | 373 | ||
376 | if (wd->dmapd) | 374 | if (wd->dmapd) |
377 | au1xpsc_pcm_destroy(wd->dmapd); | 375 | au1xpsc_pcm_destroy(wd->dmapd); |
@@ -384,8 +382,7 @@ static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) | |||
384 | au_sync(); | 382 | au_sync(); |
385 | 383 | ||
386 | iounmap(wd->mmio); | 384 | iounmap(wd->mmio); |
387 | release_resource(wd->ioarea); | 385 | release_mem_region(r->start, resource_size(r)); |
388 | kfree(wd->ioarea); | ||
389 | kfree(wd); | 386 | kfree(wd); |
390 | 387 | ||
391 | au1xpsc_i2s_workdata = NULL; /* MDEV */ | 388 | au1xpsc_i2s_workdata = NULL; /* MDEV */ |
diff --git a/sound/soc/au1x/psc.h b/sound/soc/au1x/psc.h index 32d3807d3f5a..093775d4dc3e 100644 --- a/sound/soc/au1x/psc.h +++ b/sound/soc/au1x/psc.h | |||
@@ -32,7 +32,6 @@ struct au1xpsc_audio_data { | |||
32 | unsigned long rate; | 32 | unsigned long rate; |
33 | 33 | ||
34 | unsigned long pm[2]; | 34 | unsigned long pm[2]; |
35 | struct resource *ioarea; | ||
36 | struct mutex lock; | 35 | struct mutex lock; |
37 | struct platform_device *dmapd; | 36 | struct platform_device *dmapd; |
38 | }; | 37 | }; |
diff --git a/sound/soc/ep93xx/Kconfig b/sound/soc/ep93xx/Kconfig new file mode 100644 index 000000000000..ba66ac8e1419 --- /dev/null +++ b/sound/soc/ep93xx/Kconfig | |||
@@ -0,0 +1,9 @@ | |||
1 | config SND_EP93XX_SOC | ||
2 | tristate "SoC Audio support for the Cirrus Logic EP93xx series" | ||
3 | depends on ARCH_EP93XX && SND_SOC | ||
4 | help | ||
5 | Say Y or M if you want to add support for codecs attached to | ||
6 | the EP93xx I2S interface. | ||
7 | |||
8 | config SND_EP93XX_SOC_I2S | ||
9 | tristate | ||
diff --git a/sound/soc/ep93xx/Makefile b/sound/soc/ep93xx/Makefile new file mode 100644 index 000000000000..0239da36cea3 --- /dev/null +++ b/sound/soc/ep93xx/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # EP93xx Platform Support | ||
2 | snd-soc-ep93xx-objs := ep93xx-pcm.o | ||
3 | snd-soc-ep93xx-i2s-objs := ep93xx-i2s.o | ||
4 | |||
5 | obj-$(CONFIG_SND_EP93XX_SOC) += snd-soc-ep93xx.o | ||
6 | obj-$(CONFIG_SND_EP93XX_SOC_I2S) += snd-soc-ep93xx-i2s.o | ||
7 | |||
8 | # EP93XX Machine Support | ||
diff --git a/sound/soc/ep93xx/ep93xx-i2s.c b/sound/soc/ep93xx/ep93xx-i2s.c new file mode 100644 index 000000000000..00b946632184 --- /dev/null +++ b/sound/soc/ep93xx/ep93xx-i2s.c | |||
@@ -0,0 +1,487 @@ | |||
1 | /* | ||
2 | * linux/sound/soc/ep93xx-i2s.c | ||
3 | * EP93xx I2S driver | ||
4 | * | ||
5 | * Copyright (C) 2010 Ryan Mallon <ryan@bluewatersys.com> | ||
6 | * | ||
7 | * Based on the original driver by: | ||
8 | * Copyright (C) 2007 Chase Douglas <chasedouglas@gmail> | ||
9 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/clk.h> | ||
21 | #include <linux/io.h> | ||
22 | |||
23 | #include <sound/core.h> | ||
24 | #include <sound/pcm.h> | ||
25 | #include <sound/pcm_params.h> | ||
26 | #include <sound/initval.h> | ||
27 | #include <sound/soc.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <mach/ep93xx-regs.h> | ||
31 | #include <mach/dma.h> | ||
32 | |||
33 | #include "ep93xx-pcm.h" | ||
34 | #include "ep93xx-i2s.h" | ||
35 | |||
36 | #define EP93XX_I2S_TXCLKCFG 0x00 | ||
37 | #define EP93XX_I2S_RXCLKCFG 0x04 | ||
38 | #define EP93XX_I2S_GLCTRL 0x0C | ||
39 | |||
40 | #define EP93XX_I2S_TXLINCTRLDATA 0x28 | ||
41 | #define EP93XX_I2S_TXCTRL 0x2C | ||
42 | #define EP93XX_I2S_TXWRDLEN 0x30 | ||
43 | #define EP93XX_I2S_TX0EN 0x34 | ||
44 | |||
45 | #define EP93XX_I2S_RXLINCTRLDATA 0x58 | ||
46 | #define EP93XX_I2S_RXCTRL 0x5C | ||
47 | #define EP93XX_I2S_RXWRDLEN 0x60 | ||
48 | #define EP93XX_I2S_RX0EN 0x64 | ||
49 | |||
50 | #define EP93XX_I2S_WRDLEN_16 (0 << 0) | ||
51 | #define EP93XX_I2S_WRDLEN_24 (1 << 0) | ||
52 | #define EP93XX_I2S_WRDLEN_32 (2 << 0) | ||
53 | |||
54 | #define EP93XX_I2S_LINCTRLDATA_R_JUST (1 << 2) /* Right justify */ | ||
55 | |||
56 | #define EP93XX_I2S_CLKCFG_LRS (1 << 0) /* lrclk polarity */ | ||
57 | #define EP93XX_I2S_CLKCFG_CKP (1 << 1) /* Bit clock polarity */ | ||
58 | #define EP93XX_I2S_CLKCFG_REL (1 << 2) /* First bit transition */ | ||
59 | #define EP93XX_I2S_CLKCFG_MASTER (1 << 3) /* Master mode */ | ||
60 | #define EP93XX_I2S_CLKCFG_NBCG (1 << 4) /* Not bit clock gating */ | ||
61 | |||
62 | struct ep93xx_i2s_info { | ||
63 | struct clk *mclk; | ||
64 | struct clk *sclk; | ||
65 | struct clk *lrclk; | ||
66 | struct ep93xx_pcm_dma_params *dma_params; | ||
67 | struct resource *mem; | ||
68 | void __iomem *regs; | ||
69 | }; | ||
70 | |||
71 | struct ep93xx_pcm_dma_params ep93xx_i2s_dma_params[] = { | ||
72 | [SNDRV_PCM_STREAM_PLAYBACK] = { | ||
73 | .name = "i2s-pcm-out", | ||
74 | .dma_port = EP93XX_DMA_M2P_PORT_I2S1, | ||
75 | }, | ||
76 | [SNDRV_PCM_STREAM_CAPTURE] = { | ||
77 | .name = "i2s-pcm-in", | ||
78 | .dma_port = EP93XX_DMA_M2P_PORT_I2S1, | ||
79 | }, | ||
80 | }; | ||
81 | |||
82 | static inline void ep93xx_i2s_write_reg(struct ep93xx_i2s_info *info, | ||
83 | unsigned reg, unsigned val) | ||
84 | { | ||
85 | __raw_writel(val, info->regs + reg); | ||
86 | } | ||
87 | |||
88 | static inline unsigned ep93xx_i2s_read_reg(struct ep93xx_i2s_info *info, | ||
89 | unsigned reg) | ||
90 | { | ||
91 | return __raw_readl(info->regs + reg); | ||
92 | } | ||
93 | |||
94 | static void ep93xx_i2s_enable(struct ep93xx_i2s_info *info, int stream) | ||
95 | { | ||
96 | unsigned base_reg; | ||
97 | int i; | ||
98 | |||
99 | if ((ep93xx_i2s_read_reg(info, EP93XX_I2S_TX0EN) & 0x1) == 0 && | ||
100 | (ep93xx_i2s_read_reg(info, EP93XX_I2S_RX0EN) & 0x1) == 0) { | ||
101 | /* Enable clocks */ | ||
102 | clk_enable(info->mclk); | ||
103 | clk_enable(info->sclk); | ||
104 | clk_enable(info->lrclk); | ||
105 | |||
106 | /* Enable i2s */ | ||
107 | ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 1); | ||
108 | } | ||
109 | |||
110 | /* Enable fifos */ | ||
111 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
112 | base_reg = EP93XX_I2S_TX0EN; | ||
113 | else | ||
114 | base_reg = EP93XX_I2S_RX0EN; | ||
115 | for (i = 0; i < 3; i++) | ||
116 | ep93xx_i2s_write_reg(info, base_reg + (i * 4), 1); | ||
117 | } | ||
118 | |||
119 | static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream) | ||
120 | { | ||
121 | unsigned base_reg; | ||
122 | int i; | ||
123 | |||
124 | /* Disable fifos */ | ||
125 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
126 | base_reg = EP93XX_I2S_TX0EN; | ||
127 | else | ||
128 | base_reg = EP93XX_I2S_RX0EN; | ||
129 | for (i = 0; i < 3; i++) | ||
130 | ep93xx_i2s_write_reg(info, base_reg + (i * 4), 0); | ||
131 | |||
132 | if ((ep93xx_i2s_read_reg(info, EP93XX_I2S_TX0EN) & 0x1) == 0 && | ||
133 | (ep93xx_i2s_read_reg(info, EP93XX_I2S_RX0EN) & 0x1) == 0) { | ||
134 | /* Disable i2s */ | ||
135 | ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 0); | ||
136 | |||
137 | /* Disable clocks */ | ||
138 | clk_disable(info->lrclk); | ||
139 | clk_disable(info->sclk); | ||
140 | clk_disable(info->mclk); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | static int ep93xx_i2s_startup(struct snd_pcm_substream *substream, | ||
145 | struct snd_soc_dai *dai) | ||
146 | { | ||
147 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
148 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
149 | struct ep93xx_i2s_info *info = rtd->dai->cpu_dai->private_data; | ||
150 | |||
151 | snd_soc_dai_set_dma_data(cpu_dai, substream, | ||
152 | &info->dma_params[substream->stream]); | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static void ep93xx_i2s_shutdown(struct snd_pcm_substream *substream, | ||
157 | struct snd_soc_dai *dai) | ||
158 | { | ||
159 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
160 | struct ep93xx_i2s_info *info = rtd->dai->cpu_dai->private_data; | ||
161 | |||
162 | ep93xx_i2s_disable(info, substream->stream); | ||
163 | } | ||
164 | |||
165 | static int ep93xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | ||
166 | unsigned int fmt) | ||
167 | { | ||
168 | struct ep93xx_i2s_info *info = cpu_dai->private_data; | ||
169 | unsigned int clk_cfg, lin_ctrl; | ||
170 | |||
171 | clk_cfg = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXCLKCFG); | ||
172 | lin_ctrl = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXLINCTRLDATA); | ||
173 | |||
174 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | ||
175 | case SND_SOC_DAIFMT_I2S: | ||
176 | clk_cfg |= EP93XX_I2S_CLKCFG_REL; | ||
177 | lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST; | ||
178 | break; | ||
179 | |||
180 | case SND_SOC_DAIFMT_LEFT_J: | ||
181 | clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; | ||
182 | lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST; | ||
183 | break; | ||
184 | |||
185 | case SND_SOC_DAIFMT_RIGHT_J: | ||
186 | clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; | ||
187 | lin_ctrl |= EP93XX_I2S_LINCTRLDATA_R_JUST; | ||
188 | break; | ||
189 | |||
190 | default: | ||
191 | return -EINVAL; | ||
192 | } | ||
193 | |||
194 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | ||
195 | case SND_SOC_DAIFMT_CBS_CFS: | ||
196 | /* CPU is master */ | ||
197 | clk_cfg |= EP93XX_I2S_CLKCFG_MASTER; | ||
198 | break; | ||
199 | |||
200 | case SND_SOC_DAIFMT_CBM_CFM: | ||
201 | /* Codec is master */ | ||
202 | clk_cfg &= ~EP93XX_I2S_CLKCFG_MASTER; | ||
203 | break; | ||
204 | |||
205 | default: | ||
206 | return -EINVAL; | ||
207 | } | ||
208 | |||
209 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | ||
210 | case SND_SOC_DAIFMT_NB_NF: | ||
211 | /* Negative bit clock, lrclk low on left word */ | ||
212 | clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL); | ||
213 | break; | ||
214 | |||
215 | case SND_SOC_DAIFMT_NB_IF: | ||
216 | /* Negative bit clock, lrclk low on right word */ | ||
217 | clk_cfg &= ~EP93XX_I2S_CLKCFG_CKP; | ||
218 | clk_cfg |= EP93XX_I2S_CLKCFG_REL; | ||
219 | break; | ||
220 | |||
221 | case SND_SOC_DAIFMT_IB_NF: | ||
222 | /* Positive bit clock, lrclk low on left word */ | ||
223 | clk_cfg |= EP93XX_I2S_CLKCFG_CKP; | ||
224 | clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; | ||
225 | break; | ||
226 | |||
227 | case SND_SOC_DAIFMT_IB_IF: | ||
228 | /* Positive bit clock, lrclk low on right word */ | ||
229 | clk_cfg |= EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL; | ||
230 | break; | ||
231 | } | ||
232 | |||
233 | /* Write new register values */ | ||
234 | ep93xx_i2s_write_reg(info, EP93XX_I2S_RXCLKCFG, clk_cfg); | ||
235 | ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCLKCFG, clk_cfg); | ||
236 | ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, lin_ctrl); | ||
237 | ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, lin_ctrl); | ||
238 | return 0; | ||
239 | } | ||
240 | |||
241 | static int ep93xx_i2s_hw_params(struct snd_pcm_substream *substream, | ||
242 | struct snd_pcm_hw_params *params, | ||
243 | struct snd_soc_dai *dai) | ||
244 | { | ||
245 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
246 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
247 | struct ep93xx_i2s_info *info = cpu_dai->private_data; | ||
248 | unsigned word_len, div, sdiv, lrdiv; | ||
249 | int found = 0, err; | ||
250 | |||
251 | switch (params_format(params)) { | ||
252 | case SNDRV_PCM_FORMAT_S16_LE: | ||
253 | word_len = EP93XX_I2S_WRDLEN_16; | ||
254 | break; | ||
255 | |||
256 | case SNDRV_PCM_FORMAT_S24_LE: | ||
257 | word_len = EP93XX_I2S_WRDLEN_24; | ||
258 | break; | ||
259 | |||
260 | case SNDRV_PCM_FORMAT_S32_LE: | ||
261 | word_len = EP93XX_I2S_WRDLEN_32; | ||
262 | break; | ||
263 | |||
264 | default: | ||
265 | return -EINVAL; | ||
266 | } | ||
267 | |||
268 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
269 | ep93xx_i2s_write_reg(info, EP93XX_I2S_TXWRDLEN, word_len); | ||
270 | else | ||
271 | ep93xx_i2s_write_reg(info, EP93XX_I2S_RXWRDLEN, word_len); | ||
272 | |||
273 | /* | ||
274 | * Calculate the sdiv (bit clock) and lrdiv (left/right clock) values. | ||
275 | * If the lrclk is pulse length is larger than the word size, then the | ||
276 | * bit clock will be gated for the unused bits. | ||
277 | */ | ||
278 | div = (clk_get_rate(info->mclk) / params_rate(params)) * | ||
279 | params_channels(params); | ||
280 | for (sdiv = 2; sdiv <= 4; sdiv += 2) | ||
281 | for (lrdiv = 32; lrdiv <= 128; lrdiv <<= 1) | ||
282 | if (sdiv * lrdiv == div) { | ||
283 | found = 1; | ||
284 | goto out; | ||
285 | } | ||
286 | out: | ||
287 | if (!found) | ||
288 | return -EINVAL; | ||
289 | |||
290 | err = clk_set_rate(info->sclk, clk_get_rate(info->mclk) / sdiv); | ||
291 | if (err) | ||
292 | return err; | ||
293 | |||
294 | err = clk_set_rate(info->lrclk, clk_get_rate(info->sclk) / lrdiv); | ||
295 | if (err) | ||
296 | return err; | ||
297 | |||
298 | ep93xx_i2s_enable(info, substream->stream); | ||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | static int ep93xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id, | ||
303 | unsigned int freq, int dir) | ||
304 | { | ||
305 | struct ep93xx_i2s_info *info = cpu_dai->private_data; | ||
306 | |||
307 | if (dir == SND_SOC_CLOCK_IN || clk_id != 0) | ||
308 | return -EINVAL; | ||
309 | |||
310 | return clk_set_rate(info->mclk, freq); | ||
311 | } | ||
312 | |||
313 | #ifdef CONFIG_PM | ||
314 | static int ep93xx_i2s_suspend(struct snd_soc_dai *dai) | ||
315 | { | ||
316 | struct ep93xx_i2s_info *info = dai->private_data; | ||
317 | |||
318 | if (!dai->active) | ||
319 | return; | ||
320 | |||
321 | ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_PLAYBACK); | ||
322 | ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_CAPTURE); | ||
323 | } | ||
324 | |||
325 | static int ep93xx_i2s_resume(struct snd_soc_dai *dai) | ||
326 | { | ||
327 | struct ep93xx_i2s_info *info = dai->private_data; | ||
328 | |||
329 | if (!dai->active) | ||
330 | return; | ||
331 | |||
332 | ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_PLAYBACK); | ||
333 | ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_CAPTURE); | ||
334 | } | ||
335 | #else | ||
336 | #define ep93xx_i2s_suspend NULL | ||
337 | #define ep93xx_i2s_resume NULL | ||
338 | #endif | ||
339 | |||
340 | static struct snd_soc_dai_ops ep93xx_i2s_dai_ops = { | ||
341 | .startup = ep93xx_i2s_startup, | ||
342 | .shutdown = ep93xx_i2s_shutdown, | ||
343 | .hw_params = ep93xx_i2s_hw_params, | ||
344 | .set_sysclk = ep93xx_i2s_set_sysclk, | ||
345 | .set_fmt = ep93xx_i2s_set_dai_fmt, | ||
346 | }; | ||
347 | |||
348 | #define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ | ||
349 | SNDRV_PCM_FMTBIT_S24_LE | \ | ||
350 | SNDRV_PCM_FMTBIT_S32_LE) | ||
351 | |||
352 | struct snd_soc_dai ep93xx_i2s_dai = { | ||
353 | .name = "ep93xx-i2s", | ||
354 | .id = 0, | ||
355 | .symmetric_rates= 1, | ||
356 | .suspend = ep93xx_i2s_suspend, | ||
357 | .resume = ep93xx_i2s_resume, | ||
358 | .playback = { | ||
359 | .channels_min = 2, | ||
360 | .channels_max = 2, | ||
361 | .rates = SNDRV_PCM_RATE_8000_48000, | ||
362 | .formats = EP93XX_I2S_FORMATS, | ||
363 | }, | ||
364 | .capture = { | ||
365 | .channels_min = 2, | ||
366 | .channels_max = 2, | ||
367 | .rates = SNDRV_PCM_RATE_8000_48000, | ||
368 | .formats = EP93XX_I2S_FORMATS, | ||
369 | }, | ||
370 | .ops = &ep93xx_i2s_dai_ops, | ||
371 | }; | ||
372 | EXPORT_SYMBOL_GPL(ep93xx_i2s_dai); | ||
373 | |||
374 | static int ep93xx_i2s_probe(struct platform_device *pdev) | ||
375 | { | ||
376 | struct ep93xx_i2s_info *info; | ||
377 | struct resource *res; | ||
378 | int err; | ||
379 | |||
380 | info = kzalloc(sizeof(struct ep93xx_i2s_info), GFP_KERNEL); | ||
381 | if (!info) { | ||
382 | err = -ENOMEM; | ||
383 | goto fail; | ||
384 | } | ||
385 | |||
386 | ep93xx_i2s_dai.dev = &pdev->dev; | ||
387 | ep93xx_i2s_dai.private_data = info; | ||
388 | info->dma_params = ep93xx_i2s_dma_params; | ||
389 | |||
390 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
391 | if (!res) { | ||
392 | err = -ENODEV; | ||
393 | goto fail; | ||
394 | } | ||
395 | |||
396 | info->mem = request_mem_region(res->start, resource_size(res), | ||
397 | pdev->name); | ||
398 | if (!info->mem) { | ||
399 | err = -EBUSY; | ||
400 | goto fail; | ||
401 | } | ||
402 | |||
403 | info->regs = ioremap(info->mem->start, resource_size(info->mem)); | ||
404 | if (!info->regs) { | ||
405 | err = -ENXIO; | ||
406 | goto fail_release_mem; | ||
407 | } | ||
408 | |||
409 | info->mclk = clk_get(&pdev->dev, "mclk"); | ||
410 | if (IS_ERR(info->mclk)) { | ||
411 | err = PTR_ERR(info->mclk); | ||
412 | goto fail_unmap_mem; | ||
413 | } | ||
414 | |||
415 | info->sclk = clk_get(&pdev->dev, "sclk"); | ||
416 | if (IS_ERR(info->sclk)) { | ||
417 | err = PTR_ERR(info->sclk); | ||
418 | goto fail_put_mclk; | ||
419 | } | ||
420 | |||
421 | info->lrclk = clk_get(&pdev->dev, "lrclk"); | ||
422 | if (IS_ERR(info->lrclk)) { | ||
423 | err = PTR_ERR(info->lrclk); | ||
424 | goto fail_put_sclk; | ||
425 | } | ||
426 | |||
427 | err = snd_soc_register_dai(&ep93xx_i2s_dai); | ||
428 | if (err) | ||
429 | goto fail_put_lrclk; | ||
430 | |||
431 | return 0; | ||
432 | |||
433 | fail_put_lrclk: | ||
434 | clk_put(info->lrclk); | ||
435 | fail_put_sclk: | ||
436 | clk_put(info->sclk); | ||
437 | fail_put_mclk: | ||
438 | clk_put(info->mclk); | ||
439 | fail_unmap_mem: | ||
440 | iounmap(info->regs); | ||
441 | fail_release_mem: | ||
442 | release_mem_region(info->mem->start, resource_size(info->mem)); | ||
443 | kfree(info); | ||
444 | fail: | ||
445 | return err; | ||
446 | } | ||
447 | |||
448 | static int __devexit ep93xx_i2s_remove(struct platform_device *pdev) | ||
449 | { | ||
450 | struct ep93xx_i2s_info *info = ep93xx_i2s_dai.private_data; | ||
451 | |||
452 | snd_soc_unregister_dai(&ep93xx_i2s_dai); | ||
453 | clk_put(info->lrclk); | ||
454 | clk_put(info->sclk); | ||
455 | clk_put(info->mclk); | ||
456 | iounmap(info->regs); | ||
457 | release_mem_region(info->mem->start, resource_size(info->mem)); | ||
458 | kfree(info); | ||
459 | return 0; | ||
460 | } | ||
461 | |||
462 | static struct platform_driver ep93xx_i2s_driver = { | ||
463 | .probe = ep93xx_i2s_probe, | ||
464 | .remove = __devexit_p(ep93xx_i2s_remove), | ||
465 | .driver = { | ||
466 | .name = "ep93xx-i2s", | ||
467 | .owner = THIS_MODULE, | ||
468 | }, | ||
469 | }; | ||
470 | |||
471 | static int __init ep93xx_i2s_init(void) | ||
472 | { | ||
473 | return platform_driver_register(&ep93xx_i2s_driver); | ||
474 | } | ||
475 | |||
476 | static void __exit ep93xx_i2s_exit(void) | ||
477 | { | ||
478 | platform_driver_unregister(&ep93xx_i2s_driver); | ||
479 | } | ||
480 | |||
481 | module_init(ep93xx_i2s_init); | ||
482 | module_exit(ep93xx_i2s_exit); | ||
483 | |||
484 | MODULE_ALIAS("platform:ep93xx-i2s"); | ||
485 | MODULE_AUTHOR("Ryan Mallon <ryan@bluewatersys.com>"); | ||
486 | MODULE_DESCRIPTION("EP93XX I2S driver"); | ||
487 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/ep93xx/ep93xx-i2s.h b/sound/soc/ep93xx/ep93xx-i2s.h new file mode 100644 index 000000000000..3bd4ebfaa1de --- /dev/null +++ b/sound/soc/ep93xx/ep93xx-i2s.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * linux/sound/soc/ep93xx-i2s.h | ||
3 | * EP93xx I2S driver | ||
4 | * | ||
5 | * Copyright (C) 2010 Ryan Mallon <ryan@bluewatersys.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef _EP93XX_SND_SOC_I2S_H | ||
14 | #define _EP93XX_SND_SOC_I2S_H | ||
15 | |||
16 | extern struct snd_soc_dai ep93xx_i2s_dai; | ||
17 | |||
18 | #endif /* _EP93XX_SND_SOC_I2S_H */ | ||
diff --git a/sound/soc/ep93xx/ep93xx-pcm.c b/sound/soc/ep93xx/ep93xx-pcm.c new file mode 100644 index 000000000000..4ba938400791 --- /dev/null +++ b/sound/soc/ep93xx/ep93xx-pcm.c | |||
@@ -0,0 +1,319 @@ | |||
1 | /* | ||
2 | * linux/sound/arm/ep93xx-pcm.c - EP93xx ALSA PCM interface | ||
3 | * | ||
4 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | ||
5 | * Copyright (C) 2006 Applied Data Systems | ||
6 | * | ||
7 | * Rewritten for the SoC audio subsystem (Based on PXA2xx code): | ||
8 | * Copyright (c) 2008 Ryan Mallon <ryan@bluewatersys.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/dma-mapping.h> | ||
20 | |||
21 | #include <sound/core.h> | ||
22 | #include <sound/pcm.h> | ||
23 | #include <sound/pcm_params.h> | ||
24 | #include <sound/soc.h> | ||
25 | |||
26 | #include <mach/dma.h> | ||
27 | #include <mach/hardware.h> | ||
28 | #include <mach/ep93xx-regs.h> | ||
29 | |||
30 | #include "ep93xx-pcm.h" | ||
31 | |||
32 | static const struct snd_pcm_hardware ep93xx_pcm_hardware = { | ||
33 | .info = (SNDRV_PCM_INFO_MMAP | | ||
34 | SNDRV_PCM_INFO_MMAP_VALID | | ||
35 | SNDRV_PCM_INFO_INTERLEAVED | | ||
36 | SNDRV_PCM_INFO_BLOCK_TRANSFER), | ||
37 | |||
38 | .rates = SNDRV_PCM_RATE_8000_48000, | ||
39 | .rate_min = SNDRV_PCM_RATE_8000, | ||
40 | .rate_max = SNDRV_PCM_RATE_48000, | ||
41 | |||
42 | .formats = (SNDRV_PCM_FMTBIT_S16_LE | | ||
43 | SNDRV_PCM_FMTBIT_S24_LE | | ||
44 | SNDRV_PCM_FMTBIT_S32_LE), | ||
45 | |||
46 | .buffer_bytes_max = 131072, | ||
47 | .period_bytes_min = 32, | ||
48 | .period_bytes_max = 32768, | ||
49 | .periods_min = 1, | ||
50 | .periods_max = 32, | ||
51 | .fifo_size = 32, | ||
52 | }; | ||
53 | |||
54 | struct ep93xx_runtime_data | ||
55 | { | ||
56 | struct ep93xx_dma_m2p_client cl; | ||
57 | struct ep93xx_pcm_dma_params *params; | ||
58 | int pointer_bytes; | ||
59 | struct tasklet_struct period_tasklet; | ||
60 | int periods; | ||
61 | struct ep93xx_dma_buffer buf[32]; | ||
62 | }; | ||
63 | |||
64 | static void ep93xx_pcm_period_elapsed(unsigned long data) | ||
65 | { | ||
66 | struct snd_pcm_substream *substream = (struct snd_pcm_substream *)data; | ||
67 | snd_pcm_period_elapsed(substream); | ||
68 | } | ||
69 | |||
70 | static void ep93xx_pcm_buffer_started(void *cookie, | ||
71 | struct ep93xx_dma_buffer *buf) | ||
72 | { | ||
73 | } | ||
74 | |||
75 | static void ep93xx_pcm_buffer_finished(void *cookie, | ||
76 | struct ep93xx_dma_buffer *buf, | ||
77 | int bytes, int error) | ||
78 | { | ||
79 | struct snd_pcm_substream *substream = cookie; | ||
80 | struct ep93xx_runtime_data *rtd = substream->runtime->private_data; | ||
81 | |||
82 | if (buf == rtd->buf + rtd->periods - 1) | ||
83 | rtd->pointer_bytes = 0; | ||
84 | else | ||
85 | rtd->pointer_bytes += buf->size; | ||
86 | |||
87 | if (!error) { | ||
88 | ep93xx_dma_m2p_submit_recursive(&rtd->cl, buf); | ||
89 | tasklet_schedule(&rtd->period_tasklet); | ||
90 | } else { | ||
91 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | static int ep93xx_pcm_open(struct snd_pcm_substream *substream) | ||
96 | { | ||
97 | struct snd_soc_pcm_runtime *soc_rtd = substream->private_data; | ||
98 | struct snd_soc_dai *cpu_dai = soc_rtd->dai->cpu_dai; | ||
99 | struct ep93xx_pcm_dma_params *dma_params; | ||
100 | struct ep93xx_runtime_data *rtd; | ||
101 | int ret; | ||
102 | |||
103 | dma_params = snd_soc_dai_get_dma_data(cpu_dai, substream); | ||
104 | snd_soc_set_runtime_hwparams(substream, &ep93xx_pcm_hardware); | ||
105 | |||
106 | rtd = kmalloc(sizeof(*rtd), GFP_KERNEL); | ||
107 | if (!rtd) | ||
108 | return -ENOMEM; | ||
109 | |||
110 | memset(&rtd->period_tasklet, 0, sizeof(rtd->period_tasklet)); | ||
111 | rtd->period_tasklet.func = ep93xx_pcm_period_elapsed; | ||
112 | rtd->period_tasklet.data = (unsigned long)substream; | ||
113 | |||
114 | rtd->cl.name = dma_params->name; | ||
115 | rtd->cl.flags = dma_params->dma_port | EP93XX_DMA_M2P_IGNORE_ERROR | | ||
116 | ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
117 | EP93XX_DMA_M2P_TX : EP93XX_DMA_M2P_RX); | ||
118 | rtd->cl.cookie = substream; | ||
119 | rtd->cl.buffer_started = ep93xx_pcm_buffer_started; | ||
120 | rtd->cl.buffer_finished = ep93xx_pcm_buffer_finished; | ||
121 | ret = ep93xx_dma_m2p_client_register(&rtd->cl); | ||
122 | if (ret < 0) { | ||
123 | kfree(rtd); | ||
124 | return ret; | ||
125 | } | ||
126 | |||
127 | substream->runtime->private_data = rtd; | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | static int ep93xx_pcm_close(struct snd_pcm_substream *substream) | ||
132 | { | ||
133 | struct ep93xx_runtime_data *rtd = substream->runtime->private_data; | ||
134 | |||
135 | ep93xx_dma_m2p_client_unregister(&rtd->cl); | ||
136 | kfree(rtd); | ||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static int ep93xx_pcm_hw_params(struct snd_pcm_substream *substream, | ||
141 | struct snd_pcm_hw_params *params) | ||
142 | { | ||
143 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
144 | struct ep93xx_runtime_data *rtd = runtime->private_data; | ||
145 | size_t totsize = params_buffer_bytes(params); | ||
146 | size_t period = params_period_bytes(params); | ||
147 | int i; | ||
148 | |||
149 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | ||
150 | runtime->dma_bytes = totsize; | ||
151 | |||
152 | rtd->periods = (totsize + period - 1) / period; | ||
153 | for (i = 0; i < rtd->periods; i++) { | ||
154 | rtd->buf[i].bus_addr = runtime->dma_addr + (i * period); | ||
155 | rtd->buf[i].size = period; | ||
156 | if ((i + 1) * period > totsize) | ||
157 | rtd->buf[i].size = totsize - (i * period); | ||
158 | } | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static int ep93xx_pcm_hw_free(struct snd_pcm_substream *substream) | ||
164 | { | ||
165 | snd_pcm_set_runtime_buffer(substream, NULL); | ||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | static int ep93xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | ||
170 | { | ||
171 | struct ep93xx_runtime_data *rtd = substream->runtime->private_data; | ||
172 | int ret; | ||
173 | int i; | ||
174 | |||
175 | ret = 0; | ||
176 | switch (cmd) { | ||
177 | case SNDRV_PCM_TRIGGER_START: | ||
178 | case SNDRV_PCM_TRIGGER_RESUME: | ||
179 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
180 | rtd->pointer_bytes = 0; | ||
181 | for (i = 0; i < rtd->periods; i++) | ||
182 | ep93xx_dma_m2p_submit(&rtd->cl, rtd->buf + i); | ||
183 | break; | ||
184 | |||
185 | case SNDRV_PCM_TRIGGER_STOP: | ||
186 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
187 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
188 | ep93xx_dma_m2p_flush(&rtd->cl); | ||
189 | break; | ||
190 | |||
191 | default: | ||
192 | ret = -EINVAL; | ||
193 | break; | ||
194 | } | ||
195 | |||
196 | return ret; | ||
197 | } | ||
198 | |||
199 | static snd_pcm_uframes_t ep93xx_pcm_pointer(struct snd_pcm_substream *substream) | ||
200 | { | ||
201 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
202 | struct ep93xx_runtime_data *rtd = substream->runtime->private_data; | ||
203 | |||
204 | /* FIXME: implement this with sub-period granularity */ | ||
205 | return bytes_to_frames(runtime, rtd->pointer_bytes); | ||
206 | } | ||
207 | |||
208 | static int ep93xx_pcm_mmap(struct snd_pcm_substream *substream, | ||
209 | struct vm_area_struct *vma) | ||
210 | { | ||
211 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
212 | |||
213 | return dma_mmap_writecombine(substream->pcm->card->dev, vma, | ||
214 | runtime->dma_area, | ||
215 | runtime->dma_addr, | ||
216 | runtime->dma_bytes); | ||
217 | } | ||
218 | |||
219 | static struct snd_pcm_ops ep93xx_pcm_ops = { | ||
220 | .open = ep93xx_pcm_open, | ||
221 | .close = ep93xx_pcm_close, | ||
222 | .ioctl = snd_pcm_lib_ioctl, | ||
223 | .hw_params = ep93xx_pcm_hw_params, | ||
224 | .hw_free = ep93xx_pcm_hw_free, | ||
225 | .trigger = ep93xx_pcm_trigger, | ||
226 | .pointer = ep93xx_pcm_pointer, | ||
227 | .mmap = ep93xx_pcm_mmap, | ||
228 | }; | ||
229 | |||
230 | static int ep93xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | ||
231 | { | ||
232 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; | ||
233 | struct snd_dma_buffer *buf = &substream->dma_buffer; | ||
234 | size_t size = ep93xx_pcm_hardware.buffer_bytes_max; | ||
235 | |||
236 | buf->dev.type = SNDRV_DMA_TYPE_DEV; | ||
237 | buf->dev.dev = pcm->card->dev; | ||
238 | buf->private_data = NULL; | ||
239 | buf->area = dma_alloc_writecombine(pcm->card->dev, size, | ||
240 | &buf->addr, GFP_KERNEL); | ||
241 | buf->bytes = size; | ||
242 | |||
243 | return (buf->area == NULL) ? -ENOMEM : 0; | ||
244 | } | ||
245 | |||
246 | static void ep93xx_pcm_free_dma_buffers(struct snd_pcm *pcm) | ||
247 | { | ||
248 | struct snd_pcm_substream *substream; | ||
249 | struct snd_dma_buffer *buf; | ||
250 | int stream; | ||
251 | |||
252 | for (stream = 0; stream < 2; stream++) { | ||
253 | substream = pcm->streams[stream].substream; | ||
254 | if (!substream) | ||
255 | continue; | ||
256 | |||
257 | buf = &substream->dma_buffer; | ||
258 | if (!buf->area) | ||
259 | continue; | ||
260 | |||
261 | dma_free_writecombine(pcm->card->dev, buf->bytes, buf->area, | ||
262 | buf->addr); | ||
263 | buf->area = NULL; | ||
264 | } | ||
265 | } | ||
266 | |||
267 | static u64 ep93xx_pcm_dmamask = 0xffffffff; | ||
268 | |||
269 | static int ep93xx_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, | ||
270 | struct snd_pcm *pcm) | ||
271 | { | ||
272 | int ret = 0; | ||
273 | |||
274 | if (!card->dev->dma_mask) | ||
275 | card->dev->dma_mask = &ep93xx_pcm_dmamask; | ||
276 | if (!card->dev->coherent_dma_mask) | ||
277 | card->dev->coherent_dma_mask = 0xffffffff; | ||
278 | |||
279 | if (dai->playback.channels_min) { | ||
280 | ret = ep93xx_pcm_preallocate_dma_buffer(pcm, | ||
281 | SNDRV_PCM_STREAM_PLAYBACK); | ||
282 | if (ret) | ||
283 | return ret; | ||
284 | } | ||
285 | |||
286 | if (dai->capture.channels_min) { | ||
287 | ret = ep93xx_pcm_preallocate_dma_buffer(pcm, | ||
288 | SNDRV_PCM_STREAM_CAPTURE); | ||
289 | if (ret) | ||
290 | return ret; | ||
291 | } | ||
292 | |||
293 | return 0; | ||
294 | } | ||
295 | |||
296 | struct snd_soc_platform ep93xx_soc_platform = { | ||
297 | .name = "ep93xx-audio", | ||
298 | .pcm_ops = &ep93xx_pcm_ops, | ||
299 | .pcm_new = &ep93xx_pcm_new, | ||
300 | .pcm_free = &ep93xx_pcm_free_dma_buffers, | ||
301 | }; | ||
302 | EXPORT_SYMBOL_GPL(ep93xx_soc_platform); | ||
303 | |||
304 | static int __init ep93xx_soc_platform_init(void) | ||
305 | { | ||
306 | return snd_soc_register_platform(&ep93xx_soc_platform); | ||
307 | } | ||
308 | |||
309 | static void __exit ep93xx_soc_platform_exit(void) | ||
310 | { | ||
311 | snd_soc_unregister_platform(&ep93xx_soc_platform); | ||
312 | } | ||
313 | |||
314 | module_init(ep93xx_soc_platform_init); | ||
315 | module_exit(ep93xx_soc_platform_exit); | ||
316 | |||
317 | MODULE_AUTHOR("Ryan Mallon <ryan@bluewatersys.com>"); | ||
318 | MODULE_DESCRIPTION("EP93xx ALSA PCM interface"); | ||
319 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/ep93xx/ep93xx-pcm.h b/sound/soc/ep93xx/ep93xx-pcm.h new file mode 100644 index 000000000000..4ffdd3f62fe9 --- /dev/null +++ b/sound/soc/ep93xx/ep93xx-pcm.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * sound/soc/ep93xx/ep93xx-pcm.h - EP93xx ALSA PCM interface | ||
3 | * | ||
4 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | ||
5 | * Copyright (C) 2006 Applied Data Systems | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _EP93XX_SND_SOC_PCM_H | ||
13 | #define _EP93XX_SND_SOC_PCM_H | ||
14 | |||
15 | struct ep93xx_pcm_dma_params { | ||
16 | char *name; | ||
17 | int dma_port; | ||
18 | }; | ||
19 | |||
20 | extern struct snd_soc_platform ep93xx_soc_platform; | ||
21 | |||
22 | #endif /* _EP93XX_SND_SOC_PCM_H */ | ||
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig index eba9b9d257a1..079b23bb0b03 100644 --- a/sound/soc/imx/Kconfig +++ b/sound/soc/imx/Kconfig | |||
@@ -13,9 +13,27 @@ config SND_MXC_SOC_SSI | |||
13 | 13 | ||
14 | config SND_MXC_SOC_WM1133_EV1 | 14 | config SND_MXC_SOC_WM1133_EV1 |
15 | tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted" | 15 | tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted" |
16 | depends on SND_IMX_SOC && EXPERIMENTAL | 16 | depends on SND_IMX_SOC && MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL |
17 | select SND_SOC_WM8350 | 17 | select SND_SOC_WM8350 |
18 | select SND_MXC_SOC_SSI | 18 | select SND_MXC_SOC_SSI |
19 | help | 19 | help |
20 | Enable support for audio on the i.MX31ADS with the WM1133-EV1 | 20 | Enable support for audio on the i.MX31ADS with the WM1133-EV1 |
21 | PMIC board with WM8835x fitted. | 21 | PMIC board with WM8835x fitted. |
22 | |||
23 | config SND_SOC_PHYCORE_AC97 | ||
24 | tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards" | ||
25 | depends on MACH_PCM043 || MACH_PCA100 | ||
26 | select SND_MXC_SOC_SSI | ||
27 | select SND_SOC_WM9712 | ||
28 | help | ||
29 | Say Y if you want to add support for SoC audio on Phytec phyCORE | ||
30 | and phyCARD boards in AC97 mode | ||
31 | |||
32 | config SND_SOC_EUKREA_TLV320 | ||
33 | bool "Eukrea TLV320" | ||
34 | depends on MACH_EUKREA_MBIMX27_BASEBOARD | ||
35 | select SND_IMX_SOC | ||
36 | select SND_SOC_TLV320AIC23 | ||
37 | help | ||
38 | Enable I2S based access to the TLV320AIC23B codec attached | ||
39 | to the SSI4 interface | ||
diff --git a/sound/soc/imx/Makefile b/sound/soc/imx/Makefile index 2d203635ac11..7bc57baf2b0e 100644 --- a/sound/soc/imx/Makefile +++ b/sound/soc/imx/Makefile | |||
@@ -8,8 +8,10 @@ endif | |||
8 | obj-$(CONFIG_SND_IMX_SOC) += snd-soc-imx.o | 8 | obj-$(CONFIG_SND_IMX_SOC) += snd-soc-imx.o |
9 | 9 | ||
10 | # i.MX Machine Support | 10 | # i.MX Machine Support |
11 | snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o | ||
11 | snd-soc-phycore-ac97-objs := phycore-ac97.o | 12 | snd-soc-phycore-ac97-objs := phycore-ac97.o |
12 | snd-soc-wm1133-ev1-objs := wm1133-ev1.o | 13 | snd-soc-wm1133-ev1-objs := wm1133-ev1.o |
13 | 14 | ||
15 | obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o | ||
14 | obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o | 16 | obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o |
15 | obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o | 17 | obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o |
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c new file mode 100644 index 000000000000..968380a93e89 --- /dev/null +++ b/sound/soc/imx/eukrea-tlv320.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * eukrea-tlv320.c -- SoC audio for eukrea_cpuimxXX in I2S mode | ||
3 | * | ||
4 | * Copyright 2010 Eric Bénard, Eukréa Electromatique <eric@eukrea.com> | ||
5 | * | ||
6 | * based on sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c | ||
7 | * which is Copyright 2009 Simtec Electronics | ||
8 | * and on sound/soc/imx/phycore-ac97.c which is | ||
9 | * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/moduleparam.h> | ||
20 | #include <linux/device.h> | ||
21 | #include <linux/i2c.h> | ||
22 | #include <sound/core.h> | ||
23 | #include <sound/pcm.h> | ||
24 | #include <sound/soc.h> | ||
25 | #include <sound/soc-dapm.h> | ||
26 | #include <asm/mach-types.h> | ||
27 | |||
28 | #include "../codecs/tlv320aic23.h" | ||
29 | #include "imx-ssi.h" | ||
30 | |||
31 | #define CODEC_CLOCK 12000000 | ||
32 | |||
33 | static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream, | ||
34 | struct snd_pcm_hw_params *params) | ||
35 | { | ||
36 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
37 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | ||
38 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
39 | int ret; | ||
40 | |||
41 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | | ||
42 | SND_SOC_DAIFMT_NB_NF | | ||
43 | SND_SOC_DAIFMT_CBM_CFM); | ||
44 | if (ret) { | ||
45 | pr_err("%s: failed set cpu dai format\n", __func__); | ||
46 | return ret; | ||
47 | } | ||
48 | |||
49 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | ||
50 | SND_SOC_DAIFMT_NB_NF | | ||
51 | SND_SOC_DAIFMT_CBM_CFM); | ||
52 | if (ret) { | ||
53 | pr_err("%s: failed set codec dai format\n", __func__); | ||
54 | return ret; | ||
55 | } | ||
56 | |||
57 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, | ||
58 | CODEC_CLOCK, SND_SOC_CLOCK_OUT); | ||
59 | if (ret) { | ||
60 | pr_err("%s: failed setting codec sysclk\n", __func__); | ||
61 | return ret; | ||
62 | } | ||
63 | |||
64 | ret = snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0, | ||
65 | SND_SOC_CLOCK_IN); | ||
66 | if (ret) { | ||
67 | pr_err("can't set CPU system clock IMX_SSP_SYS_CLK\n"); | ||
68 | return ret; | ||
69 | } | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static struct snd_soc_ops eukrea_tlv320_snd_ops = { | ||
75 | .hw_params = eukrea_tlv320_hw_params, | ||
76 | }; | ||
77 | |||
78 | static struct snd_soc_dai_link eukrea_tlv320_dai = { | ||
79 | .name = "tlv320aic23", | ||
80 | .stream_name = "TLV320AIC23", | ||
81 | .codec_dai = &tlv320aic23_dai, | ||
82 | .ops = &eukrea_tlv320_snd_ops, | ||
83 | }; | ||
84 | |||
85 | static struct snd_soc_card eukrea_tlv320 = { | ||
86 | .name = "cpuimx-audio", | ||
87 | .platform = &imx_soc_platform, | ||
88 | .dai_link = &eukrea_tlv320_dai, | ||
89 | .num_links = 1, | ||
90 | }; | ||
91 | |||
92 | static struct snd_soc_device eukrea_tlv320_snd_devdata = { | ||
93 | .card = &eukrea_tlv320, | ||
94 | .codec_dev = &soc_codec_dev_tlv320aic23, | ||
95 | }; | ||
96 | |||
97 | static struct platform_device *eukrea_tlv320_snd_device; | ||
98 | |||
99 | static int __init eukrea_tlv320_init(void) | ||
100 | { | ||
101 | int ret; | ||
102 | |||
103 | if (!machine_is_eukrea_cpuimx27()) | ||
104 | /* return happy. We might run on a totally different machine */ | ||
105 | return 0; | ||
106 | |||
107 | eukrea_tlv320_snd_device = platform_device_alloc("soc-audio", -1); | ||
108 | if (!eukrea_tlv320_snd_device) | ||
109 | return -ENOMEM; | ||
110 | |||
111 | eukrea_tlv320_dai.cpu_dai = &imx_ssi_pcm_dai[0]; | ||
112 | |||
113 | platform_set_drvdata(eukrea_tlv320_snd_device, &eukrea_tlv320_snd_devdata); | ||
114 | eukrea_tlv320_snd_devdata.dev = &eukrea_tlv320_snd_device->dev; | ||
115 | ret = platform_device_add(eukrea_tlv320_snd_device); | ||
116 | |||
117 | if (ret) { | ||
118 | printk(KERN_ERR "ASoC: Platform device allocation failed\n"); | ||
119 | platform_device_put(eukrea_tlv320_snd_device); | ||
120 | } | ||
121 | |||
122 | return ret; | ||
123 | } | ||
124 | |||
125 | static void __exit eukrea_tlv320_exit(void) | ||
126 | { | ||
127 | platform_device_unregister(eukrea_tlv320_snd_device); | ||
128 | } | ||
129 | |||
130 | module_init(eukrea_tlv320_init); | ||
131 | module_exit(eukrea_tlv320_exit); | ||
132 | |||
133 | MODULE_AUTHOR("Eric Bénard <eric@eukrea.com>"); | ||
134 | MODULE_DESCRIPTION("CPUIMX ALSA SoC driver"); | ||
135 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index 80b4fee2442b..50f51624c535 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
@@ -83,8 +83,6 @@ static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, | |||
83 | /* | 83 | /* |
84 | * SSI DAI format configuration. | 84 | * SSI DAI format configuration. |
85 | * Should only be called when port is inactive (i.e. SSIEN = 0). | 85 | * Should only be called when port is inactive (i.e. SSIEN = 0). |
86 | * Note: We don't use the I2S modes but instead manually configure the | ||
87 | * SSI for I2S because the I2S mode is only a register preset. | ||
88 | */ | 86 | */ |
89 | static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) | 87 | static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) |
90 | { | 88 | { |
@@ -99,6 +97,10 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) | |||
99 | /* data on rising edge of bclk, frame low 1clk before data */ | 97 | /* data on rising edge of bclk, frame low 1clk before data */ |
100 | strcr |= SSI_STCR_TFSI | SSI_STCR_TEFS | SSI_STCR_TXBIT0; | 98 | strcr |= SSI_STCR_TFSI | SSI_STCR_TEFS | SSI_STCR_TXBIT0; |
101 | scr |= SSI_SCR_NET; | 99 | scr |= SSI_SCR_NET; |
100 | if (ssi->flags & IMX_SSI_USE_I2S_SLAVE) { | ||
101 | scr &= ~SSI_I2S_MODE_MASK; | ||
102 | scr |= SSI_SCR_I2S_MODE_SLAVE; | ||
103 | } | ||
102 | break; | 104 | break; |
103 | case SND_SOC_DAIFMT_LEFT_J: | 105 | case SND_SOC_DAIFMT_LEFT_J: |
104 | /* data on rising edge of bclk, frame high with data */ | 106 | /* data on rising edge of bclk, frame high with data */ |
@@ -143,6 +145,11 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) | |||
143 | 145 | ||
144 | strcr |= SSI_STCR_TFEN0; | 146 | strcr |= SSI_STCR_TFEN0; |
145 | 147 | ||
148 | if (ssi->flags & IMX_SSI_NET) | ||
149 | scr |= SSI_SCR_NET; | ||
150 | if (ssi->flags & IMX_SSI_SYN) | ||
151 | scr |= SSI_SCR_SYN; | ||
152 | |||
146 | writel(strcr, ssi->base + SSI_STCR); | 153 | writel(strcr, ssi->base + SSI_STCR); |
147 | writel(strcr, ssi->base + SSI_SRCR); | 154 | writel(strcr, ssi->base + SSI_SRCR); |
148 | writel(scr, ssi->base + SSI_SCR); | 155 | writel(scr, ssi->base + SSI_SCR); |
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 0adc59778d5a..0fdc7db7a469 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c | |||
@@ -296,7 +296,6 @@ static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream, | |||
296 | 296 | ||
297 | default: | 297 | default: |
298 | return -EINVAL; | 298 | return -EINVAL; |
299 | break; | ||
300 | } | 299 | } |
301 | 300 | ||
302 | return 0; | 301 | return 0; |
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index f7b44e081420..caa7c901bc2e 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include <mach/mfp.h> | 26 | #include <mach/mfp.h> |
27 | 27 | ||
28 | #include "nuc900-auido.h" | 28 | #include "nuc900-audio.h" |
29 | 29 | ||
30 | static DEFINE_MUTEX(ac97_mutex); | 30 | static DEFINE_MUTEX(ac97_mutex); |
31 | struct nuc900_audio *nuc900_ac97_data; | 31 | struct nuc900_audio *nuc900_ac97_data; |
@@ -66,9 +66,8 @@ static unsigned short nuc900_ac97_read(struct snd_ac97 *ac97, | |||
66 | udelay(100); | 66 | udelay(100); |
67 | 67 | ||
68 | /* polling the AC_R_FINISH */ | 68 | /* polling the AC_R_FINISH */ |
69 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON); | 69 | while (!(AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_R_FINISH) |
70 | val &= AC_R_FINISH; | 70 | && timeout--) |
71 | while (!val && timeout--) | ||
72 | mdelay(1); | 71 | mdelay(1); |
73 | 72 | ||
74 | if (!timeout) { | 73 | if (!timeout) { |
@@ -121,9 +120,8 @@ static void nuc900_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
121 | udelay(100); | 120 | udelay(100); |
122 | 121 | ||
123 | /* polling the AC_W_FINISH */ | 122 | /* polling the AC_W_FINISH */ |
124 | tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON); | 123 | while ((AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_W_FINISH) |
125 | tmp &= AC_W_FINISH; | 124 | && timeout--) |
126 | while (tmp && timeout--) | ||
127 | mdelay(1); | 125 | mdelay(1); |
128 | 126 | ||
129 | if (!timeout) | 127 | if (!timeout) |
@@ -149,7 +147,7 @@ static void nuc900_ac97_warm_reset(struct snd_ac97 *ac97) | |||
149 | val |= AC_W_RES; | 147 | val |= AC_W_RES; |
150 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACCON, val); | 148 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACCON, val); |
151 | 149 | ||
152 | udelay(1000); | 150 | udelay(100); |
153 | 151 | ||
154 | val = nuc900_checkready(); | 152 | val = nuc900_checkready(); |
155 | if (!!val) | 153 | if (!!val) |
@@ -170,40 +168,30 @@ static void nuc900_ac97_cold_reset(struct snd_ac97 *ac97) | |||
170 | val |= ACTL_RESET_BIT; | 168 | val |= ACTL_RESET_BIT; |
171 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); | 169 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); |
172 | 170 | ||
173 | udelay(1000); | ||
174 | |||
175 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); | 171 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); |
176 | val &= (~ACTL_RESET_BIT); | 172 | val &= (~ACTL_RESET_BIT); |
177 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); | 173 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); |
178 | 174 | ||
179 | udelay(1000); | ||
180 | |||
181 | /* reset AC-link interface */ | 175 | /* reset AC-link interface */ |
182 | 176 | ||
183 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); | 177 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); |
184 | val |= AC_RESET; | 178 | val |= AC_RESET; |
185 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); | 179 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); |
186 | 180 | ||
187 | udelay(1000); | ||
188 | |||
189 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); | 181 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); |
190 | val &= ~AC_RESET; | 182 | val &= ~AC_RESET; |
191 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); | 183 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); |
192 | 184 | ||
193 | udelay(1000); | ||
194 | |||
195 | /* cold reset AC 97 */ | 185 | /* cold reset AC 97 */ |
196 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON); | 186 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON); |
197 | val |= AC_C_RES; | 187 | val |= AC_C_RES; |
198 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACCON, val); | 188 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACCON, val); |
199 | 189 | ||
200 | udelay(1000); | ||
201 | |||
202 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON); | 190 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON); |
203 | val &= (~AC_C_RES); | 191 | val &= (~AC_C_RES); |
204 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACCON, val); | 192 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACCON, val); |
205 | 193 | ||
206 | udelay(1000); | 194 | udelay(100); |
207 | 195 | ||
208 | mutex_unlock(&ac97_mutex); | 196 | mutex_unlock(&ac97_mutex); |
209 | 197 | ||
@@ -222,7 +210,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, | |||
222 | int cmd, struct snd_soc_dai *dai) | 210 | int cmd, struct snd_soc_dai *dai) |
223 | { | 211 | { |
224 | struct nuc900_audio *nuc900_audio = nuc900_ac97_data; | 212 | struct nuc900_audio *nuc900_audio = nuc900_ac97_data; |
225 | int ret, stype = SUBSTREAM_TYPE(substream); | 213 | int ret; |
226 | unsigned long val, tmp; | 214 | unsigned long val, tmp; |
227 | 215 | ||
228 | ret = 0; | 216 | ret = 0; |
@@ -231,7 +219,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, | |||
231 | case SNDRV_PCM_TRIGGER_START: | 219 | case SNDRV_PCM_TRIGGER_START: |
232 | case SNDRV_PCM_TRIGGER_RESUME: | 220 | case SNDRV_PCM_TRIGGER_RESUME: |
233 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); | 221 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); |
234 | if (PCM_TX == stype) { | 222 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
235 | tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACOS0); | 223 | tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACOS0); |
236 | tmp |= (SLOT3_VALID | SLOT4_VALID | VALID_FRAME); | 224 | tmp |= (SLOT3_VALID | SLOT4_VALID | VALID_FRAME); |
237 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACOS0, tmp); | 225 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACOS0, tmp); |
@@ -254,7 +242,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, | |||
254 | case SNDRV_PCM_TRIGGER_STOP: | 242 | case SNDRV_PCM_TRIGGER_STOP: |
255 | case SNDRV_PCM_TRIGGER_SUSPEND: | 243 | case SNDRV_PCM_TRIGGER_SUSPEND: |
256 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); | 244 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); |
257 | if (PCM_TX == stype) { | 245 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
258 | tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACOS0); | 246 | tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACOS0); |
259 | tmp &= ~(SLOT3_VALID | SLOT4_VALID); | 247 | tmp &= ~(SLOT3_VALID | SLOT4_VALID); |
260 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACOS0, tmp); | 248 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACOS0, tmp); |
diff --git a/sound/soc/nuc900/nuc900-auido.h b/sound/soc/nuc900/nuc900-audio.h index 95ac4ef2f353..3038f519729f 100644 --- a/sound/soc/nuc900/nuc900-auido.h +++ b/sound/soc/nuc900/nuc900-audio.h | |||
@@ -96,10 +96,6 @@ | |||
96 | #define RESET_PRSR 0x00 | 96 | #define RESET_PRSR 0x00 |
97 | #define AUDIO_WRITE(addr, val) __raw_writel(val, addr) | 97 | #define AUDIO_WRITE(addr, val) __raw_writel(val, addr) |
98 | #define AUDIO_READ(addr) __raw_readl(addr) | 98 | #define AUDIO_READ(addr) __raw_readl(addr) |
99 | #define PCM_TX 0 | ||
100 | #define PCM_RX 1 | ||
101 | #define SUBSTREAM_TYPE(substream) \ | ||
102 | ((substream)->stream == SNDRV_PCM_STREAM_PLAYBACK ? PCM_TX : PCM_RX) | ||
103 | 99 | ||
104 | struct nuc900_audio { | 100 | struct nuc900_audio { |
105 | void __iomem *mmio; | 101 | void __iomem *mmio; |
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c index 32a503c1c4be..445a18011d8e 100644 --- a/sound/soc/nuc900/nuc900-pcm.c +++ b/sound/soc/nuc900/nuc900-pcm.c | |||
@@ -47,7 +47,7 @@ static int nuc900_dma_hw_params(struct snd_pcm_substream *substream, | |||
47 | { | 47 | { |
48 | struct snd_pcm_runtime *runtime = substream->runtime; | 48 | struct snd_pcm_runtime *runtime = substream->runtime; |
49 | struct nuc900_audio *nuc900_audio = runtime->private_data; | 49 | struct nuc900_audio *nuc900_audio = runtime->private_data; |
50 | unsigned long flags, stype = SUBSTREAM_TYPE(substream); | 50 | unsigned long flags; |
51 | int ret = 0; | 51 | int ret = 0; |
52 | 52 | ||
53 | spin_lock_irqsave(&nuc900_audio->lock, flags); | 53 | spin_lock_irqsave(&nuc900_audio->lock, flags); |
@@ -57,8 +57,9 @@ static int nuc900_dma_hw_params(struct snd_pcm_substream *substream, | |||
57 | return ret; | 57 | return ret; |
58 | 58 | ||
59 | nuc900_audio->substream = substream; | 59 | nuc900_audio->substream = substream; |
60 | nuc900_audio->dma_addr[stype] = runtime->dma_addr; | 60 | nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr; |
61 | nuc900_audio->buffersize[stype] = params_buffer_bytes(params); | 61 | nuc900_audio->buffersize[substream->stream] = |
62 | params_buffer_bytes(params); | ||
62 | 63 | ||
63 | spin_unlock_irqrestore(&nuc900_audio->lock, flags); | 64 | spin_unlock_irqrestore(&nuc900_audio->lock, flags); |
64 | 65 | ||
@@ -72,7 +73,7 @@ static void nuc900_update_dma_register(struct snd_pcm_substream *substream, | |||
72 | struct nuc900_audio *nuc900_audio = runtime->private_data; | 73 | struct nuc900_audio *nuc900_audio = runtime->private_data; |
73 | void __iomem *mmio_addr, *mmio_len; | 74 | void __iomem *mmio_addr, *mmio_len; |
74 | 75 | ||
75 | if (SUBSTREAM_TYPE(substream) == PCM_TX) { | 76 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
76 | mmio_addr = nuc900_audio->mmio + ACTL_PDSTB; | 77 | mmio_addr = nuc900_audio->mmio + ACTL_PDSTB; |
77 | mmio_len = nuc900_audio->mmio + ACTL_PDST_LENGTH; | 78 | mmio_len = nuc900_audio->mmio + ACTL_PDST_LENGTH; |
78 | } else { | 79 | } else { |
@@ -167,18 +168,19 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream) | |||
167 | { | 168 | { |
168 | struct snd_pcm_runtime *runtime = substream->runtime; | 169 | struct snd_pcm_runtime *runtime = substream->runtime; |
169 | struct nuc900_audio *nuc900_audio = runtime->private_data; | 170 | struct nuc900_audio *nuc900_audio = runtime->private_data; |
170 | unsigned long flags, val, stype = SUBSTREAM_TYPE(substream);; | 171 | unsigned long flags, val; |
171 | 172 | ||
172 | spin_lock_irqsave(&nuc900_audio->lock, flags); | 173 | spin_lock_irqsave(&nuc900_audio->lock, flags); |
173 | 174 | ||
174 | nuc900_update_dma_register(substream, | 175 | nuc900_update_dma_register(substream, |
175 | nuc900_audio->dma_addr[stype], nuc900_audio->buffersize[stype]); | 176 | nuc900_audio->dma_addr[substream->stream], |
177 | nuc900_audio->buffersize[substream->stream]); | ||
176 | 178 | ||
177 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); | 179 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); |
178 | 180 | ||
179 | switch (runtime->channels) { | 181 | switch (runtime->channels) { |
180 | case 1: | 182 | case 1: |
181 | if (PCM_TX == stype) { | 183 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
182 | val &= ~(PLAY_LEFT_CHNNEL | PLAY_RIGHT_CHNNEL); | 184 | val &= ~(PLAY_LEFT_CHNNEL | PLAY_RIGHT_CHNNEL); |
183 | val |= PLAY_RIGHT_CHNNEL; | 185 | val |= PLAY_RIGHT_CHNNEL; |
184 | } else { | 186 | } else { |
@@ -188,7 +190,7 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream) | |||
188 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); | 190 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); |
189 | break; | 191 | break; |
190 | case 2: | 192 | case 2: |
191 | if (PCM_TX == stype) | 193 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
192 | val |= (PLAY_LEFT_CHNNEL | PLAY_RIGHT_CHNNEL); | 194 | val |= (PLAY_LEFT_CHNNEL | PLAY_RIGHT_CHNNEL); |
193 | else | 195 | else |
194 | val |= (RECORD_LEFT_CHNNEL | RECORD_RIGHT_CHNNEL); | 196 | val |= (RECORD_LEFT_CHNNEL | RECORD_RIGHT_CHNNEL); |
diff --git a/sound/soc/s3c24xx/s3c-ac97.c b/sound/soc/s3c24xx/s3c-ac97.c index ecf4fd04ae96..31f6d45b6384 100644 --- a/sound/soc/s3c24xx/s3c-ac97.c +++ b/sound/soc/s3c24xx/s3c-ac97.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #define AC_CMD_DATA(x) (x & 0xffff) | 31 | #define AC_CMD_DATA(x) (x & 0xffff) |
32 | 32 | ||
33 | struct s3c_ac97_info { | 33 | struct s3c_ac97_info { |
34 | unsigned state; | ||
35 | struct clk *ac97_clk; | 34 | struct clk *ac97_clk; |
36 | void __iomem *regs; | 35 | void __iomem *regs; |
37 | struct mutex lock; | 36 | struct mutex lock; |
diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c index 5b9ac1759bd2..59e3fa7bcb05 100644 --- a/sound/soc/s6000/s6000-i2s.c +++ b/sound/soc/s6000/s6000-i2s.c | |||
@@ -451,16 +451,15 @@ static int __devinit s6000_i2s_probe(struct platform_device *pdev) | |||
451 | goto err_release_none; | 451 | goto err_release_none; |
452 | } | 452 | } |
453 | 453 | ||
454 | region = request_mem_region(scbmem->start, | 454 | region = request_mem_region(scbmem->start, resource_size(scbmem), |
455 | scbmem->end - scbmem->start + 1, | 455 | pdev->name); |
456 | pdev->name); | ||
457 | if (!region) { | 456 | if (!region) { |
458 | dev_err(&pdev->dev, "I2S SCB region already claimed\n"); | 457 | dev_err(&pdev->dev, "I2S SCB region already claimed\n"); |
459 | ret = -EBUSY; | 458 | ret = -EBUSY; |
460 | goto err_release_none; | 459 | goto err_release_none; |
461 | } | 460 | } |
462 | 461 | ||
463 | mmio = ioremap(scbmem->start, scbmem->end - scbmem->start + 1); | 462 | mmio = ioremap(scbmem->start, resource_size(scbmem)); |
464 | if (!mmio) { | 463 | if (!mmio) { |
465 | dev_err(&pdev->dev, "can't ioremap SCB region\n"); | 464 | dev_err(&pdev->dev, "can't ioremap SCB region\n"); |
466 | ret = -ENOMEM; | 465 | ret = -ENOMEM; |
@@ -474,9 +473,8 @@ static int __devinit s6000_i2s_probe(struct platform_device *pdev) | |||
474 | goto err_release_map; | 473 | goto err_release_map; |
475 | } | 474 | } |
476 | 475 | ||
477 | region = request_mem_region(sifmem->start, | 476 | region = request_mem_region(sifmem->start, resource_size(sifmem), |
478 | sifmem->end - sifmem->start + 1, | 477 | pdev->name); |
479 | pdev->name); | ||
480 | if (!region) { | 478 | if (!region) { |
481 | dev_err(&pdev->dev, "I2S SIF region already claimed\n"); | 479 | dev_err(&pdev->dev, "I2S SIF region already claimed\n"); |
482 | ret = -EBUSY; | 480 | ret = -EBUSY; |
@@ -490,8 +488,8 @@ static int __devinit s6000_i2s_probe(struct platform_device *pdev) | |||
490 | goto err_release_sif; | 488 | goto err_release_sif; |
491 | } | 489 | } |
492 | 490 | ||
493 | region = request_mem_region(dma1->start, dma1->end - dma1->start + 1, | 491 | region = request_mem_region(dma1->start, resource_size(dma1), |
494 | pdev->name); | 492 | pdev->name); |
495 | if (!region) { | 493 | if (!region) { |
496 | dev_err(&pdev->dev, "I2S DMA region already claimed\n"); | 494 | dev_err(&pdev->dev, "I2S DMA region already claimed\n"); |
497 | ret = -EBUSY; | 495 | ret = -EBUSY; |
@@ -500,9 +498,8 @@ static int __devinit s6000_i2s_probe(struct platform_device *pdev) | |||
500 | 498 | ||
501 | dma2 = platform_get_resource(pdev, IORESOURCE_DMA, 1); | 499 | dma2 = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
502 | if (dma2) { | 500 | if (dma2) { |
503 | region = request_mem_region(dma2->start, | 501 | region = request_mem_region(dma2->start, resource_size(dma2), |
504 | dma2->end - dma2->start + 1, | 502 | pdev->name); |
505 | pdev->name); | ||
506 | if (!region) { | 503 | if (!region) { |
507 | dev_err(&pdev->dev, | 504 | dev_err(&pdev->dev, |
508 | "I2S DMA region already claimed\n"); | 505 | "I2S DMA region already claimed\n"); |
@@ -561,15 +558,15 @@ err_release_dev: | |||
561 | kfree(dev); | 558 | kfree(dev); |
562 | err_release_dma2: | 559 | err_release_dma2: |
563 | if (dma2) | 560 | if (dma2) |
564 | release_mem_region(dma2->start, dma2->end - dma2->start + 1); | 561 | release_mem_region(dma2->start, resource_size(dma2)); |
565 | err_release_dma1: | 562 | err_release_dma1: |
566 | release_mem_region(dma1->start, dma1->end - dma1->start + 1); | 563 | release_mem_region(dma1->start, resource_size(dma1)); |
567 | err_release_sif: | 564 | err_release_sif: |
568 | release_mem_region(sifmem->start, (sifmem->end - sifmem->start) + 1); | 565 | release_mem_region(sifmem->start, resource_size(sifmem)); |
569 | err_release_map: | 566 | err_release_map: |
570 | iounmap(mmio); | 567 | iounmap(mmio); |
571 | err_release_scb: | 568 | err_release_scb: |
572 | release_mem_region(scbmem->start, (scbmem->end - scbmem->start) + 1); | 569 | release_mem_region(scbmem->start, resource_size(scbmem)); |
573 | err_release_none: | 570 | err_release_none: |
574 | return ret; | 571 | return ret; |
575 | } | 572 | } |
@@ -590,19 +587,18 @@ static void __devexit s6000_i2s_remove(struct platform_device *pdev) | |||
590 | kfree(dev); | 587 | kfree(dev); |
591 | 588 | ||
592 | region = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 589 | region = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
593 | release_mem_region(region->start, region->end - region->start + 1); | 590 | release_mem_region(region->start, resource_size(region)); |
594 | 591 | ||
595 | region = platform_get_resource(pdev, IORESOURCE_DMA, 1); | 592 | region = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
596 | if (region) | 593 | if (region) |
597 | release_mem_region(region->start, | 594 | release_mem_region(region->start, resource_size(region)); |
598 | region->end - region->start + 1); | ||
599 | 595 | ||
600 | region = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 596 | region = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
601 | release_mem_region(region->start, (region->end - region->start) + 1); | 597 | release_mem_region(region->start, resource_size(region)); |
602 | 598 | ||
603 | iounmap(mmio); | 599 | iounmap(mmio); |
604 | region = platform_get_resource(pdev, IORESOURCE_IO, 0); | 600 | region = platform_get_resource(pdev, IORESOURCE_IO, 0); |
605 | release_mem_region(region->start, (region->end - region->start) + 1); | 601 | release_mem_region(region->start, resource_size(region)); |
606 | } | 602 | } |
607 | 603 | ||
608 | static struct platform_driver s6000_i2s_driver = { | 604 | static struct platform_driver s6000_i2s_driver = { |