Skip to content

Commit a65b3c3

Browse files
committed
Merge tag 'hid-for-linus-2024091602' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina: - New HID over SPI driver for Goodix devices that don't follow Microsoft's HID-over-SPI specification, so a separate driver is needed. Currently supported device is GT7986U touchscreen (Charles Wang) - support for new hardware features in Wacom driver (high-res wheel scrolling, touchstrings with relative motions, support for two touchrings) (Jason Gerecke) - support for customized vendor firmware loading in intel-ish driver (Zhang Lixu) - fix for theoretical race condition in i2c-hid (Dmitry Torokhov) - support for HIDIOCREVOKE -- evdev's EVIOCREVOKE equivalent in hidraw (Peter Hutterer) - initial hidraw selftest implementation (Benjamin Tissoires) - constification of device-specific report descriptors (Thomas Weißschuh) - other small assorted fixes and device ID / quirk additions * tag 'hid-for-linus-2024091602' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (54 commits) hid: cp2112: Use irq_get_trigger_type() helper HID: i2c-hid: ensure various commands do not interfere with each other HID: multitouch: Add support for Thinkpad X12 Gen 2 Kbd Portfolio HID: wacom: Do not warn about dropped packets for first packet HID: wacom: Support sequence numbers smaller than 16-bit HID: lg: constify fixed up report descriptor HID: uclogic: constify fixed up report descriptor HID: waltop: constify fixed up report descriptor HID: sony: constify fixed up report descriptor HID: pxrc: constify fixed up report descriptor HID: steelseries: constify fixed up report descriptor HID: viewsonic: constify fixed up report descriptor HID: vrc2: constify fixed up report descriptor HID: xiaomi: constify fixed up report descriptor HID: maltron: constify fixed up report descriptor HID: keytouch: constify fixed up report descriptor HID: holtek-kbd: constify fixed up report descriptor HID: dr: constify fixed up report descriptor HID: bigbenff: constify fixed up report descriptor HID: picoLCD: Use backlight power constants ...
2 parents d5e65d1 + 0aa0437 commit a65b3c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2150
-732
lines changed

Documentation/devicetree/bindings/input/elan,ekth6915.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ properties:
2323
- enum:
2424
- elan,ekth5015m
2525
- const: elan,ekth6915
26-
- const: elan,ekth6915
26+
- enum:
27+
- elan,ekth6915
28+
- elan,ekth6a12nay
2729

2830
reg:
2931
const: 0x10
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/input/goodix,gt7986u.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: GOODIX GT7986U SPI HID Touchscreen
8+
9+
maintainers:
10+
- Charles Wang <[email protected]>
11+
12+
description: Supports the Goodix GT7986U touchscreen.
13+
This touch controller reports data packaged according to the HID protocol,
14+
but is incompatible with Microsoft's HID-over-SPI protocol.
15+
16+
allOf:
17+
- $ref: /schemas/spi/spi-peripheral-props.yaml#
18+
19+
properties:
20+
compatible:
21+
enum:
22+
- goodix,gt7986u
23+
24+
reg:
25+
maxItems: 1
26+
27+
interrupts:
28+
maxItems: 1
29+
30+
reset-gpios:
31+
maxItems: 1
32+
33+
goodix,hid-report-addr:
34+
$ref: /schemas/types.yaml#/definitions/uint32
35+
description:
36+
The register address for retrieving HID report data.
37+
This address is related to the device firmware and may
38+
change after a firmware update.
39+
40+
spi-max-frequency: true
41+
42+
additionalProperties: false
43+
44+
required:
45+
- compatible
46+
- reg
47+
- interrupts
48+
- reset-gpios
49+
- goodix,hid-report-addr
50+
51+
examples:
52+
- |
53+
#include <dt-bindings/interrupt-controller/irq.h>
54+
#include <dt-bindings/gpio/gpio.h>
55+
56+
spi {
57+
#address-cells = <1>;
58+
#size-cells = <0>;
59+
60+
touchscreen@0 {
61+
compatible = "goodix,gt7986u";
62+
reg = <0>;
63+
interrupt-parent = <&gpio>;
64+
interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
65+
reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
66+
spi-max-frequency = <10000000>;
67+
goodix,hid-report-addr = <0x22c8c>;
68+
};
69+
};
70+
71+
...

Documentation/hid/intel-ish-hid.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,35 @@ For more detailed information, please refer to the flow descriptions provided be
404404
| ISHTP Driver | | ISH Bootloader |
405405
+---------------+ +-----------------+
406406

407+
Vendor Custom Firmware Loading
408+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
409+
410+
The firmware running inside ISH can be provided by Intel or developed by vendors using the Firmware Development Kit (FDK) provided by Intel.
411+
Intel will upstream the Intel-built firmware to the ``linux-firmware.git`` repository, located under the path ``intel/ish/``. For the Lunar Lake platform, the Intel-built ISH firmware will be named ``ish_lnlm.bin``.
412+
Vendors who wish to upstream their custom firmware should follow these guidelines for naming their firmware files:
413+
414+
- The firmware filename should use one of the following patterns:
415+
416+
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
417+
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin``
418+
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}.bin``
419+
- ``ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}.bin``
420+
421+
- ``${intel_plat_gen}`` indicates the Intel platform generation (e.g., ``lnlm`` for Lunar Lake) and must not exceed 8 characters in length.
422+
- ``${SYS_VENDOR_CRC32}`` is the CRC32 checksum of the ``sys_vendor`` value from the DMI field ``DMI_SYS_VENDOR``.
423+
- ``${PRODUCT_NAME_CRC32}`` is the CRC32 checksum of the ``product_name`` value from the DMI field ``DMI_PRODUCT_NAME``.
424+
- ``${PRODUCT_SKU_CRC32}`` is the CRC32 checksum of the ``product_sku`` value from the DMI field ``DMI_PRODUCT_SKU``.
425+
426+
During system boot, the ISH Linux driver will attempt to load the firmware in the following order, prioritizing custom firmware with more precise matching patterns:
427+
428+
1. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}_${PRODUCT_SKU_CRC32}.bin``
429+
2. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_SKU_CRC32}.bin``
430+
3. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}_${PRODUCT_NAME_CRC32}.bin``
431+
4. ``intel/ish/ish_${intel_plat_gen}_${SYS_VENDOR_CRC32}.bin``
432+
5. ``intel/ish/ish_${intel_plat_gen}.bin``
433+
434+
The driver will load the first matching firmware and skip the rest. If no matching firmware is found, it will proceed to the next pattern in the specified order. If all searches fail, the default Intel firmware, listed last in the order above, will be loaded.
435+
407436
ISH Debugging
408437
-------------
409438

drivers/hid/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,12 @@ config HID_VIVALDI_COMMON
404404
option so that drivers can use common code to parse the HID
405405
descriptors for vivaldi function row keymap.
406406

407+
config HID_GOODIX_SPI
408+
tristate "Goodix GT7986U SPI HID touchscreen"
409+
depends on SPI_MASTER
410+
help
411+
Support for Goodix GT7986U SPI HID touchscreen device.
412+
407413
config HID_GOOGLE_HAMMER
408414
tristate "Google Hammer Keyboard"
409415
select HID_VIVALDI_COMMON

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o
5454
obj-$(CONFIG_HID_GFRM) += hid-gfrm.o
5555
obj-$(CONFIG_HID_GLORIOUS) += hid-glorious.o
5656
obj-$(CONFIG_HID_VIVALDI_COMMON) += hid-vivaldi-common.o
57+
obj-$(CONFIG_HID_GOODIX_SPI) += hid-goodix-spi.o
5758
obj-$(CONFIG_HID_GOOGLE_HAMMER) += hid-google-hammer.o
5859
obj-$(CONFIG_HID_GOOGLE_STADIA_FF) += hid-google-stadiaff.o
5960
obj-$(CONFIG_HID_VIVALDI) += hid-vivaldi.o

