ARM: EXYNOS4: Add MCS Touchkey device on Universal_C210
authorMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 22 Jun 2011 04:43:39 +0000 (13:43 +0900)
committerKukjin Kim <kgene.kim@samsung.com>
Wed, 20 Jul 2011 14:17:33 +0000 (23:17 +0900)
This patch adds definitions to enable support for MCS Touchkey driver
for Universal C210 board.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/mach-exynos4/Kconfig
arch/arm/mach-exynos4/mach-universal_c210.c

index 32a96f41e0e377a4e6f771869797d166fed9ef9f..08482439acc33dfbd5bbc3be2bf238cebe3ff581 100644 (file)
@@ -153,6 +153,7 @@ config MACH_ARMLEX4210
 config MACH_UNIVERSAL_C210
        bool "Mobile UNIVERSAL_C210 Board"
        select CPU_EXYNOS4210
+       select S5P_GPIO_INT
        select S5P_DEV_FIMC0
        select S5P_DEV_FIMC1
        select S5P_DEV_FIMC2
index 65f8d62e067f89789efe4a80690c4077ea848279..83c83cce2478d07b8471140b775216f51cb7a9c2 100644 (file)
@@ -18,6 +18,8 @@
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/max8952.h>
 #include <linux/mmc/host.h>
+#include <linux/i2c-gpio.h>
+#include <linux/i2c/mcs.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
@@ -477,6 +479,56 @@ static struct i2c_board_info i2c5_devs[] __initdata = {
        },
 };
 
+/* GPIO I2C 12 (3 Touchkey) */
+static uint32_t touchkey_keymap[] = {
+       /* MCS_KEY_MAP(value, keycode) */
+       MCS_KEY_MAP(0, KEY_MENU),               /* KEY_SEND */
+       MCS_KEY_MAP(1, KEY_BACK),               /* KEY_END */
+};
+
+static struct mcs_platform_data touchkey_data = {
+       .keymap         = touchkey_keymap,
+       .keymap_size    = ARRAY_SIZE(touchkey_keymap),
+       .key_maxval     = 2,
+};
+
+/* GPIO I2C 3_TOUCH 2.8V */
+#define I2C_GPIO_BUS_12                12
+static struct i2c_gpio_platform_data i2c_gpio12_data = {
+       .sda_pin        = EXYNOS4_GPE4(0),      /* XMDMDATA_8 */
+       .scl_pin        = EXYNOS4_GPE4(1),      /* XMDMDATA_9 */
+};
+
+static struct platform_device i2c_gpio12 = {
+       .name           = "i2c-gpio",
+       .id             = I2C_GPIO_BUS_12,
+       .dev            = {
+               .platform_data  = &i2c_gpio12_data,
+       },
+};
+
+static struct i2c_board_info i2c_gpio12_devs[] __initdata = {
+       {
+               I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
+               .platform_data = &touchkey_data,
+       },
+};
+
+static void __init universal_touchkey_init(void)
+{
+       int gpio;
+
+       gpio = EXYNOS4_GPE3(7);                 /* XMDMDATA_7 */
+       gpio_request(gpio, "3_TOUCH_INT");
+       s5p_register_gpio_interrupt(gpio);
+       s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
+       i2c_gpio12_devs[0].irq = gpio_to_irq(gpio);
+
+       gpio = EXYNOS4_GPE3(3);                 /* XMDMDATA_3 */
+       gpio_request(gpio, "3_TOUCH_EN");
+       gpio_direction_output(gpio, 1);
+}
+
 /* GPIO KEYS */
 static struct gpio_keys_button universal_gpio_keys_tables[] = {
        {
@@ -619,6 +671,7 @@ static struct platform_device *universal_devices[] __initdata = {
        &s3c_device_i2c5,
 
        /* Universal Devices */
+       &i2c_gpio12,
        &universal_gpio_keys,
        &s5p_device_onenand,
 };
@@ -640,6 +693,10 @@ static void __init universal_machine_init(void)
        s3c_i2c5_set_platdata(NULL);
        i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
 
+       universal_touchkey_init();
+       i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
+                       ARRAY_SIZE(i2c_gpio12_devs));
+
        /* Last */
        platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
 }