]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
input: touch: raydium: conditional wakelock calls
authorNaveen Kumar S <nkumars@nvidia.com>
Mon, 1 Jul 2013 11:16:21 +0000 (16:46 +0530)
committerDan Willemsen <dwillemsen@nvidia.com>
Wed, 18 Mar 2015 18:57:04 +0000 (11:57 -0700)
Tasks holding wakelocks in raydium driver intermittently obstruct
system from entering suspend state. Added conditional checks while
invoking wakelock functions so as to disable them if needed.

Bug 1314808
Bug 1343545

Change-Id: Ie71ea98661e56f2f50d406ee759b007ac877762a
Signed-off-by: Naveen Kumar S <nkumars@nvidia.com>
Reviewed-on: http://git-master/r/247729
(cherry picked from commit f56a79205a60e0e86b4a0c2e9f3c5d33f22c5a58)
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: http://git-master/r/258556
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Dan Willemsen <dwillemsen@nvidia.com>
drivers/input/touchscreen/rm31080a_ts.c

index c06c35104f82cc33d4ca66464a0d0991e632b31e..240404dbb2ae67a75fd70d5d78368e84f85b8d68 100644 (file)
@@ -35,7 +35,9 @@
 #include <linux/random.h>      /* random32() */
 #include <linux/suspend.h>     /* pm_notifier */
 #include <linux/workqueue.h>
+#ifdef CONFIG_HAS_WAKELOCK
 #include <linux/wakelock.h> /* wakelock */
+#endif
 #include <linux/regulator/consumer.h> /* regulator & voltage */
 #include <linux/clk.h> /* clock */
 #ifdef CONFIG_HAS_EARLYSUSPEND
@@ -154,8 +156,9 @@ struct rm31080a_ts_para {
        u8 u8TestVersion;
        u8 u8Repeat;
 
+#ifdef CONFIG_HAS_WAKELOCK
        struct wake_lock Wakelock_Initialization;
-
+#endif
        struct mutex mutex_scan_mode;
 
        struct workqueue_struct *rm_workqueue;
@@ -1675,9 +1678,10 @@ static void rm_tch_init_ts_structure(void)
        g_stTs.rm_timer_workqueue = create_singlethread_workqueue("rm_idle_work");
        INIT_WORK(&g_stTs.rm_timer_work, rm_timer_work_handler);
 
+#ifdef CONFIG_HAS_WAKELOCK
        wake_lock_init(&g_stTs.Wakelock_Initialization,
                WAKE_LOCK_SUSPEND, "TouchInitialLock");
-
+#endif
        mutex_init(&g_stTs.mutex_scan_mode);
 
 }
@@ -1759,8 +1763,10 @@ static int rm_tch_suspend(struct device *dev)
 static int rm_tch_resume(struct device *dev)
 {
        struct rm_tch_ts *ts = dev_get_drvdata(dev);
+#ifdef CONFIG_HAS_WAKELOCK
        wake_lock_timeout(&g_stTs.Wakelock_Initialization,
                TCH_WAKE_LOCK_TIMEOUT);
+#endif
        rm_ctrl_start(ts);
        return 0;
 }
@@ -2051,8 +2057,10 @@ static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                case RM_IOCTL_INIT_END:
                        g_stTs.bInitFinish = 1;
                        g_stTs.bCalcFinish = 1;
+#ifdef CONFIG_HAS_WAKELOCK
                        if (wake_lock_active(&g_stTs.Wakelock_Initialization))
                                wake_unlock(&g_stTs.Wakelock_Initialization);
+#endif
                        ret = rm_tch_ctrl_scan_start();
                        break;
                case RM_IOCTL_FINISH_CALC:
@@ -2158,9 +2166,10 @@ static int rm_tch_spi_remove(struct spi_device *spi)
        if (g_stTs.rm_workqueue)
                destroy_workqueue(g_stTs.rm_workqueue);
 
+#ifdef CONFIG_HAS_WAKELOCK
        if (&g_stTs.Wakelock_Initialization)
                wake_lock_destroy(&g_stTs.Wakelock_Initialization);
-
+#endif
        sysfs_remove_group(&raydium_ts_miscdev.this_device->kobj,
                                                &rm_ts_attr_group);
        misc_deregister(&raydium_ts_miscdev);