input: touchscreen: Add virtual key support from dtsi

Add virtual key support from device tree node and
corrected the sequence of virtual keys defined in
dtsi for Goodix driver.

Change-Id: Iee1db2eb07c00fd4338255b9648fac5e05aa9c6d
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
This commit is contained in:
Shantanu Jain 2013-11-01 11:48:21 +05:30 committed by Abinaya P
parent ccd9ea31e2
commit 7dca98d496
2 changed files with 14 additions and 8 deletions

View file

@ -485,18 +485,19 @@ static void goodix_ts_work_func(struct work_struct *work)
memcpy(&point_data[12], &buf[2], 8 * (touch_num - 1));
}
#if GTP_HAVE_TOUCH_KEY
key_value = point_data[3 + 8 * touch_num];
if (key_value || pre_key) {
for (i = 0; i < ARRAY_SIZE(touch_key_array); i++) {
for (i = 0; i < ts->pdata->num_button; i++) {
input_report_key(ts->input_dev,
touch_key_array[i], key_value & (0x01<<i));
ts->pdata->button_map[i],
key_value & (0x01<<i));
}
touch_num = 0;
pre_touch = 0;
}
#endif
pre_key = key_value;
#if GTP_WITH_PEN
@ -1210,12 +1211,11 @@ static int gtp_request_input_dev(struct goodix_ts_data *ts)
/* in case of "out of memory" */
input_mt_init_slots(ts->input_dev, 10, 0);
#if GTP_HAVE_TOUCH_KEY
for (index = 0; index < ARRAY_SIZE(touch_key_array); index++) {
for (index = 0; index < ts->pdata->num_button; index++) {
input_set_capability(ts->input_dev,
EV_KEY, touch_key_array[index]);
EV_KEY, ts->pdata->button_map[index]);
}
#endif
#if GTP_SLIDE_WAKEUP
input_set_capability(ts->input_dev, EV_KEY, KEY_POWER);
@ -1609,6 +1609,9 @@ static int goodix_parse_dt(struct device *dev,
dev_err(dev, "Unable to read key codes\n");
return rc;
}
pdata->num_button = num_buttons;
memcpy(pdata->button_map, button_map,
pdata->num_button * sizeof(u32));
}
read_cfg_num = 0;

View file

@ -42,6 +42,7 @@
#define GOODIX_SUSPEND_LEVEL 1
#endif
#define MAX_BUTTONS 4
#define GOODIX_MAX_CFG_GROUP 6
#define GTP_FW_NAME_MAXSIZE 50
@ -64,6 +65,8 @@ struct goodix_ts_platform_data {
bool i2c_pull_up;
size_t config_data_len[GOODIX_MAX_CFG_GROUP];
u8 *config_data[GOODIX_MAX_CFG_GROUP];
u32 button_map[MAX_BUTTONS];
u8 num_button;
};
struct goodix_ts_data {
spinlock_t irq_lock;