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 <kalath(CR)@motorola.com>
Reviewed-on: https://gerrit.mot.com/1727525
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Vijayakumar Gn <vijaygn@motorola.com>
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
kalathik 2020-08-19 18:49:17 +05:30 • committed by Kanagarathina Kalathi
commit 778d8abfb9
3 changed files with 20 additions and 16 deletions

View file

@ -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;

View file

@ -61,6 +61,7 @@
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/dma-mapping.h>
#include <linux/mmi_wake_lock.h>
#include "focaltech_common.h"
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
#include <linux/touchscreen_mmi.h>
@ -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

View file

@ -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;