All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hui Wang <hui.wang@canonical.com>
To: linux-input@vger.kernel.org, jikos@kernel.org,
	benjamin.tissoires@redhat.com
Subject: [PATCH 2/2] HID: i2c-hid: Add a quirk to keep the power in shutdown
Date: Fri,  4 Dec 2020 23:29:12 +0800	[thread overview]
Message-ID: <20201204152912.151604-2-hui.wang@canonical.com> (raw)
In-Reply-To: <20201204152912.151604-1-hui.wang@canonical.com>

On the latest Thinkpad Yoga laptop, the touchscreen module is wacom
I2C WACF2200 (056a:5276), we found the touchscreen could not work
after rebooting, needs to poweroff the machine then poweron the
machine to let it work.

It is highly possible that this is a BIOS issue, but the windows
doesn't have this problem with the same BIOS.

If keeping the power on when calling shutdown, the touchscreen could
work after rebooting. Let us add a quirk for it and apply the quirk
to this machine only.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 drivers/hid/hid-ids.h              |  1 +
 drivers/hid/i2c-hid/i2c-hid-core.c | 20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index f170feaac40b..ecc1d4040b6f 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1223,6 +1223,7 @@
 #define USB_VENDOR_ID_WACOM		0x056a
 #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH	0x81
 #define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH   0x00BD
+#define USB_DEVICE_ID_WACOM_5276		0x5276
 
 #define USB_VENDOR_ID_WALTOP				0x172f
 #define USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH	0x0032
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 953877cf1051..7c6d5b8175fd 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -51,7 +51,7 @@
 #define I2C_HID_QUIRK_BOGUS_IRQ			BIT(4)
 #define I2C_HID_QUIRK_RESET_ON_RESUME		BIT(5)
 #define I2C_HID_QUIRK_BAD_INPUT_SIZE		BIT(6)
-
+#define I2C_HID_QUIRK_KEEP_PWR_ON_SHUTDOWN	BIT(7)
 
 /* flags */
 #define I2C_HID_STARTED		0
@@ -183,6 +183,20 @@ static const struct i2c_hid_quirks {
 		 I2C_HID_QUIRK_RESET_ON_RESUME },
 	{ USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
 		I2C_HID_QUIRK_BAD_INPUT_SIZE },
+	{
+		.idVendor = USB_VENDOR_ID_WACOM,
+		.idProduct = USB_DEVICE_ID_WACOM_5276,
+		.quirks = I2C_HID_QUIRK_KEEP_PWR_ON_SHUTDOWN,
+		.dmi_table = (const struct dmi_system_id []) {
+			{
+				.matches = {
+					DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+					DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "LENOVO_MT_20XY_BU_Think_FM_ThinkPad X1 Yoga Gen 6"),
+				}
+			},
+			{}
+		}
+	},
 	{ 0, 0 }
 };
 
@@ -1182,7 +1196,9 @@ static void i2c_hid_shutdown(struct i2c_client *client)
 {
 	struct i2c_hid *ihid = i2c_get_clientdata(client);
 
-	i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
+	if (!(ihid->quirks & I2C_HID_QUIRK_KEEP_PWR_ON_SHUTDOWN))
+		i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
+
 	free_irq(client->irq, ihid);
 
 	i2c_hid_acpi_shutdown(&client->dev);
-- 
2.25.1


  reply	other threads:[~2020-12-04 15:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 15:29 [PATCH 1/2] HID: i2c-hid: expand the quirk lookup table to support dmi_table Hui Wang
2020-12-04 15:29 ` Hui Wang [this message]
2021-01-07  9:12   ` [PATCH 2/2] HID: i2c-hid: Add a quirk to keep the power in shutdown Jiri Kosina
2021-01-07 11:46     ` Hui Wang
2021-01-08 15:01       ` Jiri Kosina
2021-01-26  8:57         ` Hui Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201204152912.151604-2-hui.wang@canonical.com \
    --to=hui.wang@canonical.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.