1 /* linux/arch/arm/mach-s5pv310/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 s5pv310_cfg_i2s(struct platform_device
*pdev
)
29 /* configure GPIO for i2s port */
32 s3c_gpio_cfgpin_range(S5PV310_GPZ(0), 7, S3C_GPIO_SFN(2));
35 s3c_gpio_cfgpin_range(S5PV310_GPC0(0), 5, S3C_GPIO_SFN(2));
38 s3c_gpio_cfgpin_range(S5PV310_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
= s5pv310_cfg_i2s
,
52 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
59 static struct resource s5pv310_i2s0_resource
[] = {
61 .start
= S5PV310_PA_I2S0
,
62 .end
= S5PV310_PA_I2S0
+ 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 s5pv310_device_i2s0
= {
83 .name
= "samsung-i2s",
85 .num_resources
= ARRAY_SIZE(s5pv310_i2s0_resource
),
86 .resource
= s5pv310_i2s0_resource
,
88 .platform_data
= &i2sv5_pdata
,
92 static const char *rclksrc_v3
[] = {
94 [1] = "no_such_clock",
97 static struct s3c_audio_pdata i2sv3_pdata
= {
98 .cfg_gpio
= s5pv310_cfg_i2s
,
101 .quirks
= QUIRK_NO_MUXPSR
,
102 .src_clk
= rclksrc_v3
,
107 static struct resource s5pv310_i2s1_resource
[] = {
109 .start
= S5PV310_PA_I2S1
,
110 .end
= S5PV310_PA_I2S1
+ 0x100 - 1,
111 .flags
= IORESOURCE_MEM
,
114 .start
= DMACH_I2S1_TX
,
115 .end
= DMACH_I2S1_TX
,
116 .flags
= IORESOURCE_DMA
,
119 .start
= DMACH_I2S1_RX
,
120 .end
= DMACH_I2S1_RX
,
121 .flags
= IORESOURCE_DMA
,
125 struct platform_device s5pv310_device_i2s1
= {
126 .name
= "samsung-i2s",
128 .num_resources
= ARRAY_SIZE(s5pv310_i2s1_resource
),
129 .resource
= s5pv310_i2s1_resource
,
131 .platform_data
= &i2sv3_pdata
,
135 static struct resource s5pv310_i2s2_resource
[] = {
137 .start
= S5PV310_PA_I2S2
,
138 .end
= S5PV310_PA_I2S2
+ 0x100 - 1,
139 .flags
= IORESOURCE_MEM
,
142 .start
= DMACH_I2S2_TX
,
143 .end
= DMACH_I2S2_TX
,
144 .flags
= IORESOURCE_DMA
,
147 .start
= DMACH_I2S2_RX
,
148 .end
= DMACH_I2S2_RX
,
149 .flags
= IORESOURCE_DMA
,
153 struct platform_device s5pv310_device_i2s2
= {
154 .name
= "samsung-i2s",
156 .num_resources
= ARRAY_SIZE(s5pv310_i2s2_resource
),
157 .resource
= s5pv310_i2s2_resource
,
159 .platform_data
= &i2sv3_pdata
,
163 /* PCM Controller platform_devices */
165 static int s5pv310_pcm_cfg_gpio(struct platform_device
*pdev
)
169 s3c_gpio_cfgpin_range(S5PV310_GPZ(0), 5, S3C_GPIO_SFN(3));
172 s3c_gpio_cfgpin_range(S5PV310_GPC0(0), 5, S3C_GPIO_SFN(3));
175 s3c_gpio_cfgpin_range(S5PV310_GPC1(0), 5, S3C_GPIO_SFN(3));
178 printk(KERN_DEBUG
"Invalid PCM Controller number!");
185 static struct s3c_audio_pdata s3c_pcm_pdata
= {
186 .cfg_gpio
= s5pv310_pcm_cfg_gpio
,
189 static struct resource s5pv310_pcm0_resource
[] = {
191 .start
= S5PV310_PA_PCM0
,
192 .end
= S5PV310_PA_PCM0
+ 0x100 - 1,
193 .flags
= IORESOURCE_MEM
,
196 .start
= DMACH_PCM0_TX
,
197 .end
= DMACH_PCM0_TX
,
198 .flags
= IORESOURCE_DMA
,
201 .start
= DMACH_PCM0_RX
,
202 .end
= DMACH_PCM0_RX
,
203 .flags
= IORESOURCE_DMA
,
207 struct platform_device s5pv310_device_pcm0
= {
208 .name
= "samsung-pcm",
210 .num_resources
= ARRAY_SIZE(s5pv310_pcm0_resource
),
211 .resource
= s5pv310_pcm0_resource
,
213 .platform_data
= &s3c_pcm_pdata
,
217 static struct resource s5pv310_pcm1_resource
[] = {
219 .start
= S5PV310_PA_PCM1
,
220 .end
= S5PV310_PA_PCM1
+ 0x100 - 1,
221 .flags
= IORESOURCE_MEM
,
224 .start
= DMACH_PCM1_TX
,
225 .end
= DMACH_PCM1_TX
,
226 .flags
= IORESOURCE_DMA
,
229 .start
= DMACH_PCM1_RX
,
230 .end
= DMACH_PCM1_RX
,
231 .flags
= IORESOURCE_DMA
,
235 struct platform_device s5pv310_device_pcm1
= {
236 .name
= "samsung-pcm",
238 .num_resources
= ARRAY_SIZE(s5pv310_pcm1_resource
),
239 .resource
= s5pv310_pcm1_resource
,
241 .platform_data
= &s3c_pcm_pdata
,
245 static struct resource s5pv310_pcm2_resource
[] = {
247 .start
= S5PV310_PA_PCM2
,
248 .end
= S5PV310_PA_PCM2
+ 0x100 - 1,
249 .flags
= IORESOURCE_MEM
,
252 .start
= DMACH_PCM2_TX
,
253 .end
= DMACH_PCM2_TX
,
254 .flags
= IORESOURCE_DMA
,
257 .start
= DMACH_PCM2_RX
,
258 .end
= DMACH_PCM2_RX
,
259 .flags
= IORESOURCE_DMA
,
263 struct platform_device s5pv310_device_pcm2
= {
264 .name
= "samsung-pcm",
266 .num_resources
= ARRAY_SIZE(s5pv310_pcm2_resource
),
267 .resource
= s5pv310_pcm2_resource
,
269 .platform_data
= &s3c_pcm_pdata
,
273 /* AC97 Controller platform devices */
275 static int s5pv310_ac97_cfg_gpio(struct platform_device
*pdev
)
277 return s3c_gpio_cfgpin_range(S5PV310_GPC0(0), 5, S3C_GPIO_SFN(4));
280 static struct resource s5pv310_ac97_resource
[] = {
282 .start
= S5PV310_PA_AC97
,
283 .end
= S5PV310_PA_AC97
+ 0x100 - 1,
284 .flags
= IORESOURCE_MEM
,
287 .start
= DMACH_AC97_PCMOUT
,
288 .end
= DMACH_AC97_PCMOUT
,
289 .flags
= IORESOURCE_DMA
,
292 .start
= DMACH_AC97_PCMIN
,
293 .end
= DMACH_AC97_PCMIN
,
294 .flags
= IORESOURCE_DMA
,
297 .start
= DMACH_AC97_MICIN
,
298 .end
= DMACH_AC97_MICIN
,
299 .flags
= IORESOURCE_DMA
,
304 .flags
= IORESOURCE_IRQ
,
308 static struct s3c_audio_pdata s3c_ac97_pdata
= {
309 .cfg_gpio
= s5pv310_ac97_cfg_gpio
,
312 static u64 s5pv310_ac97_dmamask
= DMA_BIT_MASK(32);
314 struct platform_device s5pv310_device_ac97
= {
315 .name
= "samsung-ac97",
317 .num_resources
= ARRAY_SIZE(s5pv310_ac97_resource
),
318 .resource
= s5pv310_ac97_resource
,
320 .platform_data
= &s3c_ac97_pdata
,
321 .dma_mask
= &s5pv310_ac97_dmamask
,
322 .coherent_dma_mask
= DMA_BIT_MASK(32),
326 /* S/PDIF Controller platform_device */
328 static int s5pv310_spdif_cfg_gpio(struct platform_device
*pdev
)
330 s3c_gpio_cfgpin_range(S5PV310_GPC1(0), 2, S3C_GPIO_SFN(3));
335 static struct resource s5pv310_spdif_resource
[] = {
337 .start
= S5PV310_PA_SPDIF
,
338 .end
= S5PV310_PA_SPDIF
+ 0x100 - 1,
339 .flags
= IORESOURCE_MEM
,
342 .start
= DMACH_SPDIF
,
344 .flags
= IORESOURCE_DMA
,
348 static struct s3c_audio_pdata samsung_spdif_pdata
= {
349 .cfg_gpio
= s5pv310_spdif_cfg_gpio
,
352 static u64 s5pv310_spdif_dmamask
= DMA_BIT_MASK(32);
354 struct platform_device s5pv310_device_spdif
= {
355 .name
= "samsung-spdif",
357 .num_resources
= ARRAY_SIZE(s5pv310_spdif_resource
),
358 .resource
= s5pv310_spdif_resource
,
360 .platform_data
= &samsung_spdif_pdata
,
361 .dma_mask
= &s5pv310_spdif_dmamask
,
362 .coherent_dma_mask
= DMA_BIT_MASK(32),