HACK: Input: elants_i2c - clear interrupt at resume

If a device is using edge-triggered interrupt, then, when it gets
enabled with enable_irq(), and edge came while interrupt was disabled,
the kernel is supposed to replay the interrupt. Unfortunately it does
not seem to happen on some devices. As a workaround, let's read and
discard the data from the device, so interrupt is cleared before it is

TEST=Suspend/resume on different version of Candy, ensure touchscreen

Change-Id: Ic38ab11f842dec2c12de71593113f89c120ad839
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/517282
Reviewed-by: Benson Leung <bleung@chromium.org>
(cherry picked from commit f495ada03ddc7b546850cd0d0f9b29baf364c02e)
Reviewed-on: https://chromium-review.googlesource.com/518000
Reviewed-by: Guenter Roeck <groeck@chromium.org>
diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 6880dcd..06d40b3 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -1402,6 +1402,15 @@
 	ts->state = ELAN_STATE_NORMAL;
+	/*
+	 * FIXME: Clear interrupts by reading data from the chip.
+	 * The kernel is supposed to replay edge-triggered interrupts
+	 * when we enable them, but this does not seem to happen
+	 * on some devices.
+	 */
+	(void) i2c_master_recv(client, ts->buf, sizeof(ts->buf));
 	return 0;