drivers/hid/amd-sfh-hid/amd_sfh_hid.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ struct amdtp_hid_data {
7373
};
7474

7575
/* Interface functions between HID LL driver and AMD SFH client */
76-
void hid_amdtp_set_feature(struct hid_device *hid, char *buf, u32 len, int report_id);
77-
void hid_amdtp_get_report(struct hid_device *hid, int report_id, int report_type);
7876
int amdtp_hid_probe(u32 cur_hid_dev, struct amdtp_cl_data *cli_data);
7977
void amdtp_hid_remove(struct amdtp_cl_data *cli_data);
8078
int amd_sfh_get_report(struct hid_device *hid, int report_id, int report_type);

drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ static void amd_sfh_set_ops(struct amd_mp2_dev *mp2)
299299

300300
sfh_interface_init(mp2);
301301
mp2_ops = mp2->mp2_ops;
302-
mp2_ops->clear_intr = amd_sfh_clear_intr_v2,
303-
mp2_ops->init_intr = amd_sfh_irq_init_v2,
302+
mp2_ops->clear_intr = amd_sfh_clear_intr_v2;
303+
mp2_ops->init_intr = amd_sfh_irq_init_v2;
304304
mp2_ops->suspend = amd_sfh_suspend;
305305
mp2_ops->resume = amd_sfh_resume;
306306
mp2_ops->remove = amd_mp2_pci_remove;

drivers/hid/bpf/hid_bpf_dispatch.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ int dispatch_hid_bpf_output_report(struct hid_device *hdev,
148148
}
149149
EXPORT_SYMBOL_GPL(dispatch_hid_bpf_output_report);
150150

