8346 Commits

Author SHA1 Message Date
Stephen Rothwell
6e16033768 Merge branch 'for-mfd-next' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
# Conflicts:
#	drivers/mfd/cs42l43.c
2024-12-20 13:12:25 +11:00
Stephen Rothwell
d8617a3ba0 Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git 2024-12-20 12:26:57 +11:00
Stephen Rothwell
c35d387b30 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap.git 2024-12-20 10:41:21 +11:00
Stephen Rothwell
f00ac06187 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git 2024-12-20 09:41:51 +11:00
Dmitry Torokhov
e36def244b Input: use guard notation in input core
Switch input core to use "guard" notation when acquiring spinlocks and
mutexes to simplify the code and ensure that locks are automatically
released when control leaves critical section.

Link: https://lore.kernel.org/r/20241107071538.195340-9-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 13:58:46 -08:00
Dmitry Torokhov
eccc065f0a Input: poller - convert locking to guard notation
Use guard() notation instead of explicitly acquiring and releasing
mutex to simplify the code and ensure that it is released.

Link: https://lore.kernel.org/r/20241107071538.195340-8-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 13:58:46 -08:00
Dmitry Torokhov
679d2d6ce5 Input: mt - make use of __free() cleanup facility
Annotate allocated memory with __free(kfree) to simplify the code and
make sure memory is released appropriately.

Link: https://lore.kernel.org/r/20241107071538.195340-7-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 13:58:45 -08:00
Dmitry Torokhov
2e59e97758 Input: mt - convert locking to guard notation
Use guard() notation instead of explicitly acquiring and releasing
spinlocks to simplify the code and ensure that all locks are released.

Link: https://lore.kernel.org/r/20241107071538.195340-6-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 13:58:45 -08:00
Dmitry Torokhov
fd5ba0501d Input: ff-memless - make use of __free() cleanup facility
Annotate allocated memory with __free(kfree) to simplify the code and
make sure memory is released appropriately.

Link: https://lore.kernel.org/r/20241107071538.195340-5-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 13:58:45 -08:00
Dmitry Torokhov
993c657a22 Input: ff-memless - convert locking to guard notation
Use guard() notation instead of explicitly acquiring and releasing
spinlocks to simplify the code and ensure that all locks are released.

Link: https://lore.kernel.org/r/20241107071538.195340-4-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 13:58:45 -08:00
Dmitry Torokhov
5203b3a18c Input: ff-core - make use of __free() cleanup facility
Annotate allocated memory with __free(kfree) to simplify the code and
make sure memory is released appropriately.

Link: https://lore.kernel.org/r/20241107071538.195340-3-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 13:58:45 -08:00
Dmitry Torokhov
3d11c09d41 Input: ff-core - convert locking to guard notation
Use guard() and scoped_guard() notation instead of explicitly acquiring
and releasing spinlocks and mutexes to simplify the code and ensure that
all locks are released properly.

Link: https://lore.kernel.org/r/20241107071538.195340-2-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 13:58:45 -08:00
Jiri Kosina
e571f988af Input: remove evbug driver
I've never heard of anyone having used this driver for debugging at least
in over past decade or so. Since we have tools like evtest, this driver
seems to be rather superficial.

Also, it apparently causes confusion among people who accidentaly enable
CONFIG_INPUT_EVBUG and are annoyed/confused by their kernel log being
spammed by a lot of useless data.

Let's just remove it.

Signed-off-by: Jiri Kosina <jkosina@suse.com>
Link: https://lore.kernel.org/r/8n377s5p-3r9n-ro38-3r2o-p536745552qo@xreary.bet
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 13:53:52 -08:00
Luwei Zhou
1863f213d3 Input: mma8450 - add chip ID check in probe
Prevent continuous polling error logs by adding a chip ID check in the
probe  function. This ensures the driver only proceeds when the mma8450 is
present, avoiding issues in scenarios like missing add-on cards.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20241216173205.211058-1-Frank.Li@nxp.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-17 11:11:46 -08:00
Heiko Stuebner
bb7e361191 Input: add driver for the input part of qnap-mcu devices
The MCU controls the power-button and beeper, so expose them as input
device. There is of course no interrupt line, so the status of the
power-button needs to be polled. To generate an event the power-button
also needs to be held for 1-2 seconds, so the polling interval does
not need to be overly fast.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/20241107114712.538976-7-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>
2024-12-17 13:14:42 +00:00
Peng Fan
55b75306c3 Input: bbnsm_pwrkey - add remove hook
Without remove hook to clear wake irq, there will be kernel dump when
doing module test.
"bbnsm_pwrkey 44440000.bbnsm:pwrkey: wake irq already initialized"

