summaryrefslogtreecommitdiff
path: root/drivers/hid/i2c-hid
AgeCommit message (Collapse)AuthorFilesLines
2023-09-01Merge tag 'for-linus-2023083101' of ↵Linus Torvalds1-12/+38
git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid Pull HID updates from Benjamin Tissoires: - devm fixes for problems that caused use-after-free reports (Rahul Rameshbabu) - Some extensive HID docs (Marco Morandini) - Constification of struct class (Ivan Orlov and Greg Kroah-Hartman) - Google Stadia Force Feedback support (Fabio Baltieri) - Various fixes and new device ID support * tag 'for-linus-2023083101' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (42 commits) HID: logitech-hidpp: rework one more time the retries attempts HID: nvidia-shield: Reference hid_device devm allocation of input_dev name HID: multitouch: Correct devm device reference for hidinput input_dev name HID: uclogic: Correct devm device reference for hidinput input_dev name HID: logitech-dj: Fix error handling in logi_dj_recv_switch_to_dj_mode() HID: i2c-hid: elan: Add ili9882t timing dt-bindings: input: i2c-hid: Introduce Ilitek ili9882t HID: apple: Add "Hailuck" to the list of non-apple keyboards HID: steelseries: arctis_1_battery_request[] should be static MAINTAINERS: update my email address HID: logitech-hidpp: Add support for Logitech MX Anywhere 3 mouse HID: wacom: struct name cleanup HID: wacom: remove unnecessary 'connected' variable from EKR HID: wacom: remove the battery when the EKR is off HID: nvidia-shield: Update Thunderstrike LED instance name to use id HID: nvidia-shield: Add battery support for Thunderstrike HID: nvidia-shield: Remove led_classdev_unregister in thunderstrike_create HID: hid-google-stadiaff: add support for Stadia force feedback HID: logitech-dj: Add support for a new lightspeed receiver iteration HID: logitech-hidpp: Add support for the Pro X Superlight ...
2023-08-21HID: i2c-hid: elan: Add ili9882t timingCong Yang1-12/+38
The ili9882t is a TDDI IC (Touch with Display Driver). The datasheet specifies there should be 60ms between touch SDA sleep and panel RESX. Doug's series[1] allows panels and touchscreens to power on/off together, so we can add the 65 ms delay in i2c_hid_core_suspend before panel_unprepare. Because ili9882t touchscrgeen is a panel follower, and needs to use vccio-supply instead of vcc33-supply, so set it NULL to ili9882t_chip_data, then not use vcc33 regulator. [1]: https://lore.kernel.org/all/20230727171750.633410-1-dianders@chromium.org Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Cong Yang <yangcong5@huaqin.corp-partner.google.com> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Link: https://lore.kernel.org/r/20230802071947.1683318-3-yangcong5@huaqin.corp-partner.google.com Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2023-08-03HID: i2c-hid: add more DRM dependenciesArnd Bergmann1-0/+4
When a symbol is selected that has extra dependencies, anything that selects it must have the same dependencies. With the added CONFIG_DRM reference from I2C_HID_CORE, this broke a couple of drivers that now also depend on DRM: WARNING: unmet direct dependencies detected for I2C_HID_CORE Depends on [m]: HID_SUPPORT [=y] && I2C_HID [=y] && (DRM [=m] || !DRM [=m]) Selected by [y]: - I2C_HID_OF [=y] && HID_SUPPORT [=y] && I2C_HID [=y] - I2C_HID_ACPI [=y] && HID_SUPPORT [=y] && I2C_HID [=y] && ACPI [=y] - I2C_HID_OF_GOODIX [=y] && HID_SUPPORT [=y] && I2C_HID [=y] && OF [=y] x86_64-linux-ld: vmlinux.o: in function `i2c_hid_core_remove': (.text+0xfc8826): undefined reference to `drm_panel_remove_follower' x86_64-linux-ld: vmlinux.o: in function `i2c_hid_core_probe': (.text+0xfc8da0): undefined reference to `drm_is_panel_follower' Add the corresponding DRM||!DRM dependencies on each one that is affected. Fixes: 96a37bfd232ae ("HID: i2c-hid: Support being a panel follower") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230802124947.1355415-1-arnd@kernel.org
2023-08-01HID: i2c-hid: Do panel follower work on the system_wqDouglas Anderson1-4/+46
Turning on an i2c-hid device can be a slow process. This is why i2c-hid devices use PROBE_PREFER_ASYNCHRONOUS. Unfortunately, when we're a panel follower the i2c-hid power up sequence now blocks the power on of the panel. Let's fix that by scheduling the work on the system_wq. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Benjamin Tissoires <bentiss@kernel.org> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230727101636.v4.10.I962bb462ede779005341c49320740ed95810021d@changeid
2023-08-01HID: i2c-hid: Support being a panel followerDouglas Anderson2-3/+92
As talked about in the patch ("drm/panel: Add a way for other devices to follow panel state"), we really want to keep the power states of a touchscreen and the panel it's attached to in sync with each other. In that spirit, add support to i2c-hid to be a panel follower. This will let the i2c-hid driver get informed when the panel is powered on and off. From there we can match the i2c-hid device's power state to that of the panel. NOTE: this patch specifically _doesn't_ use pm_runtime to keep track of / manage the power state of the i2c-hid device, even though my first instinct said that would be the way to go. Specific problems with using pm_runtime(): * The initial power up couldn't happen in a runtime resume function since it create sub-devices and, apparently, that's not good to do in your resume function. * Managing our power state with pm_runtime meant fighting to make the right thing happen at system suspend to prevent the system from trying to resume us only to suspend us again. While this might be able to be solved, it added complexity. Overall the code without pm_runtime() ended up being smaller and easier to understand. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Benjamin Tissoires <bentiss@kernel.org> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230727101636.v4.9.Ib1a98309c455cd7e26b931c69993d4fba33bbe15@changeid
2023-08-01HID: i2c-hid: Suspend i2c-hid devices in removeDouglas Anderson1-4/+4
In the i2c-hid remove() function we currently try to power off, depopulate our child device, and free our resources. That's OK, but... * If the i2c-hid device is on a power rail that can't turn off (either an always-on or a shared power rail) we won't try to put the device in a low power state during remove(). This probably doesn't matter for very many devices but it could be nice in some instances. * If the i2c-hid device somehow manages to generate an interrupt after we tried to power off it is conceivable that the interrupt could arrive during or after the call to hid_destroy_device() but before the call to free_irq(). That could cause a crash since our IRQ handler isn't expecting it. One could imagine this happening in the case where we couldn't turn off (see the previous bullet) or, possibly, if the interrupt line could glitch shortly after the device powered off. Let's call the suspend code during remove to avoid these issues. That will put the device into a low power state and also disable interrupts. Technically, one could consider this a "fix" of commit 4a200c3b9a40 ("HID: i2c-hid: introduce HID over i2c specification implementation"). However, since the above bullet points are more theoretical than problems seen on real systems and since the remove() of an i2c-hid touchscreen isn't terribly likely to be called in production, it's probably not worth the bother of trying to backport it. Reviewed-by: Benjamin Tissoires <bentiss@kernel.org> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230727101636.v4.8.Ic3ecad4a825905f4e4ce2a772b17f3c9cb2d60a2@changeid
2023-08-01HID: i2c-hid: Make suspend and resume into helper functionsDouglas Anderson1-42/+56
In a future patch we'd like to be able to call the current i2c-hid suspend and resume functions from times other than system suspend. Move the functions higher up in the file and have them take a "struct i2c_hid" to make this simpler. We'll then add tiny wrappers of the functions for use with system suspend. This change is expected to have no functional effect. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Benjamin Tissoires <bentiss@kernel.org> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230727101636.v4.7.I5c9894789b8b02f029bf266ae9b4f43c7907a173@changeid
2023-08-01HID: i2c-hid: Rearrange probe() to power things up laterDouglas Anderson1-47/+77
In a future patch, we want to change i2c-hid not to necessarily power up the touchscreen during probe. In preparation for that, rearrange the probe function so that we put as much stuff _before_ powering up the device as possible. This change is expected to have no functional effect. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Benjamin Tissoires <bentiss@kernel.org> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230727101636.v4.6.Ifcc9b0a44895d164788966f9b9511fe094ca8cf9@changeid
2023-08-01HID: i2c-hid: Switch to SYSTEM_SLEEP_PM_OPS()Douglas Anderson1-3/+1
The SYSTEM_SLEEP_PM_OPS() allows us to get rid of '#ifdef CONFIG_PM_SLEEP', as talked about in commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate old ones"). This change is expected to have no functional effect. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Benjamin Tissoires <bentiss@kernel.org> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230727101636.v4.5.Ib2a2865bd3c0b068432259dfc7d76cebcbb512be@changeid
2023-06-27Merge branch 'for-6.5/i2c-hid' into for-linusJiri Kosina4-4/+4
2023-06-08HID: i2c-hid: Switch i2c drivers back to use .probe()Uwe Kleine-König4-4/+4
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-06-08HID: i2c-hid: goodix: Add support for "goodix,no-reset-during-suspend" propertyFei Shao1-1/+15
In the beginning, commit 18eeef46d359 ("HID: i2c-hid: goodix: Tie the reset line to true state of the regulator") introduced a change to tie the reset line of the Goodix touchscreen to the state of the regulator to fix a power leakage issue in suspend. After some time, the change was deemed unnecessary and was reverted in commit 557e05fa9fdd ("HID: i2c-hid: goodix: Stop tying the reset line to the regulator") due to difficulties in managing regulator notifiers for designs like Evoker, which provides a second power rail to touchscreen. However, the revert caused a power regression on another Chromebook device Steelix in the field, which has a dedicated always-on regulator for touchscreen and was covered by the workaround in the first commit. To address both cases, this patch adds the support for the new "goodix,no-reset-during-suspend" property in the driver: - When set to true, the driver does not assert the reset GPIO during power-down. Instead, the GPIO will be asserted during power-up to ensure the touchscreen always has a clean start and consistent behavior after resuming. This is for designs with a dedicated always-on regulator. - When set to false or unset, the driver uses the original control flow and asserts GPIO and disables regulators normally. This is for the two-regulator and shared-regulator designs. Signed-off-by: Fei Shao <fshao@chromium.org> Suggested-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Jeff LaBundy <jeff@labundy.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-04-13HID: i2c-hid-of: Add reset GPIO support to i2c-hid-ofHans de Goede1-0/+21
Add reset GPIO support to the generic i2c-hid-of driver This is necessary to make the Wacom digitizer on the Lenovo Yoga Book 1 (yb1-x90f/l) work and this will also allow consolidating the 2 specialized i2c-hid-of-elan.c and i2c-hid-of-goodix.c drivers into the generic i2c-hid-of driver. For now the new "post-reset-deassert-delay-ms" property is only used on x86/ACPI (non devicetree) devs. IOW it is not used in actual devicetree files and the same goes for the reset GPIO. The devicetree-bindings maintainers have requested properties like these to not be added to the devicetree-bindings, so the new property + GPIO are deliberately not added to the existing devicetree-bindings. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20230413093625.71146-4-hdegoede@redhat.com Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2023-04-13HID: i2c-hid-of: Allow using i2c-hid-of on non OF platformsHans de Goede2-3/+7
There are some x86 tablets / 2-in-1s which ship with Android as their factory OS image. These have pretty broken ACPI tables, relying on everything being hardcoded in the factory kernel image. platform/x86/x86-android-tablets.c manually instantiates i2c-clients for i2c devices on these tablets to make them work with the mainline kernel. The Lenovo Yoga Book 1 (yb1-x90f/l) is such a 2-in-1. It has 2 I2C-HID devices its main touchscreen and a Wacom digitizer. Its main touchscreen can alternatively also be used in HiDeep's native protocol mode but for the Wacom digitizer we really need I2C-HID. This patch allows using i2c-hid-of on non OF platforms so that it can bind to a non ACPI instantiated i2c_client on x86 for the Wacom digitizer. Note the driver already has an "i2c-over-hid" i2c_device_id (rather then an of_device_id). Besides enabling building on non-OF platforms this also replaces the only of_property_read_u32() call with device_property_read_u32() note that other properties where already read using device_property_read_...(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20230413093625.71146-3-hdegoede@redhat.com Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2023-04-13HID: i2c-hid-of: Consistenly use dev local variable in probe()Hans de Goede1-8/+5
i2c_hid_of_probe() has a dev local variable pointing to &i2c_client->dev, consistently use this everywhere in i2c_hid_of_probe(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20230413093625.71146-2-hdegoede@redhat.com Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2023-02-22Merge branch 'for-6.3/hid-bpf' into for-linusBenjamin Tissoires1-15/+16
Initial support of HID-BPF (Benjamin Tissoires) The history is a little long for this series, as it was intended to be sent for v6.2. However some last minute issues forced us to postpone it to v6.3. Conflicts: * drivers/hid/i2c-hid/Kconfig: commit bf7660dab30d ("HID: stop drivers from selecting CONFIG_HID") conflicts with commit 2afac81dd165 ("HID: fix I2C_HID not selected when I2C_HID_OF_ELAN is") the resolution is simple enough: just drop the "default" and "select" lines as the new commit from Arnd is doing
2023-02-22Merge branch 'for-6.3/multitouch' into for-linusBenjamin Tissoires3-2/+49
Allow to pass quirks from i2c-hid to hid-multitouch (Allen Ballway & Dmitry Torokhov)
2023-02-22Merge branch 'for-6.3/i2c-hid' into for-linusBenjamin Tissoires3-103/+36
- dev_dbg cleanup (Thomas Weißschuh) - cleanup i2c-hid-acpi (Andy Shevchenko) - goodix: revert/fixes for an actual production device compared to the manufacturer sample (Douglas Anderson)
2023-02-09HID: i2c-hid: goodix: Add mainboard-vddio-supplyDouglas Anderson1-0/+10
As talked about in the patch ("dt-bindings: HID: i2c-hid: goodix: Add mainboard-vddio-supply") we may need to power up a 1.8V rail on the host associated with touchscreen IO. Let's add support in the driver for it. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Link: https://lore.kernel.org/r/20230206184744.6.Ic234b931025d1f920ce9e06fff294643943a65ad@changeid Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2023-02-09HID: i2c-hid: goodix: Stop tying the reset line to the regulatorDouglas Anderson1-75/+13
In commit 18eeef46d359 ("HID: i2c-hid: goodix: Tie the reset line to true state of the regulator"), we started tying the reset line of Goodix touchscreens to the regulator. The primary motivation for that patch was some pre-production hardware (specifically sc7180-trogdor-homestar) where it was proposed to hook the touchscreen's main 3.3V power rail to an always-on supply. In such a case, when we turned "off" the touchscreen in Linux it was bad to assert the "reset" GPIO because that was causing a power drain. The patch accomplished that goal and did it in a general sort of way that didn't require special properties to be added in the device tree for homestar. It turns out that the design of using an always-on power rail for the touchscreen was rejected soon after the patch was written and long before sc7180-trogdor-homestar went into production. The final design of homestar actually fully separates the rail for the touchscreen and the display panel and both can be powered off and on. That means that the original motivation for the feature is gone. There are 3 other users of the goodix i2c-hid driver in mainline. I'll first talk about 2 of the other users in mainline: coachz and mrbland. On both coachz and mrbland the touchscreen power and panel power _are_ shared. That means that the patch to tie the reset line to the true state of the regulator _is_ doing something on those boards. Specifically, the patch reduced power consumption by tens of mA in the case where we turned the touchscreen off but left the panel on. Other than saving a small bit of power, the patch wasn't truly necessary. That being said, even though a small bit of power was saved in the state of "panel on + touchscreen off", that's not actually a state we ever expect to be in, except perhaps for very short periods of time at boot or during suspend/resume. Thus, the patch is truly not necessary. It should be further noted that, as documented in the original patch, the current code still didn't optimize power for every corner case of the "shared rail" situation. The last user in mainline was very recently added: evoker. Evoker is actually the motivation for me removing this bit of code. It turns out that for evoker we need to manage a second power rail for IO to the touchscreen. Trying to fit the management of this IO rail into the regulator notifiers turns out to be extremely hard. To avoid lockdep splats you shouldn't enable/disable other regulators in regulator notifiers and trying to find a way around this was going to be fairly difficult. Given the lack of any true motivation to tie the reset line to the regulator, lets go back to the simpler days and remove the code. This is, effectively, a revert of commit bdbc65eb77ee ("HID: i2c-hid: goodix: Fix a lockdep splat"), commit 25ddd7cfc582 ("HID: i2c-hid: goodix: Use the devm variant of regulator_register_notifier()"), and commit 18eeef46d359 ("HID: i2c-hid: goodix: Tie the reset line to true state of the regulator"). Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Link: https://lore.kernel.org/r/20230206184744.4.I085b32b6140c7d1ac4e7e97b712bff9dd5962b62@changeid Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2023-02-09HID: retain initial quirks set up when creating HID devicesDmitry Torokhov2-3/+4
In certain circumstances, such as when creating I2C-connected HID devices, we want to pass and retain some quirks (axis inversion, etc). The source of such quirks may be device tree, or DMI data, or something else not readily available to the HID core itself and therefore cannot be reconstructed easily. To allow this, introduce "initial_quirks" field in hid_device structure and use it when determining the final set of quirks. This fixes the problem with i2c-hid setting up device-tree sourced quirks too late and losing them on device rebind, and also allows to sever the tie between hid-code and i2c-hid when applying DMI-based quirks. Fixes: b60d3c803d76 ("HID: i2c-hid-of: Expose the touchscreen-inverted properties") Fixes: a2f416bf062a ("HID: multitouch: Add quirks for flipped axes") Reviewed-by: Guenter Roeck <groeck@chromium.org> Tested-by: Allen Ballway <ballway@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Alistair Francis <alistair@alistair23.me> Link: https://lore.kernel.org/r/Y+LYwu3Zs13hdVDy@google.com Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2023-01-18HID: stop drivers from selecting CONFIG_HIDArnd Bergmann1-15/+16
There is a mix of drivers using either 'depends on HID' or 'select HID', which causes both circular dependencies and missed dependencies for a 'select': WARNING: unment direct dependencies for HID Depends on [m]: HID_SUPPORT [=y] && INPUT [=m] Selected by [y]: - AMD_SFH_HID [=y] && HID_SUPPORT [=y] && (X86_64 || COMPILE_TEST [=y]) && PCI [=y] Selected by [m]: - I2C_HID_CORE [=m] && HID_SUPPORT [=y] WARNING: unmet direct dependencies detected for INPUT_FF_MEMLESS Depends on [m]: INPUT [=m] Selected by [y]: - DRAGONRISE_FF [=y] && HID_SUPPORT [=y] && HID [=y] && HID_DRAGONRISE [=y] - HID_MICROSOFT [=y] && HID_SUPPORT [=y] && HID [=y] - GREENASIA_FF [=y] && HID_SUPPORT [=y] && HID [=y] && HID_GREENASIA [=y] Selected by [m]: - INPUT_ARIZONA_HAPTICS [=m] && INPUT [=m] && INPUT_MISC [=y] && MFD_ARIZONA [=y] && SND_SOC [=m] - INPUT_PM8XXX_VIBRATOR [=m] && INPUT [=m] && INPUT_MISC [=y] && (MFD_PM8XXX [=m] || MFD_SPMI_PMIC [=n]) - INPUT_MAX8997_HAPTIC [=m] && INPUT [=m] && INPUT_MISC [=y] && PWM [=y] && MFD_MAX8997 [=y] - INPUT_GPIO_VIBRA [=m] && INPUT [=m] && INPUT_MISC [=y] && (GPIOLIB [=y] || COMPILE_TEST [=y]) - INPUT_REGULATOR_HAPTIC [=m] && INPUT [=m] && INPUT_MISC [=y] && REGULATOR [=y] - INPUT_TWL6040_VIBRA [=m] && INPUT [=m] && INPUT_MISC [=y] && TWL6040_CORE [=y] - INPUT_PWM_VIBRA [=m] && INPUT [=m] && INPUT_MISC [=y] && PWM [=y] - INPUT_DRV260X_HAPTICS [=m] && INPUT_MISC [=y] && INPUT [=m] && I2C [=y] && (GPIOLIB [=y] || COMPILE_TEST [=y]) - INPUT_DRV2665_HAPTICS [=m] && INPUT_MISC [=y] && INPUT [=m] && I2C [=y] - INPUT_DRV2667_HAPTICS [=m] && INPUT_MISC [=y] && INPUT [=m] && I2C [=y] - INPUT_SC27XX_VIBRA [=m] && INPUT [=m] && INPUT_MISC [=y] && (MFD_SC27XX_PMIC [=y] || COMPILE_TEST [=y]) - HID_MAYFLASH [=m] && HID_SUPPORT [=y] && HID [=y] Avoid this by changing all HID client drivers to use 'depends on HID'. For I2C_HID, this requires a larger rework of the Kconfig description, but it hopefully becomes easier to understand without the complex I2C_HID_CORE definition. Fixes: 25621bcc8976 ("HID: Kconfig: split HID support and hid-core compilation") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-01-18HID: multitouch: Add quirks for flipped axesAllen Ballway2-0/+46
Certain touchscreen devices, such as the ELAN9034, are oriented incorrectly and report touches on opposite points on the X and Y axes. For example, a 100x200 screen touched at (10,20) would report (90, 180) and vice versa. This is fixed by adding device quirks to transform the touch points into the correct spaces, from X -> MAX(X) - X, and Y -> MAX(Y) - Y. Signed-off-by: Allen Ballway <ballway@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-01-18HID: i2c-hid: acpi: Unify ACPI ID tables formatAndy Shevchenko1-5/+5
Unify ACPI ID tables format by: - surrounding HID by spaces - dropping unnecessary driver_data assignment to 0 - dropping comma at the terminator entry Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-01-18HID: i2c-hid: acpi: Drop unneded NULL check of adevAndy Shevchenko1-11/+5
The driver is enumerated on ACPI platforms, so adev is valid. Since there is no valid I²C ID table provided, there is no possibility to bind a device to this driver via user space. Hence, drop unneeded NULL check of adev. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-01-18HID: i2c-hid: use uniform debugging APIsThomas Weißschuh1-2/+2
Only two locations in i2c-hid are using the standard dev_dbg() APIs. The rest are all using the custom i2c_hid_dbg(), which in turn uses dev_dbg(). Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-01-18HID: i2c-hid: switch to standard debugging APIsThomas Weißschuh1-10/+1
Instead of implementing a custom form of dynamic debugging we can use the standard debugging APIs. If the kernel is built with CONFIG_DYNAMIC_DEBUG this will be more discoverable and featureful. Also the previous module parameter "debug" is read-only so it can't actually be enabled. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-01-17HID: Make lowlevel driver structs constThomas Weißschuh1-1/+1
Nothing is nor should be modifying these structs so mark them as const. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: David Rheinsberg <david.rheinsberg@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-01-17HID: Unexport struct i2c_hid_ll_driverThomas Weißschuh1-2/+1
As there are no external users this implementation detail does not need to be exported. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: David Rheinsberg <david.rheinsberg@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-12-14Merge tag 'for-linus-2022121301' of ↵Linus Torvalds4-10/+8
git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid Pull HID updates from Jiri Kosina: - iio support for the MCP2221 HID driver (Matt Ranostay) - support for more than one hinge sensor in hid-sensor-custom (Yauhen Kharuzhy) - PS DualShock 4 controller support (Roderick Colenbrander) - XP-PEN Deco LW support (José Expósito) - other assorted code cleanups and device ID/quirk addtions * tag 'for-linus-2022121301' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (51 commits) HID: logitech HID++: Send SwID in GetProtocolVersion HID: hid-elan: use default remove for hid device HID: hid-alps: use default remove for hid device HID: hid-sensor-custom: set fixed size for custom attributes HID: i2c: let RMI devices decide what constitutes wakeup event HID: playstation: fix DualShock4 bluetooth CRC endian issue. HID: playstation: fix DualShock4 bluetooth memory corruption bug. HID: apple: Swap Control and Command keys on Apple keyboards HID: intel-ish-hid: ishtp: remove variable rb_count HID: uclogic: Standardize test name prefix HID: hid-sensor-custom: Allow more than one hinge angle sensor HID: ft260: fix 'cast to restricted' kernel CI bot warnings HID: ft260: missed NACK from busy device HID: ft260: fix a NULL pointer dereference in ft260_i2c_write HID: ft260: wake up device from power saving mode HID: ft260: missed NACK from big i2c read HID: ft260: remove SMBus Quick command support HID: ft260: skip unexpected HID input reports HID: ft260: do not populate /dev/hidraw device HID: ft260: improve i2c large reads performance ...
2022-12-14Merge tag 'input-for-v6.2-rc0' of ↵Linus Torvalds2-26/+3
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input Pull input updates from Dmitry Torokhov: - a new driver for Cypress Generation 5 touchscreens - a new driver for Hynitron cstxxx touchscreens - a new driver for Himax hx83112b touchscreen - I2C input devices have been converted to use i2c's probe_new() - a large number of input devices are now using DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr() and no longer use __maybe_unused annotations - improvements to msg2638 touchscreen driver to also support msg2138 - conversion of several input deevine bindings to yaml/DT schema - changes to select touch drivers to move handling of wake irqs to the PM core - other assorted fixes and improvements. * tag 'input-for-v6.2-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (165 commits) Input: elants_i2c - delay longer with reset asserted dt-bindings: input: Convert ti,drv260x to DT schema dt-bindings: input: gpio-beeper: Convert to yaml schema Input: pxspad - fix unused data warning when force feedback not enabled Input: lpc32xx - allow building with COMPILE_TEST Input: nomadik-ske-keypad - allow building with COMPILE_TEST Input: pxa27xx-keypad - allow build with COMPILE_TEST Input: spear-keyboard - improve build coverage using COMPILE_TEST Input: tegra-kbc - allow build with COMPILE_TEST Input: tegra-kbc - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: tca6416-keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: tc3589x - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: st-keyscan - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: sh-keysc - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: qt1070 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: pxa27x_keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: pmic8xxx-keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: nomadik-ske-keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: mcs-touchkey - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Input: max7359-keypad - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() ...
2022-12-13Merge branch 'for-6.2/rmi' into for-linusJiri Kosina1-1/+2
- wakeup event handling fix for RMI driver (Dmitry Torokhov)
2022-12-13Merge branch 'for-6.2/i2c' into for-linusJiri Kosina3-9/+6
- conversion of I2C HID drivers to use new simplified I2C probing (Stephen Kitt)
2022-11-23HID: i2c-hid: Don't set wake_capable and wake_irqRaul E Rangel1-9/+0
The i2c-core will now handle setting the wake_irq for DT and ACPI systems. Signed-off-by: Raul E Rangel <rrangel@chromium.org> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20220929093200.v6.10.Id22d056440953134d8e8fe2c2aff79c79bc78424@changeid Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2022-11-23HID: i2c-hid: acpi: Stop setting wakeup_capableRaul E Rangel1-5/+0
This is now handled by the i2c-core driver. Signed-off-by: Raul E Rangel <rrangel@chromium.org> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20220929093200.v6.9.I2efb7f551e0aa2dc4c53b5fd5bbea91a1cdd9b32@changeid Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2022-11-23HID: i2c-hid: Use PM subsystem to manage wake irqRaul E Rangel1-21/+12
The I2C hid driver is currently manually managing the wake IRQ. This change removes the explicit enable_irq_wake/disable_irq_wake and instead relies on the PM subsystem. This is done by calling dev_pm_set_wake_irq. i2c_device_probe already calls dev_pm_set_wake_irq when using device tree, and i2c_device_remove also already calls dev_pm_clear_wake_irq. There could be some device tree systems that have incorrectly declared `wake` capabilities, so this change will set the wake irq if one is missing. This matches the previous behavior. I tested this on an ACPI system that has a HID touchscreen and verified the IRQ was armed for wake on suspend. Signed-off-by: Raul E Rangel <rrangel@chromium.org> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20220929093200.v6.1.Id4b4bdfe06e2caf2d5a3c9dd4a9b1080c38b539c@changeid Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2022-11-21HID: i2c: let RMI devices decide what constitutes wakeup eventDmitry Torokhov1-1/+2
HID-RMI is special in the sense that it does not carry HID events directly, but rather uses HID protocol as a wrapper/transport for RMI protocol. Therefore we should not assume that all data coming from the device via interrupt is associated with user activity and report wakeup event indiscriminately, but rather let HID-RMI do that when appropriate. HID-RMI devices tag responses to the commands issued by the host as RMI_READ_DATA_REPORT_ID whereas motion and other input events from the device are tagged as RMI_ATTN_REPORT_ID. Change hid-rmi to report wakeup events when receiving the latter packets. This allows ChromeOS to accurately identify wakeup source and make correct decision on the mode of the resume the system should take ("dark" where the display stays off vs normal one). Fixes: d951ae1ce803 ("HID: i2c-hid: Report wakeup events") Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-11-15HID: fix I2C_HID not selected when I2C_HID_OF_ELAN isBenjamin Tissoires1-2/+2
When I2C_HID_OF_ELAN is set, we need to turn on I2C_HID_CORE to ensure we get all the HID requirements. Fixes: bd3cba00dcc6 ("HID: i2c-hid: elan: Add support for Elan eKTH6915 i2c-hid touchscreens") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-10-18HID: i2c: use simple i2c probeStephen Kitt3-9/+6
All these drivers have an i2c probe function which doesn't use the "struct i2c_device_id *id" parameter, so they can trivially be converted to the "probe_new" style of probe with a single argument. This is part of an ongoing transition to single-argument i2c probe functions. Old-style probe functions involve a call to i2c_match_id: in drivers/i2c/i2c-core-base.c, /* * When there are no more users of probe(), * rename probe_new to probe. */ if (driver->probe_new) status = driver->probe_new(client); else if (driver->probe) status = driver->probe(client, i2c_match_id(driver->id_table, client)); else status = -EINVAL; Drivers which don't need the second parameter can be declared using probe_new instead, avoiding the call to i2c_match_id. Drivers which do can still be converted to probe_new-style, calling i2c_match_id themselves (as is done currently for of_match_id). This change was done using the following Coccinelle script, and fixed up for whitespace changes: @ rule1 @ identifier fn; identifier client, id; @@ - static int fn(struct i2c_client *client, const struct i2c_device_id *id) + static int fn(struct i2c_client *client) { ...when != id } @ rule2 depends on rule1 @ identifier rule1.fn; identifier driver; @@ struct i2c_driver driver = { - .probe + .probe_new = ( fn | - &fn + fn ) , }; Signed-off-by: Stephen Kitt <steve@sk2.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-10-07Merge tag 'for-linus-2022100501' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid Pull HID updates from Benjamin Tissoires: - handle of all Logitech Bluetooth HID++ devices in the Logitech HID++ drivers (Bastien Nocera) - fix broken atomic checks in hid-multitouch by adding memory barriers (Andri Yngvason) - better handling of devices with AMD SFH1.1 (Basavaraj Natikar) - better support of Nintendo clone controllers (Icenowy Zheng and Johnothan King) - Support for various RC controllers (Marcus Folkesson) - Add UGEEv2 support in hid-uclogic (XP-PEN Deco Pro S and Parblo A610 PRO) (José Expósito) - some conversions to use dev_groups (Greg Kroah-Hartman) - HID-BPF preparatory patches, mostly to convert blank defines as enums (Benjamin Tissoires) * tag 'for-linus-2022100501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (38 commits) HID: wacom: add three styli to wacom_intuos_get_tool_type HID: amd_sfh: Handle condition of "no sensors" for SFH1.1 HID: amd_sfh: Change dev_err to dev_dbg for additional debug info HID: nintendo: check analog user calibration for plausibility HID: nintendo: deregister home LED when it fails HID: roccat: Fix use-after-free in roccat_read() hid: topre: Add driver fixing report descriptor HID: multitouch: Add memory barriers HID: convert defines of HID class requests into a proper enum HID: export hid_report_type to uapi HID: core: store the unique system identifier in hid_device HID: Add driver for PhoenixRC Flight Controller HID: Add driver for VRC-2 Car Controller HID: sony: Fix double word in comments hid: hid-logitech-hidpp: avoid unnecessary assignments in hidpp_connect_event HID: logitech-hidpp: Detect hi-res scrolling support HID: logitech-hidpp: Remove hard-coded "Sw. Id." for HID++ 2.0 commands HID: logitech-hidpp: Fix "Sw. Id." for HID++ 2.0 commands HID: logitech-hidpp: Remove special-casing of Bluetooth devices HID: logitech-hidpp: Enable HID++ for all the Logitech Bluetooth devices ...
2022-08-25HID: move from strlcpy with unused retval to strscpyWolfram Sang1-1/+1
Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-08-16i2c: Make remove callback return voidUwe Kleine-König2-4/+2
The value returned by an i2c driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com> Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Crt Mori <cmo@melexis.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013 Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/* Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5 Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860 Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power Acked-by: Krzysztof Hałasa <khalasa@piap.pl> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2022-06-08HID: i2c-hid: elan: Add support for Elan eKTH6915 i2c-hid touchscreensDouglas Anderson3-0/+146
Like many i2c-hid touchscreen controllers, the Elan eKTH6915 has a reset GPIO hooked up to it. According to the datasheet, the way we're supposed to turn the touchscreen on is: 1. Turn on the 3.3V supply. 2. Turn on the IO supply. It's OK if this is hardwired to the 3.3V supply, but if it's not then it must be turned on _after_ the 3.3V supply. 3. Wait >= 1 ms. 4. Deassert the reset GPIO (reset GPIO is active low, so there would be a leakage path if this was deasserted _before_ the IO supply). 5. Wait 300 ms. Much of the above can be handled by the generic i2c-hid-of driver, but the "reset" GPIO is not supported by that driver. Thus we'll do the same as we did for Goodix and add a new tiny driver that uses the i2c-hid core. NOTE: support for this new touchscreen could theorically fit into the Goodix driver. I've made it a separate driver because the Elan driver supports _two_ regulators and it's unclear exactly how that would fit in with commit 18eeef46d359 ("HID: i2c-hid: goodix: Tie the reset line to true state of the regulator"). Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-03-23Merge branch 'for-5.18/i2c-hid' into for-linusJiri Kosina1-278/+313
- fixes for handling unnumbered reports fully correctly (Angela Czubak Dmitry Torokhov) - untangling of intermingled code for sending and handling output reports in __i2c_hid_command() (Dmitry Torokhov)
2022-02-16HID: i2c-hid: remove unneeded semicolonYang Li1-1/+1
Eliminate the following coccicheck warning: ./drivers/hid/i2c-hid/i2c-hid-core.c:357:56-57: Unneeded semicolon Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-14HID: i2c-hid: note that I2C xfer buffers are DMA-safeDmitry Torokhov1-2/+3
All I2C communications in the driver use driver-private buffers that are DMA-safe, so mark them as such. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-14HID: i2c-hid: no longer need raw access to HID descriptor structureDmitry Torokhov1-5/+2
We can stop defining a union for HID descriptor data as we now only access individual members of it by names and using proper types instead of accessing by offset from the beginning of the data structure. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-14HID: i2c-hid: use helpers to do endian conversion in i2c_hid_get_input()Dmitry Torokhov1-13/+15
It is better to use helpers to do endian conversion as it documents and draws attention to it, and might be a bit more performant as well. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-14HID: i2c-hid: rework i2c_hid_get_report() to use i2c_hid_xfer()Dmitry Torokhov1-91/+59
Explicitly prepare command for i2c_hid_get_report() which makes the logic clearer and allows us to get rid of __i2c_hid_command() and related command definitions. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2022-02-14HID: i2c-hid: convert i2c_hid_execute_reset() to use i2c_hid_xfer()Dmitry Torokhov1-10/+9
This will allow us to drop i2c_hid_command() wrapper and get close to removing __i2c_hid_command(). Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>