Commit Graph

1295578 Commits

Author SHA1 Message Date
Benjamin Tissoires
0aa04373bc Merge branch 'for-6.12/cp2112' into for-linus
- Use irq_get_trigger_type() helper (Jinjie Ruan)
2024-09-13 16:04:30 +02:00
Jinjie Ruan
e9a081c80c hid: cp2112: Use irq_get_trigger_type() helper
Use irq_get_trigger_type() to replace irq_get_irq_data() and then
irqd_get_trigger_type(), if the irq data is NULL it will return 0.

No functional changed.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Link: https://patch.msgid.link/20240913074632.3779321-1-ruanjinjie@huawei.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-13 15:39:37 +02:00
Benjamin Tissoires
ce28dae326 Merge branch 'for-6.12/picolcd' into for-linus
- Use backlight power constants (Thomas Zimmermann)
2024-09-13 15:28:14 +02:00
Benjamin Tissoires
c9ce59650e Merge branch 'for-6.12/elan' into for-linus
- Add support for one new Elan device (ekth6a12nay) (Zhaoxiong Lv)
2024-09-13 15:27:27 +02:00
Benjamin Tissoires
54ab927352 Merge branch 'for-6.12/hid-playstation' into for-linus
- Enhance compatibility with clone controllers (Max Staudt)
2024-09-13 15:26:35 +02:00
Benjamin Tissoires
fe9c6249e8 Merge branch 'for-6.12/goodix-spi' into for-linus
- Add support for a new Goodix HID over SPI driver (Charles Wang)

Note: this driver doesn't rely on the spefication of HID over SPI
provided by Microsoft, thus needs a separate driver, not a generic bus
transport low level driver.
2024-09-13 15:24:03 +02:00
Benjamin Tissoires
1a811edf4f Merge branch 'for-6.12/wacom' into for-linus
Various Wacom fixes (Jason Gerecke):
- Support for high-resolution wheel scrolling
- Support touchrings with relative motion
- Support devices with two touchrings
- Support sequence numbers smaller than 16-bit
2024-09-13 15:21:44 +02:00
Benjamin Tissoires
8357632ef9 Merge branch 'for-6.12/amd_sfh' into for-linus
- Convert comma to semicolon (Chen Ni)
2024-09-13 15:20:58 +02:00
Benjamin Tissoires
1b6ff737e2 Merge branch 'for-6.12/intel-ish' into for-linus
- Add support for vendor customized firmware loading (Zhang Lixu)
2024-09-13 15:20:01 +02:00
Benjamin Tissoires
b169410962 Merge branch 'i2c-hid' into for-linus
- ensure various commands do not interfere with each other (Dmitry
  Torokhov)
2024-09-13 15:18:33 +02:00
Benjamin Tissoires
6937a82d48 Merge branch 'for-6.12/hidraw' into for-linus
- introduction of HIDIOCREVOKE ioctl to revoke a hidraw fd opened by a
  regular (non-root) application (Peter Hutterer)
2024-09-13 15:16:56 +02:00
Benjamin Tissoires
054e0bd345 Merge branch 'for-6.12/constify-rdesc' into for-linus
- Constification of report descriptors so drivers can use read-only
  memory when declaring report descriptors fixups (Thomas Weißschuh)
2024-09-13 15:14:56 +02:00
Benjamin Tissoires
37c25a5031 Merge branch 'for-6.12/core' into for-linus
- add helper for finding a field with a certain usage (Kerem Karabay)
2024-09-13 15:14:06 +02:00
Benjamin Tissoires
8f7ec7fe25 Merge branch 'for-6.11/bpf' into for-linus
One leftover which should have gone earlier:
- fix HID-BPF samples (Benjamin Tissoires)
2024-09-13 15:11:46 +02:00
Benjamin Tissoires
10a5fd6e98 Merge branch 'for-6.11/upstream-fixes' into for-linus
Small fixes for drivers/hid:
- Add support for 3 multitouch panels (He Lugang, tammy tseng and Vishnu
  Sankar)
- Unused declarations cleanups (Yue Haibing)
- Fix comma vs semicolon (Chen Ni)
2024-09-13 15:07:09 +02:00
Dmitry Torokhov
b4ed18a3d5 HID: i2c-hid: ensure various commands do not interfere with each other
i2c-hid uses 2 shared buffers: command and "raw" input buffer for
sending requests to peripherals and read data from peripherals when
executing variety of commands. Such commands include reading of HID
registers, requesting particular power mode, getting and setting
reports and so on. Because all such requests use the same 2 buffers
they should not execute simultaneously.

