From 70be896a4aaac6ef395f7003bed5f46dcf25fc0d Mon Sep 17 00:00:00 2001 From: litong20 Date: Tue, 2 Nov 2021 14:52:34 +0800 Subject: [PATCH] Support goodix single tap to wake the device TP: Support goodix single tap to wake the device. Change-Id: I038edf7655f6944653d22e13c3ec056baca77084 Reviewed-on: https://gerrit.mot.com/2105483 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jun Weng Reviewed-by: Jichao Zou Submit-Approved: Jira Key --- .../goodix_berlin_mmi/goodix_brl_hw.c | 4 ++-- .../goodix_berlin_mmi/goodix_ts_core.c | 10 ++++++++++ .../goodix_berlin_mmi/goodix_ts_core.h | 1 + .../goodix_berlin_mmi/goodix_ts_gesture.c | 18 ++++++++++++++++++ .../goodix_berlin_mmi/goodix_ts_mmi.c | 3 +++ .../goodix_berlin_mmi/goodix_ts_mmi.h | 1 + 6 files changed, 35 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_brl_hw.c b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_brl_hw.c index f9fc60a7a340..43762dce9df5 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_brl_hw.c +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_brl_hw.c @@ -237,7 +237,7 @@ int brl_resume(struct goodix_ts_core *cd) return cd->hw_ops->reset(cd, GOODIX_NORMAL_RESET_DELAY_MS); } -#define GOODIX_GESTURE_CMD 0x12 +#define GOODIX_GESTURE_CMD 0xA6 int brl_gesture(struct goodix_ts_core *cd, int gesture_type) { struct goodix_ts_cmd cmd; @@ -311,7 +311,7 @@ static int brl_irq_enbale(struct goodix_ts_core *cd, bool enable) ts_debug("Irq disabled"); return 0; } - ts_info("warnning: irq deepth inbalance!"); + ts_debug("warnning: irq deepth inbalance!"); return 0; } diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c index c04124385339..d0fd16a8fd1e 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c @@ -2303,6 +2303,14 @@ static int goodix_ts_probe(struct platform_device *pdev) goto err_out; } + PM_WAKEUP_REGISTER(bus_interface->dev, core_data->gesture_wakelock, + "goodix_gesture_wakelock"); + if (!core_data->gesture_wakelock) { + ts_info("allocate gesture wakeup source err!\n"); + ret = -ENOMEM; + goto err_register_gesture_wakelock; + } + /* debug node init */ goodix_tools_init(); @@ -2313,6 +2321,8 @@ static int goodix_ts_probe(struct platform_device *pdev) ts_info("goodix_ts_core probe success"); return 0; +err_register_gesture_wakelock: + PM_WAKEUP_UNREGISTER(core_data->gesture_wakelock); err_out: core_data->init_stage = CORE_INIT_FAIL; core_module_prob_sate = CORE_MODULE_PROB_FAILED; diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.h b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.h index 3ef59e48096b..2fb66112688a 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.h +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.h @@ -473,6 +473,7 @@ struct goodix_ts_core { /* when this flag is true, driver should not clean the sync flag */ bool tools_ctrl_sync; + struct wakeup_source *gesture_wakelock; struct notifier_block ts_notifier; struct goodix_ts_esd ts_esd; diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_gesture.c b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_gesture.c index 68f9dcefe02f..6f6770218d5d 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_gesture.c +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_gesture.c @@ -26,6 +26,7 @@ #include #include #include "goodix_ts_core.h" +#include "goodix_ts_mmi.h" #define QUERYBIT(longlong, bit) (!!(longlong[bit/8] & (1 << bit%8))) @@ -245,6 +246,20 @@ static int gsx_gesture_ist(struct goodix_ts_core *cd, if (QUERYBIT(gsx_gesture->gesture_type, gs_event.gesture_type)) { gsx_gesture->gesture_data = gs_event.gesture_type; +#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI) + if (cd->imports && cd->imports->report_gesture) { + struct gesture_event_data mmi_event; + + ts_info("invoke imported report gesture function\n"); + mmi_event.evcode = 1; + + /* call class method */ + ret = cd->imports->report_gesture(&mmi_event); + if (!ret) + PM_WAKEUP_EVENT(cd->gesture_wakelock, 3000); + goto gesture_ist_exit; + } +#endif /* do resume routine */ ts_info("got valid gesture type 0x%x", gs_event.gesture_type); @@ -353,6 +368,9 @@ int gesture_module_init(void) } module_initialized = true; + + goodix_gesture_enable(1); + ts_info("gesture module init success"); return 0; diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.c b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.c index f0e2a338394f..2bce6c97f1e0 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.c +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.c @@ -360,6 +360,9 @@ static int goodix_ts_mmi_panel_state(struct device *dev, core_data->gesture_enabled = false; break; case TS_MMI_PM_ACTIVE: + if (hw_ops->resume) + hw_ops->resume(core_data); + core_data->gesture_enabled = false; break; default: ts_err("Invalid power state parameter %d.\n", to); diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.h b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.h index 9dddb65aa240..20ab12d31fac 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.h +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_mmi.h @@ -15,6 +15,7 @@ #include #include +#include #ifdef CONFIG_INPUT_TOUCHSCREEN_MMI int goodix_ts_mmi_dev_register(struct platform_device *ts_device);