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>
21 #include <mach/regs-audss.h>
23 static const char *rclksrc
[] = {
28 static int s5pv210_cfg_i2s(struct platform_device
*pdev
)
30 /* configure GPIO for i2s port */
33 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 7, S3C_GPIO_SFN(2));
36 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(2));
39 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(4));
42 printk(KERN_ERR
"Invalid Device %d\n", pdev
->id
);
49 static struct s3c_audio_pdata i2sv5_pdata
= {
50 .cfg_gpio
= s5pv210_cfg_i2s
,
53 .quirks
= QUIRK_PRI_6CHAN
| QUIRK_SEC_DAI
56 .idma_addr
= S5PV210_AUDSS_INT_MEM
,
61 static struct resource s5pv210_iis0_resource
[] = {
63 .start
= S5PV210_PA_IIS0
,
64 .end
= S5PV210_PA_IIS0
+ 0x100 - 1,
65 .flags
= IORESOURCE_MEM
,
68 .start
= DMACH_I2S0_TX
,
70 .flags
= IORESOURCE_DMA
,
73 .start
= DMACH_I2S0_RX
,
75 .flags
= IORESOURCE_DMA
,
78 .start
= DMACH_I2S0S_TX
,
79 .end
= DMACH_I2S0S_TX
,
80 .flags
= IORESOURCE_DMA
,
84 struct platform_device s5pv210_device_iis0
= {
85 .name
= "samsung-i2s",
87 .num_resources
= ARRAY_SIZE(s5pv210_iis0_resource
),
88 .resource
= s5pv210_iis0_resource
,
90 .platform_data
= &i2sv5_pdata
,
94 static const char *rclksrc_v3
[] = {
99 static struct s3c_audio_pdata i2sv3_pdata
= {
100 .cfg_gpio
= s5pv210_cfg_i2s
,
103 .src_clk
= rclksrc_v3
,
108 static struct resource s5pv210_iis1_resource
[] = {
110 .start
= S5PV210_PA_IIS1
,
111 .end
= S5PV210_PA_IIS1
+ 0x100 - 1,
112 .flags
= IORESOURCE_MEM
,
115 .start
= DMACH_I2S1_TX
,
116 .end
= DMACH_I2S1_TX
,
117 .flags
= IORESOURCE_DMA
,
120 .start
= DMACH_I2S1_RX
,
121 .end
= DMACH_I2S1_RX
,
122 .flags
= IORESOURCE_DMA
,
126 struct platform_device s5pv210_device_iis1
= {
127 .name
= "samsung-i2s",
129 .num_resources
= ARRAY_SIZE(s5pv210_iis1_resource
),
130 .resource
= s5pv210_iis1_resource
,
132 .platform_data
= &i2sv3_pdata
,
136 static struct resource s5pv210_iis2_resource
[] = {
138 .start
= S5PV210_PA_IIS2
,
139 .end
= S5PV210_PA_IIS2
+ 0x100 - 1,
140 .flags
= IORESOURCE_MEM
,
143 .start
= DMACH_I2S2_TX
,
144 .end
= DMACH_I2S2_TX
,
145 .flags
= IORESOURCE_DMA
,
148 .start
= DMACH_I2S2_RX
,
149 .end
= DMACH_I2S2_RX
,
150 .flags
= IORESOURCE_DMA
,
154 struct platform_device s5pv210_device_iis2
= {
155 .name
= "samsung-i2s",
157 .num_resources
= ARRAY_SIZE(s5pv210_iis2_resource
),
158 .resource
= s5pv210_iis2_resource
,
160 .platform_data
= &i2sv3_pdata
,
164 /* PCM Controller platform_devices */
166 static int s5pv210_pcm_cfg_gpio(struct platform_device
*pdev
)
170 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 5, S3C_GPIO_SFN(3));
173 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(3));
176 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(2));
179 printk(KERN_DEBUG
"Invalid PCM Controller number!");
186 static struct s3c_audio_pdata s3c_pcm_pdata
= {
187 .cfg_gpio
= s5pv210_pcm_cfg_gpio
,
190 static struct resource s5pv210_pcm0_resource
[] = {
192 .start
= S5PV210_PA_PCM0
,
193 .end
= S5PV210_PA_PCM0
+ 0x100 - 1,
194 .flags
= IORESOURCE_MEM
,
197 .start
= DMACH_PCM0_TX
,
198 .end
= DMACH_PCM0_TX
,
199 .flags
= IORESOURCE_DMA
,
202 .start
= DMACH_PCM0_RX
,
203 .end
= DMACH_PCM0_RX
,
204 .flags
= IORESOURCE_DMA
,
208 struct platform_device s5pv210_device_pcm0
= {
209 .name
= "samsung-pcm",
211 .num_resources
= ARRAY_SIZE(s5pv210_pcm0_resource
),
212 .resource
= s5pv210_pcm0_resource
,
214 .platform_data
= &s3c_pcm_pdata
,
218 static struct resource s5pv210_pcm1_resource
[] = {
220 .start
= S5PV210_PA_PCM1
,
221 .end
= S5PV210_PA_PCM1
+ 0x100 - 1,
222 .flags
= IORESOURCE_MEM
,
225 .start
= DMACH_PCM1_TX
,
226 .end
= DMACH_PCM1_TX
,
227 .flags
= IORESOURCE_DMA
,
230 .start
= DMACH_PCM1_RX
,
231 .end
= DMACH_PCM1_RX
,
232 .flags
= IORESOURCE_DMA
,
236 struct platform_device s5pv210_device_pcm1
= {
237 .name
= "samsung-pcm",
239 .num_resources
= ARRAY_SIZE(s5pv210_pcm1_resource
),
240 .resource
= s5pv210_pcm1_resource
,
242 .platform_data
= &s3c_pcm_pdata
,
246 static struct resource s5pv210_pcm2_resource
[] = {
248 .start
= S5PV210_PA_PCM2
,
249 .end
= S5PV210_PA_PCM2
+ 0x100 - 1,
250 .flags
= IORESOURCE_MEM
,
253 .start
= DMACH_PCM2_TX
,
254 .end
= DMACH_PCM2_TX
,
255 .flags
= IORESOURCE_DMA
,
258 .start
= DMACH_PCM2_RX
,
259 .end
= DMACH_PCM2_RX
,
260 .flags
= IORESOURCE_DMA
,
264 struct platform_device s5pv210_device_pcm2
= {
265 .name
= "samsung-pcm",
267 .num_resources
= ARRAY_SIZE(s5pv210_pcm2_resource
),
268 .resource
= s5pv210_pcm2_resource
,
270 .platform_data
= &s3c_pcm_pdata
,
274 /* AC97 Controller platform devices */
276 static int s5pv210_ac97_cfg_gpio(struct platform_device
*pdev
)
278 return s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(4));
281 static struct resource s5pv210_ac97_resource
[] = {
283 .start
= S5PV210_PA_AC97
,
284 .end
= S5PV210_PA_AC97
+ 0x100 - 1,
285 .flags
= IORESOURCE_MEM
,
288 .start
= DMACH_AC97_PCMOUT
,
289 .end
= DMACH_AC97_PCMOUT
,
290 .flags
= IORESOURCE_DMA
,
293 .start
= DMACH_AC97_PCMIN
,
294 .end
= DMACH_AC97_PCMIN
,
295 .flags
= IORESOURCE_DMA
,
298 .start
= DMACH_AC97_MICIN
,
299 .end
= DMACH_AC97_MICIN
,
300 .flags
= IORESOURCE_DMA
,
305 .flags
= IORESOURCE_IRQ
,
309 static struct s3c_audio_pdata s3c_ac97_pdata
= {
310 .cfg_gpio
= s5pv210_ac97_cfg_gpio
,
313 static u64 s5pv210_ac97_dmamask
= DMA_BIT_MASK(32);
315 struct platform_device s5pv210_device_ac97
= {
316 .name
= "samsung-ac97",
318 .num_resources
= ARRAY_SIZE(s5pv210_ac97_resource
),
319 .resource
= s5pv210_ac97_resource
,
321 .platform_data
= &s3c_ac97_pdata
,
322 .dma_mask
= &s5pv210_ac97_dmamask
,
323 .coherent_dma_mask
= DMA_BIT_MASK(32),
327 /* S/PDIF Controller platform_device */
329 static int s5pv210_spdif_cfg_gpio(struct platform_device
*pdev
)
331 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 2, S3C_GPIO_SFN(3));
336 static struct resource s5pv210_spdif_resource
[] = {
338 .start
= S5PV210_PA_SPDIF
,
339 .end
= S5PV210_PA_SPDIF
+ 0x100 - 1,
340 .flags
= IORESOURCE_MEM
,
343 .start
= DMACH_SPDIF
,
345 .flags
= IORESOURCE_DMA
,
349 static struct s3c_audio_pdata samsung_spdif_pdata
= {
350 .cfg_gpio
= s5pv210_spdif_cfg_gpio
,
353 static u64 s5pv210_spdif_dmamask
= DMA_BIT_MASK(32);
355 struct platform_device s5pv210_device_spdif
= {
356 .name
= "samsung-spdif",
358 .num_resources
= ARRAY_SIZE(s5pv210_spdif_resource
),
359 .resource
= s5pv210_spdif_resource
,
361 .platform_data
= &samsung_spdif_pdata
,
362 .dma_mask
= &s5pv210_spdif_dmamask
,
363 .coherent_dma_mask
= DMA_BIT_MASK(32),