diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c index c49ee7fdfaf6..cb7f779a16a5 100644 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c @@ -2835,8 +2835,7 @@ static void himax_palm_sensor_release_timer_handler(unsigned long data) himax_palm_detect_func(private_ts, false); } -static int himax_palm_detect_sensor_set_enable(struct sensors_classdev *sensors_cdev, - unsigned int enable) +static int _himax_palm_detect_sensor_set_enable(unsigned int enable) { I("Gesture set enable %d!", enable); if (enable == 1) { @@ -2855,6 +2854,28 @@ static int himax_palm_detect_sensor_set_enable(struct sensors_classdev *sensors_ return 0; } +static int himax_palm_detect_sensor_set_enable(struct sensors_classdev *sensors_cdev, + unsigned int enable) +{ + int ret = 0; + + mutex_lock(&private_ts->suspend_resume_mutex); + if (!private_ts->suspended) + ret = _himax_palm_detect_sensor_set_enable(enable); + else { + I("Gesture lazy set enable %d!", enable); + if (enable == 1) + private_ts->palm_detection_lazy_set = PALM_SENSOR_LAZY_SET_ENABLE; + else if (enable == 0) + private_ts->palm_detection_lazy_set = PALM_SENSOR_LAZY_SET_DISABLE; + else + E("unknown enable symbol\n"); + } + mutex_unlock(&private_ts->suspend_resume_mutex); + + return ret; +} + static int himax_palm_detect_sensor_init(struct himax_ts_data *data) { struct himax_sensor_platform_data *sensor_pdata; @@ -3798,7 +3819,7 @@ int _himax_chip_common_resume(struct himax_ts_data *ts) #ifdef HIMAX_PALM_SENSOR_EN if (ts->palm_detection_enabled) { I("[himax] %s: palm detect function enable, skip resume\n", __func__); - goto END; + goto CHECK_LAZY_SET_END; } #endif @@ -3850,6 +3871,13 @@ int _himax_chip_common_resume(struct himax_ts_data *ts) #if defined(HX_ZERO_FLASH) && defined(HX_RESUME_SET_FW) ESCAPE_0F_UPDATE: #endif + +#ifdef HIMAX_PALM_SENSOR_EN +CHECK_LAZY_SET_END: + if (ts->palm_detection_lazy_set != PALM_SENSOR_LAZY_SET_NONE) + _himax_palm_detect_sensor_set_enable( + (ts->palm_detection_lazy_set == PALM_SENSOR_LAZY_SET_ENABLE) ? 1 : 0); +#endif END: if (ts->in_self_test == 1) ts->suspend_resume_done = 1; diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h index 94cb19066eb4..086b54a54f03 100755 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h @@ -74,6 +74,12 @@ struct himax_sensor_platform_data { char sensor_data; /* 0 near, 1 far */ struct himax_ts_data *data; }; + +enum palm_sensor_lazy_set { + PALM_SENSOR_LAZY_SET_NONE = 0, + PALM_SENSOR_LAZY_SET_ENABLE, + PALM_SENSOR_LAZY_SET_DISABLE, +}; #endif /*===========Himax Option function=============*/ @@ -471,6 +477,7 @@ struct himax_ts_data { #ifdef HIMAX_PALM_SENSOR_EN bool palm_detection_enabled; + enum palm_sensor_lazy_set palm_detection_lazy_set; struct himax_sensor_platform_data *palm_sensor_pdata; struct timer_list palm_release_fimer; unsigned int palm_release_delay_ms;