Index: update/drivers/hwmon/s3c24xx-adc.c
===================================================================
--- update.orig/drivers/hwmon/s3c24xx-adc.c	2006-03-21 21:21:24.000000000 +0100
+++ update/drivers/hwmon/s3c24xx-adc.c	2006-03-21 21:56:54.000000000 +0100
@@ -32,16 +32,19 @@
 #include <linux/err.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/clk.h>
 
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 
-#include <asm/hardware/clock.h>
 #include <asm/io.h>
 
 #include <asm/arch/regs-adc.h>
 #include <asm/arch/regs-irq.h>
+#include <asm/arch/irqs.h>
+#include <asm/arch/adcts_bus.h>
 #include <asm/arch/adc.h>
+
 /* Private data */
 
 struct s3c24xx_adc {
@@ -50,7 +53,6 @@
 
 	int			val;
 	int			irq;
-	void __iomem		*regs;
 	struct clk		*clk;
 	struct device		*dev;
 	struct class_device	*hwmon_dev;
@@ -78,7 +80,7 @@
 
 	clk_enable(adc->clk);
 
-	con = readl(adc->regs + S3C2410_ADCCON);
+	con = adcts_readl(S3C2410_ADCCON);
 
 	con &= ~S3C2410_ADCCON_MUXMASK;
 	con |=  S3C2410_ADCCON_SELMUX(channel);
@@ -87,15 +89,15 @@
 	dev_dbg(adc->dev, "CON setting now %08lx\n", con);
 
 	/* bring the adc out of standby first */
-	writel(con, adc->regs + S3C2410_ADCCON);
+	adcts_writel(con, S3C2410_ADCCON);
 
 	/* enable the pre-scaler */
 	con |= S3C2410_ADCCON_PRSCEN;
-	writel(con, adc->regs + S3C2410_ADCCON);
+	adcts_writel(con, S3C2410_ADCCON);
 
 	/* start the conversion */
 	con |=  S3C2410_ADCCON_ENABLE_START;
-	writel(con, adc->regs + S3C2410_ADCCON);
+	adcts_writel(con, S3C2410_ADCCON);
 	
 	timeout = wait_event_timeout(adc->wait, adc->val >= 0, HZ / 2);
 	ret = (timeout == 0) ? -ETIMEDOUT : adc->val;
@@ -153,27 +155,27 @@
 	struct s3c24xx_adc *adc = dev_id;
 	unsigned long con;
 
-	adc->val  = readl(adc->regs + S3C2410_ADCDAT0);
+	adc->val  = adcts_readl(S3C2410_ADCDAT0);
 	adc->val &= S3C2410_ADCDAT0_XPDATA_MASK;
 
 	dev_dbg(adc->dev, "read %08x from adc (con %08x)\n",
-		adc->val, readl(adc->regs + S3C2410_ADCCON));
+		adc->val, adcts_readl(S3C2410_ADCCON));
 
 	/* place the adc back into standby mode */
 
-	con  = readl(adc->regs + S3C2410_ADCCON);
+	con  = adcts_readl(S3C2410_ADCCON);
 	con |= S3C2410_ADCCON_STDBM;
 	con &= ~S3C2410_ADCCON_PRSCEN;
-	writel(con, adc->regs + S3C2410_ADCCON);
+	adcts_writel(con, S3C2410_ADCCON);
 
 	wake_up(&adc->wait);
 	return IRQ_HANDLED;
 }
 
 
-static int s3c24xx_adc_remove(struct device *dev)
+static int s3c24xx_adc_remove(struct adcts_device *dev)
 {
-	struct s3c24xx_adc *adc = dev_to_adc(dev);
+	struct s3c24xx_adc *adc = dev_to_adc(&dev->dev);
 
 	if (!IS_ERR(adc->hwmon_dev) && adc->hwmon_dev != NULL) {
 		hwmon_device_unregister(adc->hwmon_dev);
@@ -182,34 +184,12 @@
 
 	if (!IS_ERR(adc->clk) && adc->clk != NULL) {
 		clk_disable(adc->clk);
-		clk_unuse(adc->clk);
 		clk_put(adc->clk);
 		adc->clk = NULL;
 	}
-
-	if (adc->regs != NULL) {
-		iounmap(adc->regs);
-		adc->regs = NULL;
-	}
-
-	if (adc->ioarea != NULL) {
-		release_resource(adc->ioarea);
-		kfree(adc->ioarea);
-		adc->ioarea = NULL;
-	}
-
 	return 0;
 }
 
-static void s3c24xx_adc_setup(struct s3c24xx_adc *adc)
-{
-	/* configure the adc */
-
-	writel(S3C2410_ADCCON_PRSCVL((clk_get_rate(adc->clk) / 1000000)-1) |
-	       S3C2410_ADCCON_STDBM,
-	       adc->regs + S3C2410_ADCCON);
-}
-
 static ssize_t s3c24xx_adc_hwmon_in_show(struct device *dev,
 					 struct device_attribute *attr,
 					 char *buf)
@@ -260,17 +240,16 @@
 	return device_create_file(adc->dev, &attr->dev_attr);
 }
 
