x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
[linux/fpc-iii.git] / arch / arm / mach-s3c64xx / dev-audio.c
blobe367e87bbc2966d039eba15bcf90224d0010e105
1 /* linux/arch/arm/plat-s3c/dev-audio.c
3 * Copyright 2009 Wolfson Microelectronics
4 * Mark Brown <broonie@opensource.wolfsonmicro.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/kernel.h>
12 #include <linux/string.h>
13 #include <linux/platform_device.h>
14 #include <linux/dma-mapping.h>
15 #include <linux/gpio.h>
16 #include <linux/export.h>
18 #include <mach/irqs.h>
19 #include <mach/map.h>
20 #include <mach/dma.h>
22 #include <plat/devs.h>
23 #include <linux/platform_data/asoc-s3c.h>
24 #include <plat/gpio-cfg.h>
26 static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev)
28 unsigned int base;
30 switch (pdev->id) {
31 case 0:
32 base = S3C64XX_GPD(0);
33 break;
34 case 1:
35 base = S3C64XX_GPE(0);
36 break;
37 case 2:
38 s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C_GPIO_SFN(5));
39 s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C_GPIO_SFN(5));
40 s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C_GPIO_SFN(5));
41 s3c_gpio_cfgpin_range(S3C64XX_GPH(6), 4, S3C_GPIO_SFN(5));
42 return 0;
43 default:
44 printk(KERN_DEBUG "Invalid I2S Controller number: %d\n",
45 pdev->id);
46 return -EINVAL;
49 s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(3));
51 return 0;
54 static struct resource s3c64xx_iis0_resource[] = {
55 [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS0, SZ_256),
56 [1] = DEFINE_RES_DMA(DMACH_I2S0_OUT),
57 [2] = DEFINE_RES_DMA(DMACH_I2S0_IN),
60 static struct s3c_audio_pdata i2sv3_pdata = {
61 .cfg_gpio = s3c64xx_i2s_cfg_gpio,
64 struct platform_device s3c64xx_device_iis0 = {
65 .name = "samsung-i2s",
66 .id = 0,
67 .num_resources = ARRAY_SIZE(s3c64xx_iis0_resource),
68 .resource = s3c64xx_iis0_resource,
69 .dev = {
70 .platform_data = &i2sv3_pdata,
73 EXPORT_SYMBOL(s3c64xx_device_iis0);
75 static struct resource s3c64xx_iis1_resource[] = {
76 [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS1, SZ_256),
77 [1] = DEFINE_RES_DMA(DMACH_I2S1_OUT),
78 [2] = DEFINE_RES_DMA(DMACH_I2S1_IN),
81 struct platform_device s3c64xx_device_iis1 = {
82 .name = "samsung-i2s",
83 .id = 1,
84 .num_resources = ARRAY_SIZE(s3c64xx_iis1_resource),
85 .resource = s3c64xx_iis1_resource,
86 .dev = {
87 .platform_data = &i2sv3_pdata,
90 EXPORT_SYMBOL(s3c64xx_device_iis1);
92 static struct resource s3c64xx_iisv4_resource[] = {
93 [0] = DEFINE_RES_MEM(S3C64XX_PA_IISV4, SZ_256),
94 [1] = DEFINE_RES_DMA(DMACH_HSI_I2SV40_TX),
95 [2] = DEFINE_RES_DMA(DMACH_HSI_I2SV40_RX),
98 static struct s3c_audio_pdata i2sv4_pdata = {
99 .cfg_gpio = s3c64xx_i2s_cfg_gpio,
100 .type = {
101 .i2s = {
102 .quirks = QUIRK_PRI_6CHAN,
107 struct platform_device s3c64xx_device_iisv4 = {
108 .name = "samsung-i2s",
109 .id = 2,
110 .num_resources = ARRAY_SIZE(s3c64xx_iisv4_resource),
111 .resource = s3c64xx_iisv4_resource,
112 .dev = {
113 .platform_data = &i2sv4_pdata,
116 EXPORT_SYMBOL(s3c64xx_device_iisv4);
119 /* PCM Controller platform_devices */
121 static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev)
123 unsigned int base;
125 switch (pdev->id) {
126 case 0:
127 base = S3C64XX_GPD(0);
128 break;
129 case 1:
130 base = S3C64XX_GPE(0);
131 break;
132 default:
133 printk(KERN_DEBUG "Invalid PCM Controller number: %d\n",
134 pdev->id);
135 return -EINVAL;
138 s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(2));
139 return 0;
142 static struct resource s3c64xx_pcm0_resource[] = {
143 [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM0, SZ_256),
144 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
145 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
148 static struct s3c_audio_pdata s3c_pcm0_pdata = {
149 .cfg_gpio = s3c64xx_pcm_cfg_gpio,
152 struct platform_device s3c64xx_device_pcm0 = {
153 .name = "samsung-pcm",
154 .id = 0,
155 .num_resources = ARRAY_SIZE(s3c64xx_pcm0_resource),
156 .resource = s3c64xx_pcm0_resource,
157 .dev = {
158 .platform_data = &s3c_pcm0_pdata,
161 EXPORT_SYMBOL(s3c64xx_device_pcm0);
163 static struct resource s3c64xx_pcm1_resource[] = {
164 [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM1, SZ_256),
165 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
166 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
169 static struct s3c_audio_pdata s3c_pcm1_pdata = {
170 .cfg_gpio = s3c64xx_pcm_cfg_gpio,
173 struct platform_device s3c64xx_device_pcm1 = {
174 .name = "samsung-pcm",
175 .id = 1,
176 .num_resources = ARRAY_SIZE(s3c64xx_pcm1_resource),
177 .resource = s3c64xx_pcm1_resource,
178 .dev = {
179 .platform_data = &s3c_pcm1_pdata,
182 EXPORT_SYMBOL(s3c64xx_device_pcm1);
184 /* AC97 Controller platform devices */
186 static int s3c64xx_ac97_cfg_gpd(struct platform_device *pdev)
188 return s3c_gpio_cfgpin_range(S3C64XX_GPD(0), 5, S3C_GPIO_SFN(4));
191 static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev)
193 return s3c_gpio_cfgpin_range(S3C64XX_GPE(0), 5, S3C_GPIO_SFN(4));
196 static struct resource s3c64xx_ac97_resource[] = {
197 [0] = DEFINE_RES_MEM(S3C64XX_PA_AC97, SZ_256),
198 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
199 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
200 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
201 [4] = DEFINE_RES_IRQ(IRQ_AC97),
204 static struct s3c_audio_pdata s3c_ac97_pdata;
206 static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32);
208 struct platform_device s3c64xx_device_ac97 = {
209 .name = "samsung-ac97",
210 .id = -1,
211 .num_resources = ARRAY_SIZE(s3c64xx_ac97_resource),
212 .resource = s3c64xx_ac97_resource,
213 .dev = {
214 .platform_data = &s3c_ac97_pdata,
215 .dma_mask = &s3c64xx_ac97_dmamask,
216 .coherent_dma_mask = DMA_BIT_MASK(32),
219 EXPORT_SYMBOL(s3c64xx_device_ac97);
221 void __init s3c64xx_ac97_setup_gpio(int num)
223 if (num == S3C64XX_AC97_GPD)
224 s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpd;
225 else
226 s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpe;