Commit graph

1369 commits

Author SHA1 Message Date
zhouchuangao
25531d612b Input: cros_ec_keyb - use kobj_to_dev() API
Use kobj_to_dev() API instead of container_of().

Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/1624025283-56360-1-git-send-email-zhouchuangao@vivo.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-06-19 22:36:19 -07:00
Randy Dunlap
c1367ee016 m68k: atari: Fix ATARI_KBD_CORE kconfig unmet dependency warning
Since the code for ATARI_KBD_CORE does not use drivers/input/keyboard/
code, just move ATARI_KBD_CORE to arch/m68k/Kconfig.machine to remove
the dependency on INPUT_KEYBOARD.

Removes this kconfig warning:

    WARNING: unmet direct dependencies detected for ATARI_KBD_CORE
      Depends on [n]: !UML && INPUT [=y] && INPUT_KEYBOARD [=n]
      Selected by [y]:
      - MOUSE_ATARI [=y] && !UML && INPUT [=y] && INPUT_MOUSE [=y] && ATARI [=y]

Fixes: c04cb856e2 ("m68k: Atari keyboard and mouse support.")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Suggested-by: Michael Schmitz <schmitzmic@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/20210527001251.8529-1-rdunlap@infradead.org
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2021-06-07 16:28:51 +02:00
Dmitry Torokhov
cbb2452392 Linux 5.12
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmCF1cQeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGvvgH/RAXkQ5IWAJfA6+M
 8kPWOibeCRUftBQj/QP8saa/+e17R0LqFrMAOZUvIr5Z/midPsGmW3HaT0D9Un2R
 80xi3bj+S4NJi1JNKr2JoEaw5T44LOU0snQ1tRU4+R/RIISNlRyYvcHyztz7cyHX
 K3r5j4125uYytKG6tI0c7IWGN5XtgDfd8VSew+MqjOXmJSlkOUk+xqu0uKDPWTqU
 AVCtPd2D7Yp7BcmQkJstu6+zPEuIbirGx+6c28pzT3d5q16+8iZ1G9jtpOk12mA7
 jEIVgvIpevuZdkVUbf+gJMHyetVwNS0FtypUw5r1meoqwqeTNaCzc0KpFnQkO4Ak
 AWGzkMY=
 =QgJZ
 -----END PGP SIGNATURE-----

Merge tag 'v5.12' into next

Sync up with mainline to get the latest device tree bindings and kernel
APIs.
2021-05-25 11:24:42 -07:00
Zhen Lei
d9b576917a Input: hil_kbd - fix error return code in hil_dev_connect()
Return error code -EINVAL rather than '0' when the combo devices are not
supported.

Fixes: fa71c605c2 ("Input: combine hil_kbd and hil_ptr drivers")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20210515030053.6824-1-thunder.leizhen@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-05-24 20:57:04 -07:00
Dmitry Torokhov
d0034a7a4a Merge branch 'next' into for-linus
Prepare input updates for 5.13 merge window.
2021-05-04 11:46:00 -07:00
Linus Torvalds
1df01322f0 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov:
 "Just a few driver fixes here"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: elants_i2c - drop zero-checking of ABS_MT_TOUCH_MAJOR resolution
  Input: elants_i2c - fix division by zero if firmware reports zero phys size
  Input: nspire-keypad - enable interrupts only when opened
  Input: i8042 - fix Pegatron C15B ID entry
  Input: n64joy - fix return value check in n64joy_probe()
  Input: s6sy761 - fix coordinate read bit shift
2021-04-15 10:23:44 -07:00
Dmitry Torokhov
2531fdbf8b Input: gpio-keys - fix crash when disabliing GPIO-less buttons
My brain-damaged adjustments to Paul's patch caused crashes in
gpio_keys_disable_button() when driver is used in GPIO-less (i.e.
purely interrupt-driven) setups, because I mixed together debounce and
release timers when they are in fact separate:

Unable to handle kernel NULL pointer dereference at virtual address 0000000c
...
PC is at hrtimer_active+0xc/0x98
LR is at hrtimer_try_to_cancel+0x24/0x140
...
[<c01c43b8>] (hrtimer_active) from [<c01c50f4>] (hrtimer_try_to_cancel+0x24/0x140)
[<c01c50f4>] (hrtimer_try_to_cancel) from [<c01c5224>] (hrtimer_cancel+0x14/0x4c)
[<c01c5224>] (hrtimer_cancel) from [<bf1cae24>] (gpio_keys_attr_store_helper+0x1b8/0x1d8 [gpio_keys])
[<bf1cae24>] (gpio_keys_attr_store_helper [gpio_keys]) from [<bf1cae80>] (gpio_keys_store_disabled_keys+0x18/0x24 [gpio_keys])
[<bf1cae80>] (gpio_keys_store_disabled_keys [gpio_keys]) from [<c038ec7c>] (kernfs_fop_write_iter+0x10c/0x1cc)
[<c038ec7c>] (kernfs_fop_write_iter) from [<c02df858>] (vfs_write+0x2ac/0x404)
[<c02df858>] (vfs_write) from [<c02dfaf4>] (ksys_write+0x64/0xdc)
[<c02dfaf4>] (ksys_write) from [<c0100080>] (ret_fast_syscall+0x0/0x58)

Let's fix it up.

Fixes: c9efb0ba28 ("Input: gpio-keys - use hrtimer for software debounce, if possible")
Reported-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/YG1DFFgojSVfdpaz@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-04-07 23:20:52 -07:00
Fabio Estevam
73e7f1732e Input: imx_keypad - convert to a DT-only driver
i.MX has been converted to a DT-only platform, so make the
adjustments to the driver to convert it to a DT-only driver.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20210327194307.541248-1-festevam@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-27 21:40:21 -07:00
Barry Song
bcd9730a04 Input: move to use request_irq by IRQF_NO_AUTOEN flag
disable_irq() after request_irq() still has a time gap in which
interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
disable IRQ auto-enable because of requesting.

On the other hand, request_irq() after setting IRQ_NOAUTOEN as
below
irq_set_status_flags(irq, IRQ_NOAUTOEN);
request_irq(dev, irq...);
can also be replaced by request_irq() with IRQF_NO_AUTOEN flag.

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
Link: https://lore.kernel.org/r/20210302224916.13980-3-song.bao.hua@hisilicon.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25 15:27:56 -07:00
Dmitry Torokhov
5acac83bf2 Linux 5.12-rc4
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmBXwRseHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGX80H/2qQ49e2lbOfIqdR
 CBThtgg89QmN9WPTfVhwB6b4vejB7kIiIpOPyJVkaio6lVe8Ewhl064fnGHwXm39
 vPy0ZVAB96oaKaki6qi1k7jhCAMpl/vXf1RDe5PaEKPwp3Lr81BlY6dcTPbjxkFP
 Uw+uC3iRQnT8msSqA1vnhbDl9w6jfmuxX45Eo9NWGz0hDCpZNOEt2oSo/OcXTH4k
 c91FiW8Qv9uZX2tV4VSqFQgVPfneA+OWXMpjMg6kfK3jOJ5cZwmFGAa8ByqWACH/
 U9OODYQCsyX5ZM11g7MOt7Iv+YSU8OA0We8KDN4cRZobrCHF0Txp3ZTSPjb/xHE3
 9nUM50I=
 =a6Go
 -----END PGP SIGNATURE-----

Merge tag 'v5.12-rc4' into next

Sync up with the mainline to bring in newest APIs.
2021-03-25 11:46:10 -07:00
Paul Cercueil
c9efb0ba28 Input: gpio-keys - use hrtimer for software debounce, if possible
We want to be able to report the input event as soon as the debounce
delay elapsed. However, the current code does not really ensure that,
as it uses the jiffies-based schedule_delayed_work() API. With a small
enough HZ value (HZ <= 100), this results in some input events being
lost, when a key is quickly pressed then released (on a human's time
scale).

Switching to hrtimers fixes this issue, and will work even on extremely
low HZ values (tested at HZ=24). This is however only possible if
reading the GPIO is possible without sleeping. If this condition is not
met, the previous approach of using a jiffies-based timer is taken.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20210307222240.380583-3-paul@crapouillou.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25 11:14:08 -07:00
Paul Cercueil
019002f20c Input: gpio-keys - use hrtimer for release timer
Dealing with input, timing is important; if the button should be
released in one millisecond, then it should be done in one millisecond
and not a hundred milliseconds.

Therefore, the standard timer API is not really suitable for this task.

Convert the gpio-keys driver to use a hrtimer instead of the standard
timer to address this issue.

Note that by using a hard IRQ for the hrtimer callback, we can get rid
of the spin_lock_irqsave() and spin_unlock_irqrestore().

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20210307222240.380583-2-paul@crapouillou.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25 11:14:08 -07:00
Paul Cercueil
36a8fc6fa2 Input: gpio-keys - remove extra call to input_sync
The input_sync() function is already called after the loop in
gpio_keys_report_state(), so it does not need to be called after each
iteration within gpio_keys_gpio_report_event().

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20210307222240.380583-1-paul@crapouillou.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-25 11:14:08 -07:00
Fabian Vogt
69d5ff3e9e Input: nspire-keypad - enable interrupts only when opened
The driver registers an interrupt handler in _probe, but didn't configure
them until later when the _open function is called. In between, the keypad
can fire an IRQ due to touchpad activity, which the handler ignores. This
causes the kernel to disable the interrupt, blocking the keypad from
working.

Fix this by disabling interrupts before registering the handler.
Additionally, disable them in _close, so that they're only enabled while
open.

Fixes: fc4f314618 ("Input: add TI-Nspire keypad support")
Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de>
Link: https://lore.kernel.org/r/3383725.iizBOSrK1V@linux-e202.suse.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-23 10:55:10 -07:00
Linus Torvalds
e0fbd25bb3 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:
 "Mostly existing driver fixes plus a new driver for game controllers
  directly connected to Nintendo 64, and an enhancement for keyboards
  driven by Chrome OS EC to communicate layout of the top row to
  userspace"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (47 commits)
  Input: st1232 - fix NORMAL vs. IDLE state handling
  Input: aiptek - convert sysfs sprintf/snprintf family to sysfs_emit
  Input: alps - fix spelling of "positive"
  ARM: dts: cros-ec-keyboard: Use keymap macros
  dt-bindings: input: Fix the keymap for LOCK key
  dt-bindings: input: Create macros for cros-ec keymap
  Input: cros-ec-keyb - expose function row physical map to userspace
  dt-bindings: input: cros-ec-keyb: Add a new property describing top row
  Input: applespi - fix occasional crc errors under load.
  Input: applespi - don't wait for responses to commands indefinitely.
  Input: st1232 - add IDLE state as ready condition
  Input: zinitix - fix return type of zinitix_init_touch()
  Input: i8042 - add ASUS Zenbook Flip to noselftest list
  Input: add missing dependencies on CONFIG_HAS_IOMEM
  Input: joydev - prevent potential read overflow in ioctl
  Input: elo - fix an error code in elo_connect()
  Input: xpad - add support for PowerA Enhanced Wired Controller for Xbox Series X|S
  Input: sur40 - fix an error code in sur40_probe()
  Input: elants_i2c - detect enum overflow
  Input: zinitix - remove unneeded semicolon
  ...
2021-02-23 14:56:23 -08:00
Philip Chen
820c872795 Input: cros-ec-keyb - expose function row physical map to userspace
The top-row keys in a keyboard usually have dual functionalities.
E.g. A function key "F1" is also an action key "Browser back".

Therefore, when an application receives an action key code from
a top-row key press, the application needs to know how to correlate
the action key code with the function key code and do the conversion
whenever necessary.

Since the userpace already knows the key scanlines (row/column)
associated with a received key code. Essentially, the userspace only
needs a mapping between the key row/column and the matching physical
location in the top row.

So, enhance the cros-ec-keyb driver to create such a mapping
and expose it to userspace in the form of a function_row_physmap
attribute. The attribute would be a space separated ordered list of
row/column codes for the keys in the function row, in a left-to-right
order.

The attribute will only be present when the device has a custom design
for the top-row keys.

Signed-off-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20210115122412.v7.2.I6542d7d9d0b246e7079bb16b41e697b2ac4b4e39@changeid
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-02-22 21:22:15 -08:00
Dmitry Torokhov
415e915fdf Linux 5.11
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmAppPgeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGeXYH/imZPBd4A1jIMehN
 5HV2A53Z+MXmmaMuGj9X1KV6vsf55/xB+IhOoFdtRAIsO8c2yYSCO8i4+4R0XfYA
 +/YFJeq672rojQnmh6XbpR8dugaAV7CUHy6n7KDsyvtT6EOCpwFSwkOb4X3tBRX6
 TlYgm2d/xgV/wRHSgLVugK0MdFCLMAnyb7mkPfar9QrMgG1BiDKLq07xmwnS23On
 TkqpJ9yZ/rJpUrrUqQYPShSO/FmA+fSfWs0CDv7EIrJ40LUScD6PZxSHWTIHtjLk
 E4jFda6wuqLRVWsBwaBzUIdD0zk7X5quHRzEpbC5ga16SK6yrWvE5YJJXCguIEuZ
 f3FMRYs=
 =CAjn
 -----END PGP SIGNATURE-----

Merge tag 'v5.11' into next

Merge with mainline to get latest APIs and device tree bindings.
2021-02-22 21:21:03 -08:00
Ronald Tschalär
e64123949e Input: applespi - fix occasional crc errors under load.
For some reason, when the system is under heavy CPU load, the read
following the write sometimes occurs unusually quickly, resulting in
the read data not being quite ready and hence a bad packet getting read.
Adding another delay after reading the status message appears to fix
this.

Signed-off-by: Ronald Tschalär <ronald@innovation.ch>
Link: https://lore.kernel.org/r/20210217190718.11035-2-ronald@innovation.ch
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-02-19 11:13:29 -08:00
Ronald Tschalär
0ce1ac2314 Input: applespi - don't wait for responses to commands indefinitely.
The response to a command may never arrive or it may be corrupted (and
hence dropped) for some reason. While exceedingly rare, when it did
happen it blocked all further commands. One way to fix this was to
do a suspend/resume. However, recovering automatically seems like a
nicer option. Hence this puts a time limit (1 sec) on how long we're
willing to wait for a response, after which we assume it got lost.

Signed-off-by: Ronald Tschalär <ronald@innovation.ch>
Link: https://lore.kernel.org/r/20210217190718.11035-1-ronald@innovation.ch
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-02-19 11:13:27 -08:00
Dmitry Torokhov
b2e3543b5e Input: add missing dependencies on CONFIG_HAS_IOMEM
devm_ioremap_resource() is only guaranteed to be present if
CONFIG_HAS_IOMEM is set.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/YCyauGyqxut69JNz@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-02-19 11:02:18 -08:00
Uwe Kleine-König
33d6d2bb7e ARM: 9049/1: locomo: make locomo bus's remove callback return void
The driver core ignores the return value of struct bus_type::remove
because there is only little that can be done. To simplify the quest to
make this function return void, let struct locomo_driver::remove return
void, too. All users already unconditionally return 0, this commit makes
it obvious that returning an error code is a bad idea and ensures future
users behave accordingly.

Link: https://lore.kernel.org/r/20201126110140.2021758-1-u.kleine-koenig@pengutronix.de

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2021-02-01 19:44:30 +00:00
Tony Lindgren
2f6aa61d87 Input: omap4-keypad - implement errata check for lost key-up events
We are still missing handling for errata i689 related issues for the
case where we never see a key up interrupt for the last pressed key.

To fix the issue, we must scan the key state again after the keyboard
controller has idled to check if a key up event was missed. This is
described in the omap4 silicon errata documentation for Errata ID i689
"1.32 Keyboard Key Up Event Can Be Missed":

"When a key is released for a time shorter than the debounce time,
 in-between 2 key press (KP1 and KP2), the keyboard state machine will go
 to idle mode and will never detect the key release (after KP1, and also
 after KP2), and thus will never generate a new IRQ indicating the key
 release."

We can use PM runtime autosuspend features to check the keyboard state
after it enters idle.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/X/vrygoBxzGyXhfc@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-10 22:23:04 -08:00
Tony Lindgren
29bf35e5ee Input: omap4-keypad - use PM runtime autosuspend
Implement PM runtime autosuspend support to prepare for adding handling to
clear stuck last pressed key in the following patches. The hardware has
support for autoidle and can wake up to keypress events.

Let's also update omap4_keypad_probe() to use dev instead of &pdev->dev
since we already have it from the earlier changes.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/X/vqCs5/EDURprAJ@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-10 22:23:04 -08:00
Tony Lindgren
98b0c88d4b Input: omap4-keypad - move rest of key scanning to a separate function
Let's move rest of the key scanning code to omap4_keypad_scan_keys().
We will use omap4_keypad_scan_keys() also for implementing errata
handling to clear the stuck last key in the following patch.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20210110190529.46135-4-tony@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-10 22:23:02 -08:00
Tony Lindgren
905dbf1d39 Input: omap4-keypad - scan keys in two phases and simplify with bitmask
Because of errata i689 the keyboard can idle with state where no key
up interrupts are seen until after the next key press.

This means we need to first check for any lost key up events before
scanning for new down events.

For example, rapidly pressing shift-shift-j can sometimes produce a J
instead of j. Let's fix the issue by scanning the keyboard in two
phases. First we scan for any key up events that we may have missed,
and then we scan for key down events.

Let's also simplify things with for_each_set_bit() as suggested by
Dmitry Torokhov <dmitry.torokhov@gmail.com>.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20210110190529.46135-3-tony@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-10 22:23:00 -08:00
Tony Lindgren
7e0541b257 Input: omap4-keypad - disable unused long interrupts
We are not using the long events and they produce extra interrupts.
Let's not enable them at all.

Note that also the v3.0.8 Linux Android kernel has long interrupts
disabled.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20210110190529.46135-2-tony@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-10 22:22:58 -08:00
Dmitry Torokhov
60dc451194 Input: omap4-keypad - switch to use managed resources
Now that input core supports devres-managed input devices we can clean
up this driver a bit.

Link: https://lore.kernel.org/r/X/qfJKiM21uyksYl@google.com
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-01-10 22:22:57 -08:00
Dmitry Torokhov
f5cace4b93 Input: imx_keypad - add dependency on HAS_IOMEM
devm_platform_ioremap_resource() depends on CONFIG_HAS_IOMEM, so let's add
it to the dependencies when COMPILE_TEST is enabled.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: c8834032ff ("Input: imx_keypad - add COMPILE_TEST support")
Link: https://lore.kernel.org/r/X9llpA3w1zlZCHXU@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-18 10:04:36 -08:00
Linus Torvalds
ee249d30fa Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:

 - support for inhibiting input devices at request from userspace. If a
   device implements open/close methods, it can also put device into low
   power state. This is needed, for example, to disable keyboard and
   touchpad on convertibles when they are transitioned into tablet mode

 - now that ordinary input devices can be configured for polling mode,
   dedicated input polling device implementation has been removed

 - GTCO tablet driver has been removed, as it used problematic custom
   HID parser, devices are EOL, and there is no interest from the
   manufacturer

 - a new driver for Dialog DA7280 haptic chips has been introduced

 - a new driver for power button on Dell Wyse 3020

 - support for eKTF2132 in ektf2127 driver

 - support for SC2721 and SC2730 in sc27xx-vibra driver

 - enhancements for Atmel touchscreens, AD7846 touchscreens, Elan
   touchpads, ADP5589, ST1232 touchscreen, TM2 touchkey drivers

 - fixes and cleanups to allow clean builds with W=1

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (86 commits)
  Input: da7280 - fix spelling mistake "sequemce" -> "sequence"
  Input: cyapa_gen6 - fix out-of-bounds stack access
  Input: sc27xx - add support for sc2730 and sc2721
  dt-bindings: input: Add compatible string for SC2721 and SC2730
  dt-bindings: input: Convert sc27xx-vibra.txt to json-schema
  Input: stmpe - add axis inversion and swapping capability
  Input: adp5589-keys - do not explicitly control IRQ for wakeup
  Input: adp5589-keys - do not unconditionally configure as wakeup source
  Input: ipx4xx-beeper - convert comma to semicolon
  Input: parkbd - convert comma to semicolon
  Input: new da7280 haptic driver
  dt-bindings: input: Add document bindings for DA7280
  MAINTAINERS: da7280 updates to the Dialog Semiconductor search terms
  Input: elantech - fix protocol errors for some trackpoints in SMBus mode
  Input: elan_i2c - add new trackpoint report type 0x5F
  Input: elants - document some registers and values
  Input: atmel_mxt_ts - simplify the return expression of mxt_send_bootloader_cmd()
  Input: imx_keypad - add COMPILE_TEST support
  Input: applespi - use new structure for SPI transfer delays
  Input: synaptics-rmi4 - use new structure for SPI transfer delays
  ...
2020-12-15 16:18:23 -08:00
Dmitry Torokhov
4b4193256c Merge branch 'next' into for-linus
Prepare input updates for 5.11 merge window.
2020-12-14 16:27:23 -08:00
Linus Torvalds
643e69aff8 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov:

 - a fix for cm109 stomping on its own control URB if it tries to toggle
   buzzer immediately after userspace opens input device (found by
   syzcaller)

 - another fix for Raydium touchscreens that do not like splitting
   command transfers

 - quirks for i8042, soc_button_array, and goodix drivers to make them
   work better with certain hardware.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: goodix - add upside-down quirk for Teclast X98 Pro tablet
  Input: cm109 - do not stomp on control URB
  Input: i8042 - add Acer laptops to the i8042 reset list
  Input: cros_ec_keyb - send 'scancodes' in addition to key events
  Input: soc_button_array - add Lenovo Yoga Tablet2 1051L to the dmi_use_low_level_irq list
  Input: raydium_ts_i2c - do not split tx transactions
2020-12-12 09:41:33 -08:00
Dmitry Torokhov
51a224eaf8 Input: adp5589-keys - do not explicitly control IRQ for wakeup
If device is set up as a wakeup source, I2C core configures the interrupt
line as wake IRQ and PM core automatically configures it for waking up the
system on system suspend transition, so we do not have to explicitly call
enable_irq_wake() and disable_irq_wake() in suspend/resume.

Link: https://lore.kernel.org/r/20201120073920.3214492-2-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-11 13:15:53 -08:00
Dmitry Torokhov
3e35c19468 Input: adp5589-keys - do not unconditionally configure as wakeup source
We should not be configuring the controller as a wakeup source in the
driver, but rather rely on I2C core to mark it as such by either
instantiating as I2C_CLIENT_WAKEUP or specifying "wakeup-source" device
property.

Link: https://lore.kernel.org/r/20201120073920.3214492-1-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-11 13:15:51 -08:00
Anson Huang
c8834032ff Input: imx_keypad - add COMPILE_TEST support
Add COMPILE_TEST support to imx_keypad driver for better compile
testing coverage.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Link: https://lore.kernel.org/r/1583137573-16628-1-git-send-email-Anson.Huang@nxp.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-10 23:39:17 -08:00
Sergiu Cuciurean
6a8f9ed23a Input: applespi - use new structure for SPI transfer delays
In a recent change to the SPI subsystem [1], a new `delay` struct was added
to replace the `delay_usecs`. This change replaces the current
`delay_usecs` with `delay` for this driver.

The `spi_transfer_delay_exec()` function [in the SPI framework] makes sure
that both `delay_usecs` & `delay` are used (in this order to preserve
backwards compatibility).

[1] commit bebcfd272d ("spi: introduce `delay` field for
`spi_transfer` + spi_transfer_delay_exec()")

Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
Tested-by: Ronald Tschalär <ronald@innovation.ch>
Reviewed-by: Ronald Tschalär <ronald@innovation.ch>
Link: https://lore.kernel.org/r/20200227124534.23399-1-sergiu.cuciurean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-10 23:39:16 -08:00
Stephan Gerhold
7002932325 Input: tm2-touchkey - add vddio regulator
The Samsung touchkey controllers are often used with external pull-up
for the interrupt line and the I2C lines, so we might need to enable
a regulator to bring the lines into usable state. Otherwise, this might
cause spurious interrupts and reading from I2C will fail.

Implement support for a "vddio-supply" that is enabled by the
tm2-touchkey driver so that the regulator gets enabled when needed.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201203131242.44397-3-stephan@gerhold.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-09 19:47:11 -08:00
Dmitry Torokhov
80db2a087f Input: cros_ec_keyb - send 'scancodes' in addition to key events
To let userspace know what 'scancodes' should be used in EVIOCGKEYCODE
and EVIOCSKEYCODE ioctls, we should send EV_MSC/MSC_SCAN events in
addition to EV_KEY/KEY_* events. The driver already declared MSC_SCAN
capability, so it is only matter of actually sending the events.

Link: https://lore.kernel.org/r/X87aOaSptPTvZ3nZ@google.com
Acked-by: Rajat Jain <rajatja@google.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-09 18:03:56 -08:00
Andrzej Pietrasiewicz
d69f0a43c6 Input: use input_device_enabled()
Use the newly added helper in relevant input drivers.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-02 22:10:33 -08:00
Dmitry Torokhov
c1b46cd4df Input: omap4-keypad - set up interrupt as wakeup source
Marking main interrupt as wakeup interrupt in probe allows us to drop
custom suspend/resume methods whose only purpose was to configure interrupt
for waking up the system.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-02 22:10:31 -08:00
Zhang Qilong
59bbf83835 Input: omap4-keypad - fix runtime PM error handling
In omap4_keypad_probe, the patch fix several bugs.

  1) pm_runtime_get_sync will increment pm usage counter even it
     failed. Forgetting to pm_runtime_put_noidle will result in
     reference leak.

  2) In err_unmap, forget to disable runtime of device,
     pm_runtime_enable will increase power disable depth. Thus a
     pairing decrement is needed on the error handling path to keep
     it balanced.

  3) In err_pm_disable, it will call pm_runtime_put_sync twice not
     one time.

