diff --git a/arch/arm/mach-sc/board-sp7715ga.c b/arch/arm/mach-sc/board-sp7715ga.c index d80e056..cc9db11 100755 --- a/arch/arm/mach-sc/board-sp7715ga.c +++ b/arch/arm/mach-sc/board-sp7715ga.c @@ -26,8 +26,10 @@ #include #include -//#include +#if(defined(CONFIG_TOUCHSCREEN)) +#include #include +#endif #if(defined(CONFIG_INPUT_LIS3DH_I2C)||defined(CONFIG_INPUT_LIS3DH_I2C_MODULE)) #include #endif @@ -67,6 +69,11 @@ #include #include +#if defined(CONFIG_KEYBOARD_GPIO) +#include +#include +#endif + extern void __init sci_reserve(void); extern void __init sci_map_io(void); extern void __init sci_init_irq(void); @@ -78,15 +85,35 @@ extern int __init sprd_ramconsole_init(void); #endif /*keypad define */ -#define CUSTOM_KEYPAD_ROWS (SCI_ROW0 | SCI_ROW1) -#define CUSTOM_KEYPAD_COLS (SCI_COL0 | SCI_COL1) -#define ROWS (2) -#define COLS (2) +#define CUSTOM_KEYPAD_ROWS (SCI_ROW0 | SCI_ROW1 | SCI_ROW2 ) +#define CUSTOM_KEYPAD_COLS (SCI_COL0 | SCI_COL1 | SCI_COL2 ) +#define ROWS (3) +#define COLS (3) + +#if defined(CONFIG_KEYBOARD_GPIO) +#define GPIO_1_KEY 101 +#define GPIO_2_KEY 108 +#define GPIO_4_KEY 107 +#define GPIO_6_KEY 109 +#define GPIO_NUMERIC_STAR_KEY 100 +#define GPIO_UP_KEY 99 +#define GPIO_9_KEY 102 +#define GPIO_7_KEY 103 +#define GPIO_8_KEY 106 +#define GPIO_LEFT_KEY 105 +#define GPIO_RIGHT_KEY 110 +#define GPIO_SELECT_KEY 104 +#endif static const unsigned int board_keymap[] = { - KEY(0, 0, KEY_VOLUMEDOWN), - KEY(1, 0, KEY_VOLUMEUP), - KEY(0, 1, KEY_CAMERA), + KEY(0, 0, KEY_5), + KEY(1, 0, KEY_BACK), + KEY(2, 0, KEY_DOWN), + KEY(0, 1, KEY_SEND), + KEY(1, 1, KEY_0), + KEY(0, 2, KEY_3), + KEY(1, 2, KEY_MENU), + KEY(2, 2, KEY_SLASH), }; static const struct matrix_keymap_data customize_keymap = { @@ -108,6 +135,9 @@ static struct sci_keypad_platform_data sci_keypad_data = { static struct platform_device rfkill_device; static struct platform_device brcm_bluesleep_device; static struct platform_device kb_backlight_device; +#if defined(CONFIG_KEYBOARD_GPIO) +static struct platform_device gpio_button_device; +#endif static struct platform_device *devices[] __initdata = { &sprd_serial_device0, @@ -200,6 +230,9 @@ static struct platform_device *devices[] __initdata = { #ifdef CONFIG_RF_SHARK &trout_fm_device, #endif +#if defined(CONFIG_KEYBOARD_GPIO) + &gpio_button_device, +#endif &sprd_headset_device, &sprd_saudio_voip_device, }; @@ -272,6 +305,121 @@ static struct platform_device rfkill_device = { }; #endif +#if defined(CONFIG_KEYBOARD_GPIO) +static struct gpio_keys_button gpio_buttons[] = { + { + .gpio = GPIO_1_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_1, + .desc = "Key 1", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_2_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_2, + .desc = "Key 2", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_4_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_4, + .desc = "Key 4", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_6_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_6, + .desc = "Key 6", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_7_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_7, + .desc = "Key 7", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_8_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_8, + .desc = "Key 8", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_9_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_9, + .desc = "Key 9", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_UP_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_UP, + .desc = "Up key", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_LEFT_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_LEFT, + .desc = "Left key", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_RIGHT_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_RIGHT, + .desc = "Right key", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_SELECT_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_ENTER, + .desc = "Select key", + .active_low = 1, + .debounce_interval = 2, + }, + { + .gpio = GPIO_NUMERIC_STAR_KEY, + .ds_irqflags = IRQF_TRIGGER_LOW, + .code = KEY_KPASTERISK, + .desc = "Star key", + .active_low = 1, + .debounce_interval = 2, + }, +}; + +static struct gpio_keys_platform_data gpio_button_data = { + .buttons = gpio_buttons, + .nbuttons = ARRAY_SIZE(gpio_buttons), +}; + +static struct platform_device gpio_button_device = { + .name = "gpio-keys", + .id = -1, + .num_resources = 0, + .dev = { + .platform_data = &gpio_button_data, + } +}; +#endif + /* keypad backlight */ static struct platform_device kb_backlight_device = { .name = "keyboard-backlight", @@ -324,7 +472,7 @@ static struct serial_data plat_data2 = { .clk = 26000000, }; -static struct ft5x0x_ts_platform_data ft5x0x_ts_info = { +/*static struct ft5x0x_ts_platform_data ft5x0x_ts_info = { .irq_gpio_number = GPIO_TOUCH_IRQ, .reset_gpio_number = GPIO_TOUCH_RESET, .vdd_name = "vdd28", @@ -341,7 +489,7 @@ static struct ft5x0x_ts_platform_data ft5x0x_ts_info = { .TP_MAX_X = 540, .TP_MAX_Y = 960, #endif -}; +};*/ #if(defined(CONFIG_INPUT_LTR558_I2C)||defined(CONFIG_INPUT_LTR558_I2C_MODULE)) static struct ltr558_pls_platform_data ltr558_pls_info = { @@ -411,10 +411,12 @@ static struct i2c_board_info i2c0_boardinfo[] = { }; static struct i2c_board_info i2c1_boardinfo[] = { +#if(defined(CONFIG_TOUCHSCREEN)) { I2C_BOARD_INFO(FOCALTECH_TS_NAME, FOCALTECH_TS_ADDR), .platform_data = &ft5x0x_ts_info, }, +#endif }; static struct i2c_board_info i2c2_boardinfo[] = { @@ -461,8 +611,8 @@ static struct i2c_board_info i2c2_boardinfo[] = { static int sc8810_add_i2c_devices(void) { i2c_register_board_info(0, i2c0_boardinfo, ARRAY_SIZE(i2c0_boardinfo)); - i2c_register_board_info(1, i2c1_boardinfo, ARRAY_SIZE(i2c1_boardinfo)); - i2c_register_board_info(2, i2c2_boardinfo, ARRAY_SIZE(i2c2_boardinfo)); + //i2c_register_board_info(1, i2c1_boardinfo, ARRAY_SIZE(i2c1_boardinfo)); + //i2c_register_board_info(2, i2c2_boardinfo, ARRAY_SIZE(i2c2_boardinfo)); return 0; }