summaryrefslogtreecommitdiff
path: root/drivers/hid
AgeCommit message (Collapse)AuthorFilesLines
2024-04-12HID: mcp-2221: cancel delayed_work only when CONFIG_IIO is enabledAbdelrahman Morsy1-0/+2
If the device is unplugged and CONFIG_IIO is not supported, this will result in a warning message at kernel/workqueue. Only cancel delayed work in mcp2221_remove(), when CONFIG_IIO is enabled. Signed-off-by: Abdelrahman Morsy <abdelrahmanhesham94@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-04-03HID: logitech-dj: allow mice to use all types of reportsYaraslau Furman1-3/+1
You can bind whatever action you want to the mouse's reprogrammable buttons using Windows application. Allow Linux to receive multimedia keycodes. Fixes: 3ed224e273ac ("HID: logitech-dj: Fix 064d:c52f receiver support") Signed-off-by: Yaraslau Furman <yaro330@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-04-03HID: i2c-hid: Revert to await reset ACK before reading report descriptorKenny Levinsen1-21/+8
In af93a167eda9, i2c_hid_parse was changed to continue with reading the report descriptor before waiting for reset to be acknowledged. This has lead to two regressions: 1. We fail to handle reset acknowledgment if it happens while reading the report descriptor. The transfer sets I2C_HID_READ_PENDING, which causes the IRQ handler to return without doing anything. This affects both a Wacom touchscreen and a Sensel touchpad. 2. On a Sensel touchpad, reading the report descriptor this quickly after reset results in all zeroes or partial zeroes. The issues were observed on the Lenovo Thinkpad Z16 Gen 2. The change in question was made based on a Microsoft article[0] stating that Windows 8 *may* read the report descriptor in parallel with awaiting reset acknowledgment, intended as a slight reset performance optimization. Perhaps they only do this if reset is not completing quickly enough for their tastes? As the code is not currently ready to read registers in parallel with a pending reset acknowledgment, and as reading quickly breaks the report descriptor on the Sensel touchpad, revert to waiting for reset acknowledgment before proceeding to read the report descriptor. [0]: https://learn.microsoft.com/en-us/windows-hardware/drivers/hid/plug-and-play-support-and-power-management Fixes: af93a167eda9 ("HID: i2c-hid: Move i2c_hid_finish_hwreset() to after reading the report-descriptor") Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2271136 Cc: stable@vger.kernel.org Signed-off-by: Kenny Levinsen <kl@kl.wtf> Link: https://lore.kernel.org/r/20240331182440.14477-1-kl@kl.wtf [hdegoede@redhat.com Drop no longer necessary abort_reset error exit path] Signed-off-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-04-03HID: nintendo: Fix N64 controller being identified as mouseNuno Pereira1-4/+4
This patch is regarding the recent addition of support for the NSO controllers to hid-nintendo. All controllers are working correctly with the exception of the N64 controller, which is being identified as a mouse by udev. This results in the joystick controlling the mouse cursor and the controller not being detected by games. The reason for this is because the N64's C buttons have been attributed to BTN_FORWARD, BTN_BACK, BTN_LEFT, BTN_RIGHT, which are buttons typically attributed to mice. This patch changes those buttons to controller buttons, making the controller be correctly identified as such. Signed-off-by: Nuno Pereira <nf.pereira@outlook.pt> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-03-21HID: intel-ish-hid: ipc: Fix dev_err usage with uninitialized dev->devcZhang Lixu1-1/+1
The variable dev->devc in ish_dev_init was utilized by dev_err before it was properly assigned. To rectify this, the assignment of dev->devc has been moved to immediately follow memory allocation. Without this change "(NULL device *)" is printed for device information. Fixes: 8ae2f2b0a284 ("HID: intel-ish-hid: ipc: Fix potential use-after-free in work function") Fixes: ae02e5d40d5f ("HID: intel-ish-hid: ipc layer") Signed-off-by: Zhang Lixu <lixu.zhang@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-03-21HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-upNam Cao1-9/+0
The flag I2C_HID_READ_PENDING is used to serialize I2C operations. However, this is not necessary, because I2C core already has its own locking for that. More importantly, this flag can cause a lock-up: if the flag is set in i2c_hid_xfer() and an interrupt happens, the interrupt handler (i2c_hid_irq) will check this flag and return immediately without doing anything, then the interrupt handler will be invoked again in an infinite loop. Since interrupt handler is an RT task, it takes over the CPU and the flag-clearing task never gets scheduled, thus we have a lock-up. Delete this unnecessary flag. Reported-and-tested-by: Eva Kurchatova <nyandarknessgirl@gmail.com> Closes: https://lore.kernel.org/r/CA+eeCSPUDpUg76ZO8dszSbAGn+UHjcyv8F1J-CUPVARAzEtW9w@mail.gmail.com Fixes: 4a200c3b9a40 ("HID: i2c-hid: introduce HID over i2c specification implementation") Cc: <stable@vger.kernel.org> Signed-off-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-03-14Merge tag 'hid-for-linus-2024031301' of ↵Linus Torvalds20-194/+621
git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid Pull HID updates from Jiri Kosina: - support for the following Bluetooth devices from Samsung: Samsung wireless {Keyboard, GamePad, Action Mouse, Book Cover, Universal Keyboard, HOGP Keyboard} (Sandeep C S) - second version of code for applying proper quirk depending on firmware version for lenovo/cptkbd (Mikhail Khvainitski) - lenovo/cptkbd firmware-dependent quirk (Mikhail Khvainitski) - assorted fixes and optimizations for amd-sfh (Basavaraj Natikar) - dead code and dead data structures removal (Jiri Slaby, Jiapeng Chong) * tag 'hid-for-linus-2024031301' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (25 commits) HID: amd_sfh: Set the AMD SFH driver to depend on x86 HID: input: avoid polling stylus battery on Chromebook Pompom HID: amd_sfh: Extend MP2 register access to SFH HID: amd_sfh: Improve boot time when SFH is available HID: amd_sfh: Avoid disabling the interrupt HID: amd_sfh: Update HPD sensor structure elements HID: amd_sfh: Increase sensor command timeout HID: intel-ish-hid: ipc: Add Arrow Lake PCI device ID HID: nintendo: Remove some unused functions HID: hid-prodikeys: remove struct pk_device HID: hid-prodikeys: remove unused struct pcmidi_snd members HID: hid-multitouch: remove unused mt_application::dev_time HID: hid-lg3ff: remove unused struct lg3ff_device HID: protect hid_device::bpf by CONFIG_HID_BPF HID: wacom: remove unused hid_data::pressure HID: apple: remove unused members from struct apple_sc_backlight HID: wacom: Clean up use of struct->wacom_wac HID: samsung: Add Samsung wireless bookcover and universal keyboard support HID: samsung: Add Samsung wireless action mouse support HID: samsung: Add Samsung wireless gamepad support ...
2024-03-13Merge branch 'for-6.9/wacom' into for-linusJiri Kosina1-4/+4
- small cleanup of struct->wacom_wac usage (Tatsunosuke Tobita)
2024-03-13Merge branch 'for-6.9/unused-struct-removal' into for-linusJiri Kosina5-82/+40
- removal of unused data structures all over the place (Jiri Slaby)
2024-03-13Merge branch 'for-6.9/samsung' into for-linusJiri Kosina2-36/+408
- support for the following Bluetooth devices (Sandeep C S): Samsung wireless Keyboard Samsung wireless GamePad Samsung Wireless Action Mouse Samsung Wireless Book Cover Samsung Wireless Universal Keyboard Samsung Wireless HOGP Keyboard Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-03-13Merge branch 'for-6.9/nintendo' into for-linusJiri Kosina1-22/+0
- dead code removal in hid-nintendo (Jiapeng Chong)
2024-03-13Merge branch 'for-6.9/lenovo' into for-linusJiri Kosina1-18/+39
- 2nd version of code for applying proper quirk depending on firmware version for lenovo/cptkbd (Mikhail Khvainitski)
2024-03-13Merge branch 'for-6.9/amd-sfh' into for-linusJiri Kosina7-32/+125
- assorted fixes and optimizations for amd-sfh (Basavaraj Natikar) Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-03-03Merge tag 'for-netdev' of ↵Jakub Kicinski1-4/+4
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next Daniel Borkmann says: ==================== pull-request: bpf-next 2024-02-29 We've added 119 non-merge commits during the last 32 day(s) which contain a total of 150 files changed, 3589 insertions(+), 995 deletions(-). The main changes are: 1) Extend the BPF verifier to enable static subprog calls in spin lock critical sections, from Kumar Kartikeya Dwivedi. 2) Fix confusing and incorrect inference of PTR_TO_CTX argument type in BPF global subprogs, from Andrii Nakryiko. 3) Larger batch of riscv BPF JIT improvements and enabling inlining of the bpf_kptr_xchg() for RV64, from Pu Lehui. 4) Allow skeleton users to change the values of the fields in struct_ops maps at runtime, from Kui-Feng Lee. 5) Extend the verifier's capabilities of tracking scalars when they are spilled to stack, especially when the spill or fill is narrowing, from Maxim Mikityanskiy & Eduard Zingerman. 6) Various BPF selftest improvements to fix errors under gcc BPF backend, from Jose E. Marchesi. 7) Avoid module loading failure when the module trying to register a struct_ops has its BTF section stripped, from Geliang Tang. 8) Annotate all kfuncs in .BTF_ids section which eventually allows for automatic kfunc prototype generation from bpftool, from Daniel Xu. 9) Several updates to the instruction-set.rst IETF standardization document, from Dave Thaler. 10) Shrink the size of struct bpf_map resp. bpf_array, from Alexei Starovoitov. 11) Initial small subset of BPF verifier prepwork for sleepable bpf_timer, from Benjamin Tissoires. 12) Fix bpftool to be more portable to musl libc by using POSIX's basename(), from Arnaldo Carvalho de Melo. 13) Add libbpf support to gcc in CORE macro definitions, from Cupertino Miranda. 14) Remove a duplicate type check in perf_event_bpf_event, from Florian Lehner. 15) Fix bpf_spin_{un,}lock BPF helpers to actually annotate them with notrace correctly, from Yonghong Song. 16) Replace the deprecated bpf_lpm_trie_key 0-length array with flexible array to fix build warnings, from Kees Cook. 17) Fix resolve_btfids cross-compilation to non host-native endianness, from Viktor Malik. * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (119 commits) selftests/bpf: Test if shadow types work correctly. bpftool: Add an example for struct_ops map and shadow type. bpftool: Generated shadow variables for struct_ops maps. libbpf: Convert st_ops->data to shadow type. libbpf: Set btf_value_type_id of struct bpf_map for struct_ops. bpf: Replace bpf_lpm_trie_key 0-length array with flexible array bpf, arm64: use bpf_prog_pack for memory management arm64: patching: implement text_poke API bpf, arm64: support exceptions arm64: stacktrace: Implement arch_bpf_stack_walk() for the BPF JIT bpf: add is_async_callback_calling_insn() helper bpf: introduce in_sleepable() helper bpf: allow more maps in sleepable bpf programs selftests/bpf: Test case for lacking CFI stub functions. bpf: Check cfi_stubs before registering a struct_ops type. bpf: Clarify batch lookup/lookup_and_delete semantics bpf, docs: specify which BPF_ABS and BPF_IND fields were zero bpf, docs: Fix typos in instruction-set.rst selftests/bpf: update tcp_custom_syncookie to use scalar packet offset bpf: Shrink size of struct bpf_map/bpf_array. ... ==================== Link: https://lore.kernel.org/r/20240301001625.8800-1-daniel@iogearbox.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-02-28HID: amd_sfh: Set the AMD SFH driver to depend on x86Basavaraj Natikar1-0/+1
Considering that amd_sfh exists only on AMD platforms, set the AMD SFH driver to depend on x86 to avoid build warnings or errors on other architectures, as shown below. drivers/hid/amd-sfh-hid/amd_sfh_pcie.c: In function 'amd_mp2_pci_probe': drivers/hid/amd-sfh-hid/amd_sfh_pcie.c:413:21: error: 'boot_cpu_data' undeclared (first use in this function); did you mean 'boot_cpu_hwid'? 413 | if (boot_cpu_data.x86 >= 0x1A) | ^~~~~~~~~~~~~ | boot_cpu_hwid Fixes: 6296562f30b1 ("HID: amd_sfh: Extend MP2 register access to SFH") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Closes: https://lore.kernel.org/all/20240228145648.41c493ec@canb.auug.org.au/ Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-27HID: input: avoid polling stylus battery on Chromebook PompomDmitry Torokhov2-0/+3
Internal touchscreen on Trogdor Pompom (AKA Dynabook Chromebook C1) supports USI stylus. Unfortunately the HID descriptor for the stylus interface does not contain "Stylus" physical collection, which makes the kernel to try and pull battery information, resulting in errors. Apply HID_BATTERY_QUIRK_AVOID_QUERY to the device. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-27HID: amd_sfh: Extend MP2 register access to SFHBasavaraj Natikar5-11/+28
Various MP2 register sets are supported by newer processors. Therefore, extend MP2 register access to SFH. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-27HID: amd_sfh: Improve boot time when SFH is availableBasavaraj Natikar2-13/+64
AMD SFH load takes longer time in initialization. Hence split and defer initialization code to improve SFH module load time and boot time of the system when SFH is available. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-27HID: amd_sfh: Avoid disabling the interruptBasavaraj Natikar1-3/+27
HP ProBook x360 435 G7 using older version of firmware which doesn't support disabling the interrupt for all commands. Hence avoid disabling the interrupt for that particular model. Link: https://bugzilla.kernel.org/show_bug.cgi?id=218104 Fixes: b300667b33b2 ("HID: amd_sfh: Disable the interrupt for all command") Co-developed-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-27HID: amd_sfh: Update HPD sensor structure elementsBasavaraj Natikar1-3/+3
HPD sensor data is not populating properly because of wrong order of HPD sensor structure elements. So update the order of structure elements to match the HPD sensor data received from the firmware. Fixes: 24a31ea94922 ("HID: amd_sfh: Add initial support for HPD sensor") Co-developed-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-27HID: amd_sfh: Increase sensor command timeoutBasavaraj Natikar1-2/+2
During the initialization sensors may take some time to respond. Hence, increase the sensor command timeouts in order to obtain status responses within a maximum timeout. Co-developed-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-27HID: intel-ish-hid: ipc: Add Arrow Lake PCI device IDEven Xu2-0/+2
Add device ID of Arrow Lake-S into ishtp support list. Signed-off-by: Even Xu <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: nintendo: Remove some unused functionsJiapeng Chong1-12/+0
These functions are defined in the hid-nintendo.c file, but not called elsewhere, so delete these unused functions. drivers/hid/hid-nintendo.c:757:20: warning: unused function 'joycon_type_has_left_controls'. drivers/hid/hid-nintendo.c:763:20: warning: unused function 'joycon_type_has_right_controls'. Fixes: 94f18bb1994 ("HID: nintendo: add support for nso controllers") Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=8060 Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: hid-prodikeys: remove struct pk_deviceJiri Slaby (SUSE)1-73/+40
First, quirks was unused in struct pk_device. And I see no reason for this additional level of indirection. struct pcmidi_snd is far enough for the driver. Unless I am missing something? So drop struct pk_device and convert all the users to use struct pcmidi_snd directly. No need for doubled kmalloc+kfrees now. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: hid-prodikeys: remove unused struct pcmidi_snd membersJiri Slaby (SUSE)1-2/+0
struct pcmidi_snd contains two unused members: out_substream and out_active. They were added along the driver in commit 3a370ca1dcf8 (HID: Prodikeys PC-MIDI HID Driver), but not used. Drop them. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: hid-multitouch: remove unused mt_application::dev_timeJiri Slaby (SUSE)1-1/+0
dev_time was moved to struct mt_application in commit f146d1c4d7ea (HID: multitouch: Store per collection multitouch data), but is not used since then. Remove it. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: hid-lg3ff: remove unused struct lg3ff_deviceJiri Slaby (SUSE)1-4/+0
struct lg3ff_device is present in the driver since its addition by commit 74f292ca8c7a (HID: add driver for the Logitech Flight System G940). But it was never used, remove it. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Gary Stein <LordCnidarian@gmail.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: wacom: remove unused hid_data::pressureJiri Slaby (SUSE)1-1/+0
The pressure member in struct hid_data is unused. It was added in commit 5ae6e89f7409 (HID: wacom: implement the finger part of the HID generic handling), but never used. As this is not a struct to communicate with the HW, remove that member. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Ping Cheng <ping.cheng@wacom.com> Cc: Jason Gerecke <jason.gerecke@wacom.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Ping Cheng <ping.cheng@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: apple: remove unused members from struct apple_sc_backlightJiri Slaby (SUSE)1-1/+0
The backlight members in struct apple_sc_backlight are unused. They were added in commit 9018eacbe623 (HID: apple: Add support for keyboard backlight on certain T2 Macs.), but never used. As this is not a struct to communicate with the HW, remove these. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Paul Pawlowski <paul@mrarm.io> Cc: Aun-Ali Zaidi <admin@kodeit.net> Cc: Aditya Garg <gargaditya08@live.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: wacom: Clean up use of struct->wacom_wacTatsunosuke Tobita1-4/+4
Replace the indirect accesses to struct->wacom_wac from struct->wacom to the direct access in order for better code reading. Signed-off-by: Tatsunosuke Tobita <tatsunosuke.tobita@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: wacom: generic: Avoid reporting a serial of '0' to userspaceTatsunosuke Tobita1-1/+8
The xf86-input-wacom driver does not treat '0' as a valid serial number and will drop any input report which contains an MSC_SERIAL = 0 event. The kernel driver already takes care to avoid sending any MSC_SERIAL event if the value of serial[0] == 0 (which is the case for devices that don't actually report a serial number), but this is not quite sufficient. Only the lower 32 bits of the serial get reported to userspace, so if this portion of the serial is zero then there can still be problems. This commit allows the driver to report either the lower 32 bits if they are non-zero or the upper 32 bits otherwise. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Tatsunosuke Tobita <tatsunosuke.tobita@wacom.com> Fixes: f85c9dc678a5 ("HID: wacom: generic: Support tool ID and additional tool types") CC: stable@vger.kernel.org # v4.10 Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspendEven Xu2-1/+5
After legacy suspend/resume via ACPI S3, sensor read operation fails with timeout. Also, it will cause delay in resume operation as there will be retries on failure. This is caused by commit f645a90e8ff7 ("HID: intel-ish-hid: ishtp-hid-client: use helper functions for connection"), which used helper functions to simplify connect, reset and disconnect process. Also avoid freeing and allocating client buffers again during reconnect process. But there is a case, when ISH firmware resets after ACPI S3 suspend, ishtp bus driver frees client buffers. Since there is no realloc again during reconnect, there are no client buffers available to send connection requests to the firmware. Without successful connection to the firmware, subsequent sensor reads will timeout. To address this issue, ishtp bus driver does not free client buffers on warm reset after S3 resume. Simply add the buffers from the read list to free list of buffers. Fixes: f645a90e8ff7 ("HID: intel-ish-hid: ishtp-hid-client: use helper functions for connection") Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218442 Signed-off-by: Even Xu <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-13HID: multitouch: Add required quirk for Synaptics 0xcddc deviceManuel Fombuena1-0/+4
Add support for the pointing stick (Accupoint) and 2 mouse buttons. Present on some Toshiba/dynabook Portege X30 and X40 laptops. It should close https://bugzilla.kernel.org/show_bug.cgi?id=205817 Signed-off-by: Manuel Fombuena <fombuena@outlook.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-06HID: wacom: Do not register input devices until after hid_hw_startJason Gerecke1-20/+43
If a input device is opened before hid_hw_start is called, events may not be received from the hardware. In the case of USB-backed devices, for example, the hid_hw_start function is responsible for filling in the URB which is submitted when the input device is opened. If a device is opened prematurely, polling will never start because the device will not have been in the correct state to send the URB. Because the wacom driver registers its input devices before calling hid_hw_start, there is a window of time where a device can be opened and end up in an inoperable state. Some ARM-based Chromebooks in particular reliably trigger this bug. This commit splits the wacom_register_inputs function into two pieces. One which is responsible for setting up the allocated inputs (and runs prior to hid_hw_start so that devices are ready for any input events they may end up receiving) and another which only registers the devices (and runs after hid_hw_start to ensure devices can be immediately opened without issue). Note that the functions to initialize the LEDs and remotes are also moved after hid_hw_start to maintain their own dependency chains. Fixes: 7704ac937345 ("HID: wacom: implement generic HID handling for pen generic devices") Cc: stable@vger.kernel.org # v3.18+ Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Tested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-06HID: logitech-hidpp: Do not flood kernel logOleksandr Natalenko1-3/+10
Since commit 680ee411a98e ("HID: logitech-hidpp: Fix connect event race") the following messages appear in the kernel log from time to time: logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. logitech-hidpp-device 0003:046D:4051.0006: Disconnected logitech-hidpp-device 0003:046D:408A.0005: Disconnected As discussed, print the first per-device "device connected" message at info level, demoting subsequent messages to debug level. Also, demote the "Disconnected message" to debug level unconditionally. Link: https://lore.kernel.org/lkml/3277085.44csPzL39Z@natalenko.name/ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-02-01bpf: treewide: Annotate BPF kfuncs in BTFDaniel Xu1-4/+4
This commit marks kfuncs as such inside the .BTF_ids section. The upshot of these annotations is that we'll be able to automatically generate kfunc prototypes for downstream users. The process is as follows: 1. In source, use BTF_KFUNCS_START/END macro pair to mark kfuncs 2. During build, pahole injects into BTF a "bpf_kfunc" BTF_DECL_TAG for each function inside BTF_KFUNCS sets 3. At runtime, vmlinux or module BTF is made available in sysfs 4. At runtime, bpftool (or similar) can look at provided BTF and generate appropriate prototypes for functions with "bpf_kfunc" tag To ensure future kfunc are similarly tagged, we now also return error inside kfunc registration for untagged kfuncs. For vmlinux kfuncs, we also WARN(), as initcall machinery does not handle errors. Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Link: https://lore.kernel.org/r/e55150ceecbf0a5d961e608941165c0bee7bc943.1706491398.git.dxu@dxuuu.xyz Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2024-01-31HID: bpf: use __bpf_kfunc instead of noinlineBenjamin Tissoires1-5/+13
Follow the docs at Documentation/bpf/kfuncs.rst: - declare the function with `__bpf_kfunc` - disables missing prototype warnings, which allows to remove them from include/linux/hid-bpf.h Removing the prototypes is not an issue because we currently have to redeclare them when writing the BPF program. They will eventually be generated by bpftool directly AFAIU. Link: https://lore.kernel.org/r/20240124-b4-hid-bpf-fixes-v2-3-052520b1e5e6@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-01-31HID: bpf: actually free hdev memory after attaching a HID-BPF programBenjamin Tissoires2-9/+40
Turns out that I got my reference counts wrong and each successful bus_find_device() actually calls get_device(), and we need to manually call put_device(). Ensure each bus_find_device() gets a matching put_device() when releasing the bpf programs and fix all the error paths. Cc: <stable@vger.kernel.org> Fixes: f5c27da4e3c8 ("HID: initial BPF implementation") Link: https://lore.kernel.org/r/20240124-b4-hid-bpf-fixes-v2-2-052520b1e5e6@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-01-31HID: bpf: remove double fdget()Benjamin Tissoires3-41/+49
When the kfunc hid_bpf_attach_prog() is called, we called twice fdget(): one for fetching the type of the bpf program, and one for actually attaching the program to the device. The problem is that between those two calls, we have no guarantees that the prog_fd is still the same file descriptor for the given program. Solve this by calling bpf_prog_get() earlier, and use this to fetch the program type. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/bpf/CAO-hwJJ8vh8JD3-P43L-_CLNmPx0hWj44aom0O838vfP4=_1CA@mail.gmail.com/T/#t Cc: <stable@vger.kernel.org> Fixes: f5c27da4e3c8 ("HID: initial BPF implementation") Link: https://lore.kernel.org/r/20240124-b4-hid-bpf-fixes-v2-1-052520b1e5e6@kernel.org Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-01-26HID: i2c-hid-of: fix NULL-deref on failed power upJohan Hovold1-0/+1
A while back the I2C HID implementation was split in an ACPI and OF part, but the new OF driver never initialises the client pointer which is dereferenced on power-up failures. Fixes: b33752c30023 ("HID: i2c-hid: Reorganize so ACPI and OF are separate modules") Cc: stable@vger.kernel.org # 5.12 Cc: Douglas Anderson <dianders@chromium.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-25HID: samsung: Add Samsung wireless bookcover and universal keyboard supportSandeep C S2-0/+134
Add support for samsung wireless bookcover and universal keyboard with input mapping events. Device a005 (Samsung wireless bookcover keyboard). Device a006 (Samsung wireless universal keyboard). Device a064 (Samsung wireless multi hogp keyboard). Signed-off-by: Sandeep C S <sandeep.cs@samsung.com> Signed-off-by: Junwan Cho <junwan.cho@samsung.com> Signed-off-by: Jitender Sajwan <jitender.s21@samsung.com> Signed-off-by: Gwangho Lee <gaudium.lee@samsung.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-25HID: samsung: Add Samsung wireless action mouse supportSandeep C S2-0/+28
Add support for samsung wireless action mouse with input mapping events. Device a004 (Samsung wireless action mouse). Signed-off-by: Sandeep C S <sandeep.cs@samsung.com> Signed-off-by: Junwan Cho <junwan.cho@samsung.com> Signed-off-by: Jitender Sajwan <jitender.s21@samsung.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-25HID: samsung: Add Samsung wireless gamepad supportSandeep C S2-0/+96
Add support for samsung wireless gamepad with input mapping events. Device a000 (Samsung wireless gamepad) Signed-off-by: Sandeep C S <sandeep.cs@samsung.com> Signed-off-by: Junwan Cho <junwan.cho@samsung.com> Signed-off-by: Jitender Sajwan <jitender.s21@samsung.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-25HID: samsung: Add Samsung wireless keyboard supportSandeep C S2-0/+99
Add Support for samsung wireless keyboard with input mapping events. Device 7021 (Samsung wireless keyboard). Signed-off-by: Sandeep C S <sandeep.cs@samsung.com> Signed-off-by: Junwan Cho <junwan.cho@samsung.com> Signed-off-by: Jitender Sajwan <jitender.s21@samsung.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-25HID: samsung: Rewrite rdesc checking code using memcmp()Sandeep C S1-33/+47
Resolved warnings found by checkpatch.pl script. Signed-off-by: Sandeep C S <sandeep.cs@samsung.com> Signed-off-by: Junwan Cho <junwan.cho@samsung.com> Signed-off-by: Jitender Sajwan <jitender.s21@samsung.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-25HID: samsung: Broaden device compatibility in samsung driverSandeep C S1-5/+6
The USB validation check has been moved wherever its required. Earlier Samsung driver only handles USB HID devices and returns an error if it encounters a Bluetooth type of HID device. This changes improves driver compatibility and extends its support for a wide range of devices. Signed-off-by: Sandeep C S <sandeep.cs@samsung.com> Signed-off-by: Junwan Cho <junwan.cho@samsung.com> Signed-off-by: Jitender Sajwan <jitender.s21@samsung.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-25HID: hidraw: fix a problem of memory leak in hidraw_release()Su Hui1-2/+5
'struct hidraw_list' is a circular queue whose head can be smaller than tail. Using 'list->tail != list->head' to release all memory that should be released. Fixes: a5623a203cff ("HID: hidraw: fix memory leak in hidraw_release()") Signed-off-by: Su Hui <suhui@nfschina.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-23HID: lenovo: Add middleclick_workaround sysfs knob for cptkbdMikhail Khvainitski1-18/+39
Previous attempt to autodetect well-behaving patched firmware introduced in commit 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround") has shown that there are false-positives on original firmware (on both 1st gen and 2nd gen keyboards) which causes the middle button click workaround to be mistakenly disabled. This commit adds explicit parameter to sysfs to control this workaround. Fixes: 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround") Fixes: 43527a0094c1 ("HID: lenovo: Restrict detection of patched firmware only to USB cptkbd") Signed-off-by: Mikhail Khvainitski <me@khvoinitsky.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-23HID: i2c-hid: Skip SET_POWER SLEEP for Cirque touchpad on system suspendKai-Heng Feng2-1/+8
There's a Cirque touchpad that wakes system up without anything touched the touchpad. The input report is empty when this happens. The reason is stated in HID over I2C spec, 7.2.8.2: "If the DEVICE wishes to wake the HOST from its low power state, it can issue a wake by asserting the interrupt." This is fine if OS can put system back to suspend by identifying input wakeup count stays the same on resume, like Chrome OS Dark Resume [0]. But for regular distro such policy is lacking. Though the change doesn't bring any impact on power consumption for touchpad is minimal, other i2c-hid device may depends on SLEEP control power. So use a quirk to limit the change scope. [0] https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/power_manager/docs/dark_resume.md Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2024-01-23HID: nvidia-shield: Add missing null pointer checks to LED initializationKunwu Chan1-0/+4
devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity. [jkosina@suse.com: tweak changelog a bit] Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>