From bb299fa0a58108f5cd618270e28a0db11b5eae9d Mon Sep 17 00:00:00 2001 From: haojl2 Date: Sat, 1 Jun 2019 15:31:01 +0800 Subject: [PATCH] himax_mmi: Fix wakelock compile issue Wakelock is not supported by default. If it is not supported, use wakeup_source instead. Change-Id: Iae27c6fc6c8f3fd6c0129f0869ae734cec59c067 Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1366919 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- .../input/touchscreen/himax_mmi/himax_common.c | 16 ++++++++++++++++ .../input/touchscreen/himax_mmi/himax_common.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/input/touchscreen/himax_mmi/himax_common.c b/drivers/input/touchscreen/himax_mmi/himax_common.c index 6ea1958f194d..059db42dc7c2 100644 --- a/drivers/input/touchscreen/himax_mmi/himax_common.c +++ b/drivers/input/touchscreen/himax_mmi/himax_common.c @@ -2024,7 +2024,11 @@ int himax_report_data(struct himax_ts_data *ts, int ts_path, int ts_status) #endif #ifdef HX_SMART_WAKEUP } else if (ts_path == HX_REPORT_SMWP_EVENT) { +#ifdef CONFIG_HAS_WAKELOCK wake_lock_timeout(&ts->ts_SMWP_wake_lock, TS_WAKE_LOCK_TIMEOUT); +#else + __pm_wakeup_event(&ts->ts_SMWP_wake_lock, TS_WAKE_LOCK_TIMEOUT); +#endif himax_wake_event_report(); #endif } else { @@ -2684,7 +2688,11 @@ FW_force_upgrade: #ifdef HX_SMART_WAKEUP ts->SMWP_enable = 0; +#ifdef CONFIG_HAS_WAKELOCK wake_lock_init(&ts->ts_SMWP_wake_lock, WAKE_LOCK_SUSPEND, HIMAX_common_NAME); +#else + wakeup_source_init(&ts->ts_SMWP_wake_lock, HIMAX_common_NAME); +#endif #endif #ifdef HX_HIGH_SENSE ts->HSEN_enable = 0; @@ -2750,7 +2758,11 @@ err_sysfs: err_creat_proc_file_failed: err_report_data_init_failed: #ifdef HX_SMART_WAKEUP +#ifdef CONFIG_HAS_WAKELOCK wake_lock_destroy(&ts->ts_SMWP_wake_lock); +#else + wakeup_source_trash(&ts->ts_SMWP_wake_lock); +#endif #endif #ifdef CONFIG_FB cancel_delayed_work_sync(&ts->work_att); @@ -2819,7 +2831,11 @@ void himax_chip_common_deinit(void) } #ifdef HX_SMART_WAKEUP +#ifdef CONFIG_HAS_WAKELOCK wake_lock_destroy(&ts->ts_SMWP_wake_lock); +#else + wakeup_source_trash(&ts->ts_SMWP_wake_lock); +#endif #endif #ifdef CONFIG_FB if (fb_unregister_client(&ts->fb_notif)) diff --git a/drivers/input/touchscreen/himax_mmi/himax_common.h b/drivers/input/touchscreen/himax_mmi/himax_common.h index bfab79d617b9..ae34c0cb659f 100644 --- a/drivers/input/touchscreen/himax_mmi/himax_common.h +++ b/drivers/input/touchscreen/himax_mmi/himax_common.h @@ -34,7 +34,11 @@ #include #include #include +#ifdef CONFIG_HAS_WAKELOCK #include +#else +#include +#endif #include #include #include "himax_platform.h" @@ -357,7 +361,11 @@ struct himax_ts_data { #ifdef HX_SMART_WAKEUP uint8_t SMWP_enable; uint8_t gesture_cust_en[26]; +#ifdef CONFIG_HAS_WAKELOCK struct wake_lock ts_SMWP_wake_lock; +#else + struct wakeup_source ts_SMWP_wake_lock; +#endif #endif #ifdef HX_EDGE_LIMIT