input: touch: maxim: Refine power control
Xiaohui Tao [Thu, 29 Aug 2013 00:18:01 +0000 (17:18 -0700)]
(1) Move regulator control from threaded func to probe func since
the current machanism will kill the direct touch daemon and restart
it when it is not responding. Keeping the regulator code there will
make ref count go up, which will keep the power rail always on.

(2) Do not call suspend/resume in display off case for touch. Touch
suspend/resume should be consistent with display off/on. There is no
need to turn touch on/off in display off case.

Bug 1353325
Bug 1350928

Change-Id: Id9719f04398be0032faf2c9f685400b292458b06
Signed-off-by: Xiaohui Tao <xtao@nvidia.com>
Reviewed-on: http://git-master/r/267625
(cherry picked from commit 9700803ce3d59714dbc50d425f77d9c0b986c9c9)
Reviewed-on: http://git-master/r/271075
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>

drivers/input/touchscreen/maxim_sti.c

index 94b1f71..d6b8df6 100644 (file)
@@ -1181,15 +1181,6 @@ static int processing_thread(void *arg)
                                if (ret != 0)
                                        msleep(100);
                        } while (ret != 0 && !kthread_should_stop());
-
-                       /* power-up and reset-high */
-                       ret = regulator_control(dd, true);
-                       if (ret < 0)
-                               ERROR("failed to enable regulators");
-
-                       usleep_range(300, 400);
-                       pdata->reset(pdata, 1);
-
                        dd->start_fusion = false;
                }
                if (kthread_should_stop())
@@ -1312,6 +1303,13 @@ static int probe(struct spi_device *spi)
        if (ret < 0)
                goto platform_failure;
 
+       /* power-up and reset-high */
+       ret = regulator_control(dd, true);
+       if (ret < 0)
+               goto platform_failure;
+       usleep_range(300, 400);
+       pdata->reset(pdata, 1);
+
        /* start processing thread */
        dd->thread_sched.sched_priority = MAX_USER_RT_PRIO / 2;
        dd->thread = kthread_run(processing_thread, dd, pdata->nl_family);
@@ -1459,7 +1457,7 @@ static struct spi_driver driver = {
        .driver = {
                .name   = MAXIM_STI_NAME,
                .owner  = THIS_MODULE,
-#ifdef CONFIG_PM_SLEEP
+#if defined(CONFIG_PM_SLEEP) && !INPUT_ENABLE_DISABLE
                .pm     = &pm_ops,
 #endif
        },