1 /* linux/arch/arm/mach-s5pc100/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 s5pc100_cfg_i2s(struct platform_device
*pdev
)
24 /* configure GPIO for i2s port */
26 case 0: /* Dedicated pins */
29 s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(2));
32 s3c_gpio_cfgpin_range(S5PC100_GPG3(0), 5, S3C_GPIO_SFN(4));
35 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
42 static const char *rclksrc_v5
[] = {
47 static struct s3c_audio_pdata i2sv5_pdata
= {
48 .cfg_gpio
= s5pc100_cfg_i2s
,
51 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
53 .src_clk
= rclksrc_v5
,
58 static struct resource s5pc100_iis0_resource
[] = {
60 .start
= S5PC100_PA_I2S0
,
61 .end
= S5PC100_PA_I2S0
+ 0x100 - 1,
62 .flags
= IORESOURCE_MEM
,
65 .start
= DMACH_I2S0_TX
,
67 .flags
= IORESOURCE_DMA
,
70 .start
= DMACH_I2S0_RX
,
72 .flags
= IORESOURCE_DMA
,
75 .start
= DMACH_I2S0S_TX
,
76 .end
= DMACH_I2S0S_TX
,
77 .flags
= IORESOURCE_DMA
,
81 struct platform_device s5pc100_device_iis0
= {
82 .name
= "samsung-i2s",
84 .num_resources
= ARRAY_SIZE(s5pc100_iis0_resource
),
85 .resource
= s5pc100_iis0_resource
,
87 .platform_data
= &i2sv5_pdata
,
91 static const char *rclksrc_v3
[] = {
96 static struct s3c_audio_pdata i2sv3_pdata
= {
97 .cfg_gpio
= s5pc100_cfg_i2s
,
100 .src_clk
= rclksrc_v3
,
105 static struct resource s5pc100_iis1_resource
[] = {
107 .start
= S5PC100_PA_I2S1
,
108 .end
= S5PC100_PA_I2S1
+ 0x100 - 1,
109 .flags
= IORESOURCE_MEM
,
112 .start
= DMACH_I2S1_TX
,
113 .end
= DMACH_I2S1_TX
,
114 .flags
= IORESOURCE_DMA
,
117 .start
= DMACH_I2S1_RX
,
118 .end
= DMACH_I2S1_RX
,
119 .flags
= IORESOURCE_DMA
,
123 struct platform_device s5pc100_device_iis1
= {
124 .name
= "samsung-i2s",
126 .num_resources
= ARRAY_SIZE(s5pc100_iis1_resource
),
127 .resource
= s5pc100_iis1_resource
,
129 .platform_data
= &i2sv3_pdata
,
133 static struct resource s5pc100_iis2_resource
[] = {
135 .start
= S5PC100_PA_I2S2
,
136 .end
= S5PC100_PA_I2S2
+ 0x100 - 1,
137 .flags
= IORESOURCE_MEM
,
140 .start
= DMACH_I2S2_TX
,
141 .end
= DMACH_I2S2_TX
,
142 .flags
= IORESOURCE_DMA
,
145 .start
= DMACH_I2S2_RX
,
146 .end
= DMACH_I2S2_RX
,
147 .flags
= IORESOURCE_DMA
,
151 struct platform_device s5pc100_device_iis2
= {
152 .name
= "samsung-i2s",
154 .num_resources
= ARRAY_SIZE(s5pc100_iis2_resource
),
155 .resource
= s5pc100_iis2_resource
,
157 .platform_data
= &i2sv3_pdata
,
161 /* PCM Controller platform_devices */
163 static int s5pc100_pcm_cfg_gpio(struct platform_device
*pdev
)
167 s3c_gpio_cfgpin_range(S5PC100_GPG3(0), 5, S3C_GPIO_SFN(5));
171 s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(3));
175 printk(KERN_DEBUG
"Invalid PCM Controller number!");
182 static struct s3c_audio_pdata s3c_pcm_pdata
= {
183 .cfg_gpio
= s5pc100_pcm_cfg_gpio
,
186 static struct resource s5pc100_pcm0_resource
[] = {
188 .start
= S5PC100_PA_PCM0
,
189 .end
= S5PC100_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 s5pc100_device_pcm0
= {
205 .name
= "samsung-pcm",
207 .num_resources
= ARRAY_SIZE(s5pc100_pcm0_resource
),
208 .resource
= s5pc100_pcm0_resource
,
210 .platform_data
= &s3c_pcm_pdata
,
214 static struct resource s5pc100_pcm1_resource
[] = {
216 .start
= S5PC100_PA_PCM1
,
217 .end
= S5PC100_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 s5pc100_device_pcm1
= {
233 .name
= "samsung-pcm",
235 .num_resources
= ARRAY_SIZE(s5pc100_pcm1_resource
),
236 .resource
= s5pc100_pcm1_resource
,
238 .platform_data
= &s3c_pcm_pdata
,
242 /* AC97 Controller platform devices */
244 static int s5pc100_ac97_cfg_gpio(struct platform_device
*pdev
)
246 return s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(4));
249 static struct resource s5pc100_ac97_resource
[] = {
251 .start
= S5PC100_PA_AC97
,
252 .end
= S5PC100_PA_AC97
+ 0x100 - 1,
253 .flags
= IORESOURCE_MEM
,
256 .start
= DMACH_AC97_PCMOUT
,
257 .end
= DMACH_AC97_PCMOUT
,
258 .flags
= IORESOURCE_DMA
,
261 .start
= DMACH_AC97_PCMIN
,
262 .end
= DMACH_AC97_PCMIN
,
263 .flags
= IORESOURCE_DMA
,
266 .start
= DMACH_AC97_MICIN
,
267 .end
= DMACH_AC97_MICIN
,
268 .flags
= IORESOURCE_DMA
,
273 .flags
= IORESOURCE_IRQ
,
277 static struct s3c_audio_pdata s3c_ac97_pdata
= {
278 .cfg_gpio
= s5pc100_ac97_cfg_gpio
,
281 static u64 s5pc100_ac97_dmamask
= DMA_BIT_MASK(32);
283 struct platform_device s5pc100_device_ac97
= {
284 .name
= "samsung-ac97",
286 .num_resources
= ARRAY_SIZE(s5pc100_ac97_resource
),
287 .resource
= s5pc100_ac97_resource
,
289 .platform_data
= &s3c_ac97_pdata
,
290 .dma_mask
= &s5pc100_ac97_dmamask
,
291 .coherent_dma_mask
= DMA_BIT_MASK(32),
295 /* S/PDIF Controller platform_device */
296 static int s5pc100_spdif_cfg_gpd(struct platform_device
*pdev
)
298 s3c_gpio_cfgpin_range(S5PC100_GPD(5), 2, S3C_GPIO_SFN(3));
303 static int s5pc100_spdif_cfg_gpg3(struct platform_device
*pdev
)
305 s3c_gpio_cfgpin_range(S5PC100_GPG3(5), 2, S3C_GPIO_SFN(3));
310 static struct resource s5pc100_spdif_resource
[] = {
312 .start
= S5PC100_PA_SPDIF
,
313 .end
= S5PC100_PA_SPDIF
+ 0x100 - 1,
314 .flags
= IORESOURCE_MEM
,
317 .start
= DMACH_SPDIF
,
319 .flags
= IORESOURCE_DMA
,
323 static struct s3c_audio_pdata s5p_spdif_pdata
= {
324 .cfg_gpio
= s5pc100_spdif_cfg_gpd
,
327 static u64 s5pc100_spdif_dmamask
= DMA_BIT_MASK(32);
329 struct platform_device s5pc100_device_spdif
= {
330 .name
= "samsung-spdif",
332 .num_resources
= ARRAY_SIZE(s5pc100_spdif_resource
),
333 .resource
= s5pc100_spdif_resource
,
335 .platform_data
= &s5p_spdif_pdata
,
336 .dma_mask
= &s5pc100_spdif_dmamask
,
337 .coherent_dma_mask
= DMA_BIT_MASK(32),
341 void __init
s5pc100_spdif_setup_gpio(int gpio
)
343 if (gpio
== S5PC100_SPDIF_GPD
)
344 s5p_spdif_pdata
.cfg_gpio
= s5pc100_spdif_cfg_gpd
;
346 s5p_spdif_pdata
.cfg_gpio
= s5pc100_spdif_cfg_gpg3
;