]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
CHROMIUM: Input: atmel_mxt_ts - Set T9 in mxt_resume based on lid state
authorBenson Leung <bleung@chromium.org>
Mon, 28 Jan 2013 23:26:25 +0000 (15:26 -0800)
committerBenson Leung <bleung@chromium.org>
Tue, 29 Jan 2013 06:11:38 +0000 (22:11 -0800)
This is an x86 specific change for the short term.
When the lid is closed on resume, make sure T9 is disabled.
to prevent the lid from affecting the touch device and causing
stray touches. If lid is open, restore operational settings for T9.

Signed-off-by: Benson Leung <bleung@chromium.org>
BUG=chrome-os-partner:17465
TEST=Close the lid to suspend in guest mode.
Open the lid slowly, until you see the lights indicating resuming.
Close the lid immediately upon seeing the system resume from
the status light.
The system should stay in S0. Check via ssh:
cat /sys/kernel/debug/atmel_mxt_ts/2-004a/object
Check that T9 is 0x00.
On a normal suspend/resume, where the lid is opened,
check that touch device is functional.

Change-Id: I8b671c5926f510228af6327985b2c6717d226c1a
Reviewed-on: https://gerrit.chromium.org/gerrit/42184
Reviewed-by: Puneet Kumar <puneetster@chromium.org>
Commit-Queue: Benson Leung <bleung@chromium.org>
Tested-by: Benson Leung <bleung@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42214
Reviewed-by: Danielle Drew <ddrew@chromium.org>
drivers/input/touchscreen/atmel_mxt_ts.c

index af9d7956a6448cee7cc15fd1f1c16ae25f4e3489..8142d4fe168804267e42e38502a06b9803844b65 100644 (file)
@@ -2854,15 +2854,6 @@ static int mxt_suspend(struct device *dev)
                dev_err(dev, "Save T9 ctrl config failed, %d\n", ret);
        data->T9_ctrl_valid = (ret == 0);
 
-#if defined(CONFIG_ACPI_BUTTON)
-       ret = acpi_lid_open();
-       if (ret == 0) {
-               /* lid is closed. set T9_ctrl to operational on resume */
-               data->T9_ctrl = MXT_TOUCH_CTRL_OPERATIONAL;
-               data->T9_ctrl_valid = true;
-       }
-#endif
-
        /*
         *  For tpads, save T42 and T19 ctrl registers if may wakeup,
         *  enable large object suppression, and disable button wake.
@@ -2942,6 +2933,19 @@ static int mxt_resume(struct device *dev)
 
        mutex_lock(&input_dev->mutex);
 
+#if defined(CONFIG_ACPI_BUTTON)
+       ret = acpi_lid_open();
+       if (ret == 0) {
+               /* lid is closed. set T9_ctrl to non operational resume */
+               data->T9_ctrl = MXT_TOUCH_CTRL_OFF;
+               data->T9_ctrl_valid = true;
+       } else if (ret == 1) {
+               /* lid is open. Set to operational */
+               data->T9_ctrl = MXT_TOUCH_CTRL_OPERATIONAL;
+               data->T9_ctrl_valid = true;
+       }
+#endif
+
        /* Restore the T9 Ctrl config to before-suspend value */
        if (data->T9_ctrl_valid) {
                ret = mxt_set_regs(data, MXT_TOUCH_MULTI_T9, 0, 0,