From: Daniel Thompson <daniel.thompson@linaro.org>
Date: Sun, 28 May 2023 09:24:27 +0000 (+0100)
Subject: HID: sensor-hub: Allow multi-function sensor devices
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=666cf30a589a00d89c3775e27a698a2370cbe3db;p=linux.git

HID: sensor-hub: Allow multi-function sensor devices

The Lenovo Yoga C630 has a combined keyboard and accelerometer that
interfaces via i2c-hid. Currently this laptop either has a working
keyboard (if CONFIG_HID_SENSOR_HUB is disabled) or a working accelerometer.
only works on kernels. Put another way, most distro kernels enable
CONFIG_HID_SENSOR_HUB and therefore cannot work on this device since the
keyboard doesn't work!

Fix this by providing a richer connect mask during the probe. With this
change both keyboard and screen orientation sensors work correctly.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: Srinivas Pandruvada<srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---

diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 83237b86c8ff4..2eba152e8b905 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -632,7 +632,7 @@ static int sensor_hub_probe(struct hid_device *hdev,
 	}
 	INIT_LIST_HEAD(&hdev->inputs);
 
-	ret = hid_hw_start(hdev, 0);
+	ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
 	if (ret) {
 		hid_err(hdev, "hw start failed\n");
 		return ret;