Skip to contentSkip to conversation

S3C: merge ADC drivers and add support for the S3C64xx

PATCH New Maurus Cuelenaere 3 participants 6 messages Nov 20, 2009 – Nov 23, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 6/8 S3C: merge ADC drivers and add support for the S3C64xx

This moves the S3C24xx ADC driver to plat-s3c and adds support for the S3C64xx.

---
 arch/arm/plat-s3c/Kconfig                 |    7 +++++
 arch/arm/plat-s3c/Makefile                |    4 +++
 arch/arm/{plat-s3c24xx => plat-s3c}/adc.c |   17 +++++++++--
 arch/arm/plat-s3c/include/plat/regs-adc.h |    3 ++
 arch/arm/plat-s3c24xx/Kconfig             |    7 -----
 arch/arm/plat-s3c24xx/Makefile            |    1 -
 arch/arm/plat-s3c64xx/Makefile            |    1 +
 arch/arm/plat-s3c64xx/dev-adc.c           |   42 +++++++++++++++++++++++++++++
 8 files changed, 71 insertions(+), 11 deletions(-)
 rename arch/arm/{plat-s3c24xx => plat-s3c}/adc.c (95%)
 create mode 100644 arch/arm/plat-s3c64xx/dev-adc.c
arch/arm/plat-s3c/Kconfig +7 -0
index 57e685b..4184084 100644
@@ -159,6 +159,13 @@ config S3C_GPIO_CFG_S3C64XX
 	  Internal configuration to enable S3C64XX style GPIO configuration
 	  functions.
 
+config S3C_ADC
+	bool "ADC common driver support"
+	help
+	  Core support for the ADC block found in the S3C SoC systems
+	  for drivers such as the touchscreen and hwmon to use to share
+	  this resource.
+
 # DMA
 
 config S3C_DMA
arch/arm/plat-s3c/Makefile +4 -0
index 50444da..960fb43 100644
@@ -32,6 +32,10 @@ obj-$(CONFIG_S3C2410_PM_CHECK)	+= pm-check.o
 
 obj-$(CONFIG_HAVE_PWM)		+= pwm.o
 
+# ADC support
+
+obj-$(CONFIG_S3C_ADC)		+= adc.o
+
 # devices
 
 obj-$(CONFIG_S3C_DEV_HSMMC)	+= dev-hsmmc.o
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +14 -3
similarity index 95%
rename from arch/arm/plat-s3c24xx/adc.c
rename to arch/arm/plat-s3c/adc.c
index df47322..572b7be 100644
@@ -1,10 +1,10 @@
-/* arch/arm/plat-s3c24xx/adc.c
+/* arch/arm/plat-s3c/adc.c
  *
  * Copyright (c) 2008 Simtec Electronics
  *	http://armlinux.simtec.co.uk/
  *	Ben Dooks <[email protected]>, <[email protected]>
  *
- * S3C24XX ADC device core
+ * S3C ADC device core
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -72,10 +72,18 @@ static LIST_HEAD(adc_pending);
 
 #define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg)
 
+#define AUTOPST (S3C2410_ADCTSC_YM_SEN | S3C2410_ADCTSC_YP_SEN | \
+		S3C2410_ADCTSC_XP_SEN | S3C2410_ADCTSC_AUTO_PST | \
+		S3C2410_ADCTSC_XY_PST(0))
+
 static inline void s3c_adc_convert(struct adc_device *adc)
 {
 	unsigned con = readl(adc->regs + S3C2410_ADCCON);
 
+	if (adc->cur->is_ts)
+		writel(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST,
+			adc->regs + S3C2410_ADCTSC);
+
 	con |= S3C2410_ADCCON_ENABLE_START;
 	writel(con, adc->regs + S3C2410_ADCCON);
 }
@@ -260,6 +268,9 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
 	unsigned long flags;
 	unsigned data0, data1;
 
+	/* Clear ADC interrupt */
+	__raw_writel(0x0, adc->regs + S3C6400_ADCCLRINT);
+
 	if (!client) {
 		dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__);
 		return IRQ_HANDLED;