To fix this we factor out code reading revision and disabling touchpad, and
drop PM reference once we are done talking to the device.

Fixes: f77621cc64 ("Input: omap-keypad - dynamically handle register offsets")
Fixes: 5ad567ffba ("Input: omap4-keypad - wire up runtime PM handling")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201120133918.2559681-1-zhangqilong3@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-22 21:26:31 -08:00
Lee Jones
39f4879e99 Input: applespi - provide missing struct 'message' descriptions
Fixes the following W=1 kernel build warning(s):

 drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'keyboard' not described in 'message'
 drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'touchpad' not described in 'message'
 drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'tp_info' not described in 'message'
 drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'tp_info_command' not described in 'message'
 drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'init_mt_command' not described in 'message'
 drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'capsl_command' not described in 'message'
 drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'bl_command' not described in 'message'
 drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'data' not described in 'message'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-15-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-19 19:56:41 -08:00
Dmitry Torokhov
478a57072a Input: adp5589-keys - use BIT()
Let's use BIT() macro instead of explicitly shifting '1'.

Acked-by: Alexandru Ardelean <Alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201119072440.GA116840@dtor-ws
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-19 19:18:19 -08:00
Dmitry Torokhov
a265067883 Input: adp5589-keys - mark suspend and resume methods as __maybe_unused
This improves compile coverage of the code; unused code will be dropped by
the linker.

Acked-by: Alexandru Ardelean <Alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201119072418.GA114677@dtor-ws
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-19 19:18:17 -08:00
Alexandru Ardelean
30df385e35 Input: adp5589-keys - use devm_add_action_or_reset() for register clear
The driver clears the general configuration register during the remove()
hook. This should also be done in case the driver exits on error.

This change move the clear of that register to the
devm_add_action_or_reset() hook.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-6-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-18 23:18:31 -08:00
Alexandru Ardelean
74f2c59324 Input: adp5589-keys - use devm_gpiochip_add_data() for gpios
This change makes use of the devm_gpiochip_add_data() function. With this
the gpiochip_remove() function can be removed, and the
adp5589_gpio_remove() function as well.

The kpad->export_gpio variable is also redundant now, and has been removed.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-5-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-18 23:18:29 -08:00
Alexandru Ardelean
3b95bc57c8 Input: adp5589-keys - remove setup/teardown hooks for gpios
This is currently just dead code. It's from around a time when
platform-data was used, and a board could hook it's own special callback
for setup/teardown, and a private object (via 'context').

This change removes it, as there are no more users in mainline for this.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-4-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-18 23:18:27 -08:00
Alexandru Ardelean
760a1219ff Input: adp5589-keys - use device-managed function in adp5589_keypad_add()
This change makes use of the devm_input_allocate_device() function, which
gets rid of the input_free_device() and input_unregister_device() calls.

When a device is allocated via input_allocate_device(), the
input_register_device() call will also be device-managed, so there is no
longer need to manually call unregister.

Also, the irq is allocated with the devm_request_threaded_irq(), so with
these two changes, the adp5589_keypad_remove() function is no longer
needed.

This cleans up the error & exit paths.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-3-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-18 23:18:24 -08:00
Alexandru Ardelean
41d7d26b8f Input: adp5589-keys - use devm_kzalloc() to allocate the kpad object
This removes the need to manually free the kpad object and cleans up some
exit/error paths.  The error path cleanup should reduce the risk of any
memory leaks with this object.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-2-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-18 23:18:22 -08:00
Dmitry Torokhov
05909cd9a0 Linux 5.9
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl+DdgYeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGB1sH/0B4REolPPxiQsPL
 P45+a2POUU0SQK8NjkcYskQmJ6DnPKkJSXeUU8rzuI2rty5bWEzEBxdUSh064ZaM
 DGxkWrdhYNaLJuceNLlanBk3vrM3KwGkaJFSKLgsEXkmH86gl33ptA8nlQVbfc+4
 FK4hRZs2J6Y5YRsuzPO8nzzHWs1CThZEcwNPOeIZrAnv+/13zyP/piZ+R/2gKYwy
 RVrVrzSTkTGJXotn6J17Sa02+CGv5UqdxOZFv7jimYJOmFT7KnGngNrJbh8aYWk7
 vPTRUvGozh6NyYxtRI9LKGZy1yQ05Cl7N927CnFYzD235/eT7zaRDZe1e1JaIE8Z
 r2yxGCM=
 =ZIYP
 -----END PGP SIGNATURE-----

Merge tag 'v5.9' into next

Sync up with mainline to bring in the latest DTS files.
2020-11-17 18:13:23 -08:00
Linus Torvalds
0fa8ee0d9a Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov:
 "A fix for use-after-free in the Sun keyboard driver, a fix to firmware
  updates on newer ICs in the Elan touchpad diver, and a couple misc
  driver fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: elan_i2c - fix firmware update on newer ICs
  Input: resistive-adc-touch - fix kconfig dependency on IIO_BUFFER
  Input: sunkbd - avoid use-after-free in teardown paths
  Input: i8042 - allow insmod to succeed on devices without an i8042 controller
  Input: adxl34x - clean up a data type in adxl34x_probe()
2020-11-17 12:00:40 -08:00
Lee Jones
f1556986ba Input: samsung-keypad - remove set but unused variable 'var'
Fixes the following W=1 kernel build warning(s):

 drivers/input/keyboard/samsung-keypad.c: In function ‘samsung_keypad_irq’:
 drivers/input/keyboard/samsung-keypad.c:149:15: warning: variable ‘val’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-3-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-12 23:44:11 -08:00
Lee Jones
e0d80b647c Input: cros_ec_keyb - struct headers should start with 'struct <name>'
Fixes the following W=1 kernel build warning(s):

 drivers/input/keyboard/cros_ec_keyb.c:72: warning: cannot understand function prototype: 'struct cros_ec_bs_map '

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201104162427.2984742-8-lee.jones@linaro.org
[dtor: fixed up docbook comments for cros_ec_keyb structure as well]
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-08 22:25:02 -08:00
Lee Jones
2216c0e414 Input: gpio_keys - fix misnamed function parameter 'dev'
Fixes the following W=1 kernel build warning(s):

 drivers/input/keyboard/gpio_keys.c:119: warning: Function parameter or member 'dev' not described in 'get_bm_events_by_type'
 drivers/input/keyboard/gpio_keys.c:119: warning: Excess function parameter 'input' description in 'get_bm_events_by_type'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201104162427.2984742-12-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-08 22:23:59 -08:00
Lee Jones
55be5087a8 Input: pmic8xxx-keypad - fix kernel-doc formatting
Fixes the following W=1 kernel build warning(s):

 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'num_rows' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'num_cols' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'input' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'regmap' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'key_sense_irq' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'key_stuck_irq' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'keycodes' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'dev' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'keystate' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'stuckstate' not described in 'pmic8xxx_kp'
 drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'ctrl_reg' not described in 'pmic8xxx_kp'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201104162427.2984742-21-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-08 22:20:27 -08:00
Lee Jones
5b27585a85 Input: nomadik-ske-keypad - provide some missing struct member docs
Fixes the following W=1 kernel build warning(s):

 drivers/input/keyboard/nomadik-ske-keypad.c:71: warning: Function parameter or member 'pclk' not described in 'ske_keypad'
 drivers/input/keyboard/nomadik-ske-keypad.c:71: warning: Function parameter or member 'ske_keypad_lock' not described in 'ske_keypad'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201104162427.2984742-20-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-08 22:19:53 -08:00
Dmitry Torokhov
77e70d351d Input: sunkbd - avoid use-after-free in teardown paths
We need to make sure we cancel the reinit work before we tear down the
driver structures.

