mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race
[linux/fpc-iii.git] / arch / arm / mach-s3c64xx / dev-audio.c
blobcb953e238b2a61b8f80155d7b9d66549de12535e
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>
25 #include <mach/gpio-samsung.h>
27 static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev)
29 unsigned int base;
31 switch (pdev->id) {
32 case 0:
33 base = S3C64XX_GPD(0);
34 break;
35 case 1:
36 base = S3C64XX_GPE(0);
37 break;
38 case 2:
39 s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C_GPIO_SFN(5));
40 s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C_GPIO_SFN(5));
41 s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C_GPIO_SFN(5));
42 s3c_gpio_cfgpin_range(S3C64XX_GPH(6), 4, S3C_GPIO_SFN(5));
43 return 0;
44 default:
45 printk(KERN_DEBUG "Invalid I2S Controller number: %d\n",
46 pdev->id);
47 return -EINVAL;
50 s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(3));
52 return 0;
55 static struct resource s3c64xx_iis0_resource[] = {
56 [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS0, SZ_256),
59 static struct s3c_audio_pdata i2s0_pdata = {
60 .cfg_gpio = s3c64xx_i2s_cfg_gpio,
63 struct platform_device s3c64xx_device_iis0 = {
64 .name = "samsung-i2s",
65 .id = 0,
66 .num_resources = ARRAY_SIZE(s3c64xx_iis0_resource),
67 .resource = s3c64xx_iis0_resource,
68 .dev = {
69 .platform_data = &i2s0_pdata,
72 EXPORT_SYMBOL(s3c64xx_device_iis0);
74 static struct resource s3c64xx_iis1_resource[] = {
75 [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS1, SZ_256),
78 static struct s3c_audio_pdata i2s1_pdata = {
79 .cfg_gpio = s3c64xx_i2s_cfg_gpio,
82 struct platform_device s3c64xx_device_iis1 = {
83 .name = "samsung-i2s",
84 .id = 1,
85 .num_resources = ARRAY_SIZE(s3c64xx_iis1_resource),
86 .resource = s3c64xx_iis1_resource,
87 .dev = {
88 .platform_data = &i2s1_pdata,
91 EXPORT_SYMBOL(s3c64xx_device_iis1);
93 static struct resource s3c64xx_iisv4_resource[] = {
94 [0] = DEFINE_RES_MEM(S3C64XX_PA_IISV4, SZ_256),
97 static struct s3c_audio_pdata i2sv4_pdata = {
98 .cfg_gpio = s3c64xx_i2s_cfg_gpio,
99 .type = {
100 .quirks = QUIRK_PRI_6CHAN,
104 struct platform_device s3c64xx_device_iisv4 = {
105 .name = "samsung-i2s",
106 .id = 2,
107 .num_resources = ARRAY_SIZE(s3c64xx_iisv4_resource),
108 .resource = s3c64xx_iisv4_resource,
109 .dev = {
110 .platform_data = &i2sv4_pdata,
113 EXPORT_SYMBOL(s3c64xx_device_iisv4);
116 /* PCM Controller platform_devices */
118 static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev)
120 unsigned int base;
122 switch (pdev->id) {
123 case 0:
124 base = S3C64XX_GPD(0);
125 break;
126 case 1:
127 base = S3C64XX_GPE(0);
128 break;
129 default:
130 printk(KERN_DEBUG "Invalid PCM Controller number: %d\n",
131 pdev->id);
132 return -EINVAL;
135 s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(2));
136 return 0;
139 static struct resource s3c64xx_pcm0_resource[] = {
140 [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM0, SZ_256),
143 static struct s3c_audio_pdata s3c_pcm0_pdata = {
144 .cfg_gpio = s3c64xx_pcm_cfg_gpio,
147 struct platform_device s3c64xx_device_pcm0 = {
148 .name = "samsung-pcm",
149 .id = 0,
150 .num_resources = ARRAY_SIZE(s3c64xx_pcm0_resource),
151 .resource = s3c64xx_pcm0_resource,
152 .dev = {
153 .platform_data = &s3c_pcm0_pdata,
156 EXPORT_SYMBOL(s3c64xx_device_pcm0);
158 static struct resource s3c64xx_pcm1_resource[] = {
159 [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM1, SZ_256),
162 static struct s3c_audio_pdata s3c_pcm1_pdata = {
163 .cfg_gpio = s3c64xx_pcm_cfg_gpio,
166 struct platform_device s3c64xx_device_pcm1 = {
167 .name = "samsung-pcm",
168 .id = 1,
169 .num_resources = ARRAY_SIZE(s3c64xx_pcm1_resource),
170 .resource = s3c64xx_pcm1_resource,
171 .dev = {
172 .platform_data = &s3c_pcm1_pdata,
175 EXPORT_SYMBOL(s3c64xx_device_pcm1);
177 /* AC97 Controller platform devices */
179 static int s3c64xx_ac97_cfg_gpd(struct platform_device *pdev)
181 return s3c_gpio_cfgpin_range(S3C64XX_GPD(0), 5, S3C_GPIO_SFN(4));
184 static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev)
186 return s3c_gpio_cfgpin_range(S3C64XX_GPE(0), 5, S3C_GPIO_SFN(4));
189 static struct resource s3c64xx_ac97_resource[] = {
190 [0] = DEFINE_RES_MEM(S3C64XX_PA_AC97, SZ_256),
191 [1] = DEFINE_RES_IRQ(IRQ_AC97),
194 static struct s3c_audio_pdata s3c_ac97_pdata = {
197 static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32);
199 struct platform_device s3c64xx_device_ac97 = {
200 .name = "samsung-ac97",
201 .id = -1,
202 .num_resources = ARRAY_SIZE(s3c64xx_ac97_resource),
203 .resource = s3c64xx_ac97_resource,
204 .dev = {
205 .platform_data = &s3c_ac97_pdata,
206 .dma_mask = &s3c64xx_ac97_dmamask,
207 .coherent_dma_mask = DMA_BIT_MASK(32),
210 EXPORT_SYMBOL(s3c64xx_device_ac97);
212 void __init s3c64xx_ac97_setup_gpio(int num)
214 if (num == S3C64XX_AC97_GPD)
215 s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpd;
216 else
217 s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpe;