]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: S5PC100: Add keypad device to the SMDKC100 board
authorNaveen Krishna Ch <ch.naveen@samsung.com>
Mon, 21 Jun 2010 22:54:18 +0000 (07:54 +0900)
committerKukjin Kim <kgene.kim@samsung.com>
Thu, 5 Aug 2010 09:30:51 +0000 (18:30 +0900)
This patch is to support keypad device to the SMDKC100 board.

Signed-off-by: Naveen Krishna Ch <ch.naveen@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/mach-s5pc100/Kconfig
arch/arm/mach-s5pc100/Makefile
arch/arm/mach-s5pc100/include/mach/map.h
arch/arm/mach-s5pc100/mach-smdkc100.c
arch/arm/mach-s5pc100/setup-keypad.c [new file with mode: 0644]

index a7ba205f3c1cf8036a829eaa25a469dd4a0a04c7..cd7f4e95d230b04a3ad0af232dd9837fb66e71e5 100644 (file)
@@ -30,6 +30,11 @@ config S5PC100_SETUP_IDE
        help
          Common setup code for S5PC100 IDE GPIO configurations
 
+config S5PC100_SETUP_KEYPAD
+       bool
+       help
+         Common setup code for KEYPAD GPIO configurations.
+
 config S5PC100_SETUP_SDHCI
        bool
        select S5PC100_SETUP_SDHCI_GPIO
@@ -51,12 +56,14 @@ config MACH_SMDKC100
        select S3C_DEV_HSMMC
        select S3C_DEV_HSMMC1
        select S3C_DEV_HSMMC2
+       select SAMSUNG_DEV_KEYPAD
        select SAMSUNG_DEV_TS
        select S3C_DEV_WDT
        select HAVE_S3C2410_WATCHDOG
        select S5PC100_SETUP_FB_24BPP
        select S5PC100_SETUP_I2C1
        select S5PC100_SETUP_IDE
+       select S5PC100_SETUP_KEYPAD
        select S5PC100_SETUP_SDHCI
        help
          Machine support for the Samsung SMDKC100
index ab3ebe2f5d2a8c7906bf2bdb3382d11a72ad4cb8..a021ed1fb4b6c6975d77323a35afd9e6479cbece 100644 (file)
@@ -20,6 +20,7 @@ obj-$(CONFIG_CPU_S5PC100)     += dma.o
 obj-$(CONFIG_S5PC100_SETUP_FB_24BPP)   += setup-fb-24bpp.o
 obj-$(CONFIG_S5PC100_SETUP_I2C1)       += setup-i2c1.o
 obj-$(CONFIG_S5PC100_SETUP_IDE)                += setup-ide.o
+obj-$(CONFIG_S5PC100_SETUP_KEYPAD)     += setup-keypad.o
 obj-$(CONFIG_S5PC100_SETUP_SDHCI)      += setup-sdhci.o
 obj-$(CONFIG_S5PC100_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
 
index 66b626081430c2b4ce8fe767bff627ad310eb237..809ff90824cfe97e7741885c255e69ba80a4a019 100644 (file)
 #define S3C_PA_HSMMC2          S5PC100_PA_HSMMC(2)
 #define S3C_PA_KEYPAD          S5PC100_PA_KEYPAD
 #define S3C_PA_WDT             S5PC100_PA_WATCHDOG
+#define S3C_PA_TSADC           S5PC100_PA_TSADC
 #define S3C_PA_ONENAND         S5PC100_PA_ONENAND
 #define S3C_PA_ONENAND_BUF     S5PC100_PA_ONENAND_BUF
 #define S3C_SZ_ONENAND_BUF     S5PC100_SZ_ONENAND_BUF
 
 #define SAMSUNG_PA_ADC         S5PC100_PA_TSADC
 #define SAMSUNG_PA_CFCON       S5PC100_PA_CFCON
+#define SAMSUNG_PA_KEYPAD      S5PC100_PA_KEYPAD
 
 #endif /* __ASM_ARCH_C100_MAP_H */
index bf1b9271f34f0c1f8815623e71aaa9e636c6ddfe..a00dd090f1a1ac57464afc0d11f9d12bc67f532d 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/i2c.h>
 #include <linux/fb.h>
 #include <linux/delay.h>
+#include <linux/input.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -44,6 +45,7 @@
 #include <plat/iic.h>
 #include <plat/ata.h>
 #include <plat/adc.h>
+#include <plat/keypad.h>
 #include <plat/ts.h>
 
 /* Following are default values for UCON, ULCON and UFCON UART registers */
@@ -156,6 +158,25 @@ static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = {
        .setup_gpio     = s5pc100_ide_setup_gpio,
 };
 
+static uint32_t smdkc100_keymap[] __initdata = {
+       /* KEY(row, col, keycode) */
+       KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
+       KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
+       KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
+       KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
+};
+
+static struct matrix_keymap_data smdkc100_keymap_data __initdata = {
+       .keymap         = smdkc100_keymap,
+       .keymap_size    = ARRAY_SIZE(smdkc100_keymap),
+};
+
+static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
+       .keymap_data    = &smdkc100_keymap_data,
+       .rows           = 2,
+       .cols           = 8,
+};
+
 static struct platform_device *smdkc100_devices[] __initdata = {
        &s3c_device_adc,
        &s3c_device_cfcon,
@@ -169,6 +190,7 @@ static struct platform_device *smdkc100_devices[] __initdata = {
        &s3c_device_wdt,
        &smdkc100_lcd_powerdev,
        &s5pc100_device_iis0,
+       &samsung_device_keypad,
        &s5pc100_device_ac97,
 };
 
@@ -198,6 +220,8 @@ static void __init smdkc100_machine_init(void)
        s3c_fb_set_platdata(&smdkc100_lcd_pdata);
        s3c_ide_set_platdata(&smdkc100_ide_pdata);
 
+       samsung_keypad_set_platdata(&smdkc100_keypad_data);
+
        /* LCD init */
        gpio_request(S5PC100_GPD(0), "GPD");
        gpio_request(S5PC100_GPH0(6), "GPH0");
diff --git a/arch/arm/mach-s5pc100/setup-keypad.c b/arch/arm/mach-s5pc100/setup-keypad.c
new file mode 100644 (file)
index 0000000..d0837a7
--- /dev/null
@@ -0,0 +1,34 @@
+/* linux/arch/arm/mach-s5pc100/setup-keypad.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com/
+ *
+ * GPIO configuration for S5PC100 KeyPad 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/gpio.h>
+#include <plat/gpio-cfg.h>
+
+void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
+{
+       unsigned int gpio;
+       unsigned int end;
+
+       /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
+       end = S5PC100_GPH3(rows);
+       for (gpio = S5PC100_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 = S5PC100_GPH2(cols);
+       for (gpio = S5PC100_GPH2(0); gpio < end; gpio++) {
+               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+       }
+}