Add fallback power config values for Atmel T7
authorCharlie Mooney <charliemooney@chromium.org>
Mon, 8 Apr 2013 17:16:36 +0000 (10:16 -0700)
committerChromeBot <chrome-bot@google.com>
Tue, 9 Apr 2013 16:01:34 +0000 (09:01 -0700)
commit2966c172902048d7d4f53de84b633b210cdd3680
treebb3e42fcd8e49164f670d88bd905208a5cf7e0b7
parent189efdac2409ac05d298e67f65086f405900acd2
Add fallback power config values for Atmel T7

On suspend the atmel driver backs up the power configuration (T7) so
that it can restore it later on resume.  If the i2c transaction fails
when it's trying to read the current T7 config it sets a flag saying
that it was unable to back up the config, and then won't try to restore
it when the machine resumes.

A problem occurs if the i2c transaction to read the current config to
back it up on suspend fails, but the driver is still able to turn off
the touchpad.  Then on resume, it sees that it had failed to backup the
old values and never restores the T7 object.  As a result the
touchscreen/pad never wakes up.

Suspend:
 1) Read current T7 config and back it up
 2) Overwrite current config with suspend config
Resume
 3) restore value stored in step 1

So if step 1 fails, but step 2 succedes we run into a dead touch device
on resume.  Reboot fixes everything, however.

This patch adds in some default values in the event that a failed backup
config is detected and makes sure the device actually gets turned on no
matter what on resume.

BUG=chrome-os-partner:17621
TEST=manually tested on Link

Change-Id: I325efae0eb2d801d07898ad29a09e3162e5b79e5
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47564
Reviewed-by: Yufeng Shen <miletus@chromium.org>
drivers/input/touchscreen/atmel_mxt_ts.c