Skip to content

Commit

Permalink
Merge tag 'hid-for-linus-2024111801' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/hid/hid

Pull HID updates from Jiri Kosina:

 - improvement in the way hid-bpf coexists with specific drivers (others
   than hid-generic) that are already bound to devices (Benjamin
   Tissoires)

 - removal of three way-too-aggressive BUG_ON()s from HID drivers (He
   Lugang)

 - assorted cleanups and small code fixes to HID core (Dmitry Torokhov,
   Yan Zhen, Nathan Chancellor, Andy Shevchenko)

 - support for Corsair Void headset family (Stuart Hayhurst)

 - Support for Goodix GT7986U SPI (Charles Wang)

 - initial vendor-specific driver for Kysona, currently adding support
   for Kysona M600 (Lode Willems)

 - other assorted code cleanups and small bugfixes all over the place

* tag 'hid-for-linus-2024111801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (40 commits)
  HID: multitouch: make mt_set_mode() less cryptic
  HID: hid-goodix-spi: Add OF supports
  dt-bindings: input: Goodix GT7986U SPI HID Touchscreen
  HID: hyperv: streamline driver probe to avoid devres issues
  HID: magicmouse: Apple Magic Trackpad 2 USB-C driver support
  HID: rmi: Add select RMI4_F3A in Kconfig
  HID: wacom: Interpret tilt data from Intuos Pro BT as signed values
  HID: steelseries: Add capacity_level mapping
  HID: steelseries: Fix battery requests stopping after some time
  HID: hid-goodix: Fix HID get/set feature operation overwritten problem
  HID: hid-goodix: Return 0 when receiving an empty HID feature package
  HID: bpf: drop use of Logical|Physical|UsageRange
  HID: bpf: Fix Rapoo M50 Plus Silent side buttons
  HID: bpf: Fix NKRO on Mistel MD770
  HID: replace BUG_ON() with WARN_ON()
  HID: wacom: Set eraser status when either 'Eraser' or 'Invert' usage is set
  HID: Kysona: add basic online status
  HID: Kysona: check battery status every 5s using a workqueue
  HID: Kysona: Add basic battery reporting for Kysona M600
  HID: Add IDs for Kysona
  ...
  • Loading branch information
torvalds committed Nov 20, 2024
2 parents e6de688 + 9037968 commit b57807c
Show file tree
Hide file tree
Showing 50 changed files with 2,288 additions and 412 deletions.
38 changes: 38 additions & 0 deletions Documentation/ABI/testing/sysfs-driver-hid-corsair-void
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/fw_version_headset
Date: January 2024
KernelVersion: 6.13
Contact: Stuart Hayhurst <[email protected]>
Description: (R) The firmware version of the headset
* Returns -ENODATA if no version was reported

What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/fw_version_receiver
Date: January 2024
KernelVersion: 6.13
Contact: Stuart Hayhurst <[email protected]>
Description: (R) The firmware version of the receiver

What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/microphone_up
Date: July 2023
KernelVersion: 6.13
Contact: Stuart Hayhurst <[email protected]>
Description: (R) Get the physical position of the microphone
* 1 -> Microphone up
* 0 -> Microphone down

What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/send_alert
Date: July 2023
KernelVersion: 6.13
Contact: Stuart Hayhurst <[email protected]>
Description: (W) Play a built-in notification from the headset (0 / 1)

What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/set_sidetone
Date: December 2023
KernelVersion: 6.13
Contact: Stuart Hayhurst <[email protected]>
Description: (W) Set the sidetone volume (0 - sidetone_max)

What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/sidetone_max
Date: July 2024
KernelVersion: 6.13
Contact: Stuart Hayhurst <[email protected]>
Description: (R) Report the maximum sidetone volume
69 changes: 69 additions & 0 deletions Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/input/goodix,gt7986u-spifw.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Goodix GT7986U SPI HID Touchscreen

maintainers:
- Charles Wang <[email protected]>

description: |
Supports the Goodix GT7986U touchscreen.
This touch controller reports data packaged according to the HID protocol
over the SPI bus, but it is incompatible with Microsoft's HID-over-SPI protocol.
NOTE: these bindings are distinct from the bindings used with the
GT7986U when the chip is running I2C firmware. This is because there's
not a single device that talks over both I2C and SPI but rather
distinct touchscreens that happen to be built with the same ASIC but
that are distinct products running distinct firmware.
allOf:
- $ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
compatible:
enum:
- goodix,gt7986u-spifw

reg:
maxItems: 1

interrupts:
maxItems: 1

reset-gpios:
maxItems: 1

spi-max-frequency: true

required:
- compatible
- reg
- interrupts
- reset-gpios

unevaluatedProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/gpio/gpio.h>
spi {
#address-cells = <1>;
#size-cells = <0>;
touchscreen@0 {
compatible = "goodix,gt7986u-spifw";
reg = <0>;
interrupt-parent = <&gpio>;
interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
spi-max-frequency = <10000000>;
};
};
...
13 changes: 13 additions & 0 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,16 @@ config HID_CHICONY
config HID_CORSAIR
tristate "Corsair devices"
depends on USB_HID && LEDS_CLASS
select POWER_SUPPLY
help
Support for Corsair devices that are not fully compliant with the
HID standard.
Support for Corsair Void headsets.

