input:touch:raydium: fix touch off with displayoff
Xiaohui Tao [Thu, 12 Sep 2013 17:56:51 +0000 (10:56 -0700)]
Do not call suspend/resume in display off case for touch.

Bug 1293127

Change-Id: I7b2d273d53bedfacb7c8ee5771fa3697b95028e7
Signed-off-by: Xiaohui Tao <xtao@nvidia.com>
Reviewed-on: http://git-master/r/263498
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Tested-by: Mitch Luban <mluban@nvidia.com>

drivers/input/touchscreen/rm31080a_ts.c

index 03136e4..e0a5dc9 100644 (file)
@@ -99,6 +99,7 @@ enum RM_SLOW_SCAN_LEVELS {
 #define RM_WINTEK_7_CHANNEL_X 30
 
 #define TS_TIMER_PERIOD                HZ
+#define CTRL_BY_POWER_HAL
 
 struct timer_list ts_timer_triggle;
 static void init_ts_timer(void);
@@ -1754,7 +1755,6 @@ static void rm_ctrl_stop(struct rm_tch_ts *ts)
        mutex_unlock(&g_stTs.mutex_scan_mode);
 }
 
-#ifdef CONFIG_PM
 static int rm_tch_suspend(struct device *dev)
 {
        struct rm_tch_ts *ts = dev_get_drvdata(dev);
@@ -1771,7 +1771,7 @@ static int rm_tch_resume(struct device *dev)
        return 0;
 }
 
-#if defined(CONFIG_HAS_EARLYSUSPEND)
+#ifdef CONFIG_HAS_EARLYSUSPEND
 static void rm_tch_early_suspend(struct early_suspend *es)
 {
        struct rm_tch_ts *ts;
@@ -1797,12 +1797,13 @@ static void rm_tch_early_resume(struct early_suspend *es)
                dev_err(dev, "Raydium - %s : failed\n", __func__);
        }
 }
-#else
+#endif                 /*CONFIG_HAS_EARLYSUSPEND*/
+
+#ifdef CONFIG_PM
 static const struct dev_pm_ops rm_tch_pm_ops = {
        .suspend = rm_tch_suspend,
        .resume = rm_tch_resume,
 };
-#endif                 /*CONFIG_HAS_EARLYSUSPEND*/
 #endif                 /*CONFIG_PM*/
 
 /* NVIDIA 20121026 */
@@ -1810,14 +1811,11 @@ static const struct dev_pm_ops rm_tch_pm_ops = {
 static int rm_tch_input_enable(struct input_dev *in_dev)
 {
        int error = 0;
-
-#ifdef CONFIG_PM
        struct rm_tch_ts *ts = input_get_drvdata(in_dev);
 
        error = rm_tch_resume(ts->dev);
        if (error)
                dev_err(ts->dev, "Raydium - %s : failed\n", __func__);
-#endif
 
        return error;
 }
@@ -1825,14 +1823,11 @@ static int rm_tch_input_enable(struct input_dev *in_dev)
 static int rm_tch_input_disable(struct input_dev *in_dev)
 {
        int error = 0;
-
-#ifdef CONFIG_PM
        struct rm_tch_ts *ts = input_get_drvdata(in_dev);
 
        error = rm_tch_suspend(ts->dev);
        if (error)
                dev_err(ts->dev, "Raydium - %s : failed\n", __func__);
-#endif
 
        return error;
 }
@@ -1927,7 +1922,7 @@ struct rm_tch_ts *rm_tch_input_init(struct device *dev, unsigned int irq,
                goto err_free_mem;
        }
        mutex_init(&ts->access_mutex);
-#if defined(CONFIG_HAS_EARLYSUSPEND)
+#ifdef CONFIG_HAS_EARLYSUSPEND
        ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
        ts->early_suspend.suspend = rm_tch_early_suspend;
        ts->early_suspend.resume = rm_tch_early_resume;
@@ -2332,7 +2327,7 @@ err_regulator_init:
        spi_set_drvdata(spi, NULL);
        input_unregister_device(ts->input);
        sysfs_remove_group(&ts->dev->kobj, &rm_ts_attr_group);
-#if defined(CONFIG_HAS_EARLYSUSPEND)
+#ifdef CONFIG_HAS_EARLYSUSPEND
        unregister_early_suspend(&ts->early_suspend);
 #endif
        mutex_destroy(&ts->access_mutex);
@@ -2354,11 +2349,9 @@ static struct spi_driver rm_tch_spi_driver = {
                .name = "rm_ts_spidev",
                .bus = &spi_bus_type,
                .owner = THIS_MODULE,
-#if !defined(CONFIG_HAS_EARLYSUSPEND)
-#if defined(CONFIG_PM)
+#if defined(CONFIG_PM) && !defined(CTRL_BY_POWER_HAL)
                .pm = &rm_tch_pm_ops,
 #endif
-#endif
        },
        .probe = rm_tch_spi_probe,
        .remove = rm_tch_spi_remove,