From 778d8abfb920cdac2c564cc6fb1cf13b70db1dd4 Mon Sep 17 00:00:00 2001 From: kalathik Date: Wed, 19 Aug 2020 18:49:17 +0530 Subject: [PATCH] touch: focaltech: Replace wakeup_source API with macro Use common mmi_wake_lock macros instead directly using kernel API, which is version specific. Change-Id: I9242d38e97e4eec5b8ac66a18b42c8fbf9d80e62 Signed-off-by: Kanagarathina Kalathi Reviewed-on: https://gerrit.mot.com/1727525 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Vijayakumar Gn Reviewed-by: Konstantin Makariev Submit-Approved: Jira Key --- .../focaltech_0flash_mmi/focaltech_core.c | 22 +++++++++++++------ .../focaltech_0flash_mmi/focaltech_core.h | 5 +++-- .../focaltech_0flash_mmi/focaltech_gesture.c | 9 ++------ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c index 0a97fdb1502f..0df08d636c3b 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c @@ -750,7 +750,7 @@ static int fts_read_parse_touchdata(struct fts_ts_data *data) wake_lock_timeout(&fts_data->palm_gesture_wakelock, fts_data->palm_release_delay_ms); #else - __pm_wakeup_event(&fts_data->palm_gesture_wakelock, + PM_WAKEUP_EVENT(fts_data->palm_gesture_wakelock, fts_data->palm_release_delay_ms); #endif return -1; @@ -1068,7 +1068,7 @@ static int _fts_palm_sensor_set_enable(unsigned int enable) #ifdef CONFIG_HAS_WAKELOCK wake_lock(&fts_data->palm_gesture_read_wakelock); #else - __pm_stay_awake(&fts_data->palm_gesture_read_wakelock); + PM_STAY_AWAKE(fts_data->palm_gesture_read_wakelock); #endif fts_data->palm_detection_enabled = true; fts_write_reg(0xB0, 0x01); @@ -1082,7 +1082,7 @@ static int _fts_palm_sensor_set_enable(unsigned int enable) #ifdef CONFIG_HAS_WAKELOCK wake_unlock(&fts_data->palm_gesture_read_wakelock); #else - __pm_relax(&fts_data->palm_gesture_read_wakelock); + PM_RELAX(fts_data->palm_gesture_read_wakelock); #endif } else { FTS_INFO("unknown enable symbol\n"); @@ -1159,12 +1159,20 @@ static int fts_palm_sensor_init(struct fts_ts_data *data) #ifdef CONFIG_HAS_WAKELOCK wake_lock_init(&data->palm_gesture_wakelock, WAKE_LOCK_SUSPEND, "palm_detect_wl"); #else - wakeup_source_init(&data->palm_gesture_wakelock, "palm_detect_wl"); + PM_WAKEUP_REGISTER(NULL, data->palm_gesture_wakelock, "palm_detect_wl"); + if (!data->palm_gesture_wakelock) { + FTS_ERROR("Unable to register device, err=%d", err); + goto unregister_sensor_input_device; + } #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"); + PM_WAKEUP_REGISTER(NULL, data->palm_gesture_read_wakelock, "palm_read_wl"); + if (!data->palm_gesture_wakelock) { + FTS_ERROR("Unable to register device, err=%d", err); + goto unregister_sensor_input_device; + } #endif data->palm_release_fimer.function = fts_palm_sensor_release_timer_handler; @@ -1193,12 +1201,12 @@ int fts_palm_sensor_remove(struct fts_ts_data *data) #ifdef CONFIG_HAS_WAKELOCK wake_lock_destroy(&data->palm_gesture_wakelock); #else - wakeup_source_trash(&data->palm_gesture_wakelock); + PM_WAKEUP_UNREGISTER(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); + PM_WAKEUP_UNREGISTER(data->palm_gesture_read_wakelock); #endif data->palm_sensor_pdata = NULL; data->palm_detection_enabled = false; diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h index 291a434aecff..7ec433f2f787 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h @@ -61,6 +61,7 @@ #include #include #include +#include #include "focaltech_common.h" #if defined(CONFIG_INPUT_TOUCHSCREEN_MMI) #include @@ -262,12 +263,12 @@ struct fts_ts_data { #ifdef CONFIG_HAS_WAKELOCK struct wake_lock palm_gesture_wakelock; #else - struct wakeup_source palm_gesture_wakelock; + 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; + struct wakeup_source *palm_gesture_read_wakelock; #endif #endif diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_gesture.c b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_gesture.c index f8ed11047e35..4775b8b4af57 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_gesture.c +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_gesture.c @@ -340,7 +340,7 @@ static void fts_gesture_report(struct input_dev *input_dev, int gesture_id) #ifdef CONFIG_HAS_WAKELOCK wake_lock_timeout(&gesture_wakelock, msecs_to_jiffies(5000)); #else - __pm_wakeup_event(gesture_wakelock, 5000); + PM_WAKEUP_EVENT(gesture_wakelock, 5000); #endif } #else @@ -651,12 +651,7 @@ int fts_gesture_init(struct fts_ts_data *ts_data) #ifdef CONFIG_HAS_WAKELOCK wake_lock_init(&gesture_wakelock, WAKE_LOCK_SUSPEND, "poll-wake-lock"); #else -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 110) || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 163) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0))) - gesture_wakelock = wakeup_source_register(ts_data->dev, "poll-wake-lock"); -#else - gesture_wakelock = wakeup_source_register("poll-wake-lock"); -#endif + PM_WAKEUP_REGISTER(ts_data->dev, gesture_wakelock, "poll-wake-lock"); if (!gesture_wakelock) { FTS_ERROR("failed to allocate wakeup source\n"); return -ENOMEM;