Supported devices:
- Vengeance K90
- Scimitar PRO RGB
- Corsair Void headsets

config HID_COUGAR
tristate "Cougar devices"
Expand Down Expand Up @@ -465,6 +468,15 @@ config HID_KYE
- MousePen i608X tablet
- EasyPen M610X tablet

config HID_KYSONA
tristate "Kysona devices"
depends on USB_HID
help
Support for Kysona mice.

Say Y here if you have a Kysona M600 mouse
and want to be able to read its battery capacity.

config HID_UCLOGIC
tristate "UC-Logic"
depends on USB_HID
Expand Down Expand Up @@ -1096,6 +1108,7 @@ config HID_RMI
select RMI4_F11
select RMI4_F12
select RMI4_F30
select RMI4_F3A
help
Support for Synaptics RMI4 touchpads.
Say Y here if you have a Synaptics RMI4 touchpads over i2c-hid or usbhid
Expand Down
3 changes: 2 additions & 1 deletion drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ obj-$(CONFIG_HID_BIGBEN_FF) += hid-bigbenff.o
obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
obj-$(CONFIG_HID_CMEDIA) += hid-cmedia.o
obj-$(CONFIG_HID_CORSAIR) += hid-corsair.o
obj-$(CONFIG_HID_CORSAIR) += hid-corsair.o hid-corsair-void.o
obj-$(CONFIG_HID_COUGAR) += hid-cougar.o
obj-$(CONFIG_HID_CP2112) += hid-cp2112.o
obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
Expand Down Expand Up @@ -70,6 +70,7 @@ obj-$(CONFIG_HID_JABRA) += hid-jabra.o
obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o
obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o
obj-$(CONFIG_HID_KYE) += hid-kye.o
obj-$(CONFIG_HID_KYSONA) += hid-kysona.o
obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o
obj-$(CONFIG_HID_LENOVO) += hid-lenovo.o
obj-$(CONFIG_HID_LETSKETCH) += hid-letsketch.o
Expand Down
9 changes: 6 additions & 3 deletions drivers/hid/bpf/hid_bpf_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int dispatch_hid_bpf_output_report(struct hid_device *hdev,
}
EXPORT_SYMBOL_GPL(dispatch_hid_bpf_output_report);

