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 const char *rclksrc
[] = {
27 static int s5pv210_cfg_i2s(struct platform_device
*pdev
)
29 /* configure GPIO for i2s port */
32 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 7, S3C_GPIO_SFN(2));
35 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(2));
38 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(4));
41 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
48 static struct s3c_audio_pdata i2sv5_pdata
= {
49 .cfg_gpio
= s5pv210_cfg_i2s
,
52 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
59 static struct resource s5pv210_iis0_resource
[] = {
61 .start
= S5PV210_PA_IIS0
,
62 .end
= S5PV210_PA_IIS0
+ 0x100 - 1,
63 .flags
= IORESOURCE_MEM
,
66 .start
= DMACH_I2S0_TX
,
68 .flags
= IORESOURCE_DMA
,
71 .start
= DMACH_I2S0_RX
,
73 .flags
= IORESOURCE_DMA
,
76 .start
= DMACH_I2S0S_TX
,
77 .end
= DMACH_I2S0S_TX
,
78 .flags
= IORESOURCE_DMA
,
82 struct platform_device s5pv210_device_iis0
= {
83 .name
= "samsung-i2s",
85 .num_resources
= ARRAY_SIZE(s5pv210_iis0_resource
),
86 .resource
= s5pv210_iis0_resource
,
88 .platform_data
= &i2sv5_pdata
,
92 static const char *rclksrc_v3
[] = {
97 static struct s3c_audio_pdata i2sv3_pdata
= {
98 .cfg_gpio
= s5pv210_cfg_i2s
,
101 .src_clk
= rclksrc_v3
,
106 static struct resource s5pv210_iis1_resource
[] = {
108 .start
= S5PV210_PA_IIS1
,
109 .end
= S5PV210_PA_IIS1
+ 0x100 - 1,
110 .flags
= IORESOURCE_MEM
,
113 .start
= DMACH_I2S1_TX
,
114 .end
= DMACH_I2S1_TX
,
115 .flags
= IORESOURCE_DMA
,
118 .start
= DMACH_I2S1_RX
,
119 .end
= DMACH_I2S1_RX
,
120 .flags
= IORESOURCE_DMA
,
124 struct platform_device s5pv210_device_iis1
= {
125 .name
= "samsung-i2s",
127 .num_resources
= ARRAY_SIZE(s5pv210_iis1_resource
),
128 .resource
= s5pv210_iis1_resource
,
130 .platform_data
= &i2sv3_pdata
,
134 static struct resource s5pv210_iis2_resource
[] = {
136 .start
= S5PV210_PA_IIS2
,
137 .end
= S5PV210_PA_IIS2
+ 0x100 - 1,
138 .flags
= IORESOURCE_MEM
,
141 .start
= DMACH_I2S2_TX
,
142 .end
= DMACH_I2S2_TX
,
143 .flags
= IORESOURCE_DMA
,
146 .start
= DMACH_I2S2_RX
,
147 .end
= DMACH_I2S2_RX
,
148 .flags
= IORESOURCE_DMA
,
152 struct platform_device s5pv210_device_iis2
= {
153 .name
= "samsung-i2s",
155 .num_resources
= ARRAY_SIZE(s5pv210_iis2_resource
),
156 .resource
= s5pv210_iis2_resource
,
158 .platform_data
= &i2sv3_pdata
,
162 /* PCM Controller platform_devices */
164 static int s5pv210_pcm_cfg_gpio(struct platform_device
*pdev
)
168 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 5, S3C_GPIO_SFN(3));
171 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(3));
174 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(2));
177 printk(KERN_DEBUG
"Invalid PCM Controller number!");
184 static struct s3c_audio_pdata s3c_pcm_pdata
= {
185 .cfg_gpio
= s5pv210_pcm_cfg_gpio
,
188 static struct resource s5pv210_pcm0_resource
[] = {
190 .start
= S5PV210_PA_PCM0
,
191 .end
= S5PV210_PA_PCM0
+ 0x100 - 1,
192 .flags
= IORESOURCE_MEM
,
195 .start
= DMACH_PCM0_TX
,
196 .end
= DMACH_PCM0_TX
,
197 .flags
= IORESOURCE_DMA
,
200 .start
= DMACH_PCM0_RX
,
201 .end
= DMACH_PCM0_RX
,
202 .flags
= IORESOURCE_DMA
,
206 struct platform_device s5pv210_device_pcm0
= {
207 .name
= "samsung-pcm",
209 .num_resources
= ARRAY_SIZE(s5pv210_pcm0_resource
),
210 .resource
= s5pv210_pcm0_resource
,
212 .platform_data
= &s3c_pcm_pdata
,
216 static struct resource s5pv210_pcm1_resource
[] = {
218 .start
= S5PV210_PA_PCM1
,
219 .end
= S5PV210_PA_PCM1
+ 0x100 - 1,
220 .flags
= IORESOURCE_MEM
,
223 .start
= DMACH_PCM1_TX
,
224 .end
= DMACH_PCM1_TX
,
225 .flags
= IORESOURCE_DMA
,
228 .start
= DMACH_PCM1_RX
,
229 .end
= DMACH_PCM1_RX
,
230 .flags
= IORESOURCE_DMA
,
234 struct platform_device s5pv210_device_pcm1
= {
235 .name
= "samsung-pcm",
237 .num_resources
= ARRAY_SIZE(s5pv210_pcm1_resource
),
238 .resource
= s5pv210_pcm1_resource
,
240 .platform_data
= &s3c_pcm_pdata
,
244 static struct resource s5pv210_pcm2_resource
[] = {
246 .start
= S5PV210_PA_PCM2
,
247 .end
= S5PV210_PA_PCM2
+ 0x100 - 1,
248 .flags
= IORESOURCE_MEM
,
251 .start
= DMACH_PCM2_TX
,
252 .end
= DMACH_PCM2_TX
,
253 .flags
= IORESOURCE_DMA
,
256 .start
= DMACH_PCM2_RX
,
257 .end
= DMACH_PCM2_RX
,
258 .flags
= IORESOURCE_DMA
,
262 struct platform_device s5pv210_device_pcm2
= {
263 .name
= "samsung-pcm",
265 .num_resources
= ARRAY_SIZE(s5pv210_pcm2_resource
),
266 .resource
= s5pv210_pcm2_resource
,
268 .platform_data
= &s3c_pcm_pdata
,
272 /* AC97 Controller platform devices */
274 static int s5pv210_ac97_cfg_gpio(struct platform_device
*pdev
)
276 return s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(4));
279 static struct resource s5pv210_ac97_resource
[] = {
281 .start
= S5PV210_PA_AC97
,
282 .end
= S5PV210_PA_AC97
+ 0x100 - 1,
283 .flags
= IORESOURCE_MEM
,
286 .start
= DMACH_AC97_PCMOUT
,
287 .end
= DMACH_AC97_PCMOUT
,
288 .flags
= IORESOURCE_DMA
,
291 .start
= DMACH_AC97_PCMIN
,
292 .end
= DMACH_AC97_PCMIN
,
293 .flags
= IORESOURCE_DMA
,
296 .start
= DMACH_AC97_MICIN
,
297 .end
= DMACH_AC97_MICIN
,
298 .flags
= IORESOURCE_DMA
,
303 .flags
= IORESOURCE_IRQ
,
307 static struct s3c_audio_pdata s3c_ac97_pdata
= {
308 .cfg_gpio
= s5pv210_ac97_cfg_gpio
,
311 static u64 s5pv210_ac97_dmamask
= DMA_BIT_MASK(32);
313 struct platform_device s5pv210_device_ac97
= {
314 .name
= "samsung-ac97",
316 .num_resources
= ARRAY_SIZE(s5pv210_ac97_resource
),
317 .resource
= s5pv210_ac97_resource
,
319 .platform_data
= &s3c_ac97_pdata
,
320 .dma_mask
= &s5pv210_ac97_dmamask
,
321 .coherent_dma_mask
= DMA_BIT_MASK(32),
325 /* S/PDIF Controller platform_device */
327 static int s5pv210_spdif_cfg_gpio(struct platform_device
*pdev
)
329 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 2, S3C_GPIO_SFN(3));
334 static struct resource s5pv210_spdif_resource
[] = {
336 .start
= S5PV210_PA_SPDIF
,
337 .end
= S5PV210_PA_SPDIF
+ 0x100 - 1,
338 .flags
= IORESOURCE_MEM
,
341 .start
= DMACH_SPDIF
,
343 .flags
= IORESOURCE_DMA
,
347 static struct s3c_audio_pdata samsung_spdif_pdata
= {
348 .cfg_gpio
= s5pv210_spdif_cfg_gpio
,
351 static u64 s5pv210_spdif_dmamask
= DMA_BIT_MASK(32);
353 struct platform_device s5pv210_device_spdif
= {
354 .name
= "samsung-spdif",
356 .num_resources
= ARRAY_SIZE(s5pv210_spdif_resource
),
357 .resource
= s5pv210_spdif_resource
,
359 .platform_data
= &samsung_spdif_pdata
,
360 .dma_mask
= &s5pv210_spdif_dmamask
,
361 .coherent_dma_mask
= DMA_BIT_MASK(32),