aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-08-18 04:12:08 -0400
committerJiri Kosina <jkosina@suse.cz>2018-09-05 04:22:28 -0400
commitade573eb1e03d1ee5abcb3359b1259469ab6e8ed (patch)
tree1f7916f10cba3e23867b79daffe906eee09ab027
parentb034ed50a2bb517c4b76e84f7723cb6bf60a4edd (diff)
HID: sensor-hub: Restore fixup for Lenovo ThinkPad Helix 2 sensor hub report
Commit b0f847e16c1e ("HID: hid-sensor-hub: Force logical minimum to 1 for power and report state") not only replaced the descriptor fixup done for devices with the HID_SENSOR_HUB_ENUM_QUIRK with a generic fix, but also accidentally removed the unrelated descriptor fixup for the Lenovo ThinkPad Helix 2 sensor hub. This commit restores this fixup. Restoring this fixup not only fixes the Lenovo ThinkPad Helix 2's sensors, but also the Lenovo ThinkPad 8's sensors. Fixes: b0f847e16c1e ("HID: hid-sensor-hub: Force logical minimum ...") Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Fernando D S Lima <fernandodsl@gmail.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-sensor-hub.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 50af72baa5ca..2b63487057c2 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -579,6 +579,28 @@ void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev)
579} 579}
580EXPORT_SYMBOL_GPL(sensor_hub_device_close); 580EXPORT_SYMBOL_GPL(sensor_hub_device_close);
581 581
582static __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc,
583 unsigned int *rsize)
584{
585 /*
586 * Checks if the report descriptor of Thinkpad Helix 2 has a logical
587 * minimum for magnetic flux axis greater than the maximum.
588 */
589 if (hdev->product == USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA &&
590 *rsize == 2558 && rdesc[913] == 0x17 && rdesc[914] == 0x40 &&
591 rdesc[915] == 0x81 && rdesc[916] == 0x08 &&
592 rdesc[917] == 0x00 && rdesc[918] == 0x27 &&
593 rdesc[921] == 0x07 && rdesc[922] == 0x00) {
594 /* Sets negative logical minimum for mag x, y and z */
595 rdesc[914] = rdesc[935] = rdesc[956] = 0xc0;
596 rdesc[915] = rdesc[936] = rdesc[957] = 0x7e;
597 rdesc[916] = rdesc[937] = rdesc[958] = 0xf7;
598 rdesc[917] = rdesc[938] = rdesc[959] = 0xff;
599 }
600
601 return rdesc;
602}
603
582static int sensor_hub_probe(struct hid_device *hdev, 604static int sensor_hub_probe(struct hid_device *hdev,
583 const struct hid_device_id *id) 605 const struct hid_device_id *id)
584{ 606{
@@ -743,6 +765,7 @@ static struct hid_driver sensor_hub_driver = {
743 .probe = sensor_hub_probe, 765 .probe = sensor_hub_probe,
744 .remove = sensor_hub_remove, 766 .remove = sensor_hub_remove,
745 .raw_event = sensor_hub_raw_event, 767 .raw_event = sensor_hub_raw_event,
768 .report_fixup = sensor_hub_report_fixup,
746#ifdef CONFIG_PM 769#ifdef CONFIG_PM
747 .suspend = sensor_hub_suspend, 770 .suspend = sensor_hub_suspend,
748 .resume = sensor_hub_resume, 771 .resume = sensor_hub_resume,