Add remove hook to clear wake irq and set wakeup to false.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Fixes: 40e40fdfec3f ("Input: bbnsm_pwrkey - add bbnsm power key support")
Link: https://lore.kernel.org/r/20241212030322.3110017-1-peng.fan@oss.nxp.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-12-16 09:34:16 -08:00
Andreas Kemnade
6ef4ea3c94 Input: tsc2007 - accept standard properties
Only some driver-specific properties were accepted, change it
to use the now-available standard properties which are
found in devicetrees containing this chip.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/20241205204413.2466775-2-akemnade@kernel.org
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
2024-12-10 16:17:30 -08:00
Nicolas Nobelis
1bba29603a Input: xpad - add support for Nacon Pro Compact
Add Nacon Pro Compact to the list of supported devices. These are the
ids of the "Colorlight" variant. The buttons, sticks and vibrations
work. The decorative LEDs on the other hand do not (they stay turned
off).

Signed-off-by: Nicolas Nobelis <nicolas@nobelis.eu>
Link: https://lore.kernel.org/r/20241116182419.33833-1-nicolas@nobelis.eu
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-27 12:09:00 -08:00
Linus Torvalds
3e51108c72 Input updates for v6.13-rc0
- support for NT36672A touchscreen added to novatek-nvt-ts driver
 
 - a change to ads7846 driver to prevent XPT2046 from locking up
 
 - a change switching platform input dirves back to using remove() method
   (from remove_new())
 
 - updates to a number of input drivers to use the new cleanup facilities
   (__free(...), guard(), and scoped-guard()) which ensure that the
   resources and locks are released properly and automatically
 
 - other assorted driver cleanups and fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQST2eWILY88ieB2DOtAj56VGEWXnAUCZ0PQIAAKCRBAj56VGEWX
 nDFFAQCSj3Va9Y6ZgNFvjmPAoA3RmsrvydXMG6PuyHEEfvTtpgD9GPldve3MRqRr
 VcrLJXMgyX2+RgpKm1W9ZQgK9Nudegs=
 =Ry7d
 -----END PGP SIGNATURE-----

Merge tag 'input-for-v6.13-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:

 - support for NT36672A touchscreen added to novatek-nvt-ts driver

 - a change to ads7846 driver to prevent XPT2046 from locking up

 - a change switching platform input dirves back to using remove()
   method (from remove_new())

 - updates to a number of input drivers to use the new cleanup
   facilities (__free(...), guard(), and scoped-guard()) which ensure
   that the resources and locks are released properly and automatically

 - other assorted driver cleanups and fixes.

* tag 'input-for-v6.13-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (109 commits)
  Input: mpr121 - use devm_regulator_get_enable_read_voltage()
  Input: sun4i-lradc-keys - don't include 'pm_wakeup.h' directly
  Input: spear-keyboard - don't include 'pm_wakeup.h' directly
  Input: cypress-sf - constify struct i2c_device_id
  Input: ads7846 - increase xfer array size in 'struct ser_req'
  Input: fix the input_event struct documentation
  Input: i8042 - fix typo dublicate to duplicate
  Input: ads7846 - add dummy command register clearing cycle
  Input: cs40l50 - fix wrong usage of INIT_WORK()
  Input: introduce notion of passive observers for input handlers
  Input: maple_keyb - use guard notation when acquiring mutex
  Input: locomokbd - use guard notation when acquiring spinlock
  Input: hilkbd - use guard notation when acquiring spinlock
  Input: synaptics-rmi4 - switch to using cleanup functions in F34
  Input: synaptics - fix a typo
  dt-bindings: input: rotary-encoder: Fix "rotary-encoder,rollover" type
  Input: omap-keypad - use guard notation when acquiring mutex
  Input: imagis - fix warning regarding 'imagis_3038_data' being unused
  Input: userio - remove unneeded semicolon
  Input: sparcspkr - use cleanup facility for device_node
  ...
