Skip to contentSkip to conversation

HID: Add quirk for Lenovo Yoga 910 with ITE Chips

PATCH In review Patrick Pedersen 5 participants 12 messages Jul 15, 2017 – Aug 1, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: Add quirk for Lenovo Yoga 910 with ITE Chips

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.

---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++
 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
index 4f9a3938189a..b427a0bcfbe8 100644
@@ -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
drivers/hid/hid-sensor-hub.c +3 -0
index 4ef73374a8f9..85b8425483bd 100644
@@ -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},
Signature · 1 line
2.13.3
#1 lore raw
Quoted 50 lines · Patrick Pedersen

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.

---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++
 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
index 4f9a3938189a..b427a0bcfbe8 100644
@@ -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
drivers/hid/hid-sensor- renamed from drivers/hid/hid-sensor-hub.c +0 -0

hub.c
index 4ef73374a8f9..85b8425483bd 100644

drivers/hid/hid-sensor-hub.c +3 -0
@@ -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,

drivers/hid/hid-sensor-hub.c static const struct hid_device_id sensor_hub_devices[] = { · line 828

Quoted 2 lines
drivers/hid/hid-sensor-hub.c +0 -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?

#2 lore raw
Quoted 48 lines · Bastien Nocera
Quoted 47 lines · Patrick Pedersen

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.

---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++
 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
index 4f9a3938189a..b427a0bcfbe8 100644
@@ -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
drivers/hid/hid-sensor- renamed from drivers/hid/hid-sensor-hub.c +0 -0

hub.c
index 4ef73374a8f9..85b8425483bd 100644

drivers/hid/hid-sensor-hub.c +2 -0
@@ -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),
Quoted 9 lines
Quoted 5 lines
drivers/hid/hid-sensor-hub.c +1 -0
+                     .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?

I'm not sure If I got your suggestion right.

Those laptops do not share the same ITE chip. ITE is simply the vendor/manufacturer of the hid sensor hub. All three defined yoga laptops use a different ITE sensor hub model.

To make this clear, my device, the
Lenovo Yoga 910 uses a ITE8186,
where the Yoga 900 uses a ITE8396,
the Yoga 2 a ITE8350 and so on

Now what "could" me done, is to detect and set the quirk automatically. This should be doable, as the Hardware PID corresponds to the model number of the Sensor Hub (ex. ITE8186 = PID 0x8186)

#3 lore raw
Quoted 75 lines · Patrick Pedersen
Quoted 53 lines · Bastien Nocera
Quoted 1 line · Patrick Pedersen

As with previous generations of this device (see https://patchwor

k.ke

Quoted 5 lines

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

Quoted 4 lines

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

drivers/hid/hid-

Quoted 24 lines

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.

---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++
 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
index 4f9a3938189a..b427a0bcfbe8 100644
@@ -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
drivers/hid/hid- renamed from drivers/hid/hid-sensor-hub.c +0 -0

sensor-

Quoted 14 lines

hub.c
index 4ef73374a8f9..85b8425483bd 100644

drivers/hid/hid-sensor-hub.c +3 -0
@@ -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},
Quoted 8 lines
Quoted 4 lines

