diff -Nur linux-2.6.19-g500-009/arch/arm/mach-s3c2410/devs.c linux-2.6.19-g500-010/arch/arm/mach-s3c2410/devs.c
--- linux-2.6.19-g500-009/arch/arm/mach-s3c2410/devs.c	2006-12-17 15:11:50.000000000 +0100
+++ linux-2.6.19-g500-010/arch/arm/mach-s3c2410/devs.c	2006-12-17 15:14:45.000000000 +0100
@@ -30,6 +30,7 @@
 #include <asm/arch/regs-serial.h>
 #include <asm/arch/udc.h>
 #include <asm/arch/ts.h>
+#include <asm/arch/buttons.h>
 
 #include "devs.h"
 #include "cpu.h"
@@ -581,6 +582,27 @@
 }
 EXPORT_SYMBOL(set_s3c2410ts_info);
 
+/* 'Keyboard' */
+struct platform_device s3c_device_buttons = {
+	.name             = "s3c2410-buttons",
+	.id               = -1,
+};
+
+EXPORT_SYMBOL(s3c_device_buttons);
+
+void __init s3c24xx_butt_set_platdata(struct s3c2410_butt_mach_info *pd)
+{
+	struct s3c2410_butt_mach_info *npd;
+
+	npd = kmalloc(sizeof(*npd), GFP_KERNEL);
+	if (npd) {
+		memcpy(npd, pd, sizeof(*npd));
+		s3c_device_buttons.dev.platform_data = npd;
+	} else {
+		printk(KERN_ERR "no memory for buttons platform data\n");
+	}
+}
+
 #ifdef CONFIG_CPU_S3C2440
 
 /* Camif Controller */
diff -Nur linux-2.6.19-g500-009/arch/arm/mach-s3c2410/devs.h linux-2.6.19-g500-010/arch/arm/mach-s3c2410/devs.h
--- linux-2.6.19-g500-009/arch/arm/mach-s3c2410/devs.h	2006-12-17 15:11:50.000000000 +0100
+++ linux-2.6.19-g500-010/arch/arm/mach-s3c2410/devs.h	2006-12-17 15:15:00.000000000 +0100
@@ -42,6 +42,7 @@
 
 extern struct platform_device s3c_device_usbgadget;
 extern struct platform_device s3c_device_ts;
+extern struct platform_device s3c_device_buttons;
 
 /* s3c2440 specific devices */
 
diff -Nur linux-2.6.19-g500-009/arch/arm/mach-s3c2410/mach-g500.c linux-2.6.19-g500-010/arch/arm/mach-s3c2410/mach-g500.c
--- linux-2.6.19-g500-009/arch/arm/mach-s3c2410/mach-g500.c	2006-12-17 15:21:00.000000000 +0100
+++ linux-2.6.19-g500-010/arch/arm/mach-s3c2410/mach-g500.c	2006-12-17 15:25:43.000000000 +0100
@@ -201,6 +201,19 @@
 		.oversampling_shift = 2,
 };
 
