summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorShantanu Jain <shjain@codeaurora.org>2013-11-01 11:48:21 +0530
committerAbinaya P <abinayap@codeaurora.org>2016-09-21 11:05:02 +0530
commit7dca98d496c0a5013975086ecc5ec1f74dd6ecb0 (patch)
tree7f7c349dc08950333bd24f7b30357e7d7833bf97 /drivers/input/touchscreen
parentccd9ea31e2df94b7302018de71aec9bc2bd92365 (diff)
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>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/gt9xx/gt9xx.c19
-rw-r--r--drivers/input/touchscreen/gt9xx/gt9xx.h3
2 files changed, 14 insertions, 8 deletions
diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.c b/drivers/input/touchscreen/gt9xx/gt9xx.c
index b285dcd272f0..7b48a9af8799 100644
--- a/drivers/input/touchscreen/gt9xx/gt9xx.c
+++ b/drivers/input/touchscreen/gt9xx/gt9xx.c
@@ -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;
diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.h b/drivers/input/touchscreen/gt9xx/gt9xx.h
index b1b62e2f810e..289a9d4b20dd 100644
--- a/drivers/input/touchscreen/gt9xx/gt9xx.h
+++ b/drivers/input/touchscreen/gt9xx/gt9xx.h
@@ -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;