Fix this by introducing "cmd_lock" mutex and acquire it whenever
we needs to access ihid->cmdbuf or idid->rawbuf.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-12 14:11:36 +02:00
Vishnu Sankar
65b72ea91a HID: multitouch: Add support for Thinkpad X12 Gen 2 Kbd Portfolio
This applies similar quirks used by previous generation device, so that
Trackpoint and buttons on the touchpad works.  New USB KBD PID 0x61AE for
Thinkpad X12 Tab is added.

Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-11 14:17:52 +02:00
Jason Gerecke
84aecf2d25 HID: wacom: Do not warn about dropped packets for first packet
The driver currently assumes that the first sequence number it will see
is going to be 0. This is not a realiable assumption and can break if,
for example, the tablet has already been running for some time prior to
the kernel driver connecting to the device. This commit initializes the
expected sequence number to -1 and will only print the "Dropped" warning
the it has been updated to a non-negative value.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Tested-by: Joshua Dickens <joshua.dickens@wacom.com>
Fixes: 6d09085b38 ("HID: wacom: Adding Support for new usages")
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-10 23:47:03 +02:00
Jason Gerecke
359673ea3a HID: wacom: Support sequence numbers smaller than 16-bit
The current dropped packet reporting assumes that all sequence numbers
are 16 bits in length. This results in misleading "Dropped" messages if
the hardware uses fewer bits. For example, if a tablet uses only 8 bits
to store its sequence number, once it rolls over from 255 -> 0, the
driver will still be expecting a packet "256". This patch adjusts the
logic to reset the next expected packet to logical_minimum whenever
it overflows beyond logical_maximum.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Tested-by: Joshua Dickens <joshua.dickens@wacom.com>
Fixes: 6d09085b38 ("HID: wacom: Adding Support for new usages")
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-10 23:47:03 +02:00
Thomas Weißschuh
9f5305ed80 HID: lg: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240905-hid-const-fixup-2-v2-1-70915e0cc1c7@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-06 10:06:02 +02:00
Thomas Weißschuh
03f8dc1d0a HID: uclogic: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-14-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:57 +02:00
Thomas Weißschuh
24b3c515c6 HID: waltop: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-12-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:57 +02:00
Thomas Weißschuh
d4781a27ad HID: sony: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-11-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:57 +02:00
Thomas Weißschuh
4211f9b112 HID: pxrc: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-10-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:57 +02:00
Thomas Weißschuh
88ae9ffc7c HID: steelseries: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-9-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:57 +02:00
Thomas Weißschuh
4f3ff3a275 HID: viewsonic: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-8-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:57 +02:00
Thomas Weißschuh
49cf20b878 HID: vrc2: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-7-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:57 +02:00
Thomas Weißschuh
c06df4c57a HID: xiaomi: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-6-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:57 +02:00
Thomas Weißschuh
d8b21af666 HID: maltron: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-5-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:56 +02:00
Thomas Weißschuh
b299944af7 HID: keytouch: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-4-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:56 +02:00
Thomas Weißschuh
3ce7edfa4f HID: holtek-kbd: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-3-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:56 +02:00
Thomas Weißschuh
49e00b5ca0 HID: dr: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-2-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:56 +02:00
Thomas Weißschuh
00f6f65bd1 HID: bigbenff: constify fixed up report descriptor
Now that the HID core can handle const report descriptors,
constify them where possible.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240828-hid-const-fixup-2-v1-1-663b9210eb69@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-09-05 16:20:56 +02:00
Thomas Zimmermann
28a7eeb9eb HID: picoLCD: Use backlight power constants
Replace FB_BLANK_ constants with their counterparts from the
backlight subsystem. The values are identical, so there's no
change in functionality or semantics.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-05 10:55:15 +02:00
Chen Ni
d11cfda966 HID: hid-sensor-custom: Convert comma to semicolon
Replace a comma between expression statements by a semicolon.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-03 14:00:05 +02:00
tammy tseng
de07af0ab0 HID: add patch for sis multitouch format
The patch is to add proper quirks for sis multitouch format

Signed-off-by: tammy tseng <tammy0524@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-03 13:58:30 +02:00
He Lugang
251efae73b HID: multitouch: Add support for lenovo Y9000P Touchpad
The 2024 Lenovo Y9000P which use GT7868Q chip also needs a fixup.
The information of the chip is as follows:
I2C HID v1.00 Mouse [GXTP5100:00 27C6:01E0]

Signed-off-by: He Lugang <helugang@uniontech.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-03 13:54:10 +02:00
Chen Ni
8417b265e1 HID: amd_sfh: Convert comma to semicolon
Replace a comma between expression statements by a semicolon.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-03 13:39:16 +02:00
Zhaoxiong Lv
d06651bebf HID: i2c-hid: elan: Add elan-ekth6a12nay timing
Elan-ekth6a12nay requires reset to pull down time greater than 10ms,
so the configuration post_power_delay_ms is 10, and the chipset
initial time is required to be greater than 300ms,
so the post_gpio_reset_on_delay_ms is set to 300.

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-03 13:21:21 +02:00
Zhaoxiong Lv
e0808d7a63 dt-bindings: HID: i2c-hid: elan: Introduce Elan ekth6a12nay
The Elan ekth6a12nay touch screen chip same as Elan eKTH6915 controller
has a reset gpio. The difference is that they have different
post_power_delay_ms.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-09-03 13:21:21 +02:00
Dan Carpenter
252ed1f7f7 HID: hid-goodix: Fix type promotion bug in goodix_hid_get_raw_report()
The issue is GOODIX_HID_PKG_LEN_SIZE is defined as sizeof(u16) which is
type size_t.  However, goodix_hid_check_ack_status() returns negative
error codes or potentially a positive but invalid length which is too
small.  So when we compare "if ((response_data_len <=
GOODIX_HID_PKG_LEN_SIZE)" then negative error codes are type promoted to
size_t and counted as a positive large value and treated as valid.