{ 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?

I'm not sure If I got your suggestion right.

Those laptops do not share the same ITE chip. ITE is simply the vendor/manufacturer of the hid sensor hub. All three defined yoga laptops use a different ITE sensor hub model.

To make this clear, my device, the
Lenovo Yoga 910 uses a ITE8186,
where the Yoga 900 uses a ITE8396,
the Yoga 2 a ITE8350 and so on

Quoted 4 lines

Now what "could" me done, is to detect and set the quirk automatically.
This should be doable, as the Hardware PID corresponds to the model number of the Sensor Hub (ex. ITE8186 = PID 0x8186)

I'm saying that if the vendor of the device is USB_VENDOR_ID_ITE and the manufacturer of the hardware is Lenovo in the DMI information, and the model of hardware contains "Yoga", that HID_SENSOR_HUB_ENUM_QUIRK be applied automatically, instead of adding quirks one-by-one.

author
#4 lore raw
Quoted 81 lines · Bastien Nocera
Quoted 75 lines · Patrick Pedersen
Quoted 53 lines · Bastien Nocera
Quoted 1 line · Patrick Pedersen

As with previous generations of this device (see https://patchwor

k.ke

Quoted 5 lines

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

Quoted 4 lines

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

drivers/hid/hid-

Quoted 24 lines

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.

---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++
 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
index 4f9a3938189a..b427a0bcfbe8 100644
@@ -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
drivers/hid/hid- renamed from drivers/hid/hid-sensor-hub.c +0 -0

sensor-

Quoted 14 lines

hub.c
index 4ef73374a8f9..85b8425483bd 100644

drivers/hid/hid-sensor-hub.c +3 -0
@@ -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},
Quoted 8 lines
Quoted 4 lines

{ 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?

I'm not sure If I got your suggestion right.

Those laptops do not share the same ITE chip. ITE is simply the vendor/manufacturer of the hid sensor hub. All three defined yoga laptops use a different ITE sensor hub model.

To make this clear, my device, the
Lenovo Yoga 910 uses a ITE8186,
where the Yoga 900 uses a ITE8396,
the Yoga 2 a ITE8350 and so on

Quoted 4 lines

Now what "could" me done, is to detect and set the quirk automatically.
This should be doable, as the Hardware PID corresponds to the model number of the Sensor Hub (ex. ITE8186 = PID 0x8186)

Quoted 4 lines

I'm saying that if the vendor of the device is USB_VENDOR_ID_ITE and the manufacturer of the hardware is Lenovo in the DMI information, and the model of hardware contains "Yoga", that HID_SENSOR_HUB_ENUM_QUIRK be applied automatically, instead of adding quirks one-by-one.

First of all, I would like to appologise that my previous reply was not caught by the mailing list. I had a frustrating time getting mutt to work and decided to use the gmail web interface. Turns out that was a bad idea. Fortunately it seems like I got things right this time.

Now to the automated ITE chip detection you've proposed. I likely lack the driver and kernel knowledge to implement a feature of such. In the upcoming days I will to do some research on the HID drivers and see what I can do. The goal of this patch was to simply fix the issue for my device, not to find a new or different solution.

Patrick

#7 lore raw
In reply to Patrick Pedersen

Hi Patrick,

Quoted 4 lines · Patrick Pedersen

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

#8 lore raw
Quoted 19 lines · Arek Burdach

Hi Patrick,

Quoted 4 lines · Patrick Pedersen

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

Quoted 2 lines

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

#9 lore raw
Quoted 20 lines · Brian Masney
Quoted 19 lines · Arek Burdach

Hi Patrick,

Quoted 4 lines · Patrick Pedersen

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

Quoted 3 lines
Quoted 2 lines

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

Quoted 12 lines

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.

Quoted 7 lines

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

#10 lore raw
In reply to Patrick Pedersen
Quoted 4 lines · Patrick Pedersen

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.

(quoted diff) +0 -0

b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index 16ade0a..1fb407f 100644

drivers/iio/common/hid-sensors/hid-sensor-trigger.c +0 -0
@@ -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 48 lines

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.

---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++

 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
index 4f9a3938189a..b427a0bcfbe8 100644
@@ -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

drivers/hid/hid-sensor- renamed from drivers/hid/hid-sensor-hub.c +0 -0

hub.c
index 4ef73374a8f9..85b8425483bd 100644

drivers/hid/hid-sensor-hub.c +3 -0
@@ -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},

#5 lore raw
In reply to Patrick
Quoted 25 lines · Patrick
Quoted 24 lines · Bastien Nocera
Quoted 22 lines · Patrick Pedersen
Quoted 18 lines · Bastien Nocera
Quoted 3 lines · Patrick Pedersen

As with previous generations of this device (see https://patc
hwor

k.ke

Quoted 7 lines

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

Quoted 4 lines

fails to report any movements. As a result
iio-sensor-proxy receives no new data.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

It shall additionally be noted that the i2c-hid 'sleep' bug

(present

Quoted 6 lines

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.

Can you try some tests for this for test? I want to see if sensors are powered off or transport didn't wake up? So forcing the sensors to keep power on.

(quoted diff) +0 -0

b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index 16ade0a..a70df7e 100644

drivers/iio/common/hid-sensors/hid-sensor-trigger.c +0 -0
@@ -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;
@@ -146,6 +149,9 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS _ENUM);
        }

+       state_val = 0;
+       report_val = 0;
+
        if (state_val >= 0) {
                state_val += st->power_state.logical_minimum; sensor_hub_set_feature(st->hsdev, st-

Quoted 92 lines

power_state.report_id,

Quoted 62 lines
Quoted 58 lines
Quoted 39 lines

drivers/hid/hid-

Quoted 20 lines

---
 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-sensor-hub.c | 3 +++

 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
index 4f9a3938189a..b427a0bcfbe8 100644
@@ -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
drivers/hid/hid- renamed from drivers/hid/hid-sensor-hub.c +0 -0

sensor-

Quoted 18 lines

hub.c
index 4ef73374a8f9..85b8425483bd 100644

drivers/hid/hid-sensor-hub.c +0 -0
@@ -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,

Quoted 8 lines
Quoted 4 lines

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?

I'm not sure If I got your suggestion right.

Those laptops do not share the same ITE chip. ITE is simply the vendor/manufacturer of the hid sensor hub. All three defined yoga laptops use a different ITE sensor hub model.

To make this clear, my device, the
Lenovo Yoga 910 uses a ITE8186,
where the Yoga 900 uses a ITE8396,
the Yoga 2 a ITE8350 and so on

Quoted 4 lines

Now what "could" me done, is to detect and set the quirk automatically.
This should be doable, as the Hardware PID corresponds to the model number of the Sensor Hub (ex. ITE8186 = PID 0x8186)

Quoted 7 lines

I'm saying that if the vendor of the device is USB_VENDOR_ID_ITE and
the manufacturer of the hardware is Lenovo in the DMI information, and
the model of hardware contains "Yoga", that HID_SENSOR_HUB_ENUM_QUIRK
be applied automatically, instead of adding quirks one-by-one.

First of all, I would like to appologise that my previous reply was not caught by the mailing list. I had a frustrating time getting mutt to work and decided to use the gmail web interface. Turns out that was a bad idea. Fortunately it seems like I got things right this time.

Now to the automated ITE chip detection you've proposed. I likely lack
the driver and kernel knowledge to implement a feature of such. In the
upcoming days I will to do some research on the HID drivers and see what
I can do. The goal of this patch was to simply fix the issue for my device,
not to find a new or different solution.

Patrick

#6 lore raw
Quoted 32 lines · Srinivas Pandruvada
Quoted 31 lines · Patrick
Quoted 30 lines · Bastien Nocera
Quoted 28 lines · Patrick Pedersen

On Sat, Jul 15, 2017 at 4:29 PM, Bastien Nocera <hadess@hadess. ne
t>

Quoted 23 lines · wrote:
Quoted 4 lines · Patrick Pedersen

As with previous generations of this device (see https://pa
tc
hwor

k.ke

Quoted 7 lines

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

Quoted 5 lines

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

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

(present

Quoted 7 lines

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.

Those are the same symptoms as the problem I reported here:
https://www.spinics.net/lists/linux-iio/msg29983.html

Quoted 5 lines

Can you try some tests for this for test? I want to see if sensors are
powered off or transport didn't wake up? So forcing the sensors to keep
power on.

I tested the patch below using a HID sensor (ColorHug ALS) and it failed in the same way with and without the patch you have below.

Hans also had an idea that this might be due to the PM suspend. The 3- second sleep that you need to remove from iio-sensor-proxy matches the default autosuspend delay at:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/common/hid-sensors/hid-sensor-trigger.c#n285

But setting "->common_attributes.data_ready" to 1 in each of the driver's original states didn't work out.

Knowing that it affects both i2c and USB is a good bit of information though, meaning that the problem probably lies in the IIO subsystem.

Or possibly a change of behaviour in the PM subsystem which made the IIO trigger stop working. If Rafael could do a review on the code linked above, that'd be really helpful.

Note that in addition to the patches I mentioned in the kernel thread above, you'll need to revert this patch in iio-sensor-proxy:
https://github.com/hadess/iio-sensor-proxy/commit/5468452f7a72566d2e6ddc44f9396d3d088fa9fb

Otherwise things work :/

Quoted 30 lines
drivers/iio/common/hid-sensors/hid-sensor-trigger.c +3 -0
index 16ade0a..a70df7e 100644
@@ -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;
drivers/iio/common/hid-sensors/hid-sensor-trigger.c +0 -0
@@ -146,6 +149,9 @@ static int _hid_sensor_power_state(struct
 hid_sensor_common *st, bool state)
                        HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVEN

TS

_ENUM);
        }
drivers/iio/common/hid-sensors/hid-sensor-trigger.c +3 -0
+       state_val = 0;
+       report_val = 0;
+       
        if (state_val >= 0) {
                state_val += st->power_state.logical_minimum;
                sensor_hub_set_feature(st->hsdev, st-
Quoted 1 line

power_state.report_id,

author
#11 lore raw
In reply to Srinivas Pandruvada

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.

Quoted 78 lines · Srinivas Pandruvada
Quoted 4 lines · Patrick Pedersen

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.

drivers/iio/common/hid-sensors/hid-sensor-trigger.c +0 -0
index 16ade0a..1fb407f 100644
@@ -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 48 lines

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.

---
??drivers/hid/hid-ids.h????????????????| 1 +
??drivers/hid/hid-sensor-hub.c | 3 +++
??2 files changed, 4 insertions(+)

drivers/hid/hid-ids.h +0 -0
index 4f9a3938189a..b427a0bcfbe8 100644
@@ -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

drivers/hid/hid-sensor- renamed from drivers/hid/hid-sensor-hub.c +0 -0

hub.c
index 4ef73374a8f9..85b8425483bd 100644

drivers/hid/hid-sensor-hub.c +3 -0
@@ -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},