]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: S5PV210: Add keypad device helpers
authorJoonyoung Shim <jy0922.shim@samsung.com>
Mon, 21 Jun 2010 07:28:28 +0000 (16:28 +0900)
committerKukjin Kim <kgene.kim@samsung.com>
Thu, 5 Aug 2010 09:31:01 +0000 (18:31 +0900)
This patch adds the keypad device platform helpers for S5PV210 cpu.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/mach-s5pv210/Kconfig
arch/arm/mach-s5pv210/Makefile
arch/arm/mach-s5pv210/cpu.c
arch/arm/mach-s5pv210/include/mach/map.h
arch/arm/mach-s5pv210/setup-keypad.c [new file with mode: 0644]
arch/arm/plat-samsung/include/plat/keypad-core.h [new file with mode: 0644]

index e65825f47f0f8189f158638a824d383df1bfba71..1244d612872257f18a14e095cc0f7197d56d51bc 100644 (file)
@@ -37,6 +37,11 @@ config S5PV210_SETUP_FB_24BPP
        help
           Common setup code for S5PV210 with an 24bpp RGB display helper.
 
+config S5PV210_SETUP_KEYPAD
+       bool
+       help
+         Common setup code for keypad.
+
 config S5PV210_SETUP_SDHCI
         bool
         select S5PV210_SETUP_SDHCI_GPIO
index af557856b12ec258be4fbf936ca7a6768e7ff6e8..05048c5aa4c6e7e7e8eb94d435b9cb8c2243ddbd 100644 (file)
@@ -32,5 +32,6 @@ obj-$(CONFIG_S5PV210_SETUP_FB_24BPP)  += setup-fb-24bpp.o
 obj-$(CONFIG_S5PV210_SETUP_I2C1)       += setup-i2c1.o
 obj-$(CONFIG_S5PV210_SETUP_I2C2)       += setup-i2c2.o
 obj-$(CONFIG_S5PV210_SETUP_IDE)                += setup-ide.o
+obj-$(CONFIG_S5PV210_SETUP_KEYPAD)     += setup-keypad.o
 obj-$(CONFIG_S5PV210_SETUP_SDHCI)       += setup-sdhci.o
 obj-$(CONFIG_S5PV210_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
index 8c4fdcde7f3b89fecb2a2b7162efc85dfaf91c03..15e983a3f09f8c3175dfda7e485375232a93a415 100644 (file)
@@ -34,6 +34,7 @@
 #include <plat/s5pv210.h>
 #include <plat/ata-core.h>
 #include <plat/iic-core.h>
+#include <plat/keypad-core.h>
 #include <plat/sdhci.h>
 
 /* Initial IO mappings */
@@ -93,6 +94,9 @@ void __init s5pv210_map_io(void)
        s3c_i2c0_setname("s3c2440-i2c");
        s3c_i2c1_setname("s3c2440-i2c");
        s3c_i2c2_setname("s3c2440-i2c");
+
+       /* Use s5pv210-keypad instead of samsung-keypad */
+       samsung_keypad_setname("s5pv210-keypad");
 }
 
 void __init s5pv210_init_clocks(int xtal)
index 3846a0be2fa6245bfa197c29a69aa7c88f9292e6..d0af0c1a526ed9d38f7a161d3b424e617de33eb2 100644 (file)
@@ -32,6 +32,8 @@
 #define S5PV210_PA_SPI0                0xE1300000
 #define S5PV210_PA_SPI1                0xE1400000
 
+#define S5PV210_PA_KEYPAD      (0xE1600000)
+
 #define S5PV210_PA_IIC0                (0xE1800000)
 #define S5PV210_PA_IIC1                (0xFAB00000)
 #define S5PV210_PA_IIC2                (0xE1A00000)
 
 #define SAMSUNG_PA_ADC         S5PV210_PA_ADC
 #define SAMSUNG_PA_CFCON       S5PV210_PA_CFCON
+#define SAMSUNG_PA_KEYPAD      S5PV210_PA_KEYPAD
 
 #endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pv210/setup-keypad.c b/arch/arm/mach-s5pv210/setup-keypad.c
new file mode 100644 (file)
index 0000000..37b2790
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * linux/arch/arm/mach-s5pv210/setup-keypad.c
+ *
+ * Copyright (C) 2010 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <jy0922.shim@samsung.com>
+ *
+ *  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.
+ *
+ */
+
+#include <linux/gpio.h>
+#include <plat/gpio-cfg.h>
+
+void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
+{
+       unsigned int gpio, end;
+
+       /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
+       end = S5PV210_GPH3(rows);
+       for (gpio = S5PV210_GPH3(0); gpio < end; gpio++) {
+               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+       }
+
+       /* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */
+       end = S5PV210_GPH2(cols);
+       for (gpio = S5PV210_GPH2(0); gpio < end; gpio++) {
+               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+       }
+}
diff --git a/arch/arm/plat-samsung/include/plat/keypad-core.h b/arch/arm/plat-samsung/include/plat/keypad-core.h
new file mode 100644 (file)
index 0000000..d513e1b
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * linux/arch/arm/plat-samsung/include/plat/keypad-core.h
+ *
+ * Copyright (C) 2010 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <jy0922.shim@samsung.com>
+ *
+ * Samsung keypad controller core function
+ *
+ *  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.
+ *
+ */
+
+#ifndef __ASM_ARCH_KEYPAD_CORE_H
+#define __ASM_ARCH_KEYPAD_CORE_H
+
+/* These function are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void samsung_keypad_setname(char *name)
+{
+#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
+       samsung_device_keypad.name = name;
+#endif
+}
+
+#endif /* __ASM_ARCH_KEYPAD_CORE_H */