2024-11-25 10:31:39 -08:00
Dmitry Torokhov
0201710ba6 Merge branch 'next' into for-linus
Prepare input updates for 6.13 merge window.
2024-11-24 17:05:27 -08:00
David Lechner
0433773862 Input: mpr121 - use devm_regulator_get_enable_read_voltage()
We can reduce boilerplate code by using
devm_regulator_get_enable_read_voltage().

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20241119-input-mpr121-regulator-get-enable-read-voltage-v3-1-1d8ee5c22f6c@baylibre.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-19 21:37:41 -08:00
Wolfram Sang
048b3ae033 Input: sun4i-lradc-keys - don't include 'pm_wakeup.h' directly
The header clearly states that it does not want to be included directly,
only via 'device.h'. 'platform_device.h' works equally well. Remove the
direct inclusion.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20241118072917.3853-7-wsa+renesas@sang-engineering.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-19 21:35:54 -08:00
Wolfram Sang
a39fbef7c4 Input: spear-keyboard - don't include 'pm_wakeup.h' directly
The header clearly states that it does not want to be included directly,
only via 'device.h'. 'platform_device.h' works equally well. Remove the
direct inclusion.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20241118072917.3853-6-wsa+renesas@sang-engineering.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-19 21:35:48 -08:00
Christophe JAILLET
34e7714430 Input: cypress-sf - constify struct i2c_device_id
'struct i2c_device_id' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increase overall security.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
   6438	    618	      0	   7056	   1b90	drivers/input/keyboard/cypress-sf.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   6502	    554	      0	   7056	   1b90	drivers/input/keyboard/cypress-sf.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/4bc3e3b4d10223d9df850fe4ba48f1cefd197082.1731689418.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-18 19:35:24 -08:00
Nathan Chancellor
470a271627 Input: ads7846 - increase xfer array size in 'struct ser_req'
Clang warns (or errors with CONFIG_WERROR=y, trimmed for brevity):

  drivers/input/touchscreen/ads7846.c:412:2: error: array index 6 is past the end of the array (that has type 'struct spi_transfer[6]') [-Werror,-Warray-bounds]
    412 |         req->xfer[6].tx_buf = &req->scratch;
        |         ^         ~
  ...
  drivers/input/touchscreen/ads7846.c:416:2: error: array index 7 is past the end of the array (that has type 'struct spi_transfer[6]') [-Werror,-Warray-bounds]
    416 |         req->xfer[7].rx_buf = &req->scratch;
        |         ^         ~
  drivers/input/touchscreen/ads7846.c:334:2: note: array 'xfer' declared here
    334 |         struct spi_transfer     xfer[6];
        |         ^

Increase the size of xfer in 'struct ser_req' to ensure that there is
enough space for all necessary members and there are no out of bounds
accesses, clearing up the warning.

Fixes: 781a07da9bb9 ("Input: ads7846 - add dummy command register clearing cycle")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20241111-input-ads7846-increase-xfer-array-size-v1-1-06cd92e9f20f@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-14 18:04:52 -08:00
Andy Shevchenko
081aaf2dfc Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20241104093609.156059-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-11-09 14:55:33 +01:00
Andy Shevchenko
a04abf25fb Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20241104093609.156059-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-11-09 14:55:33 +01:00
Shivam Chaudhary
bed0f75909 Input: i8042 - fix typo dublicate to duplicate
Fix typo in i8042-acpipnpio.h dublicate -> duplicate.

Signed-off-by: Shivam Chaudhary <cvam0000@gmail.com>
Link: https://lore.kernel.org/r/20241107174918.78335-1-cvam0000@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-07 22:09:29 -08:00
Marek Vasut
781a07da9b Input: ads7846 - add dummy command register clearing cycle
On STM32MP135F with XPT2046 touch controller attached to SPI bus, it has
been observed that the touch controller locks up after Linux kernel has
finished booting. Adding a dummy cycle on the SPI bus seems to mitigate
the lock up.

The XPTEK XPT2046 controller seems to be an identical clone of TI TSC2046,
the datasheet seems to be a clone of the TI part as well, text seem to be
word to word identical, except all the pictures have been drawn again.

This touch controller is present e.g. on WaveShare 3.2inch RPi LCD (B)
panel, the DTO provided by WaveShare uses 50 kHz SPI clock for this
touch controller, which is unusually low and possibly might have been
used as some sort of workaround for an issue. The SPI LCD on the same
bus uses 16 MHz clock.

