From 4254e14398fbd6166efc8b54bdd8677c902e63e6 Mon Sep 17 00:00:00 2001 From: wengjun1 Date: Mon, 30 Dec 2019 14:59:18 +0800 Subject: [PATCH] novatek: 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: I8cf83493db1d1ff20ee40bbd8414f0130d1bde1e Signed-off-by: wengjun1 Reviewed-on: https://gerrit.mot.com/1477814 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yeqing Wang Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../touchscreen/nova_0flash_mmi/nt36xxx.c | 34 +++++++++++++++---- .../touchscreen/nova_0flash_mmi/nt36xxx.h | 1 + 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c index 3d1550df8a14..4f0d81f1a60c 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c @@ -1019,14 +1019,22 @@ void nvt_ts_wakeup_gesture_report(uint8_t gesture_id, uint8_t *data) NVT_LOG("Gesture got but wakeable not set. Skip this gesture."); return; } - input_report_abs(ts->sensor_pdata->input_sensor_dev, - ABS_DISTANCE, - ++report_cnt); + if (ts->report_gesture_key) { + input_report_key(ts->sensor_pdata->input_sensor_dev, KEY_F1, 1); + input_sync(ts->sensor_pdata->input_sensor_dev); + input_report_key(ts->sensor_pdata->input_sensor_dev, KEY_F1, 0); + input_sync(ts->sensor_pdata->input_sensor_dev); + ++report_cnt; + } else { + input_report_abs(ts->sensor_pdata->input_sensor_dev, + ABS_DISTANCE, + ++report_cnt); + input_sync(ts->sensor_pdata->input_sensor_dev); + } NVT_LOG("input report: %d", report_cnt); if (report_cnt >= REPORT_MAX_COUNT) { report_cnt = 0; } - input_sync(ts->sensor_pdata->input_sensor_dev); #ifdef CONFIG_HAS_WAKELOCK wake_lock_timeout(&gesture_wakelock, msecs_to_jiffies(5000)); #else @@ -1122,6 +1130,12 @@ static int32_t nvt_parse_dt(struct device *dev) ts->charger_detection_enable = 0; } + if (of_property_read_bool(np, "novatek,report_gesture_key")) { + NVT_LOG("novatek,report_gesture_key set"); + ts->report_gesture_key = 1; + } else { + ts->report_gesture_key = 0; + } return ret; } #else @@ -1590,10 +1604,16 @@ static int nvt_sensor_init(struct nvt_ts_data *data) } data->sensor_pdata = sensor_pdata; - __set_bit(EV_ABS, sensor_input_dev->evbit); + 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); + } __set_bit(EV_SYN, 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/nova_0flash_mmi/nt36xxx.h b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h index e109a98b52bb..231134387f87 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h @@ -176,6 +176,7 @@ struct nvt_ts_data { struct mt_chip_conf spi_ctrl; #endif uint32_t charger_detection_enable; + uint32_t report_gesture_key; struct usb_charger_detection *charger_detection; #ifdef CONFIG_SPI_MT65XX struct mtk_chip_config spi_ctrl;