-static int s3c24xx_adc_probe(struct device *dev)
+static int s3c24xx_adc_probe(struct adcts_device *adcdev)
 {
+	struct device *dev = &adcdev->dev;
 	struct platform_device *pdev = to_platform_device(dev);
 	struct s3c24xx_adc_platdata *pdata = dev->platform_data;
 	struct s3c24xx_adc *adc;
-	struct resource *res;
-	size_t size;
 	int ret;
 	int i;
 
-	adc = kmalloc(sizeof(struct s3c24xx_adc), GFP_KERNEL);
+	adc = kzalloc(sizeof(struct s3c24xx_adc), GFP_KERNEL);
 	if (adc == NULL) {
 		dev_err(dev, "no memory\n");
 		return -ENOMEM;
@@ -289,44 +268,23 @@
 		goto out_err;
 	}
 
-	clk_use(adc->clk);
 	/* only enable the clock when we are actually using the adc */
 
 	init_waitqueue_head(&adc->wait);
 	init_MUTEX(&adc->lock);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (res == NULL) {
-		dev_err(dev, "no register resoruce\n");
-		ret = -ENOENT;
-		goto out_err;
-	}
-
-	size = (res->end - res->start) + 1;
-
-	adc->ioarea = request_mem_region(res->start, size, pdev->name);
-
-	if (adc->ioarea == NULL) {
-		dev_err(dev, "cannot request IO\n");
-		ret = -ENXIO;
-		goto out_err;
-	}
-
-	adc->regs = ioremap(res->start, size);
-	if (adc->regs == NULL) {
-		dev_err(dev, "cannot map IO\n");
-		ret = -ENXIO;
-		goto out_err;
-	}
-
+#if 0
+	/* FIXME */
 	adc->irq = platform_get_irq(pdev, 0);
 	if (adc->irq <= 0) {
 		dev_err(dev, "No IRQ specified\n");
 		ret = -ENXIO;
 		goto out_err;
 	}
+#endif
+	adc->irq = IRQ_TC;
 
-	ret = request_irq(adc->irq+1, s3c24xx_adc_irq, 0, pdev->name, adc);
+	ret = request_irq(adc->irq+1, s3c24xx_adc_irq, SA_SHIRQ, pdev->name, adc);
 
 	if (ret != 0) {
 		dev_err(dev, "cannot claim IRQ\n");
@@ -341,8 +299,6 @@
 		goto out_err;
 	}
 
-	s3c24xx_adc_setup(adc);
-
 	/* got registers */
 
 	for (i = 0; i < ARRAY_SIZE(s3c2410_adc_attrs); i++) {
@@ -360,34 +316,33 @@
  out_err:
 	/* detach */
 
-	s3c24xx_adc_remove(dev);
+	s3c24xx_adc_remove(adcdev);
 	return ret;
 }
 
 
 #ifdef CONFIG_PM
-static int s3c24xx_adc_suspend(struct device *dev, pm_message_t state)
+static int s3c24xx_adc_suspend(struct adcts_device *dev, pm_message_t state)
 {
-	struct s3c24xx_adc *adc = dev_get_drvdata(dev);
+	struct s3c24xx_adc *adc = dev_get_drvdata(&dev->dev);
 	unsigned long con;
 
-	con  = readl(adc->regs + S3C2410_ADCCON);
+	con  = adcts_readl(S3C2410_ADCCON);
 	con |= S3C2410_ADCCON_STDBM;
 	con &= ~S3C2410_ADCCON_PRSCEN;
-	writel(con, adc->regs + S3C2410_ADCCON);
+	adcts_writel(con,S3C2410_ADCCON);
 	
 	clk_disable(adc->clk);
 
 	return 0;
 }
 
-static int s3c24xx_adc_resume(struct device *dev)
+static int s3c24xx_adc_resume(struct adcts_device *dev)
 {
-	struct s3c24xx_adc *adc = dev_get_drvdata(dev);
+	struct s3c24xx_adc *adc = dev_get_drvdata(&dev->dev);
 	
 	if (adc != NULL) {
 		dev_dbg(dev, "resume: level %d\n", level);
-		s3c24xx_adc_setup(adc);
 	}
 
 	return 0;
@@ -398,24 +353,25 @@
 #define s3c24xx_i2c_resume NULL
 #endif
 
-static struct device_driver s3c2410_adc_driver = {
-	.name		= "s3c2410-adc",
-	.owner		= THIS_MODULE,
-	.bus		= &platform_bus_type,
-	.probe		= s3c24xx_adc_probe,
-	.remove		= s3c24xx_adc_remove,
+static struct adcts_driver s3c2410_adc_driver = {
+       .driver         = {
+	       .name   = "s3c2410-adc",
+	       .owner  = THIS_MODULE,
+       },
+	.bind		= s3c24xx_adc_probe,
+	.unbind		= s3c24xx_adc_remove,
 	.resume		= s3c24xx_adc_resume,
 	.suspend	= s3c24xx_adc_suspend,
 };
 
 static int __init s3c24xx_adc_init(void)
 {
-	return driver_register(&s3c2410_adc_driver);
+	return adcts_bus_register_driver(&s3c2410_adc_driver);
 }
 
 static void __exit s3c24xx_adc_exit(void)
 {
-	driver_unregister(&s3c2410_adc_driver);
+	adcts_bus_unregister_driver(&s3c2410_adc_driver);
 }
 
 module_init(s3c24xx_adc_init);
Index: update/arch/arm/mach-s3c2410/devs.c
===================================================================
--- update.orig/arch/arm/mach-s3c2410/devs.c	2006-03-21 20:54:47.000000000 +0100
+++ update/arch/arm/mach-s3c2410/devs.c	2006-03-21 21:42:34.000000000 +0100
@@ -39,6 +39,7 @@
 #include <asm/arch/udc.h>
 #include <asm/arch/ts.h>
 #include <asm/arch/adcts_bus.h>
+#include <asm/arch/adc.h>
 #include <asm/arch/lcd.h>
 #include <asm/arch/buttons.h>
 
@@ -354,6 +355,9 @@
 
 /* ADC */
 
+#if 0 
+/* FIXME : Resource mamagement should be done in the adcts_bus part
+ **/
 static struct resource s3c_adc_resource[] = {
 	[0] = {
 		.start = S3C24XX_PA_ADC,
@@ -372,14 +376,22 @@
 	}
 
 };
-
-struct platform_device s3c_device_adc = {
+#endif
+struct adcts_device s3c_device_adc = {
 	.name		  = "s3c2410-adc",
-	.id		  = -1,
-	.num_resources	  = ARRAY_SIZE(s3c_adc_resource),
-	.resource	  = s3c_adc_resource,
 };
 
+EXPORT_SYMBOL(s3c_device_adc);
+
+static struct s3c24xx_adc_platdata s3c24xx_adc_platdata;
+
+void __init set_s3c24xx_adc_set_platdata(struct s3c24xx_adc_platdata *hard_s3c2410_adc_platdata)
+{
+	memcpy(&s3c24xx_adc_platdata,hard_s3c2410_adc_platdata,sizeof(struct s3c24xx_adc_platdata));
+	s3c_device_adc.dev.platform_data = &s3c24xx_adc_platdata;
+}
+EXPORT_SYMBOL(set_s3c24xx_adc_set_platdata);
+
 /* SDI */
 
 static struct resource s3c_sdi_resource[] = {
Index: update/arch/arm/mach-s3c2410/devs.h
===================================================================
--- update.orig/arch/arm/mach-s3c2410/devs.h	2006-03-21 20:54:47.000000000 +0100
+++ update/arch/arm/mach-s3c2410/devs.h	2006-03-21 21:38:32.000000000 +0100
@@ -26,7 +26,6 @@
 extern struct platform_device s3c_device_i2c;
 extern struct platform_device s3c_device_iis;
 extern struct platform_device s3c_device_rtc;
-extern struct platform_device s3c_device_adc;
 extern struct platform_device s3c_device_sdi;
 
 extern struct platform_device s3c_device_spi0;
@@ -42,6 +41,7 @@
 extern struct platform_device s3c_device_usbgadget;
 extern struct platform_device s3c_device_adcts_bus;
 extern struct adcts_device s3c_device_ts;
+extern struct adcts_device s3c_device_adc;
 extern struct platform_device s3c_device_buttons;
 
 /* s3c2440 specific devices */
Index: update/arch/arm/mach-s3c2410/mach-h1940.c
===================================================================
--- update.orig/arch/arm/mach-s3c2410/mach-h1940.c	2006-03-21 20:54:47.000000000 +0100
+++ update/arch/arm/mach-s3c2410/mach-h1940.c	2006-03-21 21:31:02.000000000 +0100
@@ -375,6 +375,7 @@
 
 static struct adcts_device *h1940_adevices[] __initdata = {
 	&s3c_device_ts,
+	&s3c_device_adc
 };
 
 static struct s3c24xx_board h1940_board __initdata = {
