:himax_v2_mmi: delay palm opt when TP suspended

TP:
When TP in suspend state, palm sensor operation is not need to be set.
Delay this opt when TP resume

Change-Id: I5247f9711f376ce81ac547046969331c38c5bdad
Signed-off-by: haojl2 <haojl2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1411822
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
haojl2 2019-08-28 14:41:41 +08:00 • committed by Jialei Hao
commit 55de2a981c
2 changed files with 38 additions and 3 deletions

View file

@ -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;

View file

@ -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;