dubai: input touch add wait pm

input
add wait

Change-Id: I2d3fa46630cd5cd54c3f35872f1fd012e95a5e9a
Signed-off-by: dengwei1 <dengwei1@motorola.com>
Reviewed-on: https://gerrit.mot.com/2157954
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
dengwei1 2021-12-30 09:51:33 +08:00 • committed by Wei Deng
commit ccab9caec6
3 changed files with 58 additions and 0 deletions

View file

@ -1127,6 +1127,13 @@ static int goodix_parse_dt(struct device_node *node,
if (board_data->edge_ctrl)
ts_info("support goodix edge mode");
if (of_property_read_bool(node, "goodix,gesture-wait-pm")) {
ts_info("gesture-wait-pm set");
board_data->gesture_wait_pm = true;
} else {
board_data->gesture_wait_pm = false;
}
return 0;
}
#endif
@ -2063,6 +2070,36 @@ static int goodix_ts_pm_resume(struct device *dev)
return goodix_ts_resume(core_data);
}
#elif defined (CONFIG_TOUCHSCREEN_GOODIX_BRL_SPI)
static int goodix_ts_pm_suspend(struct device *dev)
{
struct goodix_ts_core *core_data =
dev_get_drvdata(dev);
ts_debug("CALL BACK TP PM SUSPEND");
atomic_set(&core_data->pm_resume, 0);
return 0;
}
/**
* goodix_ts_pm_resume - PM resume function
* Called by kernel during system wakeup
*/
static int goodix_ts_pm_resume(struct device *dev)
{
struct goodix_ts_core *core_data =
dev_get_drvdata(dev);
ts_debug("CALL BACK TP PM RESUME");
atomic_set(&core_data->pm_resume, 1);
if (core_data->board_data.gesture_wait_pm)
wake_up_interruptible(&core_data->pm_wq);
return 0;
}
#endif
#endif
@ -2424,6 +2461,10 @@ static int goodix_ts_probe(struct platform_device *pdev)
goto err_register_gesture_wakelock;
}
if (core_data->board_data.gesture_wait_pm)
init_waitqueue_head(&core_data->pm_wq);
atomic_set(&core_data->pm_resume, 1);
/* debug node init */
goodix_tools_init();
@ -2489,6 +2530,9 @@ static const struct dev_pm_ops dev_pm_ops = {
&& !defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
.suspend = goodix_ts_pm_suspend,
.resume = goodix_ts_pm_resume,
#elif defined (CONFIG_TOUCHSCREEN_GOODIX_BRL_SPI)
.suspend = goodix_ts_pm_suspend,
.resume = goodix_ts_pm_resume,
#endif
};
#endif

View file

@ -294,6 +294,7 @@ struct goodix_ts_board_data {
bool interpolation_ctrl;
bool report_rate_ctrl;
bool edge_ctrl;
bool gesture_wait_pm;
};
enum goodix_fw_update_mode {
@ -536,6 +537,8 @@ struct goodix_ts_core {
#ifdef CONFIG_GTP_FOD
unsigned char gesture_type;
#endif
atomic_t pm_resume;
wait_queue_head_t pm_wq;
};
/* external module structures */

View file

@ -379,6 +379,17 @@ static int gsx_gesture_ist(struct goodix_ts_core *cd,
#endif
if (atomic_read(&cd->suspended) == 0 || cd->gesture_type == 0)
return EVT_CONTINUE;
if (cd->board_data.gesture_wait_pm) {
PM_WAKEUP_EVENT(cd->gesture_wakelock, 3000);
/* Waiting for pm resume completed */
ret = wait_event_interruptible_timeout(cd->pm_wq, atomic_read(&cd->pm_resume), msecs_to_jiffies(700));
if (!ret) {
ts_err("system(spi) can't finished resuming procedure.");
return IRQ_HANDLED;
}
}
ret = hw_ops->event_handler(cd, &gs_event);
if (ret) {
ts_err("failed get gesture data");