x86, efi: Set runtime_version to the EFI spec revision
[linux/fpc-iii.git] / arch / arm / mach-s5pv210 / dev-audio.c
blobaddfb165c13d050da4bc48a6c08a57c342b36c78
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 <linux/platform_data/asoc-s3c.h>
18 #include <mach/map.h>
19 #include <mach/dma.h>
20 #include <mach/irqs.h>
21 #include <mach/regs-audss.h>
23 static int s5pv210_cfg_i2s(struct platform_device *pdev)
25 /* configure GPIO for i2s port */
26 switch (pdev->id) {
27 case 0:
28 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 7, S3C_GPIO_SFN(2));
29 break;
30 case 1:
31 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(2));
32 break;
33 case 2:
34 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(4));
35 break;
36 default:
37 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
38 return -EINVAL;
41 return 0;
44 static struct s3c_audio_pdata i2sv5_pdata = {
45 .cfg_gpio = s5pv210_cfg_i2s,
46 .type = {
47 .i2s = {
48 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
49 | QUIRK_NEED_RSTCLR,
50 .idma_addr = S5PV210_AUDSS_INT_MEM,
55 static struct resource s5pv210_iis0_resource[] = {
56 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS0, SZ_256),
57 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
58 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
59 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX),
62 struct platform_device s5pv210_device_iis0 = {
63 .name = "samsung-i2s",
64 .id = 0,
65 .num_resources = ARRAY_SIZE(s5pv210_iis0_resource),
66 .resource = s5pv210_iis0_resource,
67 .dev = {
68 .platform_data = &i2sv5_pdata,
72 static struct s3c_audio_pdata i2sv3_pdata = {
73 .cfg_gpio = s5pv210_cfg_i2s,
76 static struct resource s5pv210_iis1_resource[] = {
77 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS1, SZ_256),
78 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
79 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
82 struct platform_device s5pv210_device_iis1 = {
83 .name = "samsung-i2s",
84 .id = 1,
85 .num_resources = ARRAY_SIZE(s5pv210_iis1_resource),
86 .resource = s5pv210_iis1_resource,
87 .dev = {
88 .platform_data = &i2sv3_pdata,
92 static struct resource s5pv210_iis2_resource[] = {
93 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS2, SZ_256),
94 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
95 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
98 struct platform_device s5pv210_device_iis2 = {
99 .name = "samsung-i2s",
100 .id = 2,
101 .num_resources = ARRAY_SIZE(s5pv210_iis2_resource),
102 .resource = s5pv210_iis2_resource,
103 .dev = {
104 .platform_data = &i2sv3_pdata,
108 /* PCM Controller platform_devices */
110 static int s5pv210_pcm_cfg_gpio(struct platform_device *pdev)
112 switch (pdev->id) {
113 case 0:
114 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 5, S3C_GPIO_SFN(3));
115 break;
116 case 1:
117 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(3));
118 break;
119 case 2:
120 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(2));
121 break;
122 default:
123 printk(KERN_DEBUG "Invalid PCM Controller number!");
124 return -EINVAL;
127 return 0;
130 static struct s3c_audio_pdata s3c_pcm_pdata = {
131 .cfg_gpio = s5pv210_pcm_cfg_gpio,
134 static struct resource s5pv210_pcm0_resource[] = {
135 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM0, SZ_256),
136 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
137 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
140 struct platform_device s5pv210_device_pcm0 = {
141 .name = "samsung-pcm",
142 .id = 0,
143 .num_resources = ARRAY_SIZE(s5pv210_pcm0_resource),
144 .resource = s5pv210_pcm0_resource,
145 .dev = {
146 .platform_data = &s3c_pcm_pdata,
150 static struct resource s5pv210_pcm1_resource[] = {
151 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM1, SZ_256),
152 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
153 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
156 struct platform_device s5pv210_device_pcm1 = {
157 .name = "samsung-pcm",
158 .id = 1,
159 .num_resources = ARRAY_SIZE(s5pv210_pcm1_resource),
160 .resource = s5pv210_pcm1_resource,
161 .dev = {
162 .platform_data = &s3c_pcm_pdata,
166 static struct resource s5pv210_pcm2_resource[] = {
167 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM2, SZ_256),
168 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX),
169 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX),
172 struct platform_device s5pv210_device_pcm2 = {
173 .name = "samsung-pcm",
174 .id = 2,
175 .num_resources = ARRAY_SIZE(s5pv210_pcm2_resource),
176 .resource = s5pv210_pcm2_resource,
177 .dev = {
178 .platform_data = &s3c_pcm_pdata,
182 /* AC97 Controller platform devices */
184 static int s5pv210_ac97_cfg_gpio(struct platform_device *pdev)
186 return s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(4));
189 static struct resource s5pv210_ac97_resource[] = {
190 [0] = DEFINE_RES_MEM(S5PV210_PA_AC97, SZ_256),
191 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
192 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
193 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
194 [4] = DEFINE_RES_IRQ(IRQ_AC97),
197 static struct s3c_audio_pdata s3c_ac97_pdata = {
198 .cfg_gpio = s5pv210_ac97_cfg_gpio,
201 static u64 s5pv210_ac97_dmamask = DMA_BIT_MASK(32);
203 struct platform_device s5pv210_device_ac97 = {
204 .name = "samsung-ac97",
205 .id = -1,
206 .num_resources = ARRAY_SIZE(s5pv210_ac97_resource),
207 .resource = s5pv210_ac97_resource,
208 .dev = {
209 .platform_data = &s3c_ac97_pdata,
210 .dma_mask = &s5pv210_ac97_dmamask,
211 .coherent_dma_mask = DMA_BIT_MASK(32),
215 /* S/PDIF Controller platform_device */
217 static int s5pv210_spdif_cfg_gpio(struct platform_device *pdev)
219 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 2, S3C_GPIO_SFN(3));
221 return 0;
224 static struct resource s5pv210_spdif_resource[] = {
225 [0] = DEFINE_RES_MEM(S5PV210_PA_SPDIF, SZ_256),
226 [1] = DEFINE_RES_DMA(DMACH_SPDIF),
229 static struct s3c_audio_pdata samsung_spdif_pdata = {
230 .cfg_gpio = s5pv210_spdif_cfg_gpio,
233 static u64 s5pv210_spdif_dmamask = DMA_BIT_MASK(32);
235 struct platform_device s5pv210_device_spdif = {
236 .name = "samsung-spdif",
237 .id = -1,
238 .num_resources = ARRAY_SIZE(s5pv210_spdif_resource),
239 .resource = s5pv210_spdif_resource,
240 .dev = {
241 .platform_data = &samsung_spdif_pdata,
242 .dma_mask = &s5pv210_spdif_dmamask,
243 .coherent_dma_mask = DMA_BIT_MASK(32),