xpeng: input touch add wait when single tap

input touch
add wait when single tap

Change-Id: I11e11de6d4d96e28606a50b13f88b769159d4ced
Signed-off-by: dengwei1 <dengwei1@motorola.com>
Reviewed-on: https://gerrit.mot.com/2069935
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-09-17 17:11:50 +08:00 • committed by Wei Deng
commit 08d0ce4187
2 changed files with 56 additions and 0 deletions

View file

@ -1350,6 +1350,13 @@ static int32_t nvt_parse_dt(struct device *dev)
ts->charger_detection_enable = 0;
}
if (of_property_read_bool(np, "novatek,gesture-wait-pm")) {
NVT_LOG("novatek,gesture-wait-pm set");
ts->gesture_wait_pm = true;
} else {
ts->gesture_wait_pm = false;
}
if (of_property_read_bool(np, "novatek,report_gesture_key")) {
NVT_LOG("novatek,report_gesture_key set");
ts->report_gesture_key = 1;
@ -1611,6 +1618,15 @@ static irqreturn_t nvt_ts_work_func(int irq, void *data)
#if WAKEUP_GESTURE
if (ts->bTouchIsAwake == 0) {
pm_wakeup_event(&ts->input_dev->dev, 5000);
if ((ts->gesture_wait_pm) && (ts->gesture_enabled)) {
/* Waiting for pm resume completed */
ret = wait_event_interruptible_timeout(ts->pm_wq, atomic_read(&ts->pm_resume), msecs_to_jiffies(700));
if (!ret) {
NVT_ERR("system(spi) can't finished resuming procedure.");
return IRQ_HANDLED;
}
}
}
#endif
@ -2481,6 +2497,10 @@ static int32_t nvt_ts_probe(struct spi_device *client)
}
}
if (ts->gesture_wait_pm)
init_waitqueue_head(&ts->pm_wq);
atomic_set(&ts->pm_resume, 1);
#if WAKEUP_GESTURE
device_init_wakeup(&ts->input_dev->dev, 1);
#endif
@ -3479,6 +3499,36 @@ static struct of_device_id nvt_match_table[] = {
};
#endif
static int nvt_pm_suspend(struct device *dev)
{
struct nvt_ts_data *ts = dev_get_drvdata(dev);
NVT_LOG("CALL BACK TP PM SUSPEND");
atomic_set(&ts->pm_resume, 0);
return 0;
}
static int nvt_pm_resume(struct device *dev)
{
struct nvt_ts_data *ts = dev_get_drvdata(dev);
NVT_LOG("CALL BACK TP PM RESUME");
atomic_set(&ts->pm_resume, 1);
if ((ts->gesture_wait_pm) && (ts->gesture_enabled))
wake_up_interruptible(&ts->pm_wq);
return 0;
}
static const struct dev_pm_ops nvt_dev_pm_ops = {
.suspend = nvt_pm_suspend,
.resume = nvt_pm_resume,
};
static struct spi_driver nvt_spi_driver = {
.probe = nvt_ts_probe,
.remove = nvt_ts_remove,
@ -3489,6 +3539,9 @@ static struct spi_driver nvt_spi_driver = {
.owner = THIS_MODULE,
#ifdef CONFIG_OF
.of_match_table = nvt_match_table,
#endif
#ifdef CONFIG_PM
.pm = &nvt_dev_pm_ops,
#endif
},
};

View file

@ -206,6 +206,9 @@ struct nvt_ts_data {
uint8_t *xbuf;
struct mutex xbuf_lock;
bool irq_enabled;
atomic_t pm_resume;
wait_queue_head_t pm_wq;
bool gesture_wait_pm;
const char *panel_supplier;
#ifdef CONFIG_MTK_SPI
struct mt_chip_conf spi_ctrl;