@@ -412,7 +423,7 @@ static int s3c_adc_resume(struct platform_device *pdev)
 
 static struct platform_driver s3c_adc_driver = {
 	.driver		= {
-		.name	= "s3c24xx-adc",
+		.name	= "s3c-adc",
 		.owner	= THIS_MODULE,
 	},
 	.probe		= s3c_adc_probe,
(quoted diff) +0 -0

b/arch/arm/plat-s3c/include/plat/regs-adc.h
index 4323ccc..cd7d2a5 100644

arch/arm/plat-s3c/include/plat/regs-adc.h +3 -0
@@ -19,6 +19,9 @@
 #define S3C2410_ADCDLY	   S3C2410_ADCREG(0x08)
 #define S3C2410_ADCDAT0	   S3C2410_ADCREG(0x0C)
 #define S3C2410_ADCDAT1	   S3C2410_ADCREG(0x10)
+#define S3C6400_ADCUPDN	   S3C2410_ADCREG(0x14)
+#define S3C6400_ADCCLRINT  S3C2410_ADCREG(0x18)
+#define S3C6400_ADCCLRIPD  S3C2410_ADCREG(0x20)
 
 
 /* ADCCON Register Bits */
arch/arm/plat-s3c24xx/Kconfig +0 -7
index 9c7aca4..c402ed9 100644
@@ -119,13 +119,6 @@ config S3C2410_DMA_DEBUG
 	  Enable debugging output for the DMA code. This option sends info
 	  to the kernel log, at priority KERN_DEBUG.
 
-config S3C24XX_ADC
-	bool "ADC common driver support"
-	help
-	  Core support for the ADC block found in the S3C24XX SoC systems
-	  for drivers such as the touchscreen and hwmon to use to share
-	  this resource.
-
 # SPI default pin configuration code
 
 config S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13
arch/arm/plat-s3c24xx/Makefile +0 -1
index 7780d2d..a2cb87b 100644
@@ -38,7 +38,6 @@ obj-$(CONFIG_PM)		+= irq-pm.o
 obj-$(CONFIG_PM)		+= sleep.o
 obj-$(CONFIG_S3C2410_CLOCK)	+= s3c2410-clock.o
 obj-$(CONFIG_S3C2410_DMA)	+= dma.o
-obj-$(CONFIG_S3C24XX_ADC)	+= adc.o
 obj-$(CONFIG_S3C2410_IOTIMING)	+= s3c2410-iotiming.o
 obj-$(CONFIG_S3C2412_IOTIMING)	+= s3c2412-iotiming.o
 obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += s3c2410-cpufreq-utils.o
arch/arm/plat-s3c64xx/Makefile +1 -0
index b85b435..a8c5d17 100644
@@ -13,6 +13,7 @@ obj-				:=
 # Core files
 
 obj-y				+= dev-uart.o
+obj-y				+= dev-adc.o
 obj-y				+= cpu.o
 obj-y				+= irq.o
 obj-y				+= irq-eint.o
arch/arm/plat-s3c64xx/dev-adc.c new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
1.6.5.3
#1 lore raw

PATCH 6/8 S3C: merge ADC drivers and add support for the S3C64xx

? ????????? ?? 20 ?????? 2009 14:04:10 ????? Maurus Cuelenaere ???????:

Quoted 91 lines

This moves the S3C24xx ADC driver to plat-s3c and adds support for the S3C64xx.

---
 arch/arm/plat-s3c/Kconfig                 |    7 +++++
 arch/arm/plat-s3c/Makefile                |    4 +++
 arch/arm/{plat-s3c24xx => plat-s3c}/adc.c |   17 +++++++++--
 arch/arm/plat-s3c/include/plat/regs-adc.h |    3 ++
 arch/arm/plat-s3c24xx/Kconfig             |    7 -----
 arch/arm/plat-s3c24xx/Makefile            |    1 -
 arch/arm/plat-s3c64xx/Makefile            |    1 +
 arch/arm/plat-s3c64xx/dev-adc.c           |   42
 +++++++++++++++++++++++++++++ 8 files changed, 71 insertions(+), 11
 deletions(-)
 rename arch/arm/{plat-s3c24xx => plat-s3c}/adc.c (95%)
 create mode 100644 arch/arm/plat-s3c64xx/dev-adc.c
arch/arm/plat-s3c/Kconfig +7 -0
index 57e685b..4184084 100644
@@ -159,6 +159,13 @@ config S3C_GPIO_CFG_S3C64XX
 	  Internal configuration to enable S3C64XX style GPIO configuration
 	  functions.
 
+config S3C_ADC
+	bool "ADC common driver support"
+	help
+	  Core support for the ADC block found in the S3C SoC systems
+	  for drivers such as the touchscreen and hwmon to use to share
+	  this resource.
+
 # DMA
 
 config S3C_DMA
arch/arm/plat-s3c/Makefile +4 -0
index 50444da..960fb43 100644
@@ -32,6 +32,10 @@ obj-$(CONFIG_S3C2410_PM_CHECK)	+= pm-check.o
 
 obj-$(CONFIG_HAVE_PWM)		+= pwm.o
 
+# ADC support
+
+obj-$(CONFIG_S3C_ADC)		+= adc.o
+
 # devices
 
 obj-$(CONFIG_S3C_DEV_HSMMC)	+= dev-hsmmc.o
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +10 -2
similarity index 95%
rename from arch/arm/plat-s3c24xx/adc.c
rename to arch/arm/plat-s3c/adc.c
index df47322..572b7be 100644
@@ -1,10 +1,10 @@
-/* arch/arm/plat-s3c24xx/adc.c
+/* arch/arm/plat-s3c/adc.c
  *
  * Copyright (c) 2008 Simtec Electronics
  *	http://armlinux.simtec.co.uk/
  *	Ben Dooks <[email protected]>, <[email protected]>
  *
- * S3C24XX ADC device core
+ * S3C ADC device core
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -72,10 +72,18 @@ static LIST_HEAD(adc_pending);
 
 #define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg)
 
+#define AUTOPST (S3C2410_ADCTSC_YM_SEN | S3C2410_ADCTSC_YP_SEN | \
+		S3C2410_ADCTSC_XP_SEN | S3C2410_ADCTSC_AUTO_PST | \
+		S3C2410_ADCTSC_XY_PST(0))
+
 static inline void s3c_adc_convert(struct adc_device *adc)
 {
 	unsigned con = readl(adc->regs + S3C2410_ADCCON);
 
+	if (adc->cur->is_ts)
+		writel(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST,
+			adc->regs + S3C2410_ADCTSC);
+
 	con |= S3C2410_ADCCON_ENABLE_START;
 	writel(con, adc->regs + S3C2410_ADCCON);
 }

arch/arm/plat-s3c/adc.c static irqreturn_t s3c_adc_irq(int irq, void *pw) · line 273

Quoted 6 lines
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +3 -0
@@ -260,6 +268,9 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
 	unsigned long flags;
 	unsigned data0, data1;
 
+	/* Clear ADC interrupt */
+	__raw_writel(0x0, adc->regs + S3C6400_ADCCLRINT);
+

s3c24xx has not ADCCLRINT register, so I suspect it'll break s3c24xx- compatibility

Quoted 108 lines
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +1 -1
 	if (!client) {
 		dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__);
 		return IRQ_HANDLED;
@@ -412,7 +423,7 @@ static int s3c_adc_resume(struct platform_device *pdev)
 
 static struct platform_driver s3c_adc_driver = {
 	.driver		= {
-		.name	= "s3c24xx-adc",
+		.name	= "s3c-adc",
 		.owner	= THIS_MODULE,
 	},
 	.probe		= s3c_adc_probe,
arch/arm/plat-s3c/include/plat/regs-adc.h +3 -0
index 4323ccc..cd7d2a5 100644
@@ -19,6 +19,9 @@
 #define S3C2410_ADCDLY	   S3C2410_ADCREG(0x08)
 #define S3C2410_ADCDAT0	   S3C2410_ADCREG(0x0C)
 #define S3C2410_ADCDAT1	   S3C2410_ADCREG(0x10)
+#define S3C6400_ADCUPDN	   S3C2410_ADCREG(0x14)
+#define S3C6400_ADCCLRINT  S3C2410_ADCREG(0x18)
+#define S3C6400_ADCCLRIPD  S3C2410_ADCREG(0x20)
 
 
 /* ADCCON Register Bits */
arch/arm/plat-s3c24xx/Kconfig +0 -7
index 9c7aca4..c402ed9 100644
@@ -119,13 +119,6 @@ config S3C2410_DMA_DEBUG
 	  Enable debugging output for the DMA code. This option sends info
 	  to the kernel log, at priority KERN_DEBUG.
 
-config S3C24XX_ADC
-	bool "ADC common driver support"
-	help
-	  Core support for the ADC block found in the S3C24XX SoC systems
-	  for drivers such as the touchscreen and hwmon to use to share
-	  this resource.
-
 # SPI default pin configuration code
 
 config S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13
(quoted diff) +0 -0
 b/arch/arm/plat-s3c24xx/Makefile index 7780d2d..a2cb87b 100644
arch/arm/plat-s3c24xx/Makefile +0 -1
@@ -38,7 +38,6 @@ obj-$(CONFIG_PM)		+= irq-pm.o
 obj-$(CONFIG_PM)		+= sleep.o
 obj-$(CONFIG_S3C2410_CLOCK)	+= s3c2410-clock.o
 obj-$(CONFIG_S3C2410_DMA)	+= dma.o
-obj-$(CONFIG_S3C24XX_ADC)	+= adc.o
 obj-$(CONFIG_S3C2410_IOTIMING)	+= s3c2410-iotiming.o
 obj-$(CONFIG_S3C2412_IOTIMING)	+= s3c2412-iotiming.o
 obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += s3c2410-cpufreq-utils.o
(quoted diff) +0 -0
 b/arch/arm/plat-s3c64xx/Makefile index b85b435..a8c5d17 100644
arch/arm/plat-s3c64xx/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-				:=
 # Core files
 
 obj-y				+= dev-uart.o
+obj-y				+= dev-adc.o
 obj-y				+= cpu.o
 obj-y				+= irq.o
 obj-y				+= irq-eint.o
(quoted diff) +0 -0
 b/arch/arm/plat-s3c64xx/dev-adc.c new file mode 100644

index 0000000..8cff72e

arch/arm/plat-s3c64xx/dev-adc.c new file +32 -0
@@ -0,0 +1,42 @@
+/* linux/arch/arm/plat-s3c64xx/dev-adc.c
+ *
+ * Copyright 2009 by Maurus Cuelenaere <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/map.h>
+
+#include <plat/devs.h>
+
+static struct resource s3c_adc_resource[] = {
+	[0] = {
+		.start = S3C64XX_PA_ADC,
+		.end   = S3C64XX_PA_ADC + SZ_1K - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start = IRQ_TC,
+		.end   = IRQ_TC,
+		.flags = IORESOURCE_IRQ,
+	},
+	[2] = {
+		.start = IRQ_ADC,
+		.end   = IRQ_ADC,

arch/arm/plat-s3c64xx/dev-adc.c line 42

Quoted 10 lines
arch/arm/plat-s3c64xx/dev-adc.c new file +10 -0
+		.flags = IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device s3c_device_adc = {
+	.name		  = "s3c-adc",
+	.id		  = -1,
+	.num_resources	  = ARRAY_SIZE(s3c_adc_resource),
+	.resource	  = s3c_adc_resource,
+};

Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091120/eae167dd/attachment-0001.sig>

#2 lore raw

PATCH 6/8 S3C: merge ADC drivers and add support for the S3C64xx

Op 20-11-09 13:16, Vasily Khoruzhick schreef:

Quoted 96 lines

? ????????? ?? 20 ?????? 2009 14:04:10 ????? Maurus Cuelenaere ???????:

Quoted 94 lines

This moves the S3C24xx ADC driver to plat-s3c and adds support for the S3C64xx.

---
  arch/arm/plat-s3c/Kconfig                 |    7 +++++
  arch/arm/plat-s3c/Makefile                |    4 +++
  arch/arm/{plat-s3c24xx =>  plat-s3c}/adc.c |   17 +++++++++--
  arch/arm/plat-s3c/include/plat/regs-adc.h |    3 ++
  arch/arm/plat-s3c24xx/Kconfig             |    7 -----
  arch/arm/plat-s3c24xx/Makefile            |    1 -
  arch/arm/plat-s3c64xx/Makefile            |    1 +
  arch/arm/plat-s3c64xx/dev-adc.c           |   42

+++++++++++++++++++++++++++++ 8 files changed, 71 insertions(+), 11 deletions(-)
rename arch/arm/{plat-s3c24xx => plat-s3c}/adc.c (95%) create mode 100644 arch/arm/plat-s3c64xx/dev-adc.c

arch/arm/plat-s3c/Kconfig +7 -0
index 57e685b..4184084 100644
@@ -159,6 +159,13 @@ config S3C_GPIO_CFG_S3C64XX
  	  Internal configuration to enable S3C64XX style GPIO configuration
  	  functions.
 
+config S3C_ADC
+	bool "ADC common driver support"
+	help
+	  Core support for the ADC block found in the S3C SoC systems
+	  for drivers such as the touchscreen and hwmon to use to share
+	  this resource.
+
  # DMA
 
  config S3C_DMA
arch/arm/plat-s3c/Makefile +4 -0
index 50444da..960fb43 100644
@@ -32,6 +32,10 @@ obj-$(CONFIG_S3C2410_PM_CHECK)	+= pm-check.o
 
  obj-$(CONFIG_HAVE_PWM)		+= pwm.o
 
+# ADC support
+
+obj-$(CONFIG_S3C_ADC)		+= adc.o
+
  # devices
 
  obj-$(CONFIG_S3C_DEV_HSMMC)	+= dev-hsmmc.o
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +10 -2
similarity index 95%
rename from arch/arm/plat-s3c24xx/adc.c
rename to arch/arm/plat-s3c/adc.c
index df47322..572b7be 100644
@@ -1,10 +1,10 @@
-/* arch/arm/plat-s3c24xx/adc.c
+/* arch/arm/plat-s3c/adc.c
   *
   * Copyright (c) 2008 Simtec Electronics
   *	http://armlinux.simtec.co.uk/
   *	Ben Dooks<[email protected]>,<[email protected]>
   *
- * S3C24XX ADC device core
+ * S3C ADC device core
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
@@ -72,10 +72,18 @@ static LIST_HEAD(adc_pending);
 
  #define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg)
 
+#define AUTOPST (S3C2410_ADCTSC_YM_SEN | S3C2410_ADCTSC_YP_SEN | \
+		S3C2410_ADCTSC_XP_SEN | S3C2410_ADCTSC_AUTO_PST | \
+		S3C2410_ADCTSC_XY_PST(0))
+
  static inline void s3c_adc_convert(struct adc_device *adc)
  {
  	unsigned con = readl(adc->regs + S3C2410_ADCCON);
 
+	if (adc->cur->is_ts)
+		writel(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST,
+			adc->regs + S3C2410_ADCTSC);
+
  	con |= S3C2410_ADCCON_ENABLE_START;
  	writel(con, adc->regs + S3C2410_ADCCON);
  }
@@ -260,6 +268,9 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
  	unsigned long flags;
  	unsigned data0, data1;
 
Quoted 6 lines

arch/arm/plat-s3c/adc.c static irqreturn_t s3c_adc_irq(int irq, void *pw)

Quoted 4 lines
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +3 -0
+	/* Clear ADC interrupt */
+	__raw_writel(0x0, adc->regs + S3C6400_ADCCLRINT);
+
 

s3c24xx has not ADCCLRINT register, so I suspect it'll break s3c24xx- compatibility

Hmm right, that doesn't seem right; this should in an if(adc->type == S3C64XX) check..

Also that if(adc->cur->is_ts) change above seems unrelated, let me resend this patch.

Regards,
Maurus Cuelenaere

#3 lore raw

PATCH v2 6/8 S3C: merge ADC drivers and add support for the S3C64xx

This moves the S3C24xx ADC driver to plat-s3c and adds support for the S3C64xx.

---
 arch/arm/mach-s3c6400/include/mach/map.h  |    1 +
 arch/arm/plat-s3c/Kconfig                 |    9 +++++
 arch/arm/plat-s3c/Makefile                |    4 ++
 arch/arm/{plat-s3c24xx => plat-s3c}/adc.c |   21 +++++++++--
 arch/arm/plat-s3c/include/plat/adc.h      |    6 +++-
 arch/arm/plat-s3c/include/plat/regs-adc.h |    2 +
 arch/arm/plat-s3c24xx/Kconfig             |    7 ----
 arch/arm/plat-s3c24xx/Makefile            |    1 -
 arch/arm/plat-s3c24xx/devs.c              |   14 ++++++--
 arch/arm/plat-s3c64xx/Makefile            |    4 ++
 arch/arm/plat-s3c64xx/dev-adc.c           |   51 +++++++++++++++++++++++++++++
 11 files changed, 103 insertions(+), 17 deletions(-)
 rename arch/arm/{plat-s3c24xx => plat-s3c}/adc.c (96%)
 create mode 100644 arch/arm/plat-s3c64xx/dev-adc.c
(quoted diff) +0 -0

b/arch/arm/mach-s3c6400/include/mach/map.h
index fc8b223..b66bfaf 100644

arch/arm/mach-s3c6400/include/mach/map.h +1 -0
@@ -42,6 +42,7 @@
 #define S3C64XX_PA_FB		(0x77100000)
 #define S3C64XX_PA_USB_HSOTG	(0x7C000000)
 #define S3C64XX_PA_WATCHDOG	(0x7E004000)
+#define S3C64XX_PA_ADC		(0x7E00B000)
 #define S3C64XX_PA_SYSCON	(0x7E00F000)
 #define S3C64XX_PA_AC97		(0x7F001000)
 #define S3C64XX_PA_IIS0		(0x7F002000)
arch/arm/plat-s3c/Kconfig +9 -0
index 8931c5f..82ed66d 100644
@@ -166,6 +166,15 @@ config S3C_DMA
 	help
 	  Internal configuration for S3C DMA core
 
+# ADC
+
+config S3C_ADC
+	bool "ADC common driver support"
+	help
+	  Core support for the ADC block found in the S3C SoC systems
+	  for drivers such as the touchscreen and hwmon to use to share
+	  this resource.
+
 # device definitions to compile in
 
 config S3C_DEV_HSMMC
arch/arm/plat-s3c/Makefile +4 -0
index 3c09109..788056a 100644
@@ -22,6 +22,10 @@ obj-y				+= gpio-config.o
 
 obj-$(CONFIG_S3C_DMA)		+= dma.o
 
+# ADC support
+
+obj-$(CONFIG_S3C_ADC)		+= adc.o
+
 # PM support
 
 obj-$(CONFIG_PM)		+= pm.o
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +17 -4
similarity index 96%
rename from arch/arm/plat-s3c24xx/adc.c
rename to arch/arm/plat-s3c/adc.c
index df47322..76cb740 100644
@@ -1,10 +1,10 @@
-/* arch/arm/plat-s3c24xx/adc.c
+/* arch/arm/plat-s3c/adc.c
  *
  * Copyright (c) 2008 Simtec Electronics
  *	http://armlinux.simtec.co.uk/
  *	Ben Dooks <[email protected]>, <[email protected]>
  *
- * S3C24XX ADC device core
+ * S3C ADC device core
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -64,6 +64,7 @@ struct adc_device {
 	unsigned int		 prescale;
 
 	int			 irq;
+	struct s3c_adc_platdata* pd;
 };
 
 static struct adc_device *adc_dev;
@@ -262,7 +263,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
 
 	if (!client) {
 		dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__);
-		return IRQ_HANDLED;
+		goto exit;
 	}
 
 	data0 = readl(adc->regs + S3C2410_ADCDAT0);
@@ -289,16 +290,27 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
 		local_irq_restore(flags);
 	}
 
+exit:
+	if(adc->pd->adc_type == 1)
+		writel(0, adc->regs + S3C6410_ADCCLRI);
+
 	return IRQ_HANDLED;
 }
 
 static int s3c_adc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct s3c_adc_platdata *pd;
 	struct adc_device *adc;
 	struct resource *regs;
 	int ret;
 
+	pd = pdev->dev.platform_data;
+	if (!pd) {
+		dev_err(dev, "no platform data specified\n");
+		return -EINVAL;
+	}
+
 	adc = kzalloc(sizeof(struct adc_device), GFP_KERNEL);
 	if (adc == NULL) {
 		dev_err(dev, "failed to allocate adc_device\n");
@@ -306,6 +318,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
 	}
 
 	adc->pdev = pdev;
+	adc->pd = pd;
 	adc->prescale = S3C2410_ADCCON_PRSCVL(49);
 
 	adc->irq = platform_get_irq(pdev, 1);
@@ -412,7 +425,7 @@ static int s3c_adc_resume(struct platform_device *pdev)
 
 static struct platform_driver s3c_adc_driver = {
 	.driver		= {
-		.name	= "s3c24xx-adc",
+		.name	= "s3c-adc",
 		.owner	= THIS_MODULE,
 	},
 	.probe		= s3c_adc_probe,
(quoted diff) +0 -0

b/arch/arm/plat-s3c/include/plat/adc.h
index 5f3b1cd..a8c9f27 100644

arch/arm/plat-s3c/include/plat/adc.h +5 -1
@@ -4,7 +4,7 @@
  *	http://armlinux.simnte.co.uk/
  *	Ben Dooks <[email protected]>
  *
- * S3C24XX ADC driver information
+ * S3C ADC driver information
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -14,6 +14,10 @@
 #ifndef __ASM_PLAT_ADC_H
 #define __ASM_PLAT_ADC_H __FILE__
 
+struct s3c_adc_platdata {
+	int adc_type;
+};
+
 struct s3c_adc_client;
 
 extern int s3c_adc_start(struct s3c_adc_client *client,
(quoted diff) +0 -0

b/arch/arm/plat-s3c/include/plat/regs-adc.h
index 4323ccc..933ba79 100644

arch/arm/plat-s3c/include/plat/regs-adc.h +2 -0
@@ -19,6 +19,8 @@
 #define S3C2410_ADCDLY	   S3C2410_ADCREG(0x08)
 #define S3C2410_ADCDAT0	   S3C2410_ADCREG(0x0C)
 #define S3C2410_ADCDAT1	   S3C2410_ADCREG(0x10)
+#define S3C6410_ADCCLRI	   S3C2410_ADCREG(0x18)
+#define S3C6410_ADCCIDU	   S3C2410_ADCREG(0x20)
 
 
 /* ADCCON Register Bits */
arch/arm/plat-s3c24xx/Kconfig +0 -7
index 9c7aca4..c402ed9 100644
@@ -119,13 +119,6 @@ config S3C2410_DMA_DEBUG
 	  Enable debugging output for the DMA code. This option sends info
 	  to the kernel log, at priority KERN_DEBUG.
 
-config S3C24XX_ADC
-	bool "ADC common driver support"
-	help
-	  Core support for the ADC block found in the S3C24XX SoC systems
-	  for drivers such as the touchscreen and hwmon to use to share
-	  this resource.
-
 # SPI default pin configuration code
 
 config S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13
arch/arm/plat-s3c24xx/Makefile +0 -1
index 7780d2d..a2cb87b 100644
@@ -38,7 +38,6 @@ obj-$(CONFIG_PM)		+= irq-pm.o
 obj-$(CONFIG_PM)		+= sleep.o
 obj-$(CONFIG_S3C2410_CLOCK)	+= s3c2410-clock.o
 obj-$(CONFIG_S3C2410_DMA)	+= dma.o
-obj-$(CONFIG_S3C24XX_ADC)	+= adc.o
 obj-$(CONFIG_S3C2410_IOTIMING)	+= s3c2410-iotiming.o
 obj-$(CONFIG_S3C2412_IOTIMING)	+= s3c2412-iotiming.o
 obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += s3c2410-cpufreq-utils.o
arch/arm/plat-s3c24xx/devs.c +10 -4
index f52a92c..1b131e3 100644
@@ -33,6 +33,7 @@
 #include <plat/regs-serial.h>
 #include <plat/udc.h>
 
+#include <plat/adc.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/regs-spi.h>
@@ -321,11 +322,16 @@ static struct resource s3c_adc_resource[] = {
 
 };
 
+static struct s3c_adc_platdata s3c_adc_pdata = {
+	.adc_type	= 0,
+};
+
 struct platform_device s3c_device_adc = {
-	.name		  = "s3c24xx-adc",
-	.id		  = -1,
-	.num_resources	  = ARRAY_SIZE(s3c_adc_resource),
-	.resource	  = s3c_adc_resource,
+	.name		   = "s3c-adc",
+	.id		   = -1,
+	.num_resources	   = ARRAY_SIZE(s3c_adc_resource),
+	.resource	   = s3c_adc_resource,
+	.dev.platform_data = &s3c_adc_pdata,
 };
 
 /* HWMON */
arch/arm/plat-s3c64xx/Makefile +4 -0
index b85b435..8060017 100644
@@ -35,6 +35,10 @@ obj-$(CONFIG_PM)		+= irq-pm.o
 
 obj-$(CONFIG_S3C64XX_DMA)	+= dma.o
 
+# ADC support
+
+obj-$(CONFIG_S3C_ADC)		+= dev-adc.o
+
 # Device setup
 
 obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o
arch/arm/plat-s3c64xx/dev-adc.c new file +51 -0

51 lines not on this page · raw message

Signature · 1 line
1.6.5.3
#4 lore raw

PATCH v2 6/8 S3C: merge ADC drivers and add support for the S3C64xx

Quoted 2 lines · Maurus Cuelenaere

This moves the S3C24xx ADC driver to plat-s3c and adds support for the S3C64xx.

it would have been nicer to have the move then the addition in a seperate patch.

secondly, I'm probably going to hold off on these changes pending actually trying to get some time together to fix up plat-samsung where these files probably should end up being moved to.

Quoted 104 lines
---
 arch/arm/mach-s3c6400/include/mach/map.h  |    1 +
 arch/arm/plat-s3c/Kconfig                 |    9 +++++
 arch/arm/plat-s3c/Makefile                |    4 ++
 arch/arm/{plat-s3c24xx => plat-s3c}/adc.c |   21 +++++++++--
 arch/arm/plat-s3c/include/plat/adc.h      |    6 +++-
 arch/arm/plat-s3c/include/plat/regs-adc.h |    2 +
 arch/arm/plat-s3c24xx/Kconfig             |    7 ----
 arch/arm/plat-s3c24xx/Makefile            |    1 -
 arch/arm/plat-s3c24xx/devs.c              |   14 ++++++--
 arch/arm/plat-s3c64xx/Makefile            |    4 ++
 arch/arm/plat-s3c64xx/dev-adc.c           |   51 +++++++++++++++++++++++++++++
 11 files changed, 103 insertions(+), 17 deletions(-)
 rename arch/arm/{plat-s3c24xx => plat-s3c}/adc.c (96%)
 create mode 100644 arch/arm/plat-s3c64xx/dev-adc.c
arch/arm/mach-s3c6400/include/mach/map.h +1 -0
index fc8b223..b66bfaf 100644
@@ -42,6 +42,7 @@
 #define S3C64XX_PA_FB		(0x77100000)
 #define S3C64XX_PA_USB_HSOTG	(0x7C000000)
 #define S3C64XX_PA_WATCHDOG	(0x7E004000)
+#define S3C64XX_PA_ADC		(0x7E00B000)
 #define S3C64XX_PA_SYSCON	(0x7E00F000)
 #define S3C64XX_PA_AC97		(0x7F001000)
 #define S3C64XX_PA_IIS0		(0x7F002000)
arch/arm/plat-s3c/Kconfig +9 -0
index 8931c5f..82ed66d 100644
@@ -166,6 +166,15 @@ config S3C_DMA
 	help
 	  Internal configuration for S3C DMA core
 
+# ADC
+
+config S3C_ADC
+	bool "ADC common driver support"
+	help
+	  Core support for the ADC block found in the S3C SoC systems
+	  for drivers such as the touchscreen and hwmon to use to share
+	  this resource.
+
 # device definitions to compile in
 
 config S3C_DEV_HSMMC
arch/arm/plat-s3c/Makefile +4 -0
index 3c09109..788056a 100644
@@ -22,6 +22,10 @@ obj-y				+= gpio-config.o
 
 obj-$(CONFIG_S3C_DMA)		+= dma.o
 
+# ADC support
+
+obj-$(CONFIG_S3C_ADC)		+= adc.o
+
 # PM support
 
 obj-$(CONFIG_PM)		+= pm.o
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +4 -3
similarity index 96%
rename from arch/arm/plat-s3c24xx/adc.c
rename to arch/arm/plat-s3c/adc.c
index df47322..76cb740 100644
@@ -1,10 +1,10 @@
-/* arch/arm/plat-s3c24xx/adc.c
+/* arch/arm/plat-s3c/adc.c
  *
  * Copyright (c) 2008 Simtec Electronics
  *	http://armlinux.simtec.co.uk/
  *	Ben Dooks <[email protected]>, <[email protected]>
  *
- * S3C24XX ADC device core
+ * S3C ADC device core
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -64,6 +64,7 @@ struct adc_device {
 	unsigned int		 prescale;
 
 	int			 irq;
+	struct s3c_adc_platdata* pd;
 };
 
 static struct adc_device *adc_dev;
@@ -262,7 +263,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
 
 	if (!client) {
 		dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__);
-		return IRQ_HANDLED;
+		goto exit;
 	}
 
 	data0 = readl(adc->regs + S3C2410_ADCDAT0);

arch/arm/plat-s3c/adc.c static irqreturn_t s3c_adc_irq(int irq, void *pw) · line 296

Quoted 7 lines
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +4 -0
@@ -289,16 +290,27 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
 		local_irq_restore(flags);
 	}
 
+exit:
+	if(adc->pd->adc_type == 1)
+		writel(0, adc->regs + S3C6410_ADCCLRI);
+

formattign error, if (...

return IRQ_HANDLED;

Quoted 51 lines
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +9 -1
 }
 
 static int s3c_adc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct s3c_adc_platdata *pd;
 	struct adc_device *adc;
 	struct resource *regs;
 	int ret;
 
+	pd = pdev->dev.platform_data;
+	if (!pd) {
+		dev_err(dev, "no platform data specified\n");
+		return -EINVAL;
+	}
+
 	adc = kzalloc(sizeof(struct adc_device), GFP_KERNEL);
 	if (adc == NULL) {
 		dev_err(dev, "failed to allocate adc_device\n");
@@ -306,6 +318,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
 	}
 
 	adc->pdev = pdev;
+	adc->pd = pd;
 	adc->prescale = S3C2410_ADCCON_PRSCVL(49);
 
 	adc->irq = platform_get_irq(pdev, 1);
@@ -412,7 +425,7 @@ static int s3c_adc_resume(struct platform_device *pdev)
 
 static struct platform_driver s3c_adc_driver = {
 	.driver		= {
-		.name	= "s3c24xx-adc",
+		.name	= "s3c-adc",
 		.owner	= THIS_MODULE,
 	},
 	.probe		= s3c_adc_probe,
arch/arm/plat-s3c/include/plat/adc.h +1 -1
index 5f3b1cd..a8c9f27 100644
@@ -4,7 +4,7 @@
  *	http://armlinux.simnte.co.uk/
  *	Ben Dooks <[email protected]>
  *
- * S3C24XX ADC driver information
+ * S3C ADC driver information
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as

arch/arm/plat-s3c/include/plat/adc.h line 20

Quoted 7 lines
arch/arm/plat-s3c/include/plat/adc.h +4 -0
@@ -14,6 +14,10 @@
 #ifndef __ASM_PLAT_ADC_H
 #define __ASM_PLAT_ADC_H __FILE__
 
+struct s3c_adc_platdata {
+	int adc_type;
+};
+

change the device name for the newer devices and use that as the key.

Quoted 159 lines
arch/arm/plat-s3c/include/plat/adc.h +0 -0
 struct s3c_adc_client;
 
 extern int s3c_adc_start(struct s3c_adc_client *client,
arch/arm/plat-s3c/include/plat/regs-adc.h +2 -0
index 4323ccc..933ba79 100644
@@ -19,6 +19,8 @@
 #define S3C2410_ADCDLY	   S3C2410_ADCREG(0x08)
 #define S3C2410_ADCDAT0	   S3C2410_ADCREG(0x0C)
 #define S3C2410_ADCDAT1	   S3C2410_ADCREG(0x10)
+#define S3C6410_ADCCLRI	   S3C2410_ADCREG(0x18)
+#define S3C6410_ADCCIDU	   S3C2410_ADCREG(0x20)
 
 
 /* ADCCON Register Bits */
arch/arm/plat-s3c24xx/Kconfig +0 -7
index 9c7aca4..c402ed9 100644
@@ -119,13 +119,6 @@ config S3C2410_DMA_DEBUG
 	  Enable debugging output for the DMA code. This option sends info
 	  to the kernel log, at priority KERN_DEBUG.
 
-config S3C24XX_ADC
-	bool "ADC common driver support"
-	help
-	  Core support for the ADC block found in the S3C24XX SoC systems
-	  for drivers such as the touchscreen and hwmon to use to share
-	  this resource.
-
 # SPI default pin configuration code
 
 config S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13
arch/arm/plat-s3c24xx/Makefile +0 -1
index 7780d2d..a2cb87b 100644
@@ -38,7 +38,6 @@ obj-$(CONFIG_PM)		+= irq-pm.o
 obj-$(CONFIG_PM)		+= sleep.o
 obj-$(CONFIG_S3C2410_CLOCK)	+= s3c2410-clock.o
 obj-$(CONFIG_S3C2410_DMA)	+= dma.o
-obj-$(CONFIG_S3C24XX_ADC)	+= adc.o
 obj-$(CONFIG_S3C2410_IOTIMING)	+= s3c2410-iotiming.o
 obj-$(CONFIG_S3C2412_IOTIMING)	+= s3c2412-iotiming.o
 obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += s3c2410-cpufreq-utils.o
arch/arm/plat-s3c24xx/devs.c +10 -4
index f52a92c..1b131e3 100644
@@ -33,6 +33,7 @@
 #include <plat/regs-serial.h>
 #include <plat/udc.h>
 
+#include <plat/adc.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/regs-spi.h>
@@ -321,11 +322,16 @@ static struct resource s3c_adc_resource[] = {
 
 };
 
+static struct s3c_adc_platdata s3c_adc_pdata = {
+	.adc_type	= 0,
+};
+
 struct platform_device s3c_device_adc = {
-	.name		  = "s3c24xx-adc",
-	.id		  = -1,
-	.num_resources	  = ARRAY_SIZE(s3c_adc_resource),
-	.resource	  = s3c_adc_resource,
+	.name		   = "s3c-adc",
+	.id		   = -1,
+	.num_resources	   = ARRAY_SIZE(s3c_adc_resource),
+	.resource	   = s3c_adc_resource,
+	.dev.platform_data = &s3c_adc_pdata,
 };
 
 /* HWMON */
arch/arm/plat-s3c64xx/Makefile +4 -0
index b85b435..8060017 100644
@@ -35,6 +35,10 @@ obj-$(CONFIG_PM)		+= irq-pm.o
 
 obj-$(CONFIG_S3C64XX_DMA)	+= dma.o
 
+# ADC support
+
+obj-$(CONFIG_S3C_ADC)		+= dev-adc.o
+
 # Device setup
 
 obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o
arch/arm/plat-s3c64xx/dev-adc.c new file +51 -0
new file mode 100644
index 0000000..5861ab3
@@ -0,0 +1,51 @@
+/* linux/arch/arm/plat-s3c64xx/dev-adc.c
+ *
+ * Copyright 2009 Maurus Cuelenaere
+ *
+ * S3C64xx series device definition for ADC device
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/map.h>
+
+#include <plat/adc.h>
+#include <plat/devs.h>
+#include <plat/cpu.h>
+
+static struct resource s3c_adc_resource[] = {
+	[0] = {
+		.start = S3C64XX_PA_ADC,
+		.end   = S3C64XX_PA_ADC + SZ_256 - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start = IRQ_TC,
+		.end   = IRQ_TC,
+		.flags = IORESOURCE_IRQ,
+	},
+	[2] = {
+		.start = IRQ_ADC,
+		.end   = IRQ_ADC,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+static struct s3c_adc_platdata s3c_adc_pdata = {
+	.adc_type	= 1,
+};
+
+struct platform_device s3c_device_adc = {
+	.name			= "s3c-adc",
+	.id			= -1,
+	.num_resources		= ARRAY_SIZE(s3c_adc_resource),
+	.resource		= s3c_adc_resource,
+	.dev.platform_data	= &s3c_adc_pdata,
+};
Signature · 6 lines
1.6.5.3

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 5 lines
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#5 lore raw

PATCH v2 6/8 S3C: merge ADC drivers and add support for the S3C64xx

Op 23-11-09 01:09, Ben Dooks schreef:

Quoted 8 lines · Maurus Cuelenaere
Quoted 4 lines

This moves the S3C24xx ADC driver to plat-s3c and adds support for the S3C64xx.

it would have been nicer to have the move then the addition in a seperate patch.

Ok, patch can be splitted.

Quoted 4 lines

secondly, I'm probably going to hold off on these changes pending actually trying to get some time together to fix up plat-samsung where these files probably should end up being moved to.

Hmm, then I'll probably wait with posting a reworked version of this till plat-samsung gets in.

Quoted 108 lines
Quoted 108 lines
---
  arch/arm/mach-s3c6400/include/mach/map.h  |    1 +
  arch/arm/plat-s3c/Kconfig                 |    9 +++++
  arch/arm/plat-s3c/Makefile                |    4 ++
  arch/arm/{plat-s3c24xx =>  plat-s3c}/adc.c |   21 +++++++++--
  arch/arm/plat-s3c/include/plat/adc.h      |    6 +++-
  arch/arm/plat-s3c/include/plat/regs-adc.h |    2 +
  arch/arm/plat-s3c24xx/Kconfig             |    7 ----
  arch/arm/plat-s3c24xx/Makefile            |    1 -
  arch/arm/plat-s3c24xx/devs.c              |   14 ++++++--
  arch/arm/plat-s3c64xx/Makefile            |    4 ++
  arch/arm/plat-s3c64xx/dev-adc.c           |   51 +++++++++++++++++++++++++++++
  11 files changed, 103 insertions(+), 17 deletions(-)

rename arch/arm/{plat-s3c24xx => plat-s3c}/adc.c (96%) create mode 100644 arch/arm/plat-s3c64xx/dev-adc.c

arch/arm/mach-s3c6400/include/mach/map.h +1 -0
index fc8b223..b66bfaf 100644
@@ -42,6 +42,7 @@
  #define S3C64XX_PA_FB		(0x77100000)
  #define S3C64XX_PA_USB_HSOTG	(0x7C000000)
  #define S3C64XX_PA_WATCHDOG	(0x7E004000)
+#define S3C64XX_PA_ADC		(0x7E00B000)
  #define S3C64XX_PA_SYSCON	(0x7E00F000)
  #define S3C64XX_PA_AC97		(0x7F001000)
  #define S3C64XX_PA_IIS0		(0x7F002000)
arch/arm/plat-s3c/Kconfig +9 -0
index 8931c5f..82ed66d 100644
@@ -166,6 +166,15 @@ config S3C_DMA
  	help
  	  Internal configuration for S3C DMA core
 
+# ADC
+
+config S3C_ADC
+	bool "ADC common driver support"
+	help
+	  Core support for the ADC block found in the S3C SoC systems
+	  for drivers such as the touchscreen and hwmon to use to share
+	  this resource.
+
  # device definitions to compile in
 
  config S3C_DEV_HSMMC
arch/arm/plat-s3c/Makefile +4 -0
index 3c09109..788056a 100644
@@ -22,6 +22,10 @@ obj-y				+= gpio-config.o
 
  obj-$(CONFIG_S3C_DMA)		+= dma.o
 
+# ADC support
+
+obj-$(CONFIG_S3C_ADC)		+= adc.o
+
  # PM support
 
  obj-$(CONFIG_PM)		+= pm.o
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +4 -3
similarity index 96%
rename from arch/arm/plat-s3c24xx/adc.c
rename to arch/arm/plat-s3c/adc.c
index df47322..76cb740 100644
@@ -1,10 +1,10 @@
-/* arch/arm/plat-s3c24xx/adc.c
+/* arch/arm/plat-s3c/adc.c
   *
   * Copyright (c) 2008 Simtec Electronics
   *	http://armlinux.simtec.co.uk/
   *	Ben Dooks<[email protected]>,<[email protected]>
   *
- * S3C24XX ADC device core
+ * S3C ADC device core
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
@@ -64,6 +64,7 @@ struct adc_device {
  	unsigned int		 prescale;
 
  	int			 irq;
+	struct s3c_adc_platdata* pd;
  };
 
  static struct adc_device *adc_dev;
@@ -262,7 +263,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
 
  	if (!client) {
  		dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__);
-		return IRQ_HANDLED;
+		goto exit;
  	}
 
  	data0 = readl(adc->regs + S3C2410_ADCDAT0);
@@ -289,16 +290,27 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
  		local_irq_restore(flags);
  	}
 
Quoted 7 lines

arch/arm/plat-s3c/adc.c static irqreturn_t s3c_adc_irq(int irq, void *pw) · line 299

Quoted 5 lines
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +4 -0
+exit:
+	if(adc->pd->adc_type == 1)
+		writel(0, adc->regs + S3C6410_ADCCLRI);
+
 

formattign error, if (...

Will fix.

Quoted 56 lines
   	return IRQ_HANDLED;
Quoted 54 lines
arch/arm/plat-s3c/adc.c renamed from arch/arm/plat-s3c24xx/adc.c +9 -1
  }
 
  static int s3c_adc_probe(struct platform_device *pdev)
  {
  	struct device *dev =&pdev->dev;
+	struct s3c_adc_platdata *pd;
  	struct adc_device *adc;
  	struct resource *regs;
  	int ret;
 
+	pd = pdev->dev.platform_data;
+	if (!pd) {
+		dev_err(dev, "no platform data specified\n");
+		return -EINVAL;
+	}
+
  	adc = kzalloc(sizeof(struct adc_device), GFP_KERNEL);
  	if (adc == NULL) {
  		dev_err(dev, "failed to allocate adc_device\n");
@@ -306,6 +318,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
  	}
 
  	adc->pdev = pdev;
+	adc->pd = pd;
  	adc->prescale = S3C2410_ADCCON_PRSCVL(49);
 
  	adc->irq = platform_get_irq(pdev, 1);
@@ -412,7 +425,7 @@ static int s3c_adc_resume(struct platform_device *pdev)
 
  static struct platform_driver s3c_adc_driver = {
  	.driver		= {
-		.name	= "s3c24xx-adc",
+		.name	= "s3c-adc",
  		.owner	= THIS_MODULE,
  	},
  	.probe		= s3c_adc_probe,
arch/arm/plat-s3c/include/plat/adc.h +1 -1
index 5f3b1cd..a8c9f27 100644
@@ -4,7 +4,7 @@
   *	http://armlinux.simnte.co.uk/
   *	Ben Dooks<[email protected]>
   *
- * S3C24XX ADC driver information
+ * S3C ADC driver information
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
@@ -14,6 +14,10 @@
  #ifndef __ASM_PLAT_ADC_H
  #define __ASM_PLAT_ADC_H __FILE__
 
Quoted 6 lines

arch/arm/plat-s3c/include/plat/adc.h line 22

Quoted 5 lines
arch/arm/plat-s3c/include/plat/adc.h +4 -0
+struct s3c_adc_platdata {
+	int adc_type;
+};
+
 

change the device name for the newer devices and use that as the key.

I suppose using platform_device_id's like I did with my RTC patch will work too?

Regards,
Maurus Cuelenaere