Reported-by: Bodong Zhao <nopitydays@gmail.com>
Tested-by: Bodong Zhao <nopitydays@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-11-08 21:59:07 -08:00
Linus Torvalds
bd7e8c996f Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:

 - a new driver for ADC driven joysticks

 - a new Zintix touchscreen driver

 - enhancements to Intel SoC button array driver

 - support for F3A "function" in Synaptics RMI4 driver

 - assorted driver fixups

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (29 commits)
  Input: Add MAINTAINERS entry for SiS i2c touch input driver
  Input: evdev - per-client waitgroups
  Input: synaptics - enable InterTouch for ThinkPad T14 Gen 1
  Input: synaptics - enable InterTouch for ThinkPad P1/X1E gen 2
  Input: synaptics-rmi4 - support bootloader v8 in f34v7
  Input: synaptics-rmi4 - add support for F3A
  Input: synaptics-rmi4 - rename f30_data to gpio_data
  Input: add zinitix touchscreen driver
  dt-bindings: input/touchscreen: add bindings for zinitix
  Input: joystick - add ADC attached joystick driver.
  dt-bindings: input: Add docs for ADC driven joystick
  Input: sun4i-ps2 - fix handling of platform_get_irq() error
  Input: twl4030_keypad - fix handling of platform_get_irq() error
  Input: omap4-keypad - fix handling of platform_get_irq() error
  Input: ep93xx_keypad - fix handling of platform_get_irq() error
  Input: stmfts - fix a & vs && typo
  Input: imx6ul_tsc - unify open/close and PM paths
  Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume()
  Input: elants_i2c - fix typo for an attribute to show calibration count
  Input: elants_i2c - report resolution of ABS_MT_TOUCH_MAJOR by FW information.
  ...
2020-10-23 16:16:31 -07:00
Krzysztof Kozlowski
c277e1f0dc Input: twl4030_keypad - fix handling of platform_get_irq() error
platform_get_irq() returns -ERRNO on error.  In such case casting to
unsigned and comparing to 0 would pass the check.

Fixes: 7abf38d6d1 ("Input: twl4030-keypad - add device tree support")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200828145744.3636-3-krzk@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-09-16 10:42:15 -07:00
Krzysztof Kozlowski
4738dd1992 Input: omap4-keypad - fix handling of platform_get_irq() error
platform_get_irq() returns -ERRNO on error.  In such case comparison
to 0 would pass the check.

Fixes: f3a1ba60db ("Input: omap4-keypad - use platform device helpers")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200828145744.3636-2-krzk@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-09-16 10:42:13 -07:00
Krzysztof Kozlowski
7d50f6656d Input: ep93xx_keypad - fix handling of platform_get_irq() error
platform_get_irq() returns -ERRNO on error.  In such case comparison
to 0 would pass the check.

Fixes: 60214f058f ("Input: ep93xx_keypad - update driver to new core support")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200828145744.3636-1-krzk@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-09-16 10:42:12 -07:00
Guenter Roeck
b4e452b5e9 platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPT
-ENOTSUPP is not a SUSV4 error code and should not be used. Use
-ENOPROTOOPT instead to report EC_RES_INVALID_VERSION responses
from the EC. This matches match the NFS response for unsupported
protocol versions.

Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Cc: Prashant Malani <pmalani@chromium.org>
Cc: Brian Norris <briannorris@chromium.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-08-24 11:37:34 +02:00
Linus Torvalds
4bcf69e570 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:

 - an update to Elan touchpad controller driver supporting newer ICs
   with enhanced precision reports and a new firmware update process

 - an update to EXC3000 touch controller supporting additional parts

 - assorted driver fixups

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (27 commits)
  Input: exc3000 - add support to query model and fw_version
  Input: exc3000 - add reset gpio support
  Input: exc3000 - add EXC80H60 and EXC80H84 support
  dt-bindings: touchscreen: Convert EETI EXC3000 touchscreen to json-schema
  Input: sentelic - fix error return when fsp_reg_write fails
  Input: alps - remove redundant assignment to variable ret
  Input: ims-pcu - return error code rather than -ENOMEM
  Input: elan_i2c - add ic type 0x15
  Input: atmel_mxt_ts - only read messages in mxt_acquire_irq() when necessary
  Input: uinput - fix typo in function name documentation
  Input: ati_remote2 - add missing newlines when printing module parameters
  Input: psmouse - add a newline when printing 'proto' by sysfs
  Input: synaptics-rmi4 - drop a duplicated word
  Input: elan_i2c - add support for high resolution reports
  Input: elan_i2c - do not constantly re-query pattern ID
  Input: elan_i2c - add firmware update info for ICs 0x11, 0x13, 0x14
  Input: elan_i2c - handle firmware updated on newer ICs
  Input: elan_i2c - add support for different firmware page sizes
  Input: elan_i2c - fix detecting IAP version on older controllers
  Input: elan_i2c - handle devices with patterns above 1
  ...
2020-08-10 16:35:57 -07:00
Kees Cook
b13fecb1c3 treewide: Replace DECLARE_TASKLET() with DECLARE_TASKLET_OLD()
This converts all the existing DECLARE_TASKLET() (and ...DISABLED)
macros with DECLARE_TASKLET_OLD() in preparation for refactoring the
tasklet callback type. All existing DECLARE_TASKLET() users had a "0"
data argument, it has been removed here as well.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
2020-07-30 11:15:58 -07:00
Dmitry Torokhov
9b031c8650 Merge branch 'elan-i2c' into next
Bring in update to Elan touchpad driver to support newer touchpads with
higher resolution.
2020-07-21 19:02:33 -07:00
Gustavo A. R. Silva
6f49c4f5b9 Input: Use fallthrough pseudo-keyword
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200707180857.GA30600@embeddedor
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-07-07 11:25:54 -07:00
Linus Torvalds
49f13b0921 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:

 - a new driver for the Azoteq IQS269A capacitive touch controller

 - a new driver for the Cypress CY8CTMA140 touchscreen

 - updates to Elan and ft5x06 touchscreen drivers

 - assorted driver fixes

 - msm-vibrator has been removed as we have a more generic solution

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (28 commits)
  Input: adi - work around module name confict
  Input: iqs269a - add missing I2C dependency
  Input: elants - refactor elants_i2c_execute_command()
  Input: elants - override touchscreen info with DT properties
  Input: elants - remove unused axes
  Input: add support for Azoteq IQS269A
  dt-bindings: input: Add bindings for Azoteq IQS269A
  Input: imx_sc_key - use devm_add_action_or_reset() to handle all cleanups
  Input: remove msm-vibrator driver
  dt-bindings: Input: remove msm-vibrator
  Input: elants_i2c - provide an attribute to show calibration count
  Input: introduce input_mt_report_slot_inactive()
  dt-bindings: input: touchscreen: elants_i2c: convert to YAML
  Input: add driver for the Cypress CY8CTMA140 touchscreen
  dt-bindings: touchscreen: Add CY8CTMA140 bindings
  Input: edt-ft5x06 - prefer asynchronous probe
  Input: edt-ft5x06 - improve power management operations
  Input: edt-ft5x06 - move parameter restore into helper
  Input: edt-ft5x06 - fix get_default register write access
  Input: atkbd - receive and use physcode->keycode mapping from FW
  ...
2020-06-10 13:51:47 -07:00
Linus Torvalds
d16eea2fa5 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov:
 "Just a few random driver fixups"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: synaptics - add a second working PNP_ID for Lenovo T470s
  Input: applespi - replace zero-length array with flexible-array
  Input: axp20x-pek - always register interrupt handlers
  Input: lm8333 - update contact email
  Input: synaptics-rmi4 - fix error return code in rmi_driver_probe()
  Input: synaptics-rmi4 - really fix attn_data use-after-free
  Input: i8042 - add ThinkPad S230u to i8042 reset list
  Revert "Input: i8042 - add ThinkPad S230u to i8042 nomux list"
  Input: dlink-dir685-touchkeys - fix a typo in driver name
  Input: xpad - add custom init packet for Xbox One S controllers
  Input: evdev - call input_flush_device() on release(), not flush()
  Input: i8042 - add ThinkPad S230u to i8042 nomux list
  Input: usbtouchscreen - add support for BonXeon TP
  Input: cros_ec_keyb - use cros_ec_cmd_xfer_status helper
  Input: mms114 - fix handling of mms345l
  Input: elants_i2c - support palm detection
