From 2f70e77a9155b0dec5d50661704b7ad743ba91f4 Mon Sep 17 00:00:00 2001 From: wengjun1 Date: Tue, 21 Apr 2020 16:08:23 +0800 Subject: [PATCH] himax: Compatible with the way of gesture to report key - Since we noticed that some projects need to report not only one type of touch gesture and touch hal has been changed on bq branch, so if we still report instance the single tap should not be work properly. So add report function key to fit for the hal's change. Change-Id: I463c7ceb046836305b9c947eec6f79d321df7d92 Signed-off-by: wengjun1 Reviewed-on: https://gerrit.mot.com/1538913 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqiu Huang Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../himax_0flash_mmi/himax_common.c | 24 +++++++++++++++---- .../himax_0flash_mmi/himax_common.h | 1 + .../himax_0flash_mmi/himax_platform_QCT_SPI.c | 7 ++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/himax_0flash_mmi/himax_common.c b/drivers/input/touchscreen/himax_0flash_mmi/himax_common.c index 49debc94606a..8c6aba58d062 100644 --- a/drivers/input/touchscreen/himax_0flash_mmi/himax_common.c +++ b/drivers/input/touchscreen/himax_0flash_mmi/himax_common.c @@ -1551,11 +1551,19 @@ static void himax_wake_event_report(void) if (KEY_EVENT) { #ifdef HIMAX_V2_SENSOR_EN - input_report_abs(private_ts->sensor_pdata->input_sensor_dev, ABS_DISTANCE, ++report_cnt); + if (private_ts->report_gesture_key) { + input_report_key(private_ts->sensor_pdata->input_sensor_dev, KEY_F1, 1); + input_sync(private_ts->sensor_pdata->input_sensor_dev); + input_report_key(private_ts->sensor_pdata->input_sensor_dev, KEY_F1, 0); + input_sync(private_ts->sensor_pdata->input_sensor_dev); + ++report_cnt; + } else { + input_report_abs(private_ts->sensor_pdata->input_sensor_dev, ABS_DISTANCE, ++report_cnt); + input_sync(private_ts->sensor_pdata->input_sensor_dev); + } I("input report: %d", report_cnt); if (report_cnt >= REPORT_MAX_COUNT) report_cnt = 0; - input_sync(private_ts->sensor_pdata->input_sensor_dev); #else I(" %s SMART WAKEUP KEY event %d press\n", __func__, KEY_EVENT); input_report_key(private_ts->input_dev, KEY_EVENT, 1); @@ -3072,10 +3080,16 @@ static int himax_tap_detect_sensor_init(struct himax_ts_data *data) } data->sensor_pdata = sensor_pdata; - __set_bit(EV_ABS, sensor_input_dev->evbit); __set_bit(EV_SYN, sensor_input_dev->evbit); - input_set_abs_params(sensor_input_dev, ABS_DISTANCE, - 0, REPORT_MAX_COUNT, 0, 0); + + if (data->report_gesture_key) { + __set_bit(EV_KEY, sensor_input_dev->evbit); + __set_bit(KEY_F1, sensor_input_dev->keybit); + } else { + __set_bit(EV_ABS, sensor_input_dev->evbit); + input_set_abs_params(sensor_input_dev, ABS_DISTANCE, + 0, REPORT_MAX_COUNT, 0, 0); + } sensor_input_dev->name = "double-tap"; data->sensor_pdata->input_sensor_dev = sensor_input_dev; diff --git a/drivers/input/touchscreen/himax_0flash_mmi/himax_common.h b/drivers/input/touchscreen/himax_0flash_mmi/himax_common.h index 629d42a32251..67e1f3046c4c 100755 --- a/drivers/input/touchscreen/himax_0flash_mmi/himax_common.h +++ b/drivers/input/touchscreen/himax_0flash_mmi/himax_common.h @@ -430,6 +430,7 @@ struct himax_ts_data { int (*power)(int on); int pre_finger_data[10][2]; bool vdd_1v8_always_on; + uint32_t report_gesture_key; struct device *dev; struct workqueue_struct *himax_wq; diff --git a/drivers/input/touchscreen/himax_0flash_mmi/himax_platform_QCT_SPI.c b/drivers/input/touchscreen/himax_0flash_mmi/himax_platform_QCT_SPI.c index f4078eb00385..e4e58bf980b2 100755 --- a/drivers/input/touchscreen/himax_0flash_mmi/himax_platform_QCT_SPI.c +++ b/drivers/input/touchscreen/himax_0flash_mmi/himax_platform_QCT_SPI.c @@ -201,6 +201,13 @@ int himax_parse_dt(struct himax_ts_data *ts, I(" DT:vdd_1v8_always_on=%d\n", ts->vdd_1v8_always_on); } + if (of_property_read_bool(dt, "himax,report_gesture_key")) { + I("novatek,report_gesture_key set"); + ts->report_gesture_key = 1; + } else { + ts->report_gesture_key = 0; + } + himax_vk_parser(dt, pdata); chosen = of_find_node_by_name(NULL, "chosen");