From patchwork Thu Nov 17 23:42:59 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Jungkamp
X-Patchwork-Id: 13047476
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 9E639C433FE
for ; Thu, 17 Nov 2022 23:44:18 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S240656AbiKQXoQ (ORCPT );
Thu, 17 Nov 2022 18:44:16 -0500
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47226 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S240442AbiKQXnn (ORCPT
); Thu, 17 Nov 2022 18:43:43 -0500
Received: from mout.gmx.net (mout.gmx.net [212.227.15.19])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B65CBC9E
for ; Thu, 17 Nov 2022 15:43:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417;
t=1668728607; bh=ai5UiNsV7FiIEdXOfAcFEua4IHE3CLfMJ3MgziZRV6Q=;
h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References;
b=CM1wXFSo6WCfwZV67/cCYE7PDNs6IUAUFy7QY6Vni97DSrwCQWIM2/2QRUscAvEZl
janqupW87/RCEGV2ALgUx0R5tPNuwKY36tGTb/x+WkTYz1Le/e/zbW5/OyoeVqtF3q
Ezkcv1WyNwW/3rxJ3rjkYUqGqK+VGg4teNyjcYpXxqM4kRh4ZhDuAq/ng94NtN2+JA
a2E+2+Zt34/+A6Fe+l6ZSMYFAhCkJyGlmJAsmUGR3TGDjDFFu9+ke5+HahX/VLHaYR
wdP+oxt/O5k1VQWRB4Dd82F2b8cH2tIyI/px+5kQ/xLgG06AqI0tPj1ri4RTqtf5qB
5UVQ3bMEFH1Zg==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from localhost.localdomain ([95.223.45.31]) by mail.gmx.net
(mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id
1MhlGk-1pQUaU3UoK-00druC; Fri, 18 Nov 2022 00:43:26 +0100
From: Philipp Jungkamp
To: Jiri Kosina ,
Jonathan Cameron ,
Srinivas Pandruvada
Cc: linux-iio@vger.kernel.org, Philipp Jungkamp
Subject: [PATCH v2 1/4] HID: hid-sensor-custom: Allow more custom iio sensors
Date: Fri, 18 Nov 2022 00:42:59 +0100
Message-Id: <20221117234302.3875-1-p.jungkamp@gmx.net>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <20221117150508.00002704@Huawei.com>
References: <20221117150508.00002704@Huawei.com>
MIME-Version: 1.0
X-Provags-ID: V03:K1:IFPdek38SeVXmEN4QKBCNos3T1mniBtocUfXf6RrbRxKF/LtSit
M4QeL9LlhNm0b4+3/rQdQHcQvuiAZmtfLQhoAhiunUAXLr/KuOm2Lil7Xqy8UQCom9LLMm6
QHTqcqGq5qC6EeOx21DA07mec/au0cNZiV2mWo23SVHyFCBov//KvcGIwsBdgbRK0X3+JXC
U8ugdKulo1iUiu1XUUwuA==
UI-OutboundReport: notjunk:1;M01:P0:WcJzogOkqrc=;zVBbIlOhc5RA7sUAWrZ5t6s2RTj
QTjlNT3KzEaMJrWDifELJ+gR3No19/Z3tA/r9X5xT1035FjP2Bmlpo8cegwRVkmC127PjvzOS
yuXi64NZfvOdHQNJySfT4TdDczfKsNvjTTMECksuZqKZuf4Ielk4jzCbkWenzZmuCRLwIOZp4
ccaiHax747AI3RRjQmD2ZJAFsRDga+CCTECsSkpu6ogzyx61gPyFUlYo3+etS5EKJYUi6Hiq1
2l9x6NOYP1i7slsLh8NPbRG+WA+bAovuIWBPfX9woEAcsQtPbFmkM63Qqpj1yVXrSvu7ycjpr
G7PVpXU3UPd+fXvBSy18rHVuLx/frsmwf5p76Mf9epln0cjVTHwXNeJzADBQsX8Q+un2EYeiu
PstMImN3svY5R991ry5/bK1qbJwqFY36gotggIjPHs1QI6WkuvJXhufIktZPT0RyylRWht5k3
5ohNcLyV7uoyAbU3InaAIOEqSHsDT8il+acgdyuGh0JZTnmlsCwSvC/2rEBx0XoEzc98KvXxl
cM5AwhqKCDH6Gw/H8zxFpFo+fupHjoNsXAPDYxQJ7wgrutESruBPyrkaKP1HsjyVOCO1eNtyj
328Ar9Jhs/FG/C4APFehVBID/FL56psLbMfAFh6SMFUUPOQy10+hO4jwfnz6T8mShWmeiXQ1B
3Di2yzzTU9YUqea2MBFp0VdkH2MZP7zcIfETa5iboQdFq3L2H6ya1/K5zZednQy4fosiSbFmI
6wXUb3dlfjOJE5MWsq2XIOdo2c3/OttA1Q8piPQdKbYDttwYC43vYl/VS/5msP758j80Sr8pj
dBcN9/wIVXORh9pZWRhHypab53/JvktAFP6IUAFI7GyVh8USBrptZyxq8c11YpWLAK1h+w28t
7SRq5m1jfcVj4nGbEXe8TwUI/X60+oX0SfeqUM6dKGLMd2NR/Nx6CI78gKBTyTzcFP8ZH4VXw
OPVcvj7gLO+vkV5oMZuoX1Y4m4s=
Precedence: bulk
List-ID:
X-Mailing-List: linux-iio@vger.kernel.org
The known LUID table for established/known custom HID sensors was
limited to sensors with "INTEL" as manufacturer. But some vendors such
as Lenovo also include fairly standard iio sensors (e.g. ambient light)
in their custom sensors.
Expand the known custom sensors table by a tag used for the platform
device name and match sensors based on the LUID as well as optionally
on model and manufacturer properties.
Introduce sensors from Lenovo's "Intelligent Sensing Solution" on the
Lenovo Yoga 9 14IAP7 as an example.
Signed-off-by: Philipp Jungkamp
---
Hello,
here's a short summary of changes compared to v1:
Added an additional commit which adds the LISS entries to the known
custom sensors.
Removed all unnecessary linebreaks from modified function calls and stayed
below the 80 columns.
Revisited the matching logic and removed the explicit error codes
in favor of bools and forwarding the inner error.
I noticed that the strange ENODATA return code was already redundant with
the **known out parameter. So I removed it.
Regards,
Philipp Jungkamp
drivers/hid/hid-sensor-custom.c | 211 +++++++++++++++++++++-----------
include/linux/hid-sensor-ids.h | 1 +
2 files changed, 142 insertions(+), 70 deletions(-)
--
2.38.1
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 32c2306e240d..89e56913c92e 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -5,6 +5,7 @@
*/
#include
+#include
#include
#include
#include
@@ -750,114 +751,184 @@ static void hid_sensor_custom_dev_if_remove(struct hid_sensor_custom
}
-/* luid defined in FW (e.g. ISH). Maybe used to identify sensor. */
-static const char *const known_sensor_luid[] = { "020B000000000000" };
+/*
+ * Match a known custom sensor.
+ * tag and luid is mandatory.
+ */
+struct hid_sensor_custom_match {
+ const char *tag;
+ const char *luid;
+ const char *model;
+ const char *manufacturer;
+ bool check_dmi;
+ struct dmi_system_id dmi;
+};
-static int get_luid_table_index(unsigned char *usage_str)
-{
- int i;
+/*
+ * Custom sensor properties used for matching.
+ */
+struct hid_sensor_custom_properties {
+ u16 serial_num[HID_CUSTOM_MAX_FEATURE_BYTES];
+ u16 model[HID_CUSTOM_MAX_FEATURE_BYTES];
+ u16 manufacturer[HID_CUSTOM_MAX_FEATURE_BYTES];
+};
+
+static const struct hid_sensor_custom_match hid_sensor_custom_known_table[] = {
+ /*
+ * Intel Integrated Sensor Hub (ISH)
+ */
+ { /* Intel ISH hinge */
+ .tag = "INT",
+ .luid = "020B000000000000",
+ .manufacturer = "INTEL",
+ },
+ {}
+};
- for (i = 0; i < ARRAY_SIZE(known_sensor_luid); i++) {
- if (!strncmp(usage_str, known_sensor_luid[i],
- strlen(known_sensor_luid[i])))
- return i;
+static bool hid_sensor_custom_prop_match_str(const u16 *prop, const char *match,
+ size_t count)
+{
+ while (count-- && *prop && *match) {
+ if (*prop & 0xFF00 ||
+ *match != (char) *prop)
+ return false;
+ prop++;
+ match++;
}
- return -ENODEV;
+ return (count == -1) || *prop == (u16)*match;
}
-static int get_known_custom_sensor_index(struct hid_sensor_hub_device *hsdev)
+static bool hid_sensor_custom_get_prop(struct hid_sensor_hub_device *hsdev,
+ u32 prop_usage_id, size_t prop_size,
+ u16 *prop)
{
- struct hid_sensor_hub_attribute_info sensor_manufacturer = { 0 };
- struct hid_sensor_hub_attribute_info sensor_luid_info = { 0 };
+ struct hid_sensor_hub_attribute_info prop_attr = { 0 };
int report_size;
int ret;
- static u16 w_buf[HID_CUSTOM_MAX_FEATURE_BYTES];
- static char buf[HID_CUSTOM_MAX_FEATURE_BYTES];
- int i;
- memset(w_buf, 0, sizeof(w_buf));
- memset(buf, 0, sizeof(buf));
+ memset(prop, 0, prop_size);
- /* get manufacturer info */
- ret = sensor_hub_input_get_attribute_info(hsdev,
- HID_FEATURE_REPORT, hsdev->usage,
- HID_USAGE_SENSOR_PROP_MANUFACTURER, &sensor_manufacturer);
+ ret = sensor_hub_input_get_attribute_info(hsdev, HID_FEATURE_REPORT,
+ hsdev->usage, prop_usage_id,
+ &prop_attr);
if (ret < 0)
- return ret;
+ return 0;
- report_size =
- sensor_hub_get_feature(hsdev, sensor_manufacturer.report_id,
- sensor_manufacturer.index, sizeof(w_buf),
- w_buf);
+ report_size = sensor_hub_get_feature(hsdev, prop_attr.report_id,
+ prop_attr.index, prop_size, prop);
if (report_size <= 0) {
hid_err(hsdev->hdev,
- "Failed to get sensor manufacturer info %d\n",
+ "Failed to get sensor property %08x %d\n",
+ prop_usage_id,
report_size);
- return -ENODEV;
+ return report_size;
}
- /* convert from wide char to char */
- for (i = 0; i < ARRAY_SIZE(buf) - 1 && w_buf[i]; i++)
- buf[i] = (char)w_buf[i];
+ return 0;
+}
+
+static bool
+hid_sensor_custom_do_match(struct hid_sensor_hub_device *hsdev,
+ const struct hid_sensor_custom_match *match,
+ const struct hid_sensor_custom_properties *prop)
+{
+ struct dmi_system_id dmi[] = { match->dmi, { 0 } };
+
+ if (!hid_sensor_custom_prop_match_str(prop->serial_num, "LUID:", 5) ||
+ !hid_sensor_custom_prop_match_str(prop->serial_num + 5, match->luid,
+ HID_CUSTOM_MAX_FEATURE_BYTES - 5))
+ return false;
+
+ if (match->model &&
+ !hid_sensor_custom_prop_match_str(prop->model, match->model,
+ HID_CUSTOM_MAX_FEATURE_BYTES))
+ return false;
- /* ensure it's ISH sensor */
- if (strncmp(buf, "INTEL", strlen("INTEL")))
- return -ENODEV;
+ if (match->manufacturer &&
+ !hid_sensor_custom_prop_match_str(prop->manufacturer, match->manufacturer,
+ HID_CUSTOM_MAX_FEATURE_BYTES))
+ return false;
- memset(w_buf, 0, sizeof(w_buf));
- memset(buf, 0, sizeof(buf));
+ if (match->check_dmi && !dmi_check_system(dmi))
+ return false;
- /* get real usage id */
- ret = sensor_hub_input_get_attribute_info(hsdev,
- HID_FEATURE_REPORT, hsdev->usage,
- HID_USAGE_SENSOR_PROP_SERIAL_NUM, &sensor_luid_info);
+ return true;
+}
+
+static int
+hid_sensor_custom_properties_get(struct hid_sensor_hub_device *hsdev,
+ struct hid_sensor_custom_properties *prop)
+{
+ int ret;
+
+ ret = hid_sensor_custom_get_prop(hsdev,
+ HID_USAGE_SENSOR_PROP_SERIAL_NUM,
+ HID_CUSTOM_MAX_FEATURE_BYTES,
+ prop->serial_num);
if (ret < 0)
return ret;
- report_size = sensor_hub_get_feature(hsdev, sensor_luid_info.report_id,
- sensor_luid_info.index, sizeof(w_buf),
- w_buf);
- if (report_size <= 0) {
- hid_err(hsdev->hdev, "Failed to get real usage info %d\n",
- report_size);
- return -ENODEV;
- }
+ ret = hid_sensor_custom_get_prop(hsdev,
+ HID_USAGE_SENSOR_PROP_MODEL,
+ HID_CUSTOM_MAX_FEATURE_BYTES,
+ prop->model);
+ if (ret < 0)
+ return ret;
- /* convert from wide char to char */
- for (i = 0; i < ARRAY_SIZE(buf) - 1 && w_buf[i]; i++)
- buf[i] = (char)w_buf[i];
+ ret = hid_sensor_custom_get_prop(hsdev,
+ HID_USAGE_SENSOR_PROP_MANUFACTURER,
+ HID_CUSTOM_MAX_FEATURE_BYTES,
+ prop->manufacturer);
+ if (ret < 0)
+ return ret;
- if (strlen(buf) != strlen(known_sensor_luid[0]) + 5) {
- hid_err(hsdev->hdev,
- "%s luid length not match %zu != (%zu + 5)\n", __func__,
- strlen(buf), strlen(known_sensor_luid[0]));
- return -ENODEV;
+ return 0;
+}
+
+static int
+hid_sensor_custom_get_known(struct hid_sensor_hub_device *hsdev,
+ const struct hid_sensor_custom_match **known)
+{
+ int ret;
+ const struct hid_sensor_custom_match *match =
+ hid_sensor_custom_known_table;
+ struct hid_sensor_custom_properties prop;
+
+ ret = hid_sensor_custom_properties_get(hsdev, &prop);
+ if (ret < 0)
+ return ret;
+
+ while (match->tag) {
+ if (hid_sensor_custom_do_match(hsdev, match, &prop)) {
+ *known = match;
+ return 0;
+ }
+ match++;
}
- /* get table index with luid (not matching 'LUID: ' in luid) */
- return get_luid_table_index(&buf[5]);
+ *known = NULL;
+ return 0;
}
static struct platform_device *
hid_sensor_register_platform_device(struct platform_device *pdev,
struct hid_sensor_hub_device *hsdev,
- int index)
+ const struct hid_sensor_custom_match *match)
{
- char real_usage[HID_SENSOR_USAGE_LENGTH] = { 0 };
+ char real_usage[HID_SENSOR_USAGE_LENGTH];
struct platform_device *custom_pdev;
const char *dev_name;
char *c;
- /* copy real usage id */
- memcpy(real_usage, known_sensor_luid[index], 4);
+ memcpy(real_usage, match->luid, 4);
+ real_usage[4] = '\0';
- /* usage id are all lowcase */
for (c = real_usage; *c != '\0'; c++)
*c = tolower(*c);
- /* HID-SENSOR-INT-REAL_USAGE_ID */
- dev_name = kasprintf(GFP_KERNEL, "HID-SENSOR-INT-%s", real_usage);
+ dev_name = kasprintf(GFP_KERNEL, "HID-SENSOR-%s-%s",
+ match->tag, real_usage);
if (!dev_name)
return ERR_PTR(-ENOMEM);
@@ -873,7 +944,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
struct hid_sensor_custom *sensor_inst;
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
int ret;
- int index;
+ const struct hid_sensor_custom_match *match = NULL;
sensor_inst = devm_kzalloc(&pdev->dev, sizeof(*sensor_inst),
GFP_KERNEL);
@@ -888,10 +959,10 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
mutex_init(&sensor_inst->mutex);
platform_set_drvdata(pdev, sensor_inst);
- index = get_known_custom_sensor_index(hsdev);
- if (index >= 0 && index < ARRAY_SIZE(known_sensor_luid)) {
+ ret = hid_sensor_custom_get_known(hsdev, &match);
+ if (!ret && match) {
sensor_inst->custom_pdev =
- hid_sensor_register_platform_device(pdev, hsdev, index);
+ hid_sensor_register_platform_device(pdev, hsdev, match);
ret = PTR_ERR_OR_ZERO(sensor_inst->custom_pdev);
if (ret) {
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index ac631159403a..13b1e65fbdcc 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -132,6 +132,7 @@
#define HID_USAGE_SENSOR_PROP_FRIENDLY_NAME 0x200301
#define HID_USAGE_SENSOR_PROP_SERIAL_NUM 0x200307
#define HID_USAGE_SENSOR_PROP_MANUFACTURER 0x200305
+#define HID_USAGE_SENSOR_PROP_MODEL 0x200306
#define HID_USAGE_SENSOR_PROP_REPORT_INTERVAL 0x20030E
#define HID_USAGE_SENSOR_PROP_SENSITIVITY_ABS 0x20030F
#define HID_USAGE_SENSOR_PROP_SENSITIVITY_RANGE_PCT 0x200310
From patchwork Thu Nov 17 23:43:00 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Jungkamp
X-Patchwork-Id: 13047474
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 4A3A0C433FE
for ; Thu, 17 Nov 2022 23:43:52 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S240329AbiKQXnu (ORCPT );
Thu, 17 Nov 2022 18:43:50 -0500
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47186 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S240364AbiKQXnm (ORCPT
); Thu, 17 Nov 2022 18:43:42 -0500
Received: from mout.gmx.net (mout.gmx.net [212.227.15.19])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA6F7A451
for ; Thu, 17 Nov 2022 15:43:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417;
t=1668728607; bh=OrLBMed6ZHmDPzSPtZqNsBpkm0DKoQGZyE9AcMIGK2Q=;
h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References;
b=Uv9uZWuiiefC0BMFPEz1F7KNx4cz7EZPfDsnDIpqVhqP9iLfyPinzI4eQrsoaXONl
DqvgM5y5tvvv83pDqXHZxusirjRcKkAb1nmcLARE0gNZMvzZeb/pdhH60dxYaTJsEj
yOAeupFuO4357sOjaSX2gAqkhv3HrGaifiY+Rr33+F5SWTj/7zOUbW+3EbH1+8N/kB
4bXYc3wH3lktG9Oh3SFAlFNmNxGXtv43lfrJRAgTbAwiVU1wmjQN7HiKi4buLacdIQ
qRjSfVmj8GhPjMg4pzJbL4Wel3Jnxa/ZvoUvQVpkozZX30456iPqgD8ACN8xQtLtvV
nyz9r80PxPhWQ==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from localhost.localdomain ([95.223.45.31]) by mail.gmx.net
(mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id
1MbAcs-1pX5EN0Po8-00bduS; Fri, 18 Nov 2022 00:43:27 +0100
From: Philipp Jungkamp
To: Jiri Kosina ,
Jonathan Cameron ,
Srinivas Pandruvada
Cc: linux-iio@vger.kernel.org, Philipp Jungkamp
Subject: [PATCH v2 2/4] HID: hid-sensor-custom: Add LISS custom sensors
Date: Fri, 18 Nov 2022 00:43:00 +0100
Message-Id: <20221117234302.3875-2-p.jungkamp@gmx.net>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <20221117234302.3875-1-p.jungkamp@gmx.net>
References: <20221117150508.00002704@Huawei.com>
<20221117234302.3875-1-p.jungkamp@gmx.net>
MIME-Version: 1.0
X-Provags-ID: V03:K1:ONBvvDKhoEtO14roUmTVNN2fiXj6vwxKug90caj1PDqBFWqfz2z
idAlYpLyEhwjF2NU/LmGTtjYwhxp7nM7Na3IVDaK8tVd7EhcTdScx1+IpI92eI9aDqgDhCJ
pTcyB9kCQGcgSIWVdQM/lfastulvnUybt1MXjXICbH4hUOzyZ2yojexa6OSV1fpNoR3U39m
NMH0Lnq9j/RL5afq9p7Qw==
UI-OutboundReport: notjunk:1;M01:P0:bBYOZbcKTIU=;IB049hPRiBatN94fvs6XdAfniN2
f8/DGK0gHoEWpHRZuKCilZDJoESXzjsZ/6N65+4J8hpzzOOoquwZtSxIu3xiJclFUPVtAxzwx
xva8OLOK0HXRBoBZp+yRnOusvFngfOIlOWzgLiNuokT1CjK3JfuGA5jVt8swbboQJxgytgOzu
UK/hlWsHVnj9CEc7/NIrcspCmXumEV7oEFK54Xy4Dyi127XnhPRZQsErryTLDE3l0cxUGWeWK
nilpQIWi/gBFRMxuWpND5qK/jDygbHZ2B5p7IGdZ2N/ajMvSnae81wRKUzZWgoPBeEGZCq94R
STy/G8spdlUrBoIeEpvefQ5WvbdffhxtAvTQqayr3qazsuX7r7XV/6jxUcMAxYjevcXfl4+1C
4FCzloJbF6kowh4sau37XXmI1e8BmmC9N7FnA0Ebks86T7rE5vSJPiPQkYXzzR+aj5wt/gebA
HuEju+n6dCILveWYZHnr+x9mUW0obxw5Yra4IJ6x9josNlgiigSi+8WEF14oCpY/oC1MbAcGY
eVZMY6cwIHc1FuWIOMfspSniBCcW2GUc/j2ODYURp+pXaTcN42LOQx3FJGVf02/aE4vKuBa4Y
cOOdvYmDAmkAkfcPXHKh/5ncYkQo1jctvXQCit+EUUeT4ieeO2MsASwQsMXMojaYqEHQ7Czj0
+GPcXjeJ01Wr/TgbUeJ6ZDpnR0zEAGG44KFNl+QemZsKy6wfBAp6KhiwU59p1ciVvwpPOsxM3
EFEaTE54AhOtOk/p8ir3Xl3UKWRtLHCkVNnk9gF9pxMMW8yqK/pIM7L+7nUvt1pNzvr+wqJ1E
V4SJS5pa+SeTLWp71Ey2gr+i0CopWAiIeQDjo6X7uFX6SoDHPvCD9aQA8Y25DBC1X0QUtqyIU
BmFLLRrP0XsJD7UPY1C+xGjRyVnvt96pw47NQZEAoq7hYdR/WZt4UFOAzUOlEg1g7+JTFlJPU
7JWcBw==
Precedence: bulk
List-ID:
X-Mailing-List: linux-iio@vger.kernel.org
Add the Lenovo Intelligent Sensing Solution (LISS) custom sensors to the
known custom sensors.
---
Here is the requested noop commit that changes the device ids for the known
LISS sensors.
drivers/hid/hid-sensor-custom.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
--
2.38.1
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 89e56913c92e..85db14406b23 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -782,6 +782,29 @@ static const struct hid_sensor_custom_match hid_sensor_custom_known_table[] = {
.luid = "020B000000000000",
.manufacturer = "INTEL",
},
+ /*
+ * Lenovo Intelligent Sensing Solution (LISS)
+ */
+ { /* ambient light */
+ .tag = "LISS",
+ .luid = "0041010200000082",
+ .model = "STK3X3X Sensor",
+ .manufacturer = "Vendor 258",
+ .check_dmi = true,
+ .dmi.matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ }
+ },
+ { /* human presence */
+ .tag = "LISS",
+ .luid = "0226000171AC0081",
+ .model = "VL53L1_HOD Sensor",
+ .manufacturer = "ST_MICRO",
+ .check_dmi = true,
+ .dmi.matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ }
+ },
{}
};
From patchwork Thu Nov 17 23:43:01 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Jungkamp
X-Patchwork-Id: 13047477
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 784F6C4332F
for ; Thu, 17 Nov 2022 23:44:25 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S240664AbiKQXoY (ORCPT );
Thu, 17 Nov 2022 18:44:24 -0500
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47238 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S240446AbiKQXno (ORCPT
); Thu, 17 Nov 2022 18:43:44 -0500
Received: from mout.gmx.net (mout.gmx.net [212.227.15.15])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9227F03D
for ; Thu, 17 Nov 2022 15:43:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417;
t=1668728607; bh=zIOolA9952zV+6SNTVjguhB5zc/PxoGHuNoxiOEklMc=;
h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References;
b=a3aFFdv0utipbYgqqPo0yyzmMKrvLplXtl641cJovMznpy/0MCYrbjfAoYoTs+kJF
wESEMwLsbAt0biIjW8OP/LQb9CBwIOW7EkvNnMX0z4322Foe9reaUqqtjzMf01iTo5
I29/G2y/2vOjkkK2hTfe09G4DeuubB55EBMmO+/vcCgUQ6SszTEPfHYDvPoNVv1mB6
se87DNkkXfkIgL8OciutKDICaUy10eY8E73ZADoikq39JTClXecpOlBvzwrl/r0tS7
pmc2nYVcQkicKAeNBgvGBhMjijSPbNZjJy4JwzCLekbQJSbzEhtoFHOzeJ2gM22IRp
gkEQJ5kMNTyFQ==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from localhost.localdomain ([95.223.45.31]) by mail.gmx.net
(mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id
1MVvPD-1oUYG21cJx-00RmWb; Fri, 18 Nov 2022 00:43:27 +0100
From: Philipp Jungkamp
To: Jiri Kosina ,
Jonathan Cameron ,
Srinivas Pandruvada
Cc: linux-iio@vger.kernel.org, Philipp Jungkamp
Subject: [PATCH v2 3/4] IIO: hid-sensor-als: Use generic usage
Date: Fri, 18 Nov 2022 00:43:01 +0100
Message-Id: <20221117234302.3875-3-p.jungkamp@gmx.net>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <20221117234302.3875-1-p.jungkamp@gmx.net>
References: <20221117150508.00002704@Huawei.com>
<20221117234302.3875-1-p.jungkamp@gmx.net>
MIME-Version: 1.0
X-Provags-ID: V03:K1:7vk9XKobwlOkKa8MBfwsRpqxwB2m8AH8laXCv1ibK88eOuivvt3
WHCYi3PBfKAFGIkh59P0b5bj/raNqe9r4mEdTKQV7OGKcYOyKlpFRUycE1Tb1x11js0DZ0U
hksrGoQDp1H6oRHdv3X/8Hea7HDpiSJBXYt0ue31og6rBEwXJ1CXJ8NnJ6h+h73Eg13l/OB
45bzdbCy+57XQ4rUIUmpA==
UI-OutboundReport: notjunk:1;M01:P0:vi66KzIiUuA=;DG/RAFEXHxA0SSz8lmiXERslQrc
LHz0Z1oxlJP3dIRzvXuckyMYhz2TGlz+IkmkwsBaZulYnbaFbikkAkde2CgqiZMxH4YgqdPS/
okaO0msNb5KWtMRjOJVcyVrbySYLX63wz4RdzFMnYZgaA67Nm/Zqv5Y4z3dELCHNjl65FpOK+
nLecJFSWTOzSNEHj2gSkTGbNnqssc1WfDd2eoyTh/rZQyH3FVlFsVRVXVe4zrlsiovPx8vzZm
YV0sBLoPEmMcXI46y7gciGj1R6/lHQSiR7mbGqaIRXpCKk2emH8UcaXz5Pd4midQzXVdMwBem
qCBuefGPLF/1ZPnW3yytv98eZTlQd4+hrLTQRVu3uCiuRnJP9XvGUCNn0/EXg/Dqb6GKvF43W
p9TODPdrNe3fWjkjb3LIt4jiHvBMUd4IYscePmJwWEWjauSHeU9QUO0cVswZG2n/5jZdQM6Wb
NPtQwkeWQgChJ6Bt/pnY8GnNQaTL3KZbWnmXlPMx/KRinGn2vvLyTtvl8IUyfrzriouOM1rgW
518ORme5QaMFHVWa1cp1E7F9wBq+fCVYydGR7j7UwlR7xicfXjSFw+89GPmqYnQ41S+J+4fZi
6ql9Qx0pWWdBJjWNp/1/407iRZevZwJQeNXVpZWSpT4lv48iJKZPepEMyt/bF4EiC1bgHx0jF
1wgdOp+wGEeaXcFV58ZxR76kD7DrXvxkpO577PFgOP51LKgoPZ55fv4cvCvS99V0dihi6x52s
5616x7/cloqmKPjZ/t7FYzUchMFrNs2Wn6An0pp/lzBFSZeKYc7S7+sreF2nwvVWSWj0q6kvf
YXpb8jyaXnFsf/3bULOmTG739me2DJbFdPtVRJfNA5Fc3J0+W0iwx31YkSV+aLIAth8nsbC0t
qS2zFRmb6cI/7kkK4VALxkXYa3KluHNQcYRTbn2xw3Hk4GUIeFES5uMWXTtbW3v3ZtovmIepL
fgE1dw==
Precedence: bulk
List-ID:
X-Mailing-List: linux-iio@vger.kernel.org
Use a generic 'hsdev->usage' instead of the HID_USAGE_SENSOR_ALS to
allow this driver to drive the Lenovo custom ambient light sensor,
which is registered under a 'custom' usage and not HID_USAGE_SENSOR_ALS.
Add the Lenovo Intelligent Sensing Solution (LISS) ambient light sensor
to the platform device ids.
Signed-off-by: Philipp Jungkamp
---
Less unnecessary line breaks in function calls.
drivers/iio/light/hid-sensor-als.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
--
2.38.1
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 5a1a625d8d16..eb1aedad7edc 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -86,6 +86,7 @@ static int als_read_raw(struct iio_dev *indio_dev,
long mask)
{
struct als_state *als_state = iio_priv(indio_dev);
+ struct hid_sensor_hub_device *hsdev = als_state->common_attributes.hsdev;
int report_id = -1;
u32 address;
int ret_type;
@@ -110,11 +111,8 @@ static int als_read_raw(struct iio_dev *indio_dev,
hid_sensor_power_state(&als_state->common_attributes,
true);
*val = sensor_hub_input_attr_get_raw_value(
- als_state->common_attributes.hsdev,
- HID_USAGE_SENSOR_ALS, address,
- report_id,
- SENSOR_HUB_SYNC,
- min < 0);
+ hsdev, hsdev->usage, address, report_id,
+ SENSOR_HUB_SYNC, min < 0);
hid_sensor_power_state(&als_state->common_attributes,
false);
} else {
@@ -259,9 +257,7 @@ static int als_parse_report(struct platform_device *pdev,
dev_dbg(&pdev->dev, "als %x:%x\n", st->als_illum.index,
st->als_illum.report_id);
- st->scale_precision = hid_sensor_format_scale(
- HID_USAGE_SENSOR_ALS,
- &st->als_illum,
+ st->scale_precision = hid_sensor_format_scale(usage_id, &st->als_illum,
&st->scale_pre_decml, &st->scale_post_decml);
return ret;
@@ -285,7 +281,8 @@ static int hid_als_probe(struct platform_device *pdev)
als_state->common_attributes.hsdev = hsdev;
als_state->common_attributes.pdev = pdev;
- ret = hid_sensor_parse_common_attributes(hsdev, HID_USAGE_SENSOR_ALS,
+ ret = hid_sensor_parse_common_attributes(hsdev,
+ hsdev->usage,
&als_state->common_attributes,
als_sensitivity_addresses,
ARRAY_SIZE(als_sensitivity_addresses));
@@ -303,7 +300,8 @@ static int hid_als_probe(struct platform_device *pdev)
ret = als_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
- HID_USAGE_SENSOR_ALS, als_state);
+ hsdev->usage,
+ als_state);
if (ret) {
dev_err(&pdev->dev, "failed to setup attributes\n");
return ret;
@@ -333,8 +331,7 @@ static int hid_als_probe(struct platform_device *pdev)
als_state->callbacks.send_event = als_proc_event;
als_state->callbacks.capture_sample = als_capture_sample;
als_state->callbacks.pdev = pdev;
- ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_ALS,
- &als_state->callbacks);
+ ret = sensor_hub_register_callback(hsdev, hsdev->usage, &als_state->callbacks);
if (ret < 0) {
dev_err(&pdev->dev, "callback reg failed\n");
goto error_iio_unreg;
@@ -356,7 +353,7 @@ static int hid_als_remove(struct platform_device *pdev)
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct als_state *als_state = iio_priv(indio_dev);
- sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_ALS);
+ sensor_hub_remove_callback(hsdev, hsdev->usage);
iio_device_unregister(indio_dev);
hid_sensor_remove_trigger(indio_dev, &als_state->common_attributes);
@@ -368,6 +365,10 @@ static const struct platform_device_id hid_als_ids[] = {
/* Format: HID-SENSOR-usage_id_in_hex_lowercase */
.name = "HID-SENSOR-200041",
},
+ {
+ /* Format: HID-SENSOR-custom_sensor_tag-usage_id_in_hex_lowercase */
+ .name = "HID-SENSOR-LISS-0041",
+ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, hid_als_ids);
From patchwork Thu Nov 17 23:43:02 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Jungkamp
X-Patchwork-Id: 13047475
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id 69A14C4332F
for ; Thu, 17 Nov 2022 23:43:56 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S234380AbiKQXny (ORCPT );
Thu, 17 Nov 2022 18:43:54 -0500
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47216 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S240412AbiKQXnm (ORCPT
); Thu, 17 Nov 2022 18:43:42 -0500
Received: from mout.gmx.net (mout.gmx.net [212.227.15.19])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CD3BA446
for ; Thu, 17 Nov 2022 15:43:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417;
t=1668728607; bh=SBPi6rC4HYka5zDnNBrOrmm3M7oLCjGw6JXOetO9axc=;
h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References;
b=Avbe71iwLkN14ehSSxASzbTXKyntKhTaQPLY8WK6CC92A0TyeezMbJSNbcDwvQGu0
5iaSNcchaq0julE9JaMixa/kqcCNEpl1v700CCdwKSuniEwkOd7YFGuBRO6juZHXEK
LaKvQHcMD/ZsvWj9kMjZuO+Dhe3gM7CW6lZimAzjBYL62GyJ6zfEChjecsoSEUPdFY
3mS1JWe5aaZlli9+IYKpbJYGAaZ8b8vkYVklDwKaSSbm+FWZRIS/9Pw1nVBP/F88rJ
Ap2fM5yVAwA0tL6PDjqhfyxEYskWu2vwoRH6Neb9M5it29Dof2oDf+aDxUnC1d5CBX
q7WJegIYVPl7Q==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from localhost.localdomain ([95.223.45.31]) by mail.gmx.net
(mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id
1M7sDg-1oqsaT2kh0-0055Ny; Fri, 18 Nov 2022 00:43:27 +0100
From: Philipp Jungkamp
To: Jiri Kosina ,
Jonathan Cameron ,
Srinivas Pandruvada
Cc: linux-iio@vger.kernel.org, Philipp Jungkamp
Subject: [PATCH v2 4/4] IIO: hid-sensor-prox: Use generic usage
Date: Fri, 18 Nov 2022 00:43:02 +0100
Message-Id: <20221117234302.3875-4-p.jungkamp@gmx.net>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <20221117234302.3875-1-p.jungkamp@gmx.net>
References: <20221117150508.00002704@Huawei.com>
<20221117234302.3875-1-p.jungkamp@gmx.net>
MIME-Version: 1.0
X-Provags-ID: V03:K1:JVm1vb18Tzaza31T2V6SyxPMTsNS+ggPW3YQjv2JuPbB1oKiu2h
GwGr/vub19bgJO7v7NfXXZtjotuBSXndcJEBJilXX3+GI62TLqbKs3Ow6p+LZ4uKRhHqPcu
UmIebIargp3MHaww6lkZUU1enqRihEVD3u5LJNEyLjWldh6cBdSGiBCtKHNvZ6HcKMH4DsE
rAIWMolv0KauG0BpWxwzQ==
UI-OutboundReport: notjunk:1;M01:P0:ebtB5lg9GBA=;Lym7N47TWXi0xaTg9tioz+ndGiO
OdMuw0JS4F+Nsmqz5d91/hyB6dQ8M3ywB4FqL0mDUeuSYqvpaLpbBeqzZvfO1uR9w+ZuxIz1S
XNMRoY1L074aLsFizDldItHMyKaySoDTQ1nwRYZBi9L2DfE4sb4q1e7ZUGy+QkrKz4OKsU6im
rEur22AnXNhaQKz8pYdFyfUCj+J6BixTA+trwRb4H7209xITu27zC/uRxynXKixSgAiXBBnf5
WaCFLFanqoj1c/HCVSsjWxnbkN1iyRMGSUCCDiM+lx2tJwwSQM04SHJ6RJPX4S2P5KBbInJhH
/+s3x8en1kZn2xvJZ38/kEkcf4jIcxgTbHk5meCd2x44uNmF8Ca4x30HPCmvOXhjyat8dovh7
R2QKdumqvcuZkIkkN908FayzsAo03CH9qPXtc0/Ole0GtXIfgPng2oz3h1pmAEz9VzuRfDfri
zPYhBoXpDPJuVEF65PgKIcgMHUY9Il6YHh8J+LOlOktKL21fF5GOtENPrNWHgxsDnrzJ7gxd7
pVuYSISUz3m+uNmoWtIsbJlIFGQ0nqkTAvjGYztdFDoPToQ6XsojAjmDtsixTG92yvanT0NrL
9yLnVPwmIk8IPoJ4wTp0cSduxjMSvfXg0ASNI93Iia3P4t9UUUUbkwIphN7Tw+bLem9c9oEBT
ZPsx6Z3TnTrZ3fj0iX5Cyr5BjFIas8kYLoBu4/m2GpbDkhYZjs6QOXwN2eUFe6hX2l05Pnt6h
NhiBZW3paAJzdooAdUxbntvlSClDNlsZ5RCEqu+uwJLsmvhN9kOs9TuOmiToMEVQeHRWFk71B
tDPMy32hEWFgj+b/UPgViR4DdKEA2e/Cteud8xhQx8Z2sgX8NoWH3uEXEsLXWgOJDNEZNdiJy
YlzdFOXT+pTCzH1LwA3kA7O9xfsSFN0BqbAvnewEzrPJFlJ8hbk85d6pDKolo/FIQw8cxrRey
g9Xj69knJhlfmIiPvM0OyP6Za9A=
Precedence: bulk
List-ID:
X-Mailing-List: linux-iio@vger.kernel.org
Use a generic 'hsdev->usage' instead of the HID_USAGE_SENSOR_PROX to
allow this driver to drive the Lenvo custom proximity sensor, which is
registered under a 'custom' usage and not HID_USAGE_SENSOR_PROX.
Add the Lenovo Intelligent Sensing Solution (LISS) human presence sensor
to the platform device ids.
Signed-off-by: Philipp Jungkamp
---
Lines are shorter and the switch statement for raw_len is cleaner.
drivers/iio/light/hid-sensor-prox.c | 37 ++++++++++++++++++-----------
1 file changed, 23 insertions(+), 14 deletions(-)
--
2.38.1
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index f10fa2abfe72..a47591e1bad9 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -61,6 +61,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
long mask)
{
struct prox_state *prox_state = iio_priv(indio_dev);
+ struct hid_sensor_hub_device *hsdev;
int report_id = -1;
u32 address;
int ret_type;
@@ -75,6 +76,7 @@ static int prox_read_raw(struct iio_dev *indio_dev,
report_id = prox_state->prox_attr.report_id;
min = prox_state->prox_attr.logical_minimum;
address = HID_USAGE_SENSOR_HUMAN_PRESENCE;
+ hsdev = prox_state->common_attributes.hsdev;
break;
default:
report_id = -1;
@@ -84,11 +86,8 @@ static int prox_read_raw(struct iio_dev *indio_dev,
hid_sensor_power_state(&prox_state->common_attributes,
true);
*val = sensor_hub_input_attr_get_raw_value(
- prox_state->common_attributes.hsdev,
- HID_USAGE_SENSOR_PROX, address,
- report_id,
- SENSOR_HUB_SYNC,
- min < 0);
+ hsdev, hsdev->usage, address, report_id,
+ SENSOR_HUB_SYNC, min < 0);
hid_sensor_power_state(&prox_state->common_attributes,
false);
} else {
@@ -191,10 +190,16 @@ static int prox_capture_sample(struct hid_sensor_hub_device *hsdev,
switch (usage_id) {
case HID_USAGE_SENSOR_HUMAN_PRESENCE:
- prox_state->human_presence = *(u32 *)raw_data;
- ret = 0;
- break;
- default:
+ switch (raw_len) {
+ case 1:
+ prox_state->human_presence = *(u8 *)raw_data;
+ return 0;
+ case 4:
+ prox_state->human_presence = *(u32 *)raw_data;
+ return 0;
+ default:
+ break;
+ }
break;
}
@@ -244,7 +249,7 @@ static int hid_prox_probe(struct platform_device *pdev)
prox_state->common_attributes.hsdev = hsdev;
prox_state->common_attributes.pdev = pdev;
- ret = hid_sensor_parse_common_attributes(hsdev, HID_USAGE_SENSOR_PROX,
+ ret = hid_sensor_parse_common_attributes(hsdev, hsdev->usage,
&prox_state->common_attributes,
prox_sensitivity_addresses,
ARRAY_SIZE(prox_sensitivity_addresses));
@@ -262,7 +267,7 @@ static int hid_prox_probe(struct platform_device *pdev)
ret = prox_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
- HID_USAGE_SENSOR_PROX, prox_state);
+ hsdev->usage, prox_state);
if (ret) {
dev_err(&pdev->dev, "failed to setup attributes\n");
return ret;
@@ -291,8 +296,8 @@ static int hid_prox_probe(struct platform_device *pdev)
prox_state->callbacks.send_event = prox_proc_event;
prox_state->callbacks.capture_sample = prox_capture_sample;
prox_state->callbacks.pdev = pdev;
- ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_PROX,
- &prox_state->callbacks);
+ ret = sensor_hub_register_callback(hsdev, hsdev->usage,
+ &prox_state->callbacks);
if (ret < 0) {
dev_err(&pdev->dev, "callback reg failed\n");
goto error_iio_unreg;
@@ -314,7 +319,7 @@ static int hid_prox_remove(struct platform_device *pdev)
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct prox_state *prox_state = iio_priv(indio_dev);
- sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PROX);
+ sensor_hub_remove_callback(hsdev, hsdev->usage);
iio_device_unregister(indio_dev);
hid_sensor_remove_trigger(indio_dev, &prox_state->common_attributes);
@@ -326,6 +331,10 @@ static const struct platform_device_id hid_prox_ids[] = {
/* Format: HID-SENSOR-usage_id_in_hex_lowercase */
.name = "HID-SENSOR-200011",
},
+ {
+ /* Format: HID-SENSOR-tag-usage_id_in_hex_lowercase */
+ .name = "HID-SENSOR-LISS-0226",
+ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, hid_prox_ids);