2020-05-28 12:41:11 -07:00
Dmitry Torokhov
2969869bfa Merge branch 'for-linus' into next
Merge for-linus branch to sync Elan touchscreen driver code.
2020-05-17 21:10:28 -07:00
Anson Huang
768062fd12 Input: imx_sc_key - use devm_add_action_or_reset() to handle all cleanups
Use devm_add_action_or_reset() to handle all cleanups of failure in
.probe and .remove, then .remove callback can be dropped.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Link: https://lore.kernel.org/r/1584082751-17047-1-git-send-email-Anson.Huang@nxp.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-05-13 10:34:58 -07:00
Dmitry Torokhov
0fdc50dfab Linux 5.6
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl6BIG4eHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGlHUH/RCFve2sfHRPjRW+
 xR5SaLVAw6XKvtKBq7yvKmHEwqNJnL79IHyqqtSrtfFr2FfaH/KvYiCbbAezvSrM
 np0udGu7STKGd21CWuyEZJudyhXkOwMRNiFiCXWp7rs35oh8T0TpJxMzo2Nc1nLk
 JFQPqAP6OSvq4IkWEywKQI+Au3Z1IBf83xVjZ1s+MKPQHYD49x2hc4cQntL5/cnm
 a3DoR2iBkYiGZCZ9dDqAqJTnMQIiCbACdZXgGjNRUpdyA/dtAjsMl11NPYHm8TA2
 3AHBupAK50WBZGad6xv2qKQyScsmoJG2mv92QjlOFz0Tpiu6rLnDlLYREDVB6YH6
 qbLDsc8=
 =XEIU
 -----END PGP SIGNATURE-----

Merge tag 'v5.6' into next

Sync up with mainline to get device tree and other changes.
2020-05-12 12:18:21 -07:00
Gustavo A. R. Silva
d34fced41e Input: applespi - replace zero-length array with flexible-array
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200507185347.GA14499@embeddedor
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-05-09 22:15:41 -07:00
Rajat Jain
9d17ad2369 Input: atkbd - receive and use physcode->keycode mapping from FW
Allow the firmware to specify the mapping between the scan code and the
linux keycode. This takes the form of a "linux,keymap" property which is
an array of u32 values, each value specifying mapping for a key.

Signed-off-by: Rajat Jain <rajatja@google.com>
Link: https://lore.kernel.org/r/20200427210259.91330-3-rajatja@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-04-27 18:04:24 -07:00
Rajat Jain
8f7b057abe Input: atkbd - expose function row physical map to userspace
Certain keyboards have their top-row keys intended for actions such as
"Browser back", "Browser Refresh", "Fullscreen" etc as their primary mode,
thus they will send scan codes for those actions. Further, they don't
have a dedicated "Fn" key so don't have the capability to generate
function key codes (e.g. F1, F2 etc..).  However in this case, if
userspace still wants to "synthesize" those function keys using the top
row action keys, it needs to know the physical position of the top row
keys. (Essentially a mapping between usage codes and a physical location
in the top row).

This patch enhances the atkbd driver to receive such a mapping from the
firmware / device tree, and expose it to userspace in the form of a
function-row-physmap attribute. The attribute would be a space separated
ordered list of physical codes, for the keys in the function row, in
left-to-right order.

The attribute will only be present if the kernel knows about such mapping,
otherwise the attribute shall not be visible.

Signed-off-by: Rajat Jain <rajatja@google.com>
Link: https://lore.kernel.org/r/20200427210259.91330-2-rajatja@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-04-27 18:04:23 -07:00
Christophe JAILLET
38347374ae Input: dlink-dir685-touchkeys - fix a typo in driver name
According to the file name and Kconfig, a 'k' is missing in this driver
name. It should be "dlink-dir685-touchkeys".

