1 /* linux/arch/arm/mach-s5pv210/dev-audio.c
3 * Copyright (c) 2010 Samsung Electronics Co. Ltd
4 * Jaswinder Singh <jassi.brar@samsung.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/platform_device.h>
12 #include <linux/dma-mapping.h>
13 #include <linux/gpio.h>
15 #include <plat/gpio-cfg.h>
16 #include <plat/audio.h>
20 #include <mach/irqs.h>
22 static int s5pv210_cfg_i2s(struct platform_device
*pdev
)
24 /* configure GPIO for i2s port */
27 s3c_gpio_cfgpin(S5PV210_GPC0(0), S3C_GPIO_SFN(2));
28 s3c_gpio_cfgpin(S5PV210_GPC0(1), S3C_GPIO_SFN(2));
29 s3c_gpio_cfgpin(S5PV210_GPC0(2), S3C_GPIO_SFN(2));
30 s3c_gpio_cfgpin(S5PV210_GPC0(3), S3C_GPIO_SFN(2));
31 s3c_gpio_cfgpin(S5PV210_GPC0(4), S3C_GPIO_SFN(2));
35 s3c_gpio_cfgpin(S5PV210_GPC1(0), S3C_GPIO_SFN(4));
36 s3c_gpio_cfgpin(S5PV210_GPC1(1), S3C_GPIO_SFN(4));
37 s3c_gpio_cfgpin(S5PV210_GPC1(2), S3C_GPIO_SFN(4));
38 s3c_gpio_cfgpin(S5PV210_GPC1(3), S3C_GPIO_SFN(4));
39 s3c_gpio_cfgpin(S5PV210_GPC1(4), S3C_GPIO_SFN(4));
43 s3c_gpio_cfgpin(S5PV210_GPI(0), S3C_GPIO_SFN(2));
44 s3c_gpio_cfgpin(S5PV210_GPI(1), S3C_GPIO_SFN(2));
45 s3c_gpio_cfgpin(S5PV210_GPI(2), S3C_GPIO_SFN(2));
46 s3c_gpio_cfgpin(S5PV210_GPI(3), S3C_GPIO_SFN(2));
47 s3c_gpio_cfgpin(S5PV210_GPI(4), S3C_GPIO_SFN(2));
48 s3c_gpio_cfgpin(S5PV210_GPI(5), S3C_GPIO_SFN(2));
49 s3c_gpio_cfgpin(S5PV210_GPI(6), S3C_GPIO_SFN(2));
53 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
60 static struct s3c_audio_pdata s3c_i2s_pdata
= {
61 .cfg_gpio
= s5pv210_cfg_i2s
,
64 static struct resource s5pv210_iis0_resource
[] = {
66 .start
= S5PV210_PA_IIS0
,
67 .end
= S5PV210_PA_IIS0
+ 0x100 - 1,
68 .flags
= IORESOURCE_MEM
,
71 .start
= DMACH_I2S0_TX
,
73 .flags
= IORESOURCE_DMA
,
76 .start
= DMACH_I2S0_RX
,
78 .flags
= IORESOURCE_DMA
,
82 struct platform_device s5pv210_device_iis0
= {
83 .name
= "s3c64xx-iis-v4",
85 .num_resources
= ARRAY_SIZE(s5pv210_iis0_resource
),
86 .resource
= s5pv210_iis0_resource
,
88 .platform_data
= &s3c_i2s_pdata
,
92 static struct resource s5pv210_iis1_resource
[] = {
94 .start
= S5PV210_PA_IIS1
,
95 .end
= S5PV210_PA_IIS1
+ 0x100 - 1,
96 .flags
= IORESOURCE_MEM
,
99 .start
= DMACH_I2S1_TX
,
100 .end
= DMACH_I2S1_TX
,
101 .flags
= IORESOURCE_DMA
,
104 .start
= DMACH_I2S1_RX
,
105 .end
= DMACH_I2S1_RX
,
106 .flags
= IORESOURCE_DMA
,
110 struct platform_device s5pv210_device_iis1
= {
111 .name
= "s3c64xx-iis",
113 .num_resources
= ARRAY_SIZE(s5pv210_iis1_resource
),
114 .resource
= s5pv210_iis1_resource
,
116 .platform_data
= &s3c_i2s_pdata
,
120 static struct resource s5pv210_iis2_resource
[] = {
122 .start
= S5PV210_PA_IIS2
,
123 .end
= S5PV210_PA_IIS2
+ 0x100 - 1,
124 .flags
= IORESOURCE_MEM
,
127 .start
= DMACH_I2S2_TX
,
128 .end
= DMACH_I2S2_TX
,
129 .flags
= IORESOURCE_DMA
,
132 .start
= DMACH_I2S2_RX
,
133 .end
= DMACH_I2S2_RX
,
134 .flags
= IORESOURCE_DMA
,
138 struct platform_device s5pv210_device_iis2
= {
139 .name
= "s3c64xx-iis",
141 .num_resources
= ARRAY_SIZE(s5pv210_iis2_resource
),
142 .resource
= s5pv210_iis2_resource
,
144 .platform_data
= &s3c_i2s_pdata
,
148 /* PCM Controller platform_devices */
150 static int s5pv210_pcm_cfg_gpio(struct platform_device
*pdev
)
154 s3c_gpio_cfgpin(S5PV210_GPI(0), S3C_GPIO_SFN(3));
155 s3c_gpio_cfgpin(S5PV210_GPI(1), S3C_GPIO_SFN(3));
156 s3c_gpio_cfgpin(S5PV210_GPI(2), S3C_GPIO_SFN(3));
157 s3c_gpio_cfgpin(S5PV210_GPI(3), S3C_GPIO_SFN(3));
158 s3c_gpio_cfgpin(S5PV210_GPI(4), S3C_GPIO_SFN(3));
161 s3c_gpio_cfgpin(S5PV210_GPC0(0), S3C_GPIO_SFN(3));
162 s3c_gpio_cfgpin(S5PV210_GPC0(1), S3C_GPIO_SFN(3));
163 s3c_gpio_cfgpin(S5PV210_GPC0(2), S3C_GPIO_SFN(3));
164 s3c_gpio_cfgpin(S5PV210_GPC0(3), S3C_GPIO_SFN(3));
165 s3c_gpio_cfgpin(S5PV210_GPC0(4), S3C_GPIO_SFN(3));
168 s3c_gpio_cfgpin(S5PV210_GPC1(0), S3C_GPIO_SFN(2));
169 s3c_gpio_cfgpin(S5PV210_GPC1(1), S3C_GPIO_SFN(2));
170 s3c_gpio_cfgpin(S5PV210_GPC1(2), S3C_GPIO_SFN(2));
171 s3c_gpio_cfgpin(S5PV210_GPC1(3), S3C_GPIO_SFN(2));
172 s3c_gpio_cfgpin(S5PV210_GPC1(4), S3C_GPIO_SFN(2));
175 printk(KERN_DEBUG
"Invalid PCM Controller number!");
182 static struct s3c_audio_pdata s3c_pcm_pdata
= {
183 .cfg_gpio
= s5pv210_pcm_cfg_gpio
,
186 static struct resource s5pv210_pcm0_resource
[] = {
188 .start
= S5PV210_PA_PCM0
,
189 .end
= S5PV210_PA_PCM0
+ 0x100 - 1,
190 .flags
= IORESOURCE_MEM
,
193 .start
= DMACH_PCM0_TX
,
194 .end
= DMACH_PCM0_TX
,
195 .flags
= IORESOURCE_DMA
,
198 .start
= DMACH_PCM0_RX
,
199 .end
= DMACH_PCM0_RX
,
200 .flags
= IORESOURCE_DMA
,
204 struct platform_device s5pv210_device_pcm0
= {
205 .name
= "samsung-pcm",
207 .num_resources
= ARRAY_SIZE(s5pv210_pcm0_resource
),
208 .resource
= s5pv210_pcm0_resource
,
210 .platform_data
= &s3c_pcm_pdata
,
214 static struct resource s5pv210_pcm1_resource
[] = {
216 .start
= S5PV210_PA_PCM1
,
217 .end
= S5PV210_PA_PCM1
+ 0x100 - 1,
218 .flags
= IORESOURCE_MEM
,
221 .start
= DMACH_PCM1_TX
,
222 .end
= DMACH_PCM1_TX
,
223 .flags
= IORESOURCE_DMA
,
226 .start
= DMACH_PCM1_RX
,
227 .end
= DMACH_PCM1_RX
,
228 .flags
= IORESOURCE_DMA
,
232 struct platform_device s5pv210_device_pcm1
= {
233 .name
= "samsung-pcm",
235 .num_resources
= ARRAY_SIZE(s5pv210_pcm1_resource
),
236 .resource
= s5pv210_pcm1_resource
,
238 .platform_data
= &s3c_pcm_pdata
,
242 static struct resource s5pv210_pcm2_resource
[] = {
244 .start
= S5PV210_PA_PCM2
,
245 .end
= S5PV210_PA_PCM2
+ 0x100 - 1,
246 .flags
= IORESOURCE_MEM
,
249 .start
= DMACH_PCM2_TX
,
250 .end
= DMACH_PCM2_TX
,
251 .flags
= IORESOURCE_DMA
,
254 .start
= DMACH_PCM2_RX
,
255 .end
= DMACH_PCM2_RX
,
256 .flags
= IORESOURCE_DMA
,
260 struct platform_device s5pv210_device_pcm2
= {
261 .name
= "samsung-pcm",
263 .num_resources
= ARRAY_SIZE(s5pv210_pcm2_resource
),
264 .resource
= s5pv210_pcm2_resource
,
266 .platform_data
= &s3c_pcm_pdata
,
270 /* AC97 Controller platform devices */
272 static int s5pv210_ac97_cfg_gpio(struct platform_device
*pdev
)
274 s3c_gpio_cfgpin(S5PV210_GPC0(0), S3C_GPIO_SFN(4));
275 s3c_gpio_cfgpin(S5PV210_GPC0(1), S3C_GPIO_SFN(4));
276 s3c_gpio_cfgpin(S5PV210_GPC0(2), S3C_GPIO_SFN(4));
277 s3c_gpio_cfgpin(S5PV210_GPC0(3), S3C_GPIO_SFN(4));
278 s3c_gpio_cfgpin(S5PV210_GPC0(4), S3C_GPIO_SFN(4));
283 static struct resource s5pv210_ac97_resource
[] = {
285 .start
= S5PV210_PA_AC97
,
286 .end
= S5PV210_PA_AC97
+ 0x100 - 1,
287 .flags
= IORESOURCE_MEM
,
290 .start
= DMACH_AC97_PCMOUT
,
291 .end
= DMACH_AC97_PCMOUT
,
292 .flags
= IORESOURCE_DMA
,
295 .start
= DMACH_AC97_PCMIN
,
296 .end
= DMACH_AC97_PCMIN
,
297 .flags
= IORESOURCE_DMA
,
300 .start
= DMACH_AC97_MICIN
,
301 .end
= DMACH_AC97_MICIN
,
302 .flags
= IORESOURCE_DMA
,
307 .flags
= IORESOURCE_IRQ
,
311 static struct s3c_audio_pdata s3c_ac97_pdata
= {
312 .cfg_gpio
= s5pv210_ac97_cfg_gpio
,
315 static u64 s5pv210_ac97_dmamask
= DMA_BIT_MASK(32);
317 struct platform_device s5pv210_device_ac97
= {
320 .num_resources
= ARRAY_SIZE(s5pv210_ac97_resource
),
321 .resource
= s5pv210_ac97_resource
,
323 .platform_data
= &s3c_ac97_pdata
,
324 .dma_mask
= &s5pv210_ac97_dmamask
,
325 .coherent_dma_mask
= DMA_BIT_MASK(32),