diff options
-rw-r--r-- | arch/arm/mach-s3c6400/include/mach/map.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-s3c/include/plat/regs-adc.h | 3 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/dev-adc.c | 46 | ||||
-rw-r--r-- | arch/arm/plat-samsung/adc.c | 27 |
5 files changed, 79 insertions, 2 deletions
diff --git a/arch/arm/mach-s3c6400/include/mach/map.h b/arch/arm/mach-s3c6400/include/mach/map.h index d4cd3abe3cba..5a35f24fcb80 100644 --- a/arch/arm/mach-s3c6400/include/mach/map.h +++ b/arch/arm/mach-s3c6400/include/mach/map.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #define S3C64XX_PA_FB (0x77100000) | 42 | #define S3C64XX_PA_FB (0x77100000) |
43 | #define S3C64XX_PA_USB_HSOTG (0x7C000000) | 43 | #define S3C64XX_PA_USB_HSOTG (0x7C000000) |
44 | #define S3C64XX_PA_WATCHDOG (0x7E004000) | 44 | #define S3C64XX_PA_WATCHDOG (0x7E004000) |
45 | #define S3C64XX_PA_ADC (0x7E00B000) | ||
45 | #define S3C64XX_PA_SYSCON (0x7E00F000) | 46 | #define S3C64XX_PA_SYSCON (0x7E00F000) |
46 | #define S3C64XX_PA_AC97 (0x7F001000) | 47 | #define S3C64XX_PA_AC97 (0x7F001000) |
47 | #define S3C64XX_PA_IIS0 (0x7F002000) | 48 | #define S3C64XX_PA_IIS0 (0x7F002000) |
diff --git a/arch/arm/plat-s3c/include/plat/regs-adc.h b/arch/arm/plat-s3c/include/plat/regs-adc.h index 4323cccc86cd..f43c8dab39e4 100644 --- a/arch/arm/plat-s3c/include/plat/regs-adc.h +++ b/arch/arm/plat-s3c/include/plat/regs-adc.h | |||
@@ -19,6 +19,9 @@ | |||
19 | #define S3C2410_ADCDLY S3C2410_ADCREG(0x08) | 19 | #define S3C2410_ADCDLY S3C2410_ADCREG(0x08) |
20 | #define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C) | 20 | #define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C) |
21 | #define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) | 21 | #define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) |
22 | #define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) | ||
23 | #define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) | ||
24 | #define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) | ||
22 | 25 | ||
23 | 26 | ||
24 | /* ADCCON Register Bits */ | 27 | /* ADCCON Register Bits */ |
diff --git a/arch/arm/plat-s3c64xx/Makefile b/arch/arm/plat-s3c64xx/Makefile index b85b4359e935..80600176cf2a 100644 --- a/arch/arm/plat-s3c64xx/Makefile +++ b/arch/arm/plat-s3c64xx/Makefile | |||
@@ -35,6 +35,10 @@ obj-$(CONFIG_PM) += irq-pm.o | |||
35 | 35 | ||
36 | obj-$(CONFIG_S3C64XX_DMA) += dma.o | 36 | obj-$(CONFIG_S3C64XX_DMA) += dma.o |
37 | 37 | ||
38 | # ADC support | ||
39 | |||
40 | obj-$(CONFIG_S3C_ADC) += dev-adc.o | ||
41 | |||
38 | # Device setup | 42 | # Device setup |
39 | 43 | ||
40 | obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o | 44 | obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o |
diff --git a/arch/arm/plat-s3c64xx/dev-adc.c b/arch/arm/plat-s3c64xx/dev-adc.c new file mode 100644 index 000000000000..fafef9b6bcfa --- /dev/null +++ b/arch/arm/plat-s3c64xx/dev-adc.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* linux/arch/arm/plat-s3c64xx/dev-adc.c | ||
2 | * | ||
3 | * Copyright 2010 Maurus Cuelenaere | ||
4 | * | ||
5 | * S3C64xx series device definition for ADC device | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | #include <mach/irqs.h> | ||
17 | #include <mach/map.h> | ||
18 | |||
19 | #include <plat/adc.h> | ||
20 | #include <plat/devs.h> | ||
21 | #include <plat/cpu.h> | ||
22 | |||
23 | static struct resource s3c_adc_resource[] = { | ||
24 | [0] = { | ||
25 | .start = S3C64XX_PA_ADC, | ||
26 | .end = S3C64XX_PA_ADC + SZ_256 - 1, | ||
27 | .flags = IORESOURCE_MEM, | ||
28 | }, | ||
29 | [1] = { | ||
30 | .start = IRQ_TC, | ||
31 | .end = IRQ_TC, | ||
32 | .flags = IORESOURCE_IRQ, | ||
33 | }, | ||
34 | [2] = { | ||
35 | .start = IRQ_ADC, | ||
36 | .end = IRQ_ADC, | ||
37 | .flags = IORESOURCE_IRQ, | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | struct platform_device s3c_device_adc = { | ||
42 | .name = "s3c64xx-adc", | ||
43 | .id = -1, | ||
44 | .num_resources = ARRAY_SIZE(s3c_adc_resource), | ||
45 | .resource = s3c_adc_resource, | ||
46 | }; | ||
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c index a8843dd5e1e7..120b7902fc2f 100644 --- a/arch/arm/plat-samsung/adc.c +++ b/arch/arm/plat-samsung/adc.c | |||
@@ -37,6 +37,11 @@ | |||
37 | * action is required. | 37 | * action is required. |
38 | */ | 38 | */ |
39 | 39 | ||
40 | enum s3c_cpu_type { | ||
41 | TYPE_S3C24XX, | ||
42 | TYPE_S3C64XX | ||
43 | }; | ||
44 | |||
40 | struct s3c_adc_client { | 45 | struct s3c_adc_client { |
41 | struct platform_device *pdev; | 46 | struct platform_device *pdev; |
42 | struct list_head pend; | 47 | struct list_head pend; |
@@ -262,7 +267,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) | |||
262 | 267 | ||
263 | if (!client) { | 268 | if (!client) { |
264 | dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__); | 269 | dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__); |
265 | return IRQ_HANDLED; | 270 | goto exit; |
266 | } | 271 | } |
267 | 272 | ||
268 | data0 = readl(adc->regs + S3C2410_ADCDAT0); | 273 | data0 = readl(adc->regs + S3C2410_ADCDAT0); |
@@ -289,6 +294,11 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) | |||
289 | local_irq_restore(flags); | 294 | local_irq_restore(flags); |
290 | } | 295 | } |
291 | 296 | ||
297 | exit: | ||
298 | if (platform_get_device_id(client->pdev)->driver_data == TYPE_S3C64XX) { | ||
299 | /* Clear ADC interrupt */ | ||
300 | writel(0, adc->regs + S3C64XX_ADCCLRINT); | ||
301 | } | ||
292 | return IRQ_HANDLED; | 302 | return IRQ_HANDLED; |
293 | } | 303 | } |
294 | 304 | ||
@@ -410,9 +420,22 @@ static int s3c_adc_resume(struct platform_device *pdev) | |||
410 | #define s3c_adc_resume NULL | 420 | #define s3c_adc_resume NULL |
411 | #endif | 421 | #endif |
412 | 422 | ||
423 | static struct platform_device_id s3c_adc_driver_ids[] = { | ||
424 | { | ||
425 | .name = "s3c24xx-adc", | ||
426 | .driver_data = TYPE_S3C24XX, | ||
427 | }, { | ||
428 | .name = "s3c64xx-adc", | ||
429 | .driver_data = TYPE_S3C64XX, | ||
430 | }, | ||
431 | { } | ||
432 | }; | ||
433 | MODULE_DEVICE_TABLE(platform, s3c_adc_driver_ids); | ||
434 | |||
413 | static struct platform_driver s3c_adc_driver = { | 435 | static struct platform_driver s3c_adc_driver = { |
436 | .id_table = s3c_adc_driver_ids, | ||
414 | .driver = { | 437 | .driver = { |
415 | .name = "s3c24xx-adc", | 438 | .name = "s3c-adc", |
416 | .owner = THIS_MODULE, | 439 | .owner = THIS_MODULE, |
417 | }, | 440 | }, |
418 | .probe = s3c_adc_probe, | 441 | .probe = s3c_adc_probe, |