From 73e64a00787cf0825683bfd9b109f3ec6065c361 Mon Sep 17 00:00:00 2001 From: haojl2 Date: Fri, 19 Apr 2019 19:17:08 +0800 Subject: [PATCH] Fix wakelock header file issue file is only avaliable if CONFIG_HAS_WAKELOCK is defined. If this is not defined, use pm_wakeup_source instead. Change-Id: I1b70e1420caf1ecfed08016134b6b972ef178663 Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1339495 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1367085 --- drivers/input/misc/ets_fps_mmi/ets_fps.c | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/input/misc/ets_fps_mmi/ets_fps.c b/drivers/input/misc/ets_fps_mmi/ets_fps.c index a4b9a1dca7f8..ecc8f278cae4 100644 --- a/drivers/input/misc/ets_fps_mmi/ets_fps.c +++ b/drivers/input/misc/ets_fps_mmi/ets_fps.c @@ -44,7 +44,11 @@ #include #include #include +#ifdef CONFIG_HAS_WAKELOCK #include +#else +#include +#endif #include "ets_fps.h" #include "ets_navi_input.h" @@ -54,7 +58,11 @@ #define LEVEL_TRIGGER_LOW 0x2 #define LEVEL_TRIGGER_HIGH 0x3 #define EGIS_NAVI_INPUT 1 /* 1:open ; 0:close */ +#ifdef CONFIG_HAS_WAKELOCK static struct wake_lock ets_wake_lock; +#else +static struct wakeup_source ets_wake_lock; +#endif /* * FPS interrupt table */ @@ -221,7 +229,11 @@ static irqreturn_t fp_eint_func(int irq, void *dev_id) mod_timer(&fps_ints.timer, jiffies + msecs_to_jiffies(fps_ints.detect_period)); fps_ints.int_count++; /* printk_ratelimited(KERN_WARNING "----------- zq fp fp_eint_func ,fps_ints.int_count=%d",fps_ints.int_count);*/ +#ifdef CONFIG_HAS_WAKELOCK wake_lock_timeout(&ets_wake_lock, msecs_to_jiffies(1500)); +#else + __pm_wakeup_event(&ets_wake_lock, msecs_to_jiffies(1500)); +#endif return IRQ_HANDLED; } @@ -234,7 +246,11 @@ static irqreturn_t fp_eint_func_ll(int irq, void *dev_id) fps_ints.drdy_irq_flag = DRDY_IRQ_DISABLE; wake_up_interruptible(&interrupt_waitq); /* printk_ratelimited(KERN_WARNING "----------- zq fp fp_eint_func ,fps_ints.int_count=%d",fps_ints.int_count);*/ +#ifdef CONFIG_HAS_WAKELOCK wake_lock_timeout(&ets_wake_lock, msecs_to_jiffies(1500)); +#else + __pm_wakeup_event(&ets_wake_lock, msecs_to_jiffies(1500)); +#endif return IRQ_RETVAL(IRQ_HANDLED); } @@ -907,7 +923,11 @@ static int etspi_remove(struct platform_device *pdev) DEBUG_PRINT("%s(#%d)\n", __func__, __LINE__); etspi_create_sysfs(etspi, false); sysfs_remove_group(&dev->kobj, &attribute_group); +#ifdef CONFIG_HAS_WAKELOCK wake_lock_destroy(&ets_wake_lock); +#else + wakeup_source_trash(&ets_wake_lock); +#endif del_timer_sync(&fps_ints.timer); etspi_create_device(etspi, false); //free_irq(gpio_irq, NULL); @@ -980,7 +1000,11 @@ static int etspi_probe(struct platform_device *pdev) /* the timer is for ET310 */ setup_timer(&fps_ints.timer, interrupt_timer_routine, (unsigned long)&fps_ints); add_timer(&fps_ints.timer); +#ifdef CONFIG_HAS_WAKELOCK wake_lock_init(&ets_wake_lock, WAKE_LOCK_SUSPEND, "ets_wake_lock"); +#else + wakeup_source_init(&ets_wake_lock, "ets_wake_lock"); +#endif DEBUG_PRINT(" add_timer ---- \n"); DEBUG_PRINT("%s : initialize success %d\n", __func__, status); @@ -1002,7 +1026,11 @@ static int etspi_probe(struct platform_device *pdev) etspi_sysfs_failed: sysfs_remove_group(&dev->kobj, &attribute_group); etspi_create_group_failed: +#ifdef CONFIG_HAS_WAKELOCK wake_lock_destroy(&ets_wake_lock); +#else + wakeup_source_trash(&ets_wake_lock); +#endif del_timer_sync(&fps_ints.timer); etspi_create_device(etspi, false); etspi_probe_create_device_failed: