[PATCH] HID: Add quirk for Lenovo Yoga 910 with ITE Chips

Subsystems: hid core layer, hid sensor hub drivers, the rest

STALE3361d

7 messages, 5 authors, 2017-08-01 · open the first message on its own page

[PATCH] HID: Add quirk for Lenovo Yoga 910 with ITE Chips

From: Patrick Pedersen <hidden>
Date: 2017-07-15 12:27:28

As with previous generations of this device (see https://patchwork.kernel.org/patch/7887361/), the ITE
HID Sensor Hub, responsible for the accelerometer and als sensor, requires a quirk entry.

Without the entry, the Sensor Hub can't be accessed and the kernel fails to report any movements. As a result
iio-sensor-proxy receives no new data.

It shall additionally be noted that the i2c-hid 'sleep' bug (present since kernel ver. 4.3)
still affects the driver. This means that the sensor hub will not report any movement, until
the device is suspended and resumed.

Signed-off-by: Patrick Pedersen <redacted>
---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++
 2 files changed, 4 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 4f9a3938189a..b427a0bcfbe8 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -565,6 +565,7 @@
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA   0x8386
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA2  0x8350
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA900	0x8396
+#define USB_DEVICE_ID_ITE_LENOVO_YOGA910	0x8186
 
 #define USB_VENDOR_ID_JABRA		0x0b0e
 #define USB_DEVICE_ID_JABRA_SPEAK_410	0x0412
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 4ef73374a8f9..85b8425483bd 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -820,6 +820,9 @@ static const struct hid_device_id sensor_hub_devices[] = {
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_ITE,
 			USB_DEVICE_ID_ITE_LENOVO_YOGA900),
 			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_ITE,
+			USB_DEVICE_ID_ITE_LENOVO_YOGA910),
+			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_0,
 			0x22D8),
 			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
-- 
2.13.3

Re: [PATCH] HID: Add quirk for Lenovo Yoga 910 with ITE Chips

From: Bastien Nocera <hadess@hadess.net>
Date: 2017-07-15 14:30:07

On Sat, 2017-07-15 at 14:27 +0200, Patrick Pedersen wrote:
quoted hunk
As with previous generations of this device (see https://patchwork.ke
rnel.org/patch/7887361/), the ITE
HID Sensor Hub, responsible for the accelerometer and als sensor,
requires a quirk entry.

Without the entry, the Sensor Hub can't be accessed and the kernel
fails to report any movements. As a result
iio-sensor-proxy receives no new data.

It shall additionally be noted that the i2c-hid 'sleep' bug (present
since kernel ver. 4.3)
still affects the driver. This means that the sensor hub will not
report any movement, until
the device is suspended and resumed.

Signed-off-by: Patrick Pedersen <redacted>
---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++
 2 files changed, 4 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 4f9a3938189a..b427a0bcfbe8 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -565,6 +565,7 @@
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA   0x8386
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA2  0x8350
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA900	0x8396
+#define USB_DEVICE_ID_ITE_LENOVO_YOGA910	0x8186
 
 #define USB_VENDOR_ID_JABRA		0x0b0e
 #define USB_DEVICE_ID_JABRA_SPEAK_410	0x0412
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-
hub.c
index 4ef73374a8f9..85b8425483bd 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -820,6 +820,9 @@ static const struct hid_device_id
sensor_hub_devices[] = {
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB,
USB_VENDOR_ID_ITE,
 			USB_DEVICE_ID_ITE_LENOVO_YOGA900),
 			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB,
USB_VENDOR_ID_ITE,
+			USB_DEVICE_ID_ITE_LENOVO_YOGA910),
+			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB,
USB_VENDOR_ID_INTEL_0,
 			0x22D8),
 			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
At this point, wouldn't it make sense to apply the quirk to *all* ITE
devices in Lenovo Yoga laptops?

Re: [PATCH] HID: Add quirk for Lenovo Yoga 910 with ITE Chips

From: Arek Burdach <hidden>
Date: 2017-07-16 07:39:27

Hi Patrick,

On 15.07.2017 14:27, Patrick Pedersen wrote:
It shall additionally be noted that the i2c-hid 'sleep' bug (present since kernel ver. 4.3)
still affects the driver. This means that the sensor hub will not report any movement, until
the device is suspended and resumed.
Do you have workaround for that? In my case suspending and resuming doesn't help. Sensor reporting is backing to work in unpredictable way. What I've tested:

- kernel v4.13-rc1 with your patch applied
- watch -n1 cat /sys/bus/iio/devices/iio\:device*/*_raw <- value not changing
- suspend
- resume
- watch -n1 cat /sys/bus/iio/devices/iio\:device*/*_raw <- still not changing

If you have some workaround scenario please add it to bug reported be me: https://bugzilla.kernel.org/show_bug.cgi?id=195681

Cheers,
Arek

Re: [PATCH] HID: Add quirk for Lenovo Yoga 910 with ITE Chips

From: Brian Masney <hidden>
Date: 2017-07-16 10:23:47

On Sun, Jul 16, 2017 at 09:39:19AM +0200, Arek Burdach wrote:
Hi Patrick,

On 15.07.2017 14:27, Patrick Pedersen wrote:
quoted
It shall additionally be noted that the i2c-hid 'sleep' bug (present since kernel ver. 4.3)
still affects the driver. This means that the sensor hub will not report any movement, until
the device is suspended and resumed.
Do you have workaround for that? In my case suspending and resuming doesn't
help. Sensor reporting is backing to work in unpredictable way. What I've
tested:

- kernel v4.13-rc1 with your patch applied
- watch -n1 cat /sys/bus/iio/devices/iio\:device*/*_raw <- value not
changing
- suspend
- resume
- watch -n1 cat /sys/bus/iio/devices/iio\:device*/*_raw <- still not
changing

If you have some workaround scenario please add it to bug reported be me:
https://bugzilla.kernel.org/show_bug.cgi?id=195681
I have a Lenovo Yoga 910-13IKB and verified that the patch works
correctly for me on an upstream 4.12 kernel. The ALS sensor and
accelerometer function correctly without suspending the laptop with
this patch. The difference may be due the following kernel boot options
that I use:

	i915.enable_rc6=0 pci=noaer intel_pstate=disable

I have to disable power management for the CPU/GPU (i915.enable_rc6=0)
since I can only suspend and resume once on this laptop. Suspending a
second time will cause the laptop to hang before the suspend finishes.

The pci=noaer is likely not needed for UEFI firmware revisions 2JCN36WW
and newer. I'm stuck on UEFI firmware revision 2JCN28WW, which is what
came preinstalled on the system. Lenovo's UEFI update tool requires
Windows, which I no longer have.

I need to get on the latest UEFI revision and go through
basic-pm-debugging.txt if the power management issues are still present.

Brian

Re: [PATCH] HID: Add quirk for Lenovo Yoga 910 with ITE Chips

From: Arek Burdach <hidden>
Date: 2017-07-17 06:26:44


On 16.07.2017 12:23, Brian Masney wrote:
On Sun, Jul 16, 2017 at 09:39:19AM +0200, Arek Burdach wrote:
quoted
Hi Patrick,

On 15.07.2017 14:27, Patrick Pedersen wrote:
quoted
It shall additionally be noted that the i2c-hid 'sleep' bug (present since kernel ver. 4.3)
still affects the driver. This means that the sensor hub will not report any movement, until
the device is suspended and resumed.
Do you have workaround for that? In my case suspending and resuming doesn't
help. Sensor reporting is backing to work in unpredictable way. What I've
tested:

- kernel v4.13-rc1 with your patch applied
- watch -n1 cat /sys/bus/iio/devices/iio\:device*/*_raw <- value not
changing
- suspend
- resume
- watch -n1 cat /sys/bus/iio/devices/iio\:device*/*_raw <- still not
changing

If you have some workaround scenario please add it to bug reported be me:
https://bugzilla.kernel.org/show_bug.cgi?id=195681
I have a Lenovo Yoga 910-13IKB
So do I
  and verified that the patch works
correctly for me on an upstream 4.12 kernel. The ALS sensor and
accelerometer function correctly without suspending the laptop with
this patch. The difference may be due the following kernel boot options
that I use:

	i915.enable_rc6=0 pci=noaer intel_pstate=disable

I have to disable power management for the CPU/GPU (i915.enable_rc6=0)
since I can only suspend and resume once on this laptop. Suspending a
second time will cause the laptop to hang before the suspend finishes.

The pci=noaer is likely not needed for UEFI firmware revisions 2JCN36WW
and newer. I'm stuck on UEFI firmware revision 2JCN28WW, which is what
came preinstalled on the system. Lenovo's UEFI update tool requires
Windows, which I no longer have.

I need to get on the latest UEFI revision and go through
basic-pm-debugging.txt if the power management issues are still present.
I have installed 2JCN36WW and: pci=noaer intel_pstate=disable flags are never need - suspending works ok every time.

I investigated that having iio-sensor-proxy installed may cause sensors stopping to work. Looks like only one option can work in the same time - either iio-sensor-proxy service or sensor reporting of raw data.

Arek

Re: [PATCH] HID: Add quirk for Lenovo Yoga 910 with ITE Chips

From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date: 2017-07-17 19:58:28

On Sat, 2017-07-15 at 14:27 +0200, Patrick Pedersen wrote:
As with previous generations of this device (see https://patchwork.ke
rnel.org/patch/7887361/), the ITE
HID Sensor Hub, responsible for the accelerometer and als sensor,
requires a quirk entry.
I want to get rid of these quirks as this is now the defacto standard.
Can you try with this change without any quirk.
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index 16ade0a..1fb407f 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -110,6 +110,9 @@ static int _hid_sensor_power_state(struct
hid_sensor_common *st, bool state)
        int report_val;
        s32 poll_value = 0;
 
+       st->power_state.logical_minimum = 1;
+       st->report_state.logical_minimum = 1;
+
        if (state) {
                if (!atomic_read(&st->user_requested_state))
                        return 0;


Thanks,
Srinivas
quoted hunk
Without the entry, the Sensor Hub can't be accessed and the kernel
fails to report any movements. As a result
iio-sensor-proxy receives no new data.

It shall additionally be noted that the i2c-hid 'sleep' bug (present
since kernel ver. 4.3)
still affects the driver. This means that the sensor hub will not
report any movement, until
the device is suspended and resumed.

Signed-off-by: Patrick Pedersen <redacted>
---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++
 2 files changed, 4 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 4f9a3938189a..b427a0bcfbe8 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -565,6 +565,7 @@
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA   0x8386
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA2  0x8350
 #define USB_DEVICE_ID_ITE_LENOVO_YOGA900	0x8396
+#define USB_DEVICE_ID_ITE_LENOVO_YOGA910	0x8186
 
 #define USB_VENDOR_ID_JABRA		0x0b0e
 #define USB_DEVICE_ID_JABRA_SPEAK_410	0x0412
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-
hub.c
index 4ef73374a8f9..85b8425483bd 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -820,6 +820,9 @@ static const struct hid_device_id
sensor_hub_devices[] = {
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB,
USB_VENDOR_ID_ITE,
 			USB_DEVICE_ID_ITE_LENOVO_YOGA900),
 			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB,
USB_VENDOR_ID_ITE,
+			USB_DEVICE_ID_ITE_LENOVO_YOGA910),
+			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB,
USB_VENDOR_ID_INTEL_0,
 			0x22D8),
 			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},

Re: [PATCH] HID: Add quirk for Lenovo Yoga 910 with ITE Chips

From: Patrick <hidden>
Date: 2017-08-01 12:23:26

Sorry for the late response.

I can confirm that the ITE8186 hub successfully reports input data
on the latest linux-next release with the linked patch applied and no
quirks added.

On Mon, Jul 17, 2017 at 12:58:14PM -0700, Srinivas Pandruvada wrote:
quoted hunk
On Sat, 2017-07-15 at 14:27 +0200, Patrick Pedersen wrote:
quoted
As with previous generations of this device (see https://patchwork.ke
rnel.org/patch/7887361/), the ITE
HID Sensor Hub, responsible for the accelerometer and als sensor,
requires a quirk entry.
I want to get rid of these quirks as this is now the defacto standard.
Can you try with this change without any quirk.
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index 16ade0a..1fb407f 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -110,6 +110,9 @@ static int _hid_sensor_power_state(struct
hid_sensor_common *st, bool state)
????????????????int report_val;
????????????????s32 poll_value = 0;
??
+??????????????st->power_state.logical_minimum = 1;
+??????????????st->report_state.logical_minimum = 1;
+
????????????????if (state) {
????????????????????????????????if (!atomic_read(&st->user_requested_state))
????????????????????????????????????????????????return 0;


Thanks,
Srinivas
quoted
Without the entry, the Sensor Hub can't be accessed and the kernel
fails to report any movements. As a result
iio-sensor-proxy receives no new data.

It shall additionally be noted that the i2c-hid 'sleep' bug (present
since kernel ver. 4.3)
still affects the driver. This means that the sensor hub will not
report any movement, until
the device is suspended and resumed.

Signed-off-by: Patrick Pedersen <redacted>
---
??drivers/hid/hid-ids.h????????????????| 1 +
??drivers/hid/hid-sensor-hub.c | 3 +++
??2 files changed, 4 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 4f9a3938189a..b427a0bcfbe8 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -565,6 +565,7 @@
??#define USB_DEVICE_ID_ITE_LENOVO_YOGA??????0x8386
??#define USB_DEVICE_ID_ITE_LENOVO_YOGA2????0x8350
??#define USB_DEVICE_ID_ITE_LENOVO_YOGA900	0x8396
+#define USB_DEVICE_ID_ITE_LENOVO_YOGA910	0x8186
??
??#define USB_VENDOR_ID_JABRA		0x0b0e
??#define USB_DEVICE_ID_JABRA_SPEAK_410	0x0412
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-
hub.c
index 4ef73374a8f9..85b8425483bd 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -820,6 +820,9 @@ static const struct hid_device_id
sensor_hub_devices[] = {
??	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB,
USB_VENDOR_ID_ITE,
??			USB_DEVICE_ID_ITE_LENOVO_YOGA900),
??			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB,
USB_VENDOR_ID_ITE,
+			USB_DEVICE_ID_ITE_LENOVO_YOGA910),
+			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
??	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB,
USB_VENDOR_ID_INTEL_0,
??			0x22D8),
??			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help