diff options
author | masonwang <masonwang@google.com> | 2021-08-13 20:37:14 +0800 |
---|---|---|
committer | masonwang <masonwang@google.com> | 2021-08-13 21:49:18 +0800 |
commit | b7c06e75709357f98c8ace51b53c3b91013f5f0d (patch) | |
tree | 1a569489b0c294dd58d8f25dde4e9b8a945c8415 | |
parent | f8f1a1e50d53a7e2ef4ccc0ec1c2dd5c0871245e (diff) | |
download | himax_touch-b7c06e75709357f98c8ace51b53c3b91013f5f0d.tar.gz |
touch/himax: fix KP for zero-flash touch.
To prevent calling input_report_key(ts->input_dev,...) when
input device is not registered.
Bug: 196223936
Test: There is no KP when device is booting.
Change-Id: I2f5e52f9b98f5e33e61f084f1f495e047dbd2df5
-rw-r--r-- | himax_common.c | 29 | ||||
-rw-r--r-- | himax_common.h | 1 | ||||
-rw-r--r-- | himax_platform.c | 2 |
3 files changed, 13 insertions, 19 deletions
diff --git a/himax_common.c b/himax_common.c index cb5c816..85968c1 100644 --- a/himax_common.c +++ b/himax_common.c @@ -76,8 +76,6 @@ char *g_guest_info_item[] = { }; #endif -uint32_t g_hx_chip_inited; - #if defined(__EMBEDDED_FW__) struct firmware g_embedded_fw = { .data = _binary___Himax_firmware_bin_start, @@ -2375,19 +2373,21 @@ static int himax_parse_report_data(struct himax_ts_data *ts, static void himax_report_all_leave_event(struct himax_ts_data *ts) { - int i = 0; + if(ts->initialized) { + int i = 0; - for (i = 0; i < ts->nFinger_support; i++) { + for (i = 0; i < ts->nFinger_support; i++) { #if !defined(HX_PROTOCOL_A) - input_mt_slot(ts->input_dev, i); - input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0); - input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0); - input_report_abs(ts->input_dev, ABS_MT_PRESSURE, 0); - input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); + input_mt_slot(ts->input_dev, i); + input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0); + input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0); + input_report_abs(ts->input_dev, ABS_MT_PRESSURE, 0); + input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); #endif + } + input_report_key(ts->input_dev, BTN_TOUCH, 0); + input_sync(ts->input_dev); } - input_report_key(ts->input_dev, BTN_TOUCH, 0); - input_sync(ts->input_dev); } /* start report_point*/ @@ -2396,7 +2396,6 @@ static void himax_point_report(struct himax_ts_data *ts) int i = 0; bool valid = false; - if (g_ts_dbg != 0) { I("%s:start hx_touch_data->finger_num=%d\n", __func__, hx_touch_data->finger_num); @@ -3361,8 +3360,6 @@ int himax_chip_common_init(void) ts->power = pdata->power; #endif - g_hx_chip_inited = 0; - if (hx_ic_register() != NO_ERR) { E("%s: can't detect IC!\n", __func__); goto error_ic_detect_failed; @@ -3508,8 +3505,6 @@ int himax_chip_common_init(void) INIT_DELAYED_WORK(&ts->ts_int_work, himax_resume_work_func); #endif - ts->initialized = true; - #if defined(HX_CONFIG_FB) || defined(HX_CONFIG_DRM) ts->himax_att_wq = create_singlethread_workqueue("HMX_ATT_request"); if (!ts->himax_att_wq) { @@ -3523,7 +3518,7 @@ int himax_chip_common_init(void) msecs_to_jiffies(0)); #endif - g_hx_chip_inited = true; + ts->initialized = true; return 0; #if defined(HX_CONFIG_FB) || defined(HX_CONFIG_DRM) diff --git a/himax_common.h b/himax_common.h index 8790cef..d333f89 100644 --- a/himax_common.h +++ b/himax_common.h @@ -632,7 +632,6 @@ extern uint8_t *wake_event_buffer; extern int g_mmi_refcnt; extern int *g_inspt_crtra_flag; -extern uint32_t g_hx_chip_inited; /*void himax_HW_reset(uint8_t loadconfig,uint8_t int_off);*/ int himax_chip_common_suspend(struct himax_ts_data *ts); diff --git a/himax_platform.c b/himax_platform.c index b767c49..ab1d441 100644 --- a/himax_platform.c +++ b/himax_platform.c @@ -1293,7 +1293,7 @@ int himax_chip_common_remove(struct spi_device *spi) { struct himax_ts_data *ts = spi_get_drvdata(spi); - if (g_hx_chip_inited) + if (ts->initialized) himax_chip_common_deinit(); ts->spi = NULL; |