u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, const u8 *rdesc, unsigned int *size)
const u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, const u8 *rdesc, unsigned int *size)
{
int ret;
struct hid_bpf_ctx_kern ctx_kern = {
Expand Down Expand Up @@ -183,7 +183,7 @@ u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, const u8 *rdesc, unsigned

ignore_bpf:
kfree(ctx_kern.data);
return kmemdup(rdesc, *size, GFP_KERNEL);
return rdesc;
}
EXPORT_SYMBOL_GPL(call_hid_bpf_rdesc_fixup);

Expand Down Expand Up @@ -260,8 +260,11 @@ int hid_bpf_allocate_event_data(struct hid_device *hdev)

int hid_bpf_reconnect(struct hid_device *hdev)
{
if (!test_and_set_bit(ffs(HID_STAT_REPROBED), &hdev->status))
if (!test_and_set_bit(ffs(HID_STAT_REPROBED), &hdev->status)) {
/* trigger call to call_hid_bpf_rdesc_fixup() during the next probe */
hdev->bpf_rsize = 0;
return device_reprobe(&hdev->dev);
}

return 0;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/bpf/hid_bpf_struct_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static int hid_bpf_ops_btf_struct_access(struct bpf_verifier_log *log,
WRITE_RANGE(hid_device, name, true),
WRITE_RANGE(hid_device, uniq, true),
WRITE_RANGE(hid_device, phys, true),
WRITE_RANGE(hid_device, quirks, false),
};
#undef WRITE_RANGE
const struct btf_type *state = NULL;
Expand Down
66 changes: 44 additions & 22 deletions drivers/hid/bpf/progs/Huion__Dial-2.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ static const __u8 fixed_rdesc_pad[] = {
CollectionApplication(
// -- Byte 0 in report
ReportId(PAD_REPORT_ID)
LogicalRange_i8(0, 1)
LogicalMaximum_i8(0)
LogicalMaximum_i8(1)
UsagePage_Digitizers
Usage_Dig_TabletFunctionKeys
CollectionPhysical(
Expand All @@ -234,14 +235,17 @@ static const __u8 fixed_rdesc_pad[] = {
Input(Var|Abs)
// Byte 4 in report is the dial
Usage_GD_Wheel
LogicalRange_i8(-1, 1)
LogicalMinimum_i8(-1)
LogicalMaximum_i8(1)
ReportCount(1)
ReportSize(8)
Input(Var|Rel)
// Byte 5 is the button state
UsagePage_Button
UsageRange_i8(0x01, 0x8)
LogicalRange_i8(0x0, 0x1)
UsageMinimum_i8(0x01)
UsageMaximum_i8(0x08)
LogicalMinimum_i8(0x0)
LogicalMaximum_i8(0x1)
ReportCount(7)
ReportSize(1)
Input(Var|Abs)
Expand All @@ -265,7 +269,8 @@ static const __u8 fixed_rdesc_pen[] = {
Usage_Dig_TipSwitch
Usage_Dig_BarrelSwitch
Usage_Dig_SecondaryBarrelSwitch // maps eraser to BTN_STYLUS2
LogicalRange_i8(0, 1)
LogicalMinimum_i8(0)
LogicalMaximum_i8(1)
ReportSize(1)
ReportCount(3)
Input(Var|Abs)
Expand All @@ -280,22 +285,28 @@ static const __u8 fixed_rdesc_pen[] = {
UsagePage_GenericDesktop
Unit(cm)
UnitExponent(-1)
PhysicalRange_i16(0, 266)
LogicalRange_i16(0, 32767)
PhysicalMinimum_i16(0)
PhysicalMaximum_i16(266)
LogicalMinimum_i16(0)
LogicalMaximum_i16(32767)
Usage_GD_X
Input(Var|Abs) // Bytes 2+3
PhysicalRange_i16(0, 166)
LogicalRange_i16(0, 32767)
PhysicalMinimum_i16(0)
PhysicalMaximum_i16(166)
LogicalMinimum_i16(0)
LogicalMaximum_i16(32767)
Usage_GD_Y
Input(Var|Abs) // Bytes 4+5
)
UsagePage_Digitizers
Usage_Dig_TipPressure
LogicalRange_i16(0, 8191)
LogicalMinimum_i16(0)
LogicalMaximum_i16(8191)
Input(Var|Abs) // Byte 6+7
ReportSize(8)
ReportCount(2)
LogicalRange_i8(-60, 60)
LogicalMinimum_i8(-60)
LogicalMaximum_i8(60)
Usage_Dig_XTilt
Usage_Dig_YTilt
Input(Var|Abs) // Byte 8+9
Expand All @@ -313,7 +324,8 @@ static const __u8 fixed_rdesc_vendor[] = {
Usage_Dig_Pen
CollectionPhysical(
// Byte 1 are the buttons
LogicalRange_i8(0, 1)
LogicalMinimum_i8(0)
LogicalMaximum_i8(1)
ReportSize(1)
Usage_Dig_TipSwitch
Usage_Dig_BarrelSwitch
Expand All @@ -333,25 +345,31 @@ static const __u8 fixed_rdesc_vendor[] = {
UnitExponent(-1)
// Note: reported logical range differs
// from the pen report ID for x and y
LogicalRange_i16(0, 53340)
PhysicalRange_i16(0, 266)
LogicalMinimum_i16(0)
LogicalMaximum_i16(53340)
PhysicalMinimum_i16(0)
PhysicalMaximum_i16(266)
// Bytes 2/3 in report
Usage_GD_X
Input(Var|Abs)
LogicalRange_i16(0, 33340)
PhysicalRange_i16(0, 166)
LogicalMinimum_i16(0)
LogicalMaximum_i16(33340)
PhysicalMinimum_i16(0)
PhysicalMaximum_i16(166)
// Bytes 4/5 in report
Usage_GD_Y
Input(Var|Abs)
)
// Bytes 6/7 in report
LogicalRange_i16(0, 8191)
LogicalMinimum_i16(0)
LogicalMaximum_i16(8191)
Usage_Dig_TipPressure
Input(Var|Abs)
// Bytes 8/9 in report
ReportCount(1) // Padding
Input(Const)
LogicalRange_i8(-60, 60)
LogicalMinimum_i8(-60)
LogicalMaximum_i8(60)
// Byte 10 in report
Usage_Dig_XTilt
// Byte 11 in report
Expand All @@ -366,7 +384,8 @@ static const __u8 fixed_rdesc_vendor[] = {
CollectionApplication(
// Byte 0
ReportId(PAD_REPORT_ID)
LogicalRange_i8(0, 1)
LogicalMinimum_i8(0)
LogicalMaximum_i8(1)
UsagePage_Digitizers
Usage_Dig_TabletFunctionKeys
CollectionPhysical(
Expand All @@ -386,15 +405,18 @@ static const __u8 fixed_rdesc_vendor[] = {
Input(Var|Abs)
// Byte 4 is the button state
UsagePage_Button
UsageRange_i8(0x01, 0x8)
LogicalRange_i8(0x0, 0x1)
UsageMinimum_i8(0x1)
UsageMaximum_i8(0x8)
LogicalMinimum_i8(0x0)
LogicalMaximum_i8(0x1)
ReportCount(8)
ReportSize(1)
Input(Var|Abs)
// Byte 5 is the top dial
UsagePage_GenericDesktop
Usage_GD_Wheel
LogicalRange_i8(-1, 1)
LogicalMinimum_i8(-1)
LogicalMaximum_i8(1)
ReportCount(1)
ReportSize(8)
Input(Var|Rel)
Expand Down
Loading

0 comments on commit b57807c

Please sign in to comment.