TP wake up of gesture fix

TP wake up of gesture fix
four and five of tp bsp

Change-Id: I27b4bbe54e0d37bef95e68a8c0c52a7b1606cd53
Signed-off-by: hqjiangy <hqjiangy@motorola.com>
Reviewed-on: https://gerrit.mot.com/2361488
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wei Deng <dengwei1@motorola.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
hqjiangy 2022-08-12 13:53:39 +08:00
commit 1c3022555b
3 changed files with 48 additions and 1 deletions

View file

@ -43,6 +43,7 @@
#include "synaptics_touchcom_func_base.h"
#include "synaptics_touchcom_func_touch.h"
#include "synaptics_touchcom_func_reflash.h"
#include <linux/mmi_wake_lock.h>
#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI
extern int syna_ts_mmi_dev_register(struct syna_tcm *tcm);
@ -106,6 +107,13 @@ static unsigned char custom_touch_format[] = {
struct drm_panel *active_panel;
#endif
#ifdef ENABLE_WAKEUP_GESTURE
#ifdef CONFIG_HAS_WAKELOCK
static struct wake_lock gesture_wakelock;
#else
static struct wakeup_source *gesture_wakelock;
#endif
#endif
#if defined(ENABLE_HELPER)
/**
@ -361,6 +369,7 @@ static void syna_dev_report_input_events(struct syna_tcm *tcm)
unsigned int max_objects = tcm->tcm_dev->max_objects;
struct tcm_touch_data_blob *touch_data;
struct tcm_objects_data_blob *object_data;
int retval = 0;
if (input_dev == NULL)
return;
@ -373,13 +382,27 @@ static void syna_dev_report_input_events(struct syna_tcm *tcm)
#ifdef ENABLE_WAKEUP_GESTURE
if ((tcm->pwr_state == LOW_PWR) && tcm->irq_wake) {
if (touch_data->gesture_id) {
LOGD("Gesture detected, id:%d\n",
LOGI("Gesture detected, id:%d\n",
touch_data->gesture_id);
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
if (tcm->imports && tcm->imports->report_gesture) {
struct gesture_event_data event;
event.evcode = 1;
retval = tcm->imports->report_gesture(&event);
if (!retval)
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_timeout(&gesture_wakelock, msecs_to_jiffies(5000));
#else
PM_WAKEUP_EVENT(gesture_wakelock, 5000);
#endif
}
#else
input_report_key(input_dev, KEY_WAKEUP, 1);
input_sync(input_dev);
input_report_key(input_dev, KEY_WAKEUP, 0);
input_sync(input_dev);
#endif
}
}
#endif
@ -1644,6 +1667,10 @@ static int syna_dev_probe(struct platform_device *pdev)
struct device *dev;
#endif
#ifdef ENABLE_WAKEUP_GESTURE
static bool initialized_sensor;
#endif
hw_if = pdev->dev.platform_data;
if (!hw_if) {
LOGE("Fail to find hardware configuration\n");
@ -1680,6 +1707,20 @@ static int syna_dev_probe(struct platform_device *pdev)
#endif
tcm->irq_wake = false;
#ifdef ENABLE_WAKEUP_GESTURE
if (!initialized_sensor) {
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_init(&gesture_wakelock, WAKE_LOCK_SUSPEND, "syna_gesture_wakelock");
#else
PM_WAKEUP_REGISTER(&pdev->dev, gesture_wakelock, "syna_gesture_wakelock");
if (!gesture_wakelock) {
LOGE("failed to allocate wakeup source\n");
}
#endif
initialized_sensor = true;
}
#endif
tcm->is_connected = false;
tcm->pwr_state = PWR_OFF;

View file

@ -374,6 +374,10 @@ struct syna_tcm {
struct syna_tcm_helper helper;
#endif
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
struct ts_mmi_class_methods *imports;
#endif
/* testing */
char *testing_log_data;
unsigned int testing_log_size;

View file

@ -532,6 +532,8 @@ int syna_ts_mmi_dev_register(struct syna_tcm *tcm) {
LOGE("Failed to register ts mmi ret = %d\n", ret);
return ret;
}
/* initialize class imported methods */
tcm->imports = &syna_ts_mmi_methods.exports;
return 0;
}