focaltech_0flash_mmi: Add wakelock before SPI operation

If palm detect function is enabled, interrupt will not disable,
IC works in normal mode.
But in case touch event is reported to input subsystem, skip touch event
when suspend flag is true. So input subsystem will not take wakelock
because no one report event.
In this case, we still need read data from IC, so AP can not enter
suspend. Add a 10ms wakelock when this function is enabled.
(TP report rate is around 100Hz).

Change-Id: I381a13fca6dedfcb68e0c3048291610da2554f17
Signed-off-by: haojl2 <haojl2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1409610
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
haojl2 2019-08-25 01:05:01 +08:00 • committed by Jialei Hao
commit 68dbd702e8
2 changed files with 34 additions and 2 deletions

View file

@ -843,6 +843,25 @@ static void fts_irq_read_report(void)
static irqreturn_t fts_irq_handler(int irq, void *data)
{
/*
* If palm detect function is enabled, interrupt will not disable, IC works in
* normal mode. But in case touch event is reported to input subsystem, skip
* touch event when suspend flag is true. So input subsystem will not take
* wakelock because no one report event.
* In this case, we still need read data from IC, so AP can not enter suspend.
* Add a 10ms wakelock when this function is enabled. (TP report rate is around
* 100Hz).
*/
#ifdef FOCALTECH_PALM_SENSOR_EN
if (fts_data->palm_detection_enabled) {
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_timeout(&fts_data->palm_gesture_read_wakelock, 10);
#else
__pm_wakeup_event(&fts_data->palm_gesture_read_wakelock, 10);
#endif
}
#endif
fts_irq_read_report();
return IRQ_HANDLED;
}
@ -1023,6 +1042,11 @@ static int fts_palm_sensor_init(struct fts_ts_data *data)
#else
wakeup_source_init(&data->palm_gesture_wakelock, "palm_detect_wl");
#endif
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_init(&data->palm_gesture_read_wakelock, WAKE_LOCK_SUSPEND, "palm_read_wl");
#else
wakeup_source_init(&data->palm_gesture_read_wakelock, "palm_read_wl");
#endif
data->palm_release_fimer.function = fts_palm_sensor_release_timer_handler;
init_timer(&data->palm_release_fimer);
@ -1051,6 +1075,11 @@ int fts_palm_sensor_remove(struct fts_ts_data *data)
wake_lock_destroy(&data->palm_gesture_wakelock);
#else
wakeup_source_trash(&data->palm_gesture_wakelock);
#endif
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_destroy(&data->palm_gesture_read_wakelock);
#else
wakeup_source_trash(&data->palm_gesture_read_wakelock);
#endif
data->palm_sensor_pdata = NULL;
data->palm_detection_enabled = false;
@ -2053,8 +2082,6 @@ static int fts_ts_resume(struct device *dev)
return 0;
}
fts_release_all_finger();
if (!ts_data->ic_info.is_incell) {
#if FTS_POWER_SOURCE_CUST_EN
fts_power_source_resume(ts_data);

View file

@ -243,6 +243,11 @@ struct fts_ts_data {
#else
struct wakeup_source palm_gesture_wakelock;
#endif
#ifdef CONFIG_HAS_WAKELOCK
struct wake_lock palm_gesture_read_wakelock;
#else
struct wakeup_source palm_gesture_read_wakelock;
#endif
#endif
};