It would have been easy enough to add some casting to avoid the type
promotion, however this patch takes a more thourough approach and moves
the length check into goodix_hid_check_ack_status().  Now the function
only return negative error codes or zero on success and the length
pointer is never set to an invalid length.

Fixes: 75e16c8ce2 ("HID: hid-goodix: Add Goodix HID-over-SPI driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-08-29 21:49:22 +02:00
Benjamin Tissoires
321f7798cf selftests/hid: Add HIDIOCREVOKE tests
Add 4 tests for the new revoke ioctl, for read/write/ioctl and poll.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Link: https://patch.msgid.link/20240827-hidraw-revoke-v5-4-d004a7451aea@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-08-29 10:39:37 +02:00
Benjamin Tissoires
8163892a62 selftests/hid: Add initial hidraw tests skeleton
Largely inspired from hid_bpf.c for the fixture setup.

Create a couple of tests for hidraw:
- create a uhid device and check if the fixture is working properly
- inject one uhid event and read it through hidraw

These tests are not that useful for now, but will be once we start adding
the ioctl and BPFs to revoke the hidraw node.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Link: https://patch.msgid.link/20240827-hidraw-revoke-v5-3-d004a7451aea@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-08-29 10:39:37 +02:00
Benjamin Tissoires
375e9bde9f selftests/hid: extract the utility part of hid_bpf.c into its own header
When adding new tests programs, we need the same mechanics to create
new virtual devices, and read from their matching hidraw node.

Extract the common part into its own header so we can easily add new
tests C-files.

Link: https://patch.msgid.link/20240827-hidraw-revoke-v5-2-d004a7451aea@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-08-29 10:39:37 +02:00
Peter Hutterer
b31c9d9dc3 HID: hidraw: add HIDIOCREVOKE ioctl
There is a need for userspace applications to open HID devices directly.
Use-cases include configuration of gaming mice or direct access to
joystick devices. The latter is currently handled by the uaccess tag in
systemd, other devices include more custom/local configurations or just
sudo.

A better approach is what we already have for evdev devices: give the
application a file descriptor and revoke it when it may no longer access
that device.

This patch is the hidraw equivalent to the EVIOCREVOKE ioctl, see
commit c7dc65737c ("Input: evdev - add EVIOCREVOKE ioctl") for full
details.

An MR for systemd-logind has been filed here:
https://github.com/systemd/systemd/pull/33970

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Link: https://patch.msgid.link/20240827-hidraw-revoke-v5-1-d004a7451aea@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-08-29 10:39:37 +02:00
Thomas Weißschuh
c1f9eff7b2 HID: winwing: constify read-only structs
These structs are never modified, so mark them as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240804-hid-const-winwing-v1-1-5a6c714753b1@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-08-27 18:25:53 +02:00
Thomas Weißschuh
e6de161b5a HID: cmedia: constify fixed up report descriptor
The HID core now allows static report descriptors to be read-only,
make use of it.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240803-hid-const-fixup-v2-7-f53d7a7b29d8@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-08-27 16:30:43 +02:00
Thomas Weißschuh
fe73965d07 HID: change return type of report_fixup() to const
By allowing the drivers to return a "const *" they can constify their
static report arrays.
This makes it clear to driver authors that the HID core will not modify
those reports and they can be reused for multiple devices.
Furthermore security is slightly improved as those reports are protected
against accidental or malicious modifications.

[bentiss: fixup hid-cougar.c and hid-multitouch.c for latest version of
the master branch]

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240803-hid-const-fixup-v2-6-f53d7a7b29d8@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-08-27 16:29:55 +02:00
Thomas Weißschuh
3593630c89 HID: constify hid_device::dev_rdesc
Once a report descriptor has been created by the HID core it is not
supposed to be modified anymore.
Enforce this invariant through the type system.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240803-hid-const-fixup-v2-5-f53d7a7b29d8@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-08-27 16:18:51 +02:00
Thomas Weißschuh
80cfb508f3 HID: constify params and return value of fetch_item()
fetch_item() does not modify the descriptor it operates on.
As a prerequisite for the constification of hid_driver::dev_rdesc,
mark the parameters and return value of fetch_item() as const.

Also adapt the variable types in the callers to match this
constification.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240803-hid-const-fixup-v2-4-f53d7a7b29d8@weissschuh.net
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-08-27 16:18:51 +02:00