SPI bus DT properties spi-cs-setup-delay-ns, spi-cs-hold-delay-ns,
spi-cs-inactive-delay-ns, spi-rx-delay-us, spi-tx-delay-us set to
range of 500ns..5us seem to have no impact on the behavior of the
touch controller, the lock up always occurs. The STM32MP13xx SPI
controller users GPIO control for the nCS pins.

Since the dummy cycle happens after the controller has been put into
power down mode and both ADC and REF regulators have been disabled,
the cycle should have no impact on the configuration of the controller,
i.e. it should be a NOP.

It is unclear whether this problem is specific to this cloned XPT2046
controller, or whether this is also present on TSC2046. A test on
either TSC2046 or ADS7846 would be very welcome.

Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20240320072533.170029-1-marex@denx.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-07 21:59:13 -08:00
Yuan Can
5c822c0ce5 Input: cs40l50 - fix wrong usage of INIT_WORK()
In cs40l50_add(), the work_data is a local variable and the work_data.work
should initialize with INIT_WORK_ONSTACK() instead of INIT_WORK().
Small error in cs40l50_erase() also fixed in this commit.

Fixes: c38fe1bb5d21 ("Input: cs40l50 - Add support for the CS40L50 haptic driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: James Ogletree <jogletre@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20241106013549.78142-1-yuancan@huawei.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-07 21:54:44 -08:00
Dmitry Torokhov
57a063632d Input: introduce notion of passive observers for input handlers
Sometimes it is useful to observe (and maybe modify) data coming from
an input device, but only do that if there are other users of such input
device. An example is touchpad switching functionality on Lenovo IdeaPad
Z570 where it is desirable to suppress events coming from the touchpad
if user toggles touchpad on/off button (on this laptop the firmware does
not stop the device).

Introduce notion of passive observers for input handlers to solve this
issue. An input handler marked as passive observer behaves exactly like
any other input handler or filter, but with one exception: it does not
open/start underlying input device when attaching to it.

Link: https://lore.kernel.org/r/ZxlEROX7bMo5cbZP@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-05 14:19:47 -08:00
Dmitry Torokhov
6b6b40ff05 Input: maple_keyb - use guard notation when acquiring mutex
Using guard notation makes the code more compact and error handling
more robust by ensuring that mutexes are released in all code paths
when control leaves critical section.

Link: https://lore.kernel.org/r/Zx8mGiWOw1Av28TX@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-05 14:17:32 -08:00
Dmitry Torokhov
229ba714e5 Input: locomokbd - use guard notation when acquiring spinlock
Using guard notation makes the code more compact and error handling
more robust by ensuring that locks are released in all code paths
when control leaves critical section.

Link: https://lore.kernel.org/r/Zxr4AMJrzhZlHAlf@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-05 14:17:25 -08:00
Dmitry Torokhov
dda8fdb033 Input: hilkbd - use guard notation when acquiring spinlock
Using guard notation makes the code more compact and error handling
more robust by ensuring that locks are released in all code paths
when control leaves critical section.

Link: https://lore.kernel.org/r/Zxr30BpPobpM65vO@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-05 14:17:20 -08:00
Dmitry Torokhov
cbdc3f95cd Input: synaptics-rmi4 - switch to using cleanup functions in F34
Start using __free() and guard() primitives to simplify the code
and error handling.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://lore.kernel.org/r/Zxwd9c0njasZZoal@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-04 21:50:06 -08:00
Christophe JAILLET
7ec151f457 Input: synaptics - fix a typo
s/synatics/synaptics/
A 'p' is missing.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/f3365eab359feb9adc6e2dedcffc976f3b272d8b.1730538673.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-04 21:49:05 -08:00
Linus Torvalds
295ba6501d Input updates for v6.12-rc5
- a fix for regression in input core introduced in 6.11 preventing
   re-registering input handlers
 
 - a fix for adp5588-keys driver tyring to disable interrupt 0 at suspend
   when devices is used without interrupt
 
 - a fix for edt-ft5x06 to stop leaking regmap structure when probing
   fails and to make sure it is not released too early on removal.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQST2eWILY88ieB2DOtAj56VGEWXnAUCZycQwgAKCRBAj56VGEWX
 nFgtAQDxuWplL+cwA5f3g+/Rq38faHBY5ebmsC9G/QnBZs4hTQD/dL04tU9NwvNq
 GYw4MYRNaDIeY8vyq21Y+dQe0uL0rAM=
 =xAeU
 -----END PGP SIGNATURE-----

Merge tag 'input-for-v6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:

 - a fix for regression in input core introduced in 6.11 preventing
   re-registering input handlers

 - a fix for adp5588-keys driver tyring to disable interrupt 0 at
   suspend when devices is used without interrupt

 - a fix for edt-ft5x06 to stop leaking regmap structure when probing
   fails and to make sure it is not released too early on removal.

* tag 'input-for-v6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: fix regression when re-registering input handlers
  Input: adp5588-keys - do not try to disable interrupt 0
  Input: edt-ft5x06 - fix regmap leak when probe fails
2024-11-03 08:35:29 -10:00
Dmitry Torokhov
071b24b54d Input: fix regression when re-registering input handlers
Commit d469647bafd9 ("Input: simplify event handling logic") introduced
code that would set handler->events() method to either
input_handler_events_filter() or input_handler_events_default() or
input_handler_events_null(), depending on the kind of input handler
(a filter or a regular one) we are dealing with. Unfortunately this
breaks cases when we try to re-register the same filter (as is the case
with sysrq handler): after initial registration the handler will have 2
event handling methods defined, and will run afoul of the check in
input_handler_check_methods():

	input: input_handler_check_methods: only one event processing method can be defined (sysrq)
	sysrq: Failed to register input handler, error -22

Fix this by adding handle_events() method to input_handle structure and
setting it up when registering a new input handle according to event
handling methods defined in associated input_handler structure, thus
avoiding modifying the input_handler structure.

Reported-by: "Ned T. Crigler" <crigler@gmail.com>
Reported-by: Christian Heusel <christian@heusel.eu>
Tested-by: "Ned T. Crigler" <crigler@gmail.com>
Tested-by: Peter Seiderer <ps.report@gmx.net>
Fixes: d469647bafd9 ("Input: simplify event handling logic")
Link: https://lore.kernel.org/r/Zx2iQp6csn42PJA7@xavtug
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-11-02 22:28:58 -07:00
Dmitry Torokhov
e1325e19d2 Input: omap-keypad - use guard notation when acquiring mutex
Using guard notation makes the code more compact and error handling
more robust by ensuring that mutexes are released in all code paths
when control leaves critical section.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/Zxr4nF-igbrmgq85@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-30 15:54:51 -07:00
Dmitry Torokhov
2860586c58 Input: adp5588-keys - do not try to disable interrupt 0
Commit dc748812fca0 ("Input: adp5588-keys - add support for pure gpio")
made having interrupt line optional for the device, however it neglected
to update suspend and resume handlers that try to disable interrupts
for the duration of suspend.

Fix this by checking if interrupt number assigned to the i2c device is
not 0 before trying to disable or reenable it.

Fixes: dc748812fca0 ("Input: adp5588-keys - add support for pure gpio")
Link: https://lore.kernel.org/r/Zv_2jEMYSWDw2gKs@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-25 15:52:45 -07:00
Dmitry Torokhov
bffdf9d7e5 Input: edt-ft5x06 - fix regmap leak when probe fails
The driver neglects to free the instance of I2C regmap constructed at
the beginning of the edt_ft5x06_ts_probe() method when probe fails.
Additionally edt_ft5x06_ts_remove() is freeing the regmap too early,
before the rest of the device resources that are managed by devm are
released.

Fix this by installing a custom devm action that will ensure that the
regmap is released at the right time during normal teardown as well as
in case of probe failure.

Note that devm_regmap_init_i2c() could not be used because the driver
may replace the original regmap with a regmap specific for M06 devices
in the middle of the probe, and using devm_regmap_init_i2c() would
result in releasing the M06 regmap too early.

Reported-by: Li Zetao <lizetao1@huawei.com>
Fixes: 9dfd9708ffba ("Input: edt-ft5x06 - convert to use regmap API")
Cc: stable@vger.kernel.org
Reviewed-by: Oliver Graute <oliver.graute@kococonnector.com>
Link: https://lore.kernel.org/r/ZxL6rIlVlgsAu-Jv@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-24 18:38:07 -07:00
Zeng Heng
b4badee88c Input: imagis - fix warning regarding 'imagis_3038_data' being unused
Fix the following compilation warnings:
drivers/input/touchscreen/imagis.c:422:39: warning: ‘imagis_3038c_data’
defined but not used [-Wunused-const-variable=]
  422 | static const struct imagis_properties imagis_3038c_data = {
drivers/input/touchscreen/imagis.c:415:39: warning: ‘imagis_3038b_data’
defined but not used [-Wunused-const-variable=]
  415 | static const struct imagis_properties imagis_3038b_data = {
drivers/input/touchscreen/imagis.c:407:39: warning: ‘imagis_3038_data’
defined but not used [-Wunused-const-variable=]
  407 | static const struct imagis_properties imagis_3038_data = {
drivers/input/touchscreen/imagis.c:398:39: warning: ‘imagis_3032c_data’
defined but not used [-Wunused-const-variable=]
  398 | static const struct imagis_properties imagis_3032c_data = {

Only define the variables 'imagis_303*_data' when the CONFIG_OF
is enabled.

Fixes: 1e48ee99f603 ("Input: imagis - add supports for Imagis IST3038")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
Acked-by: Markuss Broks <markuss.broks@gmail.com>
Link: https://lore.kernel.org/r/20241023094831.1680214-1-zengheng4@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-24 18:33:23 -07:00
Yang Li
92a22842ec Input: userio - remove unneeded semicolon
Remove a redundant semicolon from the code.

./drivers/input/serio/userio.c:89:35-36: Unneeded semicolon

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11431
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241022064056.112575-1-yang.lee@linux.alibaba.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-22 14:00:31 -07:00
Javier Carrasco
20d1278d4b Input: sparcspkr - use cleanup facility for device_node
Use the 'free(device_node)' macro to simplify the code by automatically
freeing the device node, which removes the need for explicit calls to
'of_node_put()'.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20241021-input_automate_of_node_put-v3-2-cc73f636e1bc@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-22 13:58:39 -07:00
Javier Carrasco
ddefcd779e Input: sparcspkr - use device managed memory for 'state'
Use devm_kzalloc() in bbc_bee_probe() and grover_beep_probe() to
automatically free 'state' when the device is removed. Drop the
kfree(state) calls from the probe error paths and the remove functions
accordingly.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241021-input_automate_of_node_put-v3-1-cc73f636e1bc@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-22 13:58:39 -07:00
Dmitry Torokhov
d0c3a7aa81 Input: serio_raw - fix uninitialized variable bug
Recent conversion of the driver to use guard notation for locks and
other resources introduced a bug: "written" variable that is supposed to
hold number of bytes successfully written was not initialized.

Fix it by initializing the variable with 0.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410201730.ItNhUTIv-lkp@intel.com/
Fixes: 5b53a9d40c4f ("Input: serio_raw - use guard notation for locks and other resources")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-21 00:12:11 -07:00
Javier Carrasco
00850d7b54 Input: ts4800-ts - use cleanup facility for device_node
Use the '__free(device_node)' macro to automatically free the device
node, removing the need for explicit calls to 'of_node_put()' to
decrement its refcount.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241010-input_automate_of_node_put-v1-10-ebc62138fbf8@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-19 21:21:43 -07:00
Javier Carrasco
cd63c67be6 Input: raspberrypi-ts - use cleanup facility for device_node
Use the '__free(device_node)' macro to automatically free the device
node, removing the need for explicit calls to 'of_node_put()' to
decrement its refcount.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241010-input_automate_of_node_put-v1-9-ebc62138fbf8@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-19 21:21:43 -07:00
Javier Carrasco
6243376d6a Input: i8042 - use cleanup facility for device_node
Use the '__free(device_node)' macro to automatically free the device
node, removing the need for explicit calls to 'of_node_put()' to
decrement its refcount.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241010-input_automate_of_node_put-v1-8-ebc62138fbf8@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-19 21:21:42 -07:00
Javier Carrasco
8dee1ddafa Input: 88pm860x - use cleanup facility for device_node
Use the '__free(device_node)' macro to simplify the code and error
handling. This makes the code more robust by ensuring that the device
node is always freed.

Drop the first assignment to 'pdev->dev.parent->of_node', as it was only
a shortcut, and tie 'np' to its usage as a child node.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241010-input_automate_of_node_put-v1-7-ebc62138fbf8@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-10-19 21:21:41 -07:00