block: move down direct IO plugging
[linux/fpc-iii.git] / arch / arm / mach-s5pv210 / dev-audio.c
blob8367749c3eecab4d95d8b2be9876bf1d8bd0ba9f
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.
9 */
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>
18 #include <mach/map.h>
19 #include <mach/dma.h>
20 #include <mach/irqs.h>
21 #include <mach/regs-audss.h>
23 static const char *rclksrc[] = {
24 [0] = "busclk",
25 [1] = "i2sclk",
28 static int s5pv210_cfg_i2s(struct platform_device *pdev)
30 /* configure GPIO for i2s port */
31 switch (pdev->id) {
32 case 0:
33 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 7, S3C_GPIO_SFN(2));
34 break;
35 case 1:
36 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(2));
37 break;
38 case 2:
39 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(4));
40 break;
41 default:
42 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
43 return -EINVAL;
46 return 0;
49 static struct s3c_audio_pdata i2sv5_pdata = {
50 .cfg_gpio = s5pv210_cfg_i2s,
51 .type = {
52 .i2s = {
53 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
54 | QUIRK_NEED_RSTCLR,
55 .src_clk = rclksrc,
56 .idma_addr = S5PV210_AUDSS_INT_MEM,
61 static struct resource s5pv210_iis0_resource[] = {
62 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS0, SZ_256),
63 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
64 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
65 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX),
68 struct platform_device s5pv210_device_iis0 = {
69 .name = "samsung-i2s",
70 .id = 0,
71 .num_resources = ARRAY_SIZE(s5pv210_iis0_resource),
72 .resource = s5pv210_iis0_resource,
73 .dev = {
74 .platform_data = &i2sv5_pdata,
78 static const char *rclksrc_v3[] = {
79 [0] = "iis",
80 [1] = "audio-bus",
83 static struct s3c_audio_pdata i2sv3_pdata = {
84 .cfg_gpio = s5pv210_cfg_i2s,
85 .type = {
86 .i2s = {
87 .src_clk = rclksrc_v3,
92 static struct resource s5pv210_iis1_resource[] = {
93 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS1, SZ_256),
94 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
95 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
98 struct platform_device s5pv210_device_iis1 = {
99 .name = "samsung-i2s",
100 .id = 1,
101 .num_resources = ARRAY_SIZE(s5pv210_iis1_resource),
102 .resource = s5pv210_iis1_resource,
103 .dev = {
104 .platform_data = &i2sv3_pdata,
108 static struct resource s5pv210_iis2_resource[] = {
109 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS2, SZ_256),
110 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
111 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
114 struct platform_device s5pv210_device_iis2 = {
115 .name = "samsung-i2s",
116 .id = 2,
117 .num_resources = ARRAY_SIZE(s5pv210_iis2_resource),
118 .resource = s5pv210_iis2_resource,
119 .dev = {
120 .platform_data = &i2sv3_pdata,
124 /* PCM Controller platform_devices */
126 static int s5pv210_pcm_cfg_gpio(struct platform_device *pdev)
128 switch (pdev->id) {
129 case 0:
130 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 5, S3C_GPIO_SFN(3));
131 break;
132 case 1:
133 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(3));
134 break;
135 case 2:
136 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(2));
137 break;
138 default:
139 printk(KERN_DEBUG "Invalid PCM Controller number!");
140 return -EINVAL;
143 return 0;
146 static struct s3c_audio_pdata s3c_pcm_pdata = {
147 .cfg_gpio = s5pv210_pcm_cfg_gpio,
150 static struct resource s5pv210_pcm0_resource[] = {
151 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM0, SZ_256),
152 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
153 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
156 struct platform_device s5pv210_device_pcm0 = {
157 .name = "samsung-pcm",
158 .id = 0,
159 .num_resources = ARRAY_SIZE(s5pv210_pcm0_resource),
160 .resource = s5pv210_pcm0_resource,
161 .dev = {
162 .platform_data = &s3c_pcm_pdata,
166 static struct resource s5pv210_pcm1_resource[] = {
167 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM1, SZ_256),
168 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
169 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
172 struct platform_device s5pv210_device_pcm1 = {
173 .name = "samsung-pcm",
174 .id = 1,
175 .num_resources = ARRAY_SIZE(s5pv210_pcm1_resource),
176 .resource = s5pv210_pcm1_resource,
177 .dev = {
178 .platform_data = &s3c_pcm_pdata,
182 static struct resource s5pv210_pcm2_resource[] = {
183 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM2, SZ_256),
184 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX),
185 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX),
188 struct platform_device s5pv210_device_pcm2 = {
189 .name = "samsung-pcm",
190 .id = 2,
191 .num_resources = ARRAY_SIZE(s5pv210_pcm2_resource),
192 .resource = s5pv210_pcm2_resource,
193 .dev = {
194 .platform_data = &s3c_pcm_pdata,
198 /* AC97 Controller platform devices */
200 static int s5pv210_ac97_cfg_gpio(struct platform_device *pdev)
202 return s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(4));
205 static struct resource s5pv210_ac97_resource[] = {
206 [0] = DEFINE_RES_MEM(S5PV210_PA_AC97, SZ_256),
207 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
208 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
209 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
210 [4] = DEFINE_RES_IRQ(IRQ_AC97),
213 static struct s3c_audio_pdata s3c_ac97_pdata = {
214 .cfg_gpio = s5pv210_ac97_cfg_gpio,
217 static u64 s5pv210_ac97_dmamask = DMA_BIT_MASK(32);
219 struct platform_device s5pv210_device_ac97 = {
220 .name = "samsung-ac97",
221 .id = -1,
222 .num_resources = ARRAY_SIZE(s5pv210_ac97_resource),
223 .resource = s5pv210_ac97_resource,
224 .dev = {
225 .platform_data = &s3c_ac97_pdata,
226 .dma_mask = &s5pv210_ac97_dmamask,
227 .coherent_dma_mask = DMA_BIT_MASK(32),
231 /* S/PDIF Controller platform_device */
233 static int s5pv210_spdif_cfg_gpio(struct platform_device *pdev)
235 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 2, S3C_GPIO_SFN(3));
237 return 0;
240 static struct resource s5pv210_spdif_resource[] = {
241 [0] = DEFINE_RES_MEM(S5PV210_PA_SPDIF, SZ_256),
242 [1] = DEFINE_RES_DMA(DMACH_SPDIF),
245 static struct s3c_audio_pdata samsung_spdif_pdata = {
246 .cfg_gpio = s5pv210_spdif_cfg_gpio,
249 static u64 s5pv210_spdif_dmamask = DMA_BIT_MASK(32);
251 struct platform_device s5pv210_device_spdif = {
252 .name = "samsung-spdif",
253 .id = -1,
254 .num_resources = ARRAY_SIZE(s5pv210_spdif_resource),
255 .resource = s5pv210_spdif_resource,
256 .dev = {
257 .platform_data = &samsung_spdif_pdata,
258 .dma_mask = &s5pv210_spdif_dmamask,
259 .coherent_dma_mask = DMA_BIT_MASK(32),