From: Benson Leung Date: Mon, 28 Jan 2013 23:26:25 +0000 (-0800) Subject: CHROMIUM: Input: atmel_mxt_ts - Set T9 in mxt_resume based on lid state X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8e14963ec7b200d0500c3e18ac606ccf6becfc3a;p=people%2Faperard%2Flinux-chromebook.git CHROMIUM: Input: atmel_mxt_ts - Set T9 in mxt_resume based on lid state 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 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 Commit-Queue: Benson Leung Tested-by: Benson Leung Reviewed-on: https://gerrit.chromium.org/gerrit/42214 Reviewed-by: Danielle Drew --- diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index af9d7956a6448..8142d4fe16880 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -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,