151-
u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *size)
151+
u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, const u8 *rdesc, unsigned int *size)
152152
{
153153
int ret;
154154
struct hid_bpf_ctx_kern ctx_kern = {
@@ -179,9 +179,7 @@ u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *s
179179
*size = ret;
180180
}
181181

182-
rdesc = krealloc(ctx_kern.data, *size, GFP_KERNEL);
183-
184-
return rdesc;
182+
return krealloc(ctx_kern.data, *size, GFP_KERNEL);
185183

186184
ignore_bpf:
187185
kfree(ctx_kern.data);

drivers/hid/hid-apple.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ static void apple_battery_timer_tick(struct timer_list *t)
620620
* MacBook JIS keyboard has wrong logical maximum
621621
* Magic Keyboard JIS has wrong logical maximum
622622
*/
623-
static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
623+
static const __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
624624
unsigned int *rsize)
625625
{
626626
struct apple_sc *asc = hid_get_drvdata(hdev);

drivers/hid/hid-asus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ static const __u8 asus_g752_fixed_rdesc[] = {
11261126
0x2A, 0xFF, 0x00, /* Usage Maximum (0xFF) */
11271127
};
11281128

1129-
static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
1129+
static const __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
11301130
unsigned int *rsize)
11311131
{
11321132
struct asus_drvdata *drvdata = hid_get_drvdata(hdev);

drivers/hid/hid-aureal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#include "hid-ids.h"
2020

21-
static __u8 *aureal_report_fixup(struct hid_device *hdev, __u8 *rdesc,
21+
static const __u8 *aureal_report_fixup(struct hid_device *hdev, __u8 *rdesc,
2222
unsigned int *rsize)
2323
{
2424
if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {

drivers/hid/hid-bigbenff.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
* - map previously unused analog trigger data to Z/RZ
100100
* - simplify feature and output descriptor
101101
*/
102-
static __u8 pid0902_rdesc_fixed[] = {
102+
static const __u8 pid0902_rdesc_fixed[] = {
103103
0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */
104104
0x09, 0x05, /* Usage (Game Pad) */
105105
0xA1, 0x01, /* Collection (Application) */
@@ -464,12 +464,12 @@ static int bigben_probe(struct hid_device *hid,
464464
return error;
465465
}
466466

467-
static __u8 *bigben_report_fixup(struct hid_device *hid, __u8 *rdesc,
467+
static const __u8 *bigben_report_fixup(struct hid_device *hid, __u8 *rdesc,
468468
unsigned int *rsize)
469469
{
470470
if (*rsize == PID0902_RDESC_ORIG_SIZE) {
471-
rdesc = pid0902_rdesc_fixed;
472471
*rsize = sizeof(pid0902_rdesc_fixed);
472+
return pid0902_rdesc_fixed;
473473
} else
474474
hid_warn(hid, "unexpected rdesc, please submit for review\n");
475475
return rdesc;

drivers/hid/hid-cherry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Cherry Cymotion keyboard have an invalid HID report descriptor,
2323
* that needs fixing before we can parse it.
2424
*/
25-
static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
25+
static const __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
2626
unsigned int *rsize)
2727
{
2828
if (*rsize >= 18 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {

drivers/hid/hid-chicony.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
8888
return 1;
8989
}
9090

91-
static __u8 *ch_switch12_report_fixup(struct hid_device *hdev, __u8 *rdesc,
92-
unsigned int *rsize)
91+
static const __u8 *ch_switch12_report_fixup(struct hid_device *hdev,
92+
__u8 *rdesc, unsigned int *rsize)
9393
{
9494
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
9595

drivers/hid/hid-cmedia.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ MODULE_LICENSE("GPL");
2626
/* Fixed report descriptor of HS-100B audio chip
2727
* Bit 4 is an abolute Microphone mute usage instead of being unassigned.
2828
*/
29-
static __u8 hs100b_rdesc_fixed[] = {
29+
static const __u8 hs100b_rdesc_fixed[] = {
3030
0x05, 0x0C, /* Usage Page (Consumer), */
3131
0x09, 0x01, /* Usage (Consumer Control), */
3232
0xA1, 0x01, /* Collection (Application), */
@@ -199,13 +199,13 @@ static struct hid_driver cmhid_driver = {
199199
.input_mapping = cmhid_input_mapping,
200200
};
201201

202-
static __u8 *cmhid_hs100b_report_fixup(struct hid_device *hid, __u8 *rdesc,
202+
static const __u8 *cmhid_hs100b_report_fixup(struct hid_device *hid, __u8 *rdesc,
203203
unsigned int *rsize)
204204
{
205205
if (*rsize == HS100B_RDESC_ORIG_SIZE) {
206206
hid_info(hid, "Fixing CMedia HS-100B report descriptor\n");
207-
rdesc = hs100b_rdesc_fixed;
208207
*rsize = sizeof(hs100b_rdesc_fixed);
208+
return hs100b_rdesc_fixed;
209209
}
210210
return rdesc;
211211
}

drivers/hid/hid-core.c

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ static void hid_device_release(struct device *dev)
723723
* items, though they are not used yet.
724724
*/
725725

726-
static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
726+
static const u8 *fetch_item(const __u8 *start, const __u8 *end, struct hid_item *item)
727727
{
728728
u8 b;
729729

@@ -880,8 +880,8 @@ static int hid_scan_report(struct hid_device *hid)
880880
{
881881
struct hid_parser *parser;
882882
struct hid_item item;
883-
__u8 *start = hid->dev_rdesc;
884-
__u8 *end = start + hid->dev_rsize;
883+
const __u8 *start = hid->dev_rdesc;
884+
const __u8 *end = start + hid->dev_rsize;
885885
static int (*dispatch_type[])(struct hid_parser *parser,
886886
struct hid_item *item) = {
887887
hid_scan_main,
@@ -946,7 +946,7 @@ static int hid_scan_report(struct hid_device *hid)
946946
* Allocate the device report as read by the bus driver. This function should
947947
* only be called from parse() in ll drivers.
948948
*/
949-
int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size)
949+
int hid_parse_report(struct hid_device *hid, const __u8 *start, unsigned size)
950950
{
951951
hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL);
952952
if (!hid->dev_rdesc)
@@ -1204,10 +1204,10 @@ int hid_open_report(struct hid_device *device)
12041204
struct hid_parser *parser;
12051205
struct hid_item item;
12061206
unsigned int size;
1207-
__u8 *start;
1207+
const __u8 *start;
12081208
__u8 *buf;
1209-
__u8 *end;
1210-
__u8 *next;
1209+
const __u8 *end;
1210+
const __u8 *next;
12111211
int ret;
12121212
int i;
12131213
static int (*dispatch_type[])(struct hid_parser *parser,
@@ -1912,6 +1912,31 @@ int hid_set_field(struct hid_field *field, unsigned offset, __s32 value)
19121912
}
19131913
EXPORT_SYMBOL_GPL(hid_set_field);
19141914

1915+
struct hid_field *hid_find_field(struct hid_device *hdev, unsigned int report_type,
1916+
unsigned int application, unsigned int usage)
1917+
{
1918+
struct list_head *report_list = &hdev->report_enum[report_type].report_list;
1919+
struct hid_report *report;
1920+
int i, j;
1921+
1922+
list_for_each_entry(report, report_list, list) {
1923+
if (report->application != application)
1924+
continue;
1925+
1926+
for (i = 0; i < report->maxfield; i++) {
1927+
struct hid_field *field = report->field[i];
1928+
1929+
for (j = 0; j < field->maxusage; j++) {
1930+
if (field->usage[j].hid == usage)
1931+
return field;
1932+
}
1933+
}
1934+
}
1935+
1936+
return NULL;
1937+
}
1938+
EXPORT_SYMBOL_GPL(hid_find_field);
1939+
19151940
static struct hid_report *hid_get_report(struct hid_report_enum *report_enum,
19161941
const u8 *data)
19171942
{

drivers/hid/hid-corsair.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,8 @@ static int corsair_input_mapping(struct hid_device *dev,
690690
* - USB ID 1b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse
691691
*/
692692

693-
static __u8 *corsair_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
694-
unsigned int *rsize)
693+
static const __u8 *corsair_mouse_report_fixup(struct hid_device *hdev,
694+
__u8 *rdesc, unsigned int *rsize)
695695
{
696696
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
697697

drivers/hid/hid-cougar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ static void cougar_fix_g6_mapping(void)
103103
/*
104104
* Constant-friendly rdesc fixup for mouse interface
105105
*/
106-
static __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc,
107-
unsigned int *rsize)
106+
static const __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc,
107+
unsigned int *rsize)
108108
{
109109
if (*rsize >= 117 && rdesc[2] == 0x09 && rdesc[3] == 0x02 &&
110110
(rdesc[115] | rdesc[116] << 8) >= HID_MAX_USAGES) {

drivers/hid/hid-cp2112.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,6 @@ static void cp2112_gpio_poll_callback(struct work_struct *work)
10941094
{
10951095
struct cp2112_device *dev = container_of(work, struct cp2112_device,
10961096
gpio_poll_worker.work);
1097-
struct irq_data *d;
10981097
u8 gpio_mask;
10991098
u32 irq_type;
11001099
int irq, virq, ret;
@@ -1111,12 +1110,10 @@ static void cp2112_gpio_poll_callback(struct work_struct *work)
11111110
if (!irq)
11121111
continue;
11131112

1114-
d = irq_get_irq_data(irq);
1115-
if (!d)
1113+
irq_type = irq_get_trigger_type(irq);
1114+
if (!irq_type)
11161115
continue;
11171116

1118-
irq_type = irqd_get_trigger_type(d);
1119-
11201117
if (gpio_mask & BIT(virq)) {
11211118
/* Level High */
11221119

0 commit comments

Comments
 (0)