Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1294988

Re: [RESEND] Lenovo Yoga 900 touchpad issues

From Mika Westerberg <mika.westerberg@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [RESEND] Lenovo Yoga 900 touchpad issues
Date 2015-12-18 16:50 +0100
Message-ID <qH5s6-7vm-23@gated-at.bofh.it> (permalink)
References <qG3iG-8mS-21@gated-at.bofh.it> <qGgzg-8nq-13@gated-at.bofh.it> <qGtd8-7St-9@gated-at.bofh.it> <qH4w2-6U7-17@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


On Fri, Dec 18, 2015 at 04:42:09PM +0200, Mika Westerberg wrote:
> On another occasion the faulty input report was received immediatelly
> after we call i2c_hid_set_power().
> 
> With below hack patch suspend/resume works fine but it is far from being
> suitable for merging. Still, it would be nice if you could try it out
> and see if it helps in your case.

Actually it looks like we can handle this by just ignoring input reports
while we are resetting the device. Following seems to work as well.

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 10bd8e6..eeaf33a 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -352,13 +352,24 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
 static int i2c_hid_hwreset(struct i2c_client *client)
 {
 	struct i2c_hid *ihid = i2c_get_clientdata(client);
+	bool started;
 	int ret;
 
 	i2c_hid_dbg(ihid, "%s\n", __func__);
 
+	/*
+	 * Some touchpads seem to send input reports once their power is
+	 * turned back on after resume. This confuses our reset logic
+	 * below.
+	 *
+	 * Prevent handling any input reports while we are resetting the
+	 * device.
+	 */
+	started = test_and_clear_bit(I2C_HID_STARTED, &ihid->flags);
+
 	ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
 	if (ret)
-		return ret;
+		goto out;
 
 	i2c_hid_dbg(ihid, "resetting...\n");
 
@@ -366,10 +377,14 @@ static int i2c_hid_hwreset(struct i2c_client *client)
 	if (ret) {
 		dev_err(&client->dev, "failed to reset device.\n");
 		i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
-		return ret;
+		goto out;
 	}
 
-	return 0;
+out:
+	if (started)
+		set_bit(I2C_HID_STARTED, &ihid->flags);
+
+	return ret;
 }
 
 static void i2c_hid_get_input(struct i2c_hid *ihid)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RESEND] Lenovo Yoga 900 touchpad issues Nish Aravamudan <nish.aravamudan@gmail.com> - 2015-12-15 20:20 +0100
  Re: [RESEND] Lenovo Yoga 900 touchpad issues Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-12-16 10:30 +0100
    Re: [RESEND] Lenovo Yoga 900 touchpad issues Jiri Kosina <jikos@kernel.org> - 2015-12-16 14:20 +0100
      Re: [RESEND] Lenovo Yoga 900 touchpad issues Nish Aravamudan <nish.aravamudan@gmail.com> - 2015-12-17 00:00 +0100
        Re: [RESEND] Lenovo Yoga 900 touchpad issues Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2015-12-17 11:00 +0100
          Re: [RESEND] Lenovo Yoga 900 touchpad issues Nish Aravamudan <nish.aravamudan@gmail.com> - 2015-12-17 18:00 +0100
            Re: [RESEND] Lenovo Yoga 900 touchpad issues Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2015-12-17 18:30 +0100
              Re: [RESEND] Lenovo Yoga 900 touchpad issues Nish Aravamudan <nish.aravamudan@gmail.com> - 2015-12-17 18:40 +0100
    Re: [RESEND] Lenovo Yoga 900 touchpad issues Nish Aravamudan <nish.aravamudan@gmail.com> - 2015-12-17 00:00 +0100
      Re: [RESEND] Lenovo Yoga 900 touchpad issues Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-12-18 15:50 +0100
        Re: [RESEND] Lenovo Yoga 900 touchpad issues Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-12-18 16:50 +0100
          Re: [RESEND] Lenovo Yoga 900 touchpad issues Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2015-12-18 17:20 +0100
            Re: [RESEND] Lenovo Yoga 900 touchpad issues Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-12-21 12:40 +0100
          Re: [RESEND] Lenovo Yoga 900 touchpad issues Nish Aravamudan <nish.aravamudan@gmail.com> - 2015-12-18 19:00 +0100

csiph-web