+static struct s3c2410_button g500_buttons[] = {
+	{  IRQ_EINT1,   S3C2410_GPF1,   S3C2410_GPF1_EINT1,     KEY_POWER,	     "Power", 0 },
+	{  IRQ_EINT10,  S3C2410_GPG2,   S3C2410_GPG2_EINT10,    KEY_CAMERA, 	   "Camera", 0 },
+	{  IRQ_EINT11,  S3C2410_GPG3,   S3C2410_GPG3_EINT11,    KEY_LEFT, 	     "Left", 0 },
+	{  IRQ_EINT13,  S3C2410_GPG5,   S3C2410_GPG5_EINT13,    KEY_RIGHT, 	     "Right", 0 },
+	{  IRQ_EINT14,  S3C2410_GPG6,   S3C2410_GPG6_EINT14,    KEY_REPLY, 	     "Pick-Up", 0 },
+};
+
+static struct s3c2410_butt_mach_info g500_bt_cfg __initdata = {
+	.buttons  = g500_buttons,
+	.size = ARRAY_SIZE(g500_buttons),
+};
+
 static struct platform_device *g500_devices[] __initdata = {
 	&s3c_device_usb,
 	&s3c_device_lcd,
@@ -211,6 +224,7 @@
 	&s3c_device_usbgadget,
 	&s3c_device_sdi,
 	&s3c_device_ts,
+	&s3c_device_buttons,
 };
 
 static struct s3c24xx_board g500_board __initdata = {
@@ -232,6 +246,7 @@
 	s3c24xx_fb_set_platdata(&g500_lcd_cfg);
   s3c_device_sdi.dev.platform_data = &g500_mmc_cfg;
 	set_s3c2410ts_info(&g500_ts_cfg);
+	s3c24xx_butt_set_platdata(&g500_bt_cfg);
 
 	s3c2410_pm_init();
 
diff -Nur linux-2.6.19-g500-009/drivers/input/keyboard/Kconfig linux-2.6.19-g500-010/drivers/input/keyboard/Kconfig
--- linux-2.6.19-g500-009/drivers/input/keyboard/Kconfig	2006-11-29 22:57:37.000000000 +0100
+++ linux-2.6.19-g500-010/drivers/input/keyboard/Kconfig	2006-12-17 15:23:27.000000000 +0100
@@ -203,4 +203,14 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
+config S3C2410_BUTTONS
+	tristate "s3c2410 buttons"
+	depends on ARCH_S3C2410
+	default y	
+	help
+
+	  To compile this driver as a module, choose M here: the 
+	  module will be called s3c2410_buttons.ko.
+
+
 endif
diff -Nur linux-2.6.19-g500-009/drivers/input/keyboard/Makefile linux-2.6.19-g500-010/drivers/input/keyboard/Makefile
--- linux-2.6.19-g500-009/drivers/input/keyboard/Makefile	2006-11-29 22:57:37.000000000 +0100
+++ linux-2.6.19-g500-010/drivers/input/keyboard/Makefile	2006-12-17 15:23:27.000000000 +0100
@@ -17,4 +17,5 @@
 obj-$(CONFIG_KEYBOARD_HIL)		+= hil_kbd.o
 obj-$(CONFIG_KEYBOARD_HIL_OLD)		+= hilkbd.o
 obj-$(CONFIG_KEYBOARD_OMAP)             += omap-keypad.o
+obj-$(CONFIG_S3C2410_BUTTONS)		+= s3c2410_buttons.o
 
diff -Nur linux-2.6.19-g500-009/drivers/input/keyboard/s3c2410_buttons.c linux-2.6.19-g500-010/drivers/input/keyboard/s3c2410_buttons.c
--- linux-2.6.19-g500-009/drivers/input/keyboard/s3c2410_buttons.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.19-g500-010/drivers/input/keyboard/s3c2410_buttons.c	2006-12-17 15:23:27.000000000 +0100
@@ -0,0 +1,215 @@
+/*
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
+ * Samsung S3C2410 keyboard support
+ *
+ * Based on various pxa ipaq drivers.
+ * 
+ * ChangeLog
+ *
+ * 2005-07-24: Arnaud Patard <arnaud.patard@rtp-net.org>
+ * 	- Added key repeat
+ *
+ * 2005-07-23: Arnaud Patard <arnaud.patard@rtp-net.org>
+ * 	- Renamed all kbd occurences to something like buttons
+ * 	- Added debounce (specially usefull for iPAQ power button)
+ *
+ * 2005-06-21: Arnaud Patard <arnaud.patard@rtp-net.org>
+ *      - Initial version
+ *
+ */
+
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/irq.h>
+#include <asm/io.h>
+
+#include <asm/arch/regs-gpio.h>
+#include <asm/arch/buttons.h>
+
+/* For id.version */
+#define S3C2410BUTVERSION	0x0001
+#define DRV_NAME		"s3c2410-buttons"
+
+#define REPEAT_DELAY		HZ/10
+
+#ifdef DEBUG
+#define dprintk(msg...) printk(KERN_DEBUG "s3c2410_buttons: " msg);
+#else
+#define dprintk(msg...)
+#endif
+
+MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
+MODULE_DESCRIPTION("s3c2410 buttons driver");
+MODULE_LICENSE("GPL");
+
+struct s3c2410_buttons_private {
+	struct input_dev	*dev;
+	spinlock_t		lock;
+	int 			count;
+	int			shift;	
+};
+
+static struct s3c2410_buttons_private priv;
+
+static irqreturn_t s3c2410but_keyevent(int irq, void *dev_id, struct pt_regs *regs)
+{
+	struct s3c2410_button *button = (struct s3c2410_button *)dev_id;
+	int down;
+
+	if (!button)
+		return IRQ_HANDLED;
+
+	down = !(s3c2410_gpio_getpin(button->pin));
+
+	/* the power button of the ipaq are tricky. They send 'released' events even
+	 * when the button are already released. The work-around is to proceed only 
+	 * if the state changed.
+	 **/
+	if (button->last_state == down)
+		return IRQ_HANDLED;
+
+	button->last_state = down;
+	
+	dprintk("%s button %s\n",button->name, down ? "pressed" : "released");
+
+	input_report_key(priv.dev, button->keycode, down);
+	input_sync(priv.dev);
+
+	if (down)
+		mod_timer(&button->timer, jiffies + REPEAT_DELAY);
+
+	return IRQ_HANDLED;
+}
+
+static void s3c2410but_timer_callback(unsigned long data)
+{
+		struct s3c2410_button *button = (struct s3c2410_button *) data;
+		int down;
+
+		down = !(s3c2410_gpio_getpin(button->pin));
+		
+		if (down) {
+			dprintk("Timer: %s button %s\n",button->name, down ? "pressed" : "released");
+			input_report_key(priv.dev, button->keycode, down);
+			input_sync(priv.dev);
+			mod_timer(&button->timer, jiffies + REPEAT_DELAY);
+		}
+}
+
+static int __init s3c2410but_probe(struct platform_device *pdev)
+{
+	int i;
+	struct input_dev *input_dev;
+	struct s3c2410_button *s3c2410_buttons;
+	struct s3c2410_butt_mach_info *butt_info;
+
+
+	butt_info = pdev->dev.platform_data;
+	s3c2410_buttons = butt_info->buttons;
+
+	/* Initialise input stuff */
+	memset(&priv, 0, sizeof(struct s3c2410_buttons_private));
+
+	input_dev = input_allocate_device();
+	if (!input_dev) {
+		printk(KERN_ERR "Unable to allocate the input device !!\n");
+		return -ENOMEM;
+	}
+
+	priv.dev = input_dev;
+	priv.dev->evbit[0] = BIT(EV_KEY);
+
+	priv.dev->private = &priv;
+	priv.dev->name = DRV_NAME;
+	priv.dev->id.bustype = BUS_HOST;
+	priv.dev->id.vendor = 0xDEAD;
+	priv.dev->id.product = 0xBEEF;
+	priv.dev->id.version = S3C2410BUTVERSION;
+
+
+	for (i = 0; i < butt_info->size; i++) {
+		set_bit(s3c2410_buttons[i].keycode, priv.dev->keybit);
+		s3c2410_gpio_cfgpin(s3c2410_buttons[i].pin,s3c2410_buttons[i].pin_setting);
+		request_irq (s3c2410_buttons[i].irq, s3c2410but_keyevent,\
+				SA_SAMPLE_RANDOM, s3c2410_buttons[i].name, &s3c2410_buttons[i]);
+		set_irq_type(s3c2410_buttons[i].irq, IRQT_BOTHEDGE);
+		
+		init_timer(&s3c2410_buttons[i].timer);
+		s3c2410_buttons[i].timer.function = s3c2410but_timer_callback;
+		s3c2410_buttons[i].timer.data     = (unsigned long)&s3c2410_buttons[i];
+	}
+	
+	printk(KERN_INFO "%s successfully loaded\n", DRV_NAME);
+
+	/* All went ok, so register to the input system */
+	input_register_device(priv.dev);
+
+	return 0;
+}
+
+static int s3c2410but_remove(struct platform_device *pdev)
+{
+	int i;
+	struct s3c2410_button *s3c2410_buttons;
+	struct s3c2410_butt_mach_info *butt_info;
+
+	butt_info = pdev->dev.platform_data;
+	s3c2410_buttons = butt_info->buttons;
+
+	for (i = 0; i < butt_info->size; i++) {
+		disable_irq(s3c2410_buttons[i].irq);
+		free_irq(s3c2410_buttons[i].irq,priv.dev);
+	}
+
+	input_unregister_device(priv.dev);
+
+	return 0;
+}
+
+
+static struct platform_driver s3c2410but_driver = {
+	.driver		= {
+		.name	= DRV_NAME,
+	},
+	.probe		= s3c2410but_probe,
+	.remove		= s3c2410but_remove,
+};
+
+
+static int __init s3c2410but_init(void)
+{
+	return platform_driver_register(&s3c2410but_driver);
+}
+
+static void __exit s3c2410but_exit(void)
+{
+	platform_driver_unregister(&s3c2410but_driver);
+}
+
+module_init(s3c2410but_init);
+module_exit(s3c2410but_exit);
+
+
+
+
diff -Nur linux-2.6.19/include/asm-arm/arch-s3c2410/buttons.h linux-2.6.19-g500/include/asm-arm/arch-s3c2410/buttons.h
--- linux-2.6.19/include/asm-arm/arch-s3c2410/buttons.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.19-g500/include/asm-arm/arch-s3c2410/buttons.h	2006-12-09 14:24:17.000000000 +0100
@@ -0,0 +1,35 @@
+/* linux/include/asm/arch-s3c2410/buttons.h
+ *
+ * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
+ *
+ * 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.
+ *
+ *
+ *  Changelog:
+ *	21-Nov-2005	RTP	Created file
+ */
+
+#ifndef __ASM_ARM_BUTTONS_H
+#define __ASM_ARM_BUTTONS_H
+
+#include <linux/input.h>
+
+struct s3c2410_button {
+	int irq;
+	int pin;
+	int pin_setting;
+	int keycode;
+	char *name;
+	int last_state;
+	struct timer_list timer;
+};
+
+struct s3c2410_butt_mach_info {
+	struct s3c2410_button *buttons;
+	int size;
+};
+
+extern void __init s3c24xx_butt_set_platdata(struct s3c2410_butt_mach_info *);
+#endif

