From: Hans de Goede <hdegoede@redhat.com>
To: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org
Subject: [PATCH 2/2] HID: i2c-hid: Do not register i2c_hid_driver on devices with CHPN0001 touchscreen
Date: Sun, 18 Jun 2017 12:14:48 +0200 [thread overview]
Message-ID: <20170618101448.17734-3-hdegoede@redhat.com> (raw)
In-Reply-To: <20170618101448.17734-1-hdegoede@redhat.com>
The CHPN0001 ACPI device has a _CID of PNP0C50 but is not HID compatible,
it uses its own protocol which is handled by the chipone_icn8318 driver.
Registering the i2c_hid_driver first will cause probing to fail with a
"hid_descr_cmd failed" error.
Worse, after the probe failure the i2c / ACPI core code will put the ACPI
device in D3 state and when the chipone_icn8318 driver then loads the
device is put back in D0 state, executing its PS0 ACPI method, which
resets the controller, causing the controller to loose its firmware
which was loaded by the BIOS. The chipone_icn8318 driver has a workaround
for this, but that requires it to be the only (or the first) driver to
probe the device.
This commit adds a check for the presence of a CHPN0001 ACPI device to
i2c-hid and makes it not register the i2c_hid_driver on systems with this
touchscreen fixing the controller losing its firmware.
Note that acpi_dev_present is a stub always returning false on platforms
without ACPI so for non ACPI platforms this patch is a no-op.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/hid/i2c-hid/i2c-hid.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 54b53d8f96ce..71a040d421c6 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -1278,6 +1278,14 @@ static struct i2c_driver i2c_hid_driver = {
static int __init i2c_hid_init(void)
{
+ /*
+ * The CHPN0001 ACPI device has a _CID of PNP0C50 but is not HID
+ * compatible, just probing it puts the device in an unusable state due
+ * to it also have ACPI power management issues.
+ */
+ if (acpi_dev_present("CHPN0001", NULL, -1))
+ return -ENODEV;
+
return i2c_add_driver(&i2c_hid_driver);
}
module_init(i2c_hid_init);
--
2.13.0
next prev parent reply other threads:[~2017-06-18 10:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-18 10:14 [PATCH 0/2] HID: i2c-hid: Do not register i2c_hid_driver on devices with a CHPN0001 touchscreen Hans de Goede
2017-06-18 10:14 ` [PATCH 1/2] HID: i2c-hid: Expand module_i2c_driver macro Hans de Goede
2017-06-18 10:14 ` Hans de Goede [this message]
2017-06-27 12:26 ` [PATCH 0/2] HID: i2c-hid: Do not register i2c_hid_driver on devices with a CHPN0001 touchscreen Jiri Kosina
2017-06-27 12:48 ` Benjamin Tissoires
2017-06-27 13:13 ` Hans de Goede
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=20170618101448.17734-3-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=benjamin.tissoires@redhat.com \
--cc=dmitry.torokhov@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).