Fixes: 131b3de701 ("Input: add D-Link DIR-685 touchkeys driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200412213937.5287-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-04-22 14:15:06 -07:00
Christophe JAILLET
ec4ba6c35b Input: spear-keyboard - fix a typo in a module name in Kconfig
A 'y' is missing in spear-keyboard.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20200412095711.9107-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-04-18 21:57:06 -07:00
Christophe JAILLET
c154703bc8 Input: tca6416-keypad - fix a typo in MODULE_DESCRIPTION
This should be 'tca6416', not 'tca6146'

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20200413152329.4435-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-04-18 21:57:04 -07:00
Enric Balletbo i Serra
0bcee1191f Input: cros_ec_keyb - use cros_ec_cmd_xfer_status helper
This patch makes use of cros_ec_cmd_xfer_status() instead of
cros_ec_cmd_xfer(). In this case there is no advantage of doing this
apart from that we want to make cros_ec_cmd_xfer() a private function
for the EC protocol and let people only use the
cros_ec_cmd_xfer_status() to return Linux standard error codes.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20200414210434.1534982-1-enric.balletbo@collabora.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-04-18 21:31:19 -07:00
Linus Torvalds
8645f09bad - New Drivers
- Add support for IQS620A/621/622/624/625 Azoteq IQS62X Sensors
 
  - New Device Support
    - Add support for ADC, IRQ, Regulator, RTC and WDT to Ricoh RN5T618 PMIC
    - Add support for Comet Lake to Intel LPSS
 
  - New Functionality
    - Add support for Charger Detection to Spreadtrum SC27xx PMICs
    - Add support for Interrupt Polarity to Dialog Semi DA9062/61 PMIC
    - Add ACPI enumeration support to Diolan DLN2 USB Adaptor
 
  - Fix-ups
    - Device Tree; iqs62x, rn5t618, cros_ec_dev, stm32-lptimer, rohm,bd71837, rohm,bd71847
    - I2C registration; rn5t618
    - Kconfig; MFD_CPCAP, AB8500_CORE, MFD_WM8994, MFD_WM97xx, MFD_STPMIC1
    - Use flexible-array members; omap-usb-tll, qcom-pm8xxx
    - Remove unnecessary casts; omap-usb-host, omap-usb-tll
    - Power (suspend/resume/poweroff) enhancements; rk808
    - Improve error/sanity checking; dln2
    - Use snprintf(); aat2870-core
 
  - Bug Fixes
    - Fix PCI IDs; intel-lpss-pci
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAl6MSwsACgkQUa+KL4f8
 d2GklhAAk1e0tYu1w4yS0IE40mReDk5ycOE1O8Q75qWw5Af2dK48qvSHGDwaU4ES
 WNYZ3Mr/OUrvd+/XU8EXI6NXAi9W75ye2J2KmmDDL6yXnDuHbzBZF8ifEtXQKSOp
 rElzCJVnXehpjSfwa4cp5f1Msox/rFg1Kpmaas48j8U2JYCmn51GsQCCG6qMIx2i
 0ZvXNZuz+eTY3V7l6pRLfTYqwR8E5Y11ryWJaeliyDcVpUlZaykiXuxD7pbqLjJo
 8v9ISm67rzf6X5zmi6YhdvpIAzpomdRaaxHfVDkeCKqDgpuWGiq0xXA86vDKwjah
 qVx6rK/wg4YM5uSEomxIgVj9uvvLSytDqvRlPe7vFKgkR0Xhl5SdkiwadI4P9zkr
 zrRGNRAUHsZ4ZrlObD0QJWOQYnIg5oCmRouRKcHtQVZYP3rSdRz/1oC6FN8LVqUw
 3NfLB/S6uBCJ3uahckrgnjQughnvmsAzlflcNV2t+P8di8Cwyh2A5N9qkT/oI67o
 Xf7NODSdu0JzzTgsM+EJ2JphSLMYaekWs06qAXyibPrrS2SoThE79igCmNOkyyR7
 obJfN2SM5k4LkhMGlYbPfbRT2Hoa+9OJozBe3WgiW3kwTdFVB9aen2U230tHplbB
 g/NuVS+PrReR5lfzT+O8dodH7lj5/GhmGsapdguFVhXYIE+2CMg=
 =hJ2o
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull mfd updates from Lee Jones:
 "New Drivers:
   - Add support for IQS620A/621/622/624/625 Azoteq IQS62X Sensors

  New Device Support:
   - Add support for ADC, IRQ, Regulator, RTC and WDT to Ricoh RN5T618 PMIC
   - Add support for Comet Lake to Intel LPSS

  New Functionality:
   - Add support for Charger Detection to Spreadtrum SC27xx PMICs
   - Add support for Interrupt Polarity to Dialog Semi DA9062/61 PMIC
   - Add ACPI enumeration support to Diolan DLN2 USB Adaptor

  Fix-ups:
   - Device Tree; iqs62x, rn5t618, cros_ec_dev, stm32-lptimer, rohm,bd71837, rohm,bd71847
   - I2C registration; rn5t618
   - Kconfig; MFD_CPCAP, AB8500_CORE, MFD_WM8994, MFD_WM97xx, MFD_STPMIC1
   - Use flexible-array members; omap-usb-tll, qcom-pm8xxx
   - Remove unnecessary casts; omap-usb-host, omap-usb-tll
   - Power (suspend/resume/poweroff) enhancements; rk808
   - Improve error/sanity checking; dln2
   - Use snprintf(); aat2870-core

  Bug Fixes:
   - Fix PCI IDs in intel-lpss-pci"

* tag 'mfd-next-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (33 commits)
  mfd: intel-lpss: Fix Intel Elkhart Lake LPSS I2C input clock
  mfd: aat2870: Use scnprintf() for avoiding potential buffer overflow
  mfd: dln2: Allow to be enumerated via ACPI
  mfd: da9062: Add support for interrupt polarity defined in device tree
  dt-bindings: bd718x7: Yamlify and add BD71850
  mfd: dln2: Fix sanity checking for endpoints
  mfd: intel-lpss: Add Intel Comet Lake PCH-V PCI IDs
  mfd: sc27xx: Add USB charger type detection support
  dt-bindings: mfd: Document STM32 low power timer bindings
  mfd: rk808: Convert RK805 to shutdown/suspend hooks
  mfd: rk808: Reduce shutdown duplication
  mfd: rk808: Stop using syscore ops
  mfd: rk808: Ensure suspend/resume hooks always work
  mfd: rk808: Always use poweroff when requested
  mfd: omap: Remove useless cast for driver.name
  mfd: Kconfig: Fix some misspelling of the word functionality
  mfd: pm8xxx: Replace zero-length array with flexible-array member
  mfd: omap-usb-tll: Replace zero-length array with flexible-array member
  mfd: cpcap: Fix compile if MFD_CORE is not selected
  mfd: cros_ec: Check DT node for usbpd-notify add
  ...
2020-04-07 19:48:52 -07:00
Jeff LaBundy
ce1cb0eec8 input: keyboard: Add support for Azoteq IQS620A/621/622/624/625
This patch adds key and switch support for the Azoteq IQS620A,
IQS621, IQS622, IQS624 and IQS625 multi-function sensors.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-27 08:25:42 +00:00
Linus Torvalds
f3e69428b5 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov:

 - a fix to generate proper timestamps on key autorepeat events that
   were broken recently

 - a fix for Synaptics driver to only activate reduced reporting mode
   when explicitly requested

 - a new keycode for "selective screenshot" function

 - other assorted fixes

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: fix stale timestamp on key autorepeat events
  Input: move the new KEY_SELECTIVE_SCREENSHOT keycode
  Input: avoid BIT() macro usage in the serio.h UAPI header
  Input: synaptics-rmi4 - set reduced reporting mode only when requested
  Input: synaptics - enable RMI on HP Envy 13-ad105ng
  Input: allocate keycode for "Selective Screenshot" key
  Input: tm2-touchkey - add support for Coreriver TC360 variant
  dt-bindings: input: add Coreriver TC360 binding
  dt-bindings: vendor-prefixes: Add Coreriver vendor prefix
  Input: raydium_i2c_ts - fix error codes in raydium_i2c_boot_trigger()
2020-03-26 20:49:44 -07:00
Nick Reitemeyer
da32890448 Input: tm2-touchkey - add support for Coreriver TC360 variant
The Coreriver TouchCore 360 is like the midas board touchkey, but it is
using a fixed regulator.

Signed-off-by: Nick Reitemeyer <nick.reitemeyer@web.de>
Link: https://lore.kernel.org/r/20200121141525.3404-3-nick.reitemeyer@web.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-03-06 14:39:46 -08:00
Linus Torvalds
db70e26e33 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:

 - a few drivers have been updated to use flexible-array syntax instead
   of GCC extension

 - ili210x touchscreen driver now supports the 2120 protocol flavor

 - a couple more of Synaptics devices have been switched over to RMI4

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: cyapa - replace zero-length array with flexible-array member
  Input: tca6416-keypad - replace zero-length array with flexible-array member
  Input: gpio_keys_polled - replace zero-length array with flexible-array member
  Input: synaptics - remove the LEN0049 dmi id from topbuttonpad list
  Input: synaptics - enable SMBus on ThinkPad L470
  Input: synaptics - switch T470s to RMI4 by default
  Input: gpio_keys - replace zero-length array with flexible-array member
  Input: goldfish_events - replace zero-length array with flexible-array member
  Input: psmouse - switch to using i2c_new_scanned_device()
  Input: ili210x - add ili2120 support
  Input: ili210x - fix return value of is_visible function
2020-02-15 16:49:25 -08:00
Gustavo A. R. Silva
94bef5d579 Input: tca6416-keypad - replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200214172022.GA27490@embeddedor
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-02-14 17:19:21 -08:00
Gustavo A. R. Silva
3d87c75d84 Input: gpio_keys_polled - replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200214171907.GA26588@embeddedor
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-02-14 17:19:19 -08:00
Gustavo A. R. Silva
a1b9b65edf Input: gpio_keys - replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200213002600.GA31916@embeddedor.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-02-13 17:09:47 -08:00
Gustavo A. R. Silva
cfb8d7811f Input: goldfish_events - replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200213002430.GA31056@embeddedor.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-02-13 17:09:47 -08:00
Dmitry Torokhov
b19efcabb5 Merge branch 'next' into for-linus
Prepare input updates for 5.6 merge window.
2020-01-31 17:42:33 -08:00
Linus Torvalds
6a1000bd27 ioremap changes for 5.6
- remove ioremap_nocache given that is is equivalent to
    ioremap everywhere
 -----BEGIN PGP SIGNATURE-----
 
 iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAl4vKHwLHGhjaEBsc3Qu
 ZGUACgkQD55TZVIEUYMPGBAAuVNUZaZfWYHpiVP2oRcUQUguFiD3NTbknsyzV2oH
 J9P0GfeENSKwE9OOhZ7XIjnCZAJwQgTK/ppQY5yiQ/KAtYyyXjXEJ6jqqjiTDInr
 +3+I3t/LhkgrK7tMrb7ylTGa/d7KhaciljnOXC8+b75iddvM9I1z2pbHDbppZMS9
 wT4RXL/cFtRb85AfOyPLybcka3f5P2gGvQz38qyimhJYEzHDXZu9VO1Bd20f8+Xf
 eLBKX0o6yWMhcaPLma8tm0M0zaXHEfLHUKLSOkiOk+eHTWBZ3b/w5nsOQZYZ7uQp
 25yaClbameAn7k5dHajduLGEJv//ZjLRWcN3HJWJ5vzO111aHhswpE7JgTZJSVWI
 ggCVkytD3ESXapvswmACSeCIDMmiJMzvn6JvwuSMVB7a6e5mcqTuGo/FN+DrBF/R
 IP+/gY/T7zIIOaljhQVkiEIIwiD/akYo0V9fheHTBnqcKEDTHV4WjKbeF6aCwcO+
 b8inHyXZSKSMG//UlDuN84/KH/o1l62oKaB1uDIYrrL8JVyjAxctWt3GOt5KgSFq
 wVz1lMw4kIvWtC/Sy2H4oB+RtODLp6yJDqmvmPkeJwKDUcd/1JKf0KsZ8j3FpGei
 /rEkBEss0KBKyFAgBSRO2jIpdj2epgcBcsdB/r5mlhcn8L77AS6mHbA173kY4pQ/
 Kdg=
 =TUCJ
 -----END PGP SIGNATURE-----

Merge tag 'ioremap-5.6' of git://git.infradead.org/users/hch/ioremap

Pull ioremap updates from Christoph Hellwig:
 "Remove the ioremap_nocache API (plus wrappers) that are always
  identical to ioremap"

* tag 'ioremap-5.6' of git://git.infradead.org/users/hch/ioremap:
  remove ioremap_nocache and devm_ioremap_nocache
  MIPS: define ioremap_nocache to ioremap
2020-01-27 13:03:00 -08:00
Linus Torvalds
b5b3159cff Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov:
 "Just a few small fixups here"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: imx_sc_key - only take the valid data from SCU firmware as key state
  Input: add safety guards to input_set_keycode()
  Input: input_event - fix struct padding on sparc64
  Input: uinput - always report EPOLLOUT
2020-01-09 15:37:40 -08:00
Christoph Hellwig
4bdc0d676a remove ioremap_nocache and devm_ioremap_nocache
ioremap has provided non-cached semantics by default since the Linux 2.6
days, so remove the additional ioremap_nocache interface.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2020-01-06 09:45:59 +01:00
Anson Huang
1021dcf19d Input: imx_sc_key - only take the valid data from SCU firmware as key state
When reading key state from SCU, the response data from SCU firmware
is 4 bytes due to MU message protocol, but ONLY the first byte is the
key state, other 3 bytes could be some dirty data, so we should ONLY
take the first byte as key state to avoid reporting incorrect state.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Fixes: 688f1dfb69 ("Input: keyboard - imx_sc: Add i.MX system controller key support")
Link: https://lore.kernel.org/r/1576202909-1661-1-git-send-email-Anson.Huang@nxp.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-12-13 16:41:57 -08:00
Linus Torvalds
737214515d Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull more input updates from Dmitry Torokhov:

 - fixups for Synaptics RMI4 driver

 - a quirk for Goodinx touchscreen on Teclast tablet

 - a new keycode definition for activating privacy screen feature found
   on a few "enterprise" laptops

 - updates to snvs_pwrkey driver

 - polling uinput device for writing (which is always allowed) now works

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: synaptics-rmi4 - don't increment rmiaddr for SMBus transfers
  Input: synaptics-rmi4 - re-enable IRQs in f34v7_do_reflash
  Input: goodix - add upside-down quirk for Teclast X89 tablet
  Input: add privacy screen toggle keycode
  Input: uinput - fix returning EPOLLOUT from uinput_poll
  Input: snvs_pwrkey - remove gratuitous NULL initializers
  Input: snvs_pwrkey - send key events for i.MX6 S, DL and Q
2019-12-07 18:33:01 -08:00
Dmitry Torokhov
1e55c176f8 Input: snvs_pwrkey - remove gratuitous NULL initializers
Gratuitous NULL initializers rarely help and often prevent compiler
from warning about using uninitialized variable. Let's remove them.

Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Link: https://lore.kernel.org/r/20191125211407.GA97812@dtor-ws
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-12-04 17:56:55 -08:00
Linus Torvalds
63de37476e chrome platform changes for v5.5
* CrOS EC / MFD / IIO
  - Contains tag-ib-chrome-mfd-iio-input-5.5, which is the first part of a
    series from Gwendal to refactor sensor code between MFD, CrOS EC, iio
    and input in order to add a new sensorhub driver and FIFO processing
 
 * Wilco EC:
  - Add support for Dell's USB PowerShare policy control, keyboard
    backlight LED driver, and a new test_event file.
  - Fixes use after free in wilco_ec's telemetry driver.
 
 * Misc:
  - bugfix in cros_usbpd_logger (missing destroy workqueue).
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQCtZK6p/AktxXfkOlzbaomhzOwwgUCXeaqtwAKCRBzbaomhzOw
 wilIAQCQ3/dpAwg2skKYYf3RBLDJeDLA1id7rNSgMOXc2aKyTAD/fCQtNhwj+Hal
 W//04WWngTCQF5fkE9OCJrDwbm5eRwc=
 =uOGe
 -----END PGP SIGNATURE-----

Merge tag 'tag-chrome-platform-for-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform changes from Benson Leung:
 "CrOS EC / MFD / IIO:

   - Contains tag-ib-chrome-mfd-iio-input-5.5, which is the first part
     of a series from Gwendal to refactor sensor code between MFD, CrOS
     EC, iio and input in order to add a new sensorhub driver and FIFO
     processing

  Wilco EC:

   - Add support for Dell's USB PowerShare policy control, keyboard
     backlight LED driver, and a new test_event file.

   - Fixes use after free in wilco_ec's telemetry driver.

  Misc:

   - bugfix in cros_usbpd_logger (missing destroy workqueue)"

* tag 'tag-chrome-platform-for-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: wilco_ec: fix use after free issue
  platform/chrome: cros_ec: Add Kconfig default for cros-ec-sensorhub
  Revert "Input: cros_ec_keyb: mask out extra flags in event_type"
  Revert "Input: cros_ec_keyb - add back missing mask for event_type"
  platform/chrome: cros_ec: handle MKBP more events flag
  platform/chrome: cros_ec: Do not attempt to register a non-positive IRQ number
  platform/chrome: cros-ec: Record event timestamp in the hard irq
  mfd / platform / iio: cros_ec: Register sensor through sensorhub
  iio / platform: cros_ec: Add cros-ec-sensorhub driver
  mfd / platform: cros_ec: Add sensor_count and make check_features public
  platform/chrome: cros_ec: Put docs with the code
  platform/chrome: cros_usbpd_logger: add missed destroy_workqueue in remove
  platform/chrome: cros_ec: Fix Kconfig indentation
  platform/chrome: wilco_ec: Add keyboard backlight LED support
  platform/chrome: wilco_ec: Add charging config driver
  platform/chrome: wilco_ec: Add Dell's USB PowerShare Policy control
  platform/chrome: wilco_ec: Add debugfs test_event file
2019-12-03 14:37:12 -08:00
Robin van der Gracht
1a26c92071 Input: snvs_pwrkey - send key events for i.MX6 S, DL and Q
The first generation i.MX6 processors does not send an interrupt when the
power key is pressed. It sends a power down request interrupt if the key is
released before a hard shutdown (5 second press). This should allow
software to bring down the SoC safely.

For this driver to work as a regular power key with the older SoCs, we need
to send a keypress AND release when we get the power down request irq.

Signed-off-by: Robin van der Gracht <robin@protonic.nl>
Link: https://lore.kernel.org/r/20191125161210.8275-1-robin@protonic.nl
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-11-25 13:32:11 -08:00
Krzysztof Kozlowski
bcf1e034d3 Input: fix Kconfig indentation
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
	$ sed -e 's/^        /\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/1574306373-29581-1-git-send-email-krzk@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-11-22 15:19:19 -08:00
Gwendal Grignou
99cdb2472b Revert "Input: cros_ec_keyb: mask out extra flags in event_type"
This reverts commit d096aa3eb6.

This patch is not needed anymore since we clear EC_MKBP_HAS_MORE_EVENTS
flag before calling the notifiers in patch
"9d9518f5b52a (platform: chrome: cros_ec: handle MKBP more events flag)"

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-11-21 11:23:16 +01:00
Gwendal Grignou
3bcce2e805 Revert "Input: cros_ec_keyb - add back missing mask for event_type"
This reverts commit 62c3801619.

This patch is not needed anymore since we clear EC_MKBP_HAS_MORE_EVENTS
flag before calling the notifiers in patch
"9d9518f5b52a (platform: chrome: cros_ec: handle MKBP more events flag)"

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-11-21 11:23:16 +01:00
Anson Huang
dffe969aa7 Input: imx_sc_key - correct SCU message structure to avoid stack corruption
The SCU message's data field used for receiving response data from SCU
should be 32-bit width, as SCU will send back 32-bit width data.

This solves kernel panic when CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG is
enabled.

[    1.950768] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted
[    1.980607] Workqueue: events imx_sc_check_for_events
[    1.985657] Call trace:
[    1.988104]  dump_backtrace+0x0/0x140
[    1.991768]  show_stack+0x14/0x20
[    1.995090]  dump_stack+0xb4/0xf8
[    1.998407]  panic+0x158/0x324
[    2.001463]  print_tainted+0x0/0xa8
[    2.004950]  imx_sc_check_for_events+0x18c/0x190
[    2.009569]  process_one_work+0x198/0x320
[    2.013579]  worker_thread+0x48/0x420
[    2.017252]  kthread+0xf0/0x120
[    2.020394]  ret_from_fork+0x10/0x18
[    2.023977] SMP: stopping secondary CPUs
[    2.027901] Kernel Offset: disabled
[    2.031391] CPU features: 0x0002,2100600c
[    2.035401] Memory Limit: none

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Fixes: 688f1dfb69 ("Input: keyboard - imx_sc: Add i.MX system controller key support")
Link: https://lore.kernel.org/r/1573730499-2224-1-git-send-email-Anson.Huang@nxp.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-11-15 11:49:29 -08:00
Dmitry Torokhov
9584bded0b Input: gpio_keys_polled - switch to using polled mode of input devices
We have added polled mode to the normal input devices with the intent of
retiring input_polled_dev. This converts gpio_keys_polled driver to use
the polling mode of standard input devices and removes dependency on
INPUT_POLLDEV.

Note that we still keep polled and non-polled gpio-keys drivers separate,
as they are different enough and mixing them up would make the code pretty
confusing.

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.kernel.org/r/20191017204217.106453-9-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-10-29 17:13:45 -07:00