openwrt/staging/blogic.git
5 years agoInput: cros_ec_keyb - fix button/switch capability reports
Brian Norris [Mon, 12 Nov 2018 19:23:39 +0000 (11:23 -0800)]
Input: cros_ec_keyb - fix button/switch capability reports

The cros_ec_keyb_bs array lists buttons and switches together, expecting
that its users will match the appropriate type and bit fields. But
cros_ec_keyb_register_bs() only checks the 'bit' field, which causes
misreported input capabilities in some cases. For example, tablets
(e.g., Scarlet -- a.k.a. Acer Chromebook Tab 10) were reporting a SW_LID
capability, because EC_MKBP_POWER_BUTTON and EC_MKBP_LID_OPEN happen to
share the same bit.

(This has comedic effect on a tablet, in which a power-management daemon
then thinks this "lid" is closed, and so puts the system to sleep as
soon as it boots!)

To fix this, check both the 'ev_type' and 'bit' fields before reporting
the capability.

Tested with a lid (Kevin / Samsung Chromebook Plus) and without a lid
(Scarlet / Acer Chromebook Tab 10).

This error got introduced when porting the feature from the downstream
Chromium OS kernel to be upstreamed.

Fixes: cdd7950e7aa4 ("input: cros_ec_keyb: Add non-matrix buttons and switches")
Cc: <stable@vger.kernel.org>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
5 years agoInput: elan_i2c - add ELAN0620 to the ACPI table
Patrick Gaskin [Mon, 12 Nov 2018 19:12:24 +0000 (11:12 -0800)]
Input: elan_i2c - add ELAN0620 to the ACPI table

Add ELAN0620 to the ACPI table to support the elan touchpad in
the Lenovo IdeaPad 130-15IKB.

Signed-off-by: Patrick Gaskin <patrick@pgaskin.net>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
5 years agoInput: matrix_keypad - check for errors from of_get_named_gpio()
Christian Hoff [Mon, 12 Nov 2018 19:11:29 +0000 (11:11 -0800)]
Input: matrix_keypad - check for errors from of_get_named_gpio()

"of_get_named_gpio()" returns a negative error value if it fails
and drivers should check for this. This missing check was now
added to the matrix_keypad driver.

In my case "of_get_named_gpio()" returned -EPROBE_DEFER because
the referenced GPIOs belong to an I/O expander, which was not yet
probed at the point in time when the matrix_keypad driver was
loading. Because the driver did not check for errors from the
"of_get_named_gpio()" routine, it was assuming that "-EPROBE_DEFER"
is actually a GPIO number and continued as usual, which led to further
errors like this later on:

WARNING: CPU: 3 PID: 167 at drivers/gpio/gpiolib.c:114
gpio_to_desc+0xc8/0xd0
invalid GPIO -517

Note that the "GPIO number" -517 in the error message above is
actually "-EPROBE_DEFER".

As part of the patch a misleading error message "no platform data defined"
was also removed. This does not lead to information loss because the other
error paths in matrix_keypad_parse_dt() already print an error.

Signed-off-by: Christian Hoff <christian_hoff@gmx.net>
Suggested-by: Sebastian Reichel <sre@kernel.org>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoMerge branch 'next' into for-linus
Dmitry Torokhov [Mon, 22 Oct 2018 19:04:33 +0000 (12:04 -0700)]
Merge branch 'next' into for-linus

Prepare input updates for 4.20 merge window.

6 years agoInput: synaptics - avoid using uninitialized variable when probing
Dmitry Torokhov [Wed, 17 Oct 2018 00:07:35 +0000 (17:07 -0700)]
Input: synaptics - avoid using uninitialized variable when probing

synaptics_detect() does not check whether sending commands to the
device succeeds and instead relies on getting unique data from the
device. Let's make sure we seed entire buffer with zeroes to make sure
we will not use garbage on stack that just happen to be 0x47.

Reported-by: syzbot+13cb3b01d0784e4ffc3f@syzkaller.appspotmail.com
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: xen-kbdfront - mark expected switch fall-through
Gustavo A. R. Silva [Wed, 17 Oct 2018 00:11:48 +0000 (17:11 -0700)]
Input: xen-kbdfront - mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Notice that in this particular case, I placed the "fall through"
part at the beginning of the code comment, which is what GCC is
expecting to find.

Addresses-Coverity-ID: 114757 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: elan_i2c - add ACPI ID for Lenovo IdeaPad 330-15IGM
Mikhail Nikiforov [Mon, 15 Oct 2018 18:17:56 +0000 (11:17 -0700)]
Input: elan_i2c - add ACPI ID for Lenovo IdeaPad 330-15IGM

Add ELAN061C to the ACPI table to support Elan touchpad found in Lenovo
IdeaPad 330-15IGM.

Signed-off-by: Mikhail Nikiforov <jackxviichaos@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - mark expected switch fall-through
Gustavo A. R. Silva [Mon, 15 Oct 2018 18:21:47 +0000 (11:21 -0700)]
Input: atmel_mxt_ts - mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: cyapa - mark expected switch fall-throughs
Gustavo A. R. Silva [Mon, 15 Oct 2018 18:21:18 +0000 (11:21 -0700)]
Input: cyapa - mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Notice that in this particular case, I replaced the "Fallthrough state"
commern with a proper "Fall through", which is what GCC is expecting to
find.

Addresses-Coverity-ID: 114758 ("Missing break in switch")
Addresses-Coverity-ID: 114759 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: wm97xx-ts - fix exit path
Randy Dunlap [Mon, 15 Oct 2018 18:16:58 +0000 (11:16 -0700)]
Input: wm97xx-ts - fix exit path

Loading then unloading wm97xx-ts.ko when CONFIG_AC97_BUS=m
causes a WARNING: from drivers/base/driver.c:

Unexpected driver unregister!
WARNING: CPU: 0 PID: 1709 at ../drivers/base/driver.c:193 driver_unregister+0x30/0x40

Fix this by only calling driver_unregister() with the same
condition that driver_register() is called.

Fixes: ae9d1b5fbd7b ("Input: wm97xx: add new AC97 bus support")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: of_touchscreen - add support for touchscreen-min-x|y
Hans de Goede [Fri, 12 Oct 2018 00:04:13 +0000 (17:04 -0700)]
Input: of_touchscreen - add support for touchscreen-min-x|y

Some touchscreens, depending on the firmware and/or the digitizer, report
coordinates which never reach 0 along one or both of their axis.

This has been seen for example on the Silead touchscreens on a Onda V891w
and a Point of View mobii TAB-P800w(v2.0).

This commit adds support for touchscreen-min-x and touchscreen-min-y
device-properties which can be set to communicate the actual start
coordinates (rather then 0,0) to userspace.

This commit also drop the "(in pixels)" comment from the documentation
of the touchscreen-size-x and touchscreen-size-y properties. The comment
suggested that there is a relation between the range of reported
coordinates and the display resolution, which is only true for some
devices. The "(in pixels)" comment is replaced with "(maximum x coordinate
reported + 1)" to mirror the language describing the new touchscreen-min-x
and -min-y properties.

When set this fixes e.g. not being able to click things in the GNOME3
top-bar on the 2 example tablets.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: Fix DIR-685 touchkeys MAINTAINERS entry
Linus Walleij [Thu, 11 Oct 2018 00:12:31 +0000 (17:12 -0700)]
Input: Fix DIR-685 touchkeys MAINTAINERS entry

The path was incomplete, fix it.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: elants_i2c - use DMA safe i2c when possible
Stephen Boyd [Wed, 10 Oct 2018 22:50:50 +0000 (15:50 -0700)]
Input: elants_i2c - use DMA safe i2c when possible

To avoid bounce buffer when an i2c controller decides to use DMA for a
transaction, let's make out buffer that we use for reads DMA-safe and let
the master know that DMAing into it is safe.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: silead - try firmware reload after unsuccessful resume
Julian Sax [Fri, 5 Oct 2018 18:48:31 +0000 (11:48 -0700)]
Input: silead - try firmware reload after unsuccessful resume

A certain silead controller (Chip ID: 0x56810000) loses its firmware
after suspend, causing the resume to fail. This patch tries to load
the firmware, should a resume error occur and retries the resuming.

Signed-off-by: Julian Sax <jsbc@gmx.de>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: st1232 - set INPUT_PROP_DIRECT property
Martin Kepplinger [Fri, 5 Oct 2018 18:44:45 +0000 (11:44 -0700)]
Input: st1232 - set INPUT_PROP_DIRECT property

This is how userspace checks for touchscreen devices most reliably.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: uinput - add a schedule point in uinput_inject_events()
Dmitry Torokhov [Fri, 5 Oct 2018 00:50:48 +0000 (17:50 -0700)]
Input: uinput - add a schedule point in uinput_inject_events()

Large writes to uinput interface may cause rcu stalls. Let's add
cond_resched() to the loop to avoid this.

Reviewed-by: Paul E. McKenney <paulmck@linux.ibm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: evdev - add a schedule point in evdev_write()
Dmitry Torokhov [Fri, 5 Oct 2018 00:45:54 +0000 (17:45 -0700)]
Input: evdev - add a schedule point in evdev_write()

Large writes to evdev interface may cause rcu stalls. Let's add
cond_resched() to the loop to avoid this.

Reviewed-by: Paul E. McKenney <paulmck@linux.ibm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: mousedev - add a schedule point in mousedev_write()
Eric Dumazet [Fri, 5 Oct 2018 00:41:37 +0000 (17:41 -0700)]
Input: mousedev - add a schedule point in mousedev_write()

syzbot was able to trigger rcu stalls by calling write()
with large number of bytes.

Add a cond_resched() in the loop to avoid this.

Link: https://lkml.org/lkml/2018/8/23/1106
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot+9436b02171ac0894d33e@syzkaller.appspotmail.com
Reviewed-by: Paul E. McKenney <paulmck@linux.ibm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: i8042 - enable keyboard wakeups by default when s2idle is used
Daniel Drake [Mon, 1 Oct 2018 22:55:22 +0000 (15:55 -0700)]
Input: i8042 - enable keyboard wakeups by default when s2idle is used

Previously, on typical consumer laptops, pressing a key on the keyboard
when the system is in suspend would cause it to wake up (default or
unconditional behaviour). This happens because the EC generates a SCI
interrupt in this scenario.

That is no longer true on modern laptops based on Intel WhiskeyLake,
including Acer Swift SF314-55G, Asus UX333FA, Asus UX433FN and Asus
UX533FD. We confirmed with Asus EC engineers that the "Modern Standby"
design has been modified so that the EC no longer generates a SCI
in this case; the keyboard controller itself should be used for wakeup.

In order to retain the standard behaviour of being able to use the
keyboard to wake up the system, enable serio wakeups by default on
platforms that are using s2idle.

Link: https://lkml.kernel.org/r/CAB4CAwfQ0mPMqCLp95TVjw4J0r5zKPWkSvvkK4cpZUGE--w8bQ@mail.gmail.com
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: xpad - add support for Xbox1 PDP Camo series gamepad
Ramses Ramírez [Fri, 28 Sep 2018 23:59:26 +0000 (16:59 -0700)]
Input: xpad - add support for Xbox1 PDP Camo series gamepad

The "Xbox One PDP Wired Controller - Camo series" has a different
product-id than the regular PDP controller and the PDP stealth series,
but it uses the same initialization sequence. This patch adds the
product-id of the camo series to the structures that handle the other
PDP Xbox One controllers.

Signed-off-by: Ramses Ramírez <ramzeto@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: xilinx_ps2 - convert to using %pOFn instead of device_node.name
Rob Herring [Mon, 1 Oct 2018 22:27:39 +0000 (15:27 -0700)]
Input: xilinx_ps2 - convert to using %pOFn instead of device_node.name

In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - fix multiple <linux/property.h> includes
George G. Davis [Sat, 29 Sep 2018 00:19:34 +0000 (17:19 -0700)]
Input: atmel_mxt_ts - fix multiple <linux/property.h> includes

Both v4.16-rc7 commit 93afb1d6e72a ("Input: atmel_mxt_ts - switch from
OF to generic device properties") and v4.16-rc7 commit 96a938aa214e
("Input: atmel_mxt_ts - remove platform data support") added includes of
"<linux/property.h>".  Remove one of the duplicate includes to fix this.

Signed-off-by: George G. Davis <george_davis@mentor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: sun4i-lradc - convert to using %pOFn instead of device_node.name
Rob Herring [Fri, 28 Sep 2018 23:58:13 +0000 (16:58 -0700)]
Input: sun4i-lradc - convert to using %pOFn instead of device_node.name

In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: pwm-vibrator - correct pwms in DT binding example
Brian Masney [Sat, 29 Sep 2018 00:12:55 +0000 (17:12 -0700)]
Input: pwm-vibrator - correct pwms in DT binding example

In the example for the pwm-vibrator bindings, pwm8 is the direction pin,
and pwm9 is the enable pin. The pwms on the vibrator node has these two
values swapped so this patch corrects it.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: uinput - allow for max == min during input_absinfo validation
Peter Hutterer [Tue, 18 Sep 2018 16:53:32 +0000 (09:53 -0700)]
Input: uinput - allow for max == min during input_absinfo validation

These values are inclusive, so a range of 1 requires min == max.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: elantech - enable middle button of touchpad on ThinkPad P72
Aaron Ma [Tue, 18 Sep 2018 16:32:22 +0000 (09:32 -0700)]
Input: elantech - enable middle button of touchpad on ThinkPad P72

Adding 2 new touchpad IDs to support middle button support.

Cc: stable@vger.kernel.org
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atakbd - fix Atari CapsLock behaviour
Michael Schmitz [Mon, 17 Sep 2018 22:27:49 +0000 (15:27 -0700)]
Input: atakbd - fix Atari CapsLock behaviour

The CapsLock key on Atari keyboards is not a toggle, it does send the
normal make and break scancodes.

Drop the CapsLock toggle handling code, which did cause the CapsLock
key to merely act as a Shift key.

Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atakbd - fix Atari keymap
Andreas Schwab [Mon, 17 Sep 2018 19:43:34 +0000 (12:43 -0700)]
Input: atakbd - fix Atari keymap

Fix errors in Atari keymap (mostly in keypad, help and undo keys).

Patch provided on debian-68k ML by Andreas Schwab <schwab@linux-m68k.org>,
keymap array size and unhandled scancode limit adjusted to 0x73 by me.

Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: egalax_ts - add system wakeup support
Anson Huang [Mon, 17 Sep 2018 18:08:52 +0000 (11:08 -0700)]
Input: egalax_ts - add system wakeup support

This patch adds wakeup function support for egalax touch
screen, if "wakeup-source" is added to device tree's egalax
touch screen node, the wakeup function will be enabled, and
egalax touch screen will be able to wakeup system from suspend.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: gpio-keys - fix a documentation index issue
Song Qiang [Mon, 17 Sep 2018 18:08:01 +0000 (11:08 -0700)]
Input: gpio-keys - fix a documentation index issue

gpio_keys.c now exists in the drivers/input/keyboard/ rather than
drivers/input/.

Signed-off-by: Song Qiang <songqiang.1304521@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoMerge branch 'next' into for-linus
Dmitry Torokhov [Thu, 16 Aug 2018 18:10:56 +0000 (11:10 -0700)]
Merge branch 'next' into for-linus

Prepare input updates for 4.19 merge window.

6 years agoMAINTAINERS: Add PhoenixRC Flight Controller Adapter
Marcus Folkesson [Wed, 8 Aug 2018 18:20:59 +0000 (11:20 -0700)]
MAINTAINERS: Add PhoenixRC Flight Controller Adapter

Add MAINTAINERS entry for PhoenixRC Flight Controller Adapter

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: do not use WARN() in input_alloc_absinfo()
Dmitry Torokhov [Mon, 6 Aug 2018 22:10:40 +0000 (15:10 -0700)]
Input: do not use WARN() in input_alloc_absinfo()

Some of fuzzers set panic_on_warn=1 so that they can handle WARN()ings
the same way they handle full-blown kernel crashes. We used WARN() in
input_alloc_absinfo() to get a better idea where memory allocation
failed, but since then kmalloc() and friends started dumping call stack on
memory allocation failures anyway, so we are not getting anything extra
from WARN().

Because of the above, let's replace WARN with dev_err(). We use dev_err()
instead of simply removing message and relying on kcalloc() to give us
stack dump so that we'd know the instance of hardware device to which we
were trying to attach input device.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: mark expected switch fall-throughs
Gustavo A. R. Silva [Mon, 6 Aug 2018 22:31:02 +0000 (15:31 -0700)]
Input: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Warning level 2 was used: -Wimplicit-fallthrough=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: raydium_i2c_ts - use true and false for boolean values
Gustavo A. R. Silva [Mon, 6 Aug 2018 22:20:19 +0000 (15:20 -0700)]
Input: raydium_i2c_ts - use true and false for boolean values

Return statements in functions returning bool should use true or false
instead of an integer value.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: evdev - switch to bitmap API
Andy Shevchenko [Wed, 1 Aug 2018 22:47:47 +0000 (15:47 -0700)]
Input: evdev - switch to bitmap API

Switch to bitmap API, i.e. bitmap_alloc(), bitmap_zalloc(), to show
clearly what we are allocating. Besides that it returns pointer of
bitmap type instead of opaque void *.

While here, replace memcpy() with bitmap_copy() for sake of consistency.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: gpio-keys - switch to bitmap_zalloc()
Andy Shevchenko [Wed, 1 Aug 2018 22:47:14 +0000 (15:47 -0700)]
Input: gpio-keys - switch to bitmap_zalloc()

Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoMerge branch 'ib/4.17-bitmap' into next
Dmitry Torokhov [Thu, 2 Aug 2018 00:58:55 +0000 (17:58 -0700)]
Merge branch 'ib/4.17-bitmap' into next

Bring in bitmap API improvements.

6 years agoInput: elan_i2c_smbus - cast sizeof to int for comparison
Julia Lawall [Wed, 1 Aug 2018 22:57:43 +0000 (15:57 -0700)]
Input: elan_i2c_smbus - cast sizeof to int for comparison

Comparing an int to a size, which is unsigned, causes the int to become
unsigned, giving the wrong result.  i2c_smbus_read_block_data can return the
result of i2c_smbus_xfer, whih can return a negative error code.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
int x;
expression e,e1;
identifier f;
@@

*x = f(...);
... when != x = e1
    when != if (x < 0 || ...) { ... return ...; }
*x < sizeof(e)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agobitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()
Andy Shevchenko [Wed, 1 Aug 2018 22:42:56 +0000 (15:42 -0700)]
bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()

A lot of code become ugly because of open coding allocations for bitmaps.

Introduce three helpers to allow users be more clear of intention
and keep their code neat.

Note, due to multiple circular dependencies we may not provide
the helpers as inliners. For now we keep them exported and, perhaps,
at some point in the future we will sort out header inclusion and
inheritance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agomd: Avoid namespace collision with bitmap API
Andy Shevchenko [Wed, 1 Aug 2018 22:20:50 +0000 (15:20 -0700)]
md: Avoid namespace collision with bitmap API

bitmap API (include/linux/bitmap.h) has 'bitmap' prefix for its methods.

On the other hand MD bitmap API is special case.
Adding 'md' prefix to it to avoid name space collision.

No functional changes intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Shaohua Li <shli@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agodm: Avoid namespace collision with bitmap API
Andy Shevchenko [Wed, 1 Aug 2018 22:17:58 +0000 (15:17 -0700)]
dm: Avoid namespace collision with bitmap API

bitmap API (include/linux/bitmap.h) has 'bitmap' prefix for its methods.

On the other hand DM bitmap API is special case.
Adding 'dm' prefix to it to avoid potential name space collision.

No functional changes intended.

Suggested-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: pm8941-pwrkey - add resin entry
Vinod Koul [Tue, 31 Jul 2018 06:05:49 +0000 (23:05 -0700)]
Input: pm8941-pwrkey - add resin entry

Since handling is abstracted in this driver, we need to add resin entry
in id table along with pwrkey_data.

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: pm8941-pwrkey - abstract register offsets and event code
Vinod Koul [Tue, 31 Jul 2018 05:57:33 +0000 (22:57 -0700)]
Input: pm8941-pwrkey - abstract register offsets and event code

In order to support resin thru the pwrkey driver (they are very
similar in nature) we need to abstract the handling in this driver.

First we abstract pull_up_bit and status_bit along in driver data.
The event code sent for key events is quiried from DT.

Since the device can be child of pon lookup regmap and reg from
parent if lookup fails (we are child).

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: iforce - reorganize joystick configuration lists
Tim Schumacher [Fri, 27 Jul 2018 22:21:47 +0000 (15:21 -0700)]
Input: iforce - reorganize joystick configuration lists

* btn_avb_pegasus and btn_avb_tw are the same. Unify them
  into btn_joystick_avb.

* btn_wheel is an exact copy of btn_joystick, so remove it.
  Rename btn_avb_wheel into btn_wheel since it is the only
  sane configuration for a wheel.

* Assign the (new) btn_wheel configuration to the "AVB Top
  Shot Force Feedback Racing Wheel", because the previous
  configuration was meant for a joystick.

Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - move completion to after config crc is updated
Nick Dyer [Fri, 27 Jul 2018 18:49:29 +0000 (11:49 -0700)]
Input: atmel_mxt_ts - move completion to after config crc is updated

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - don't report zero pressure from T9
Nick Dyer [Fri, 27 Jul 2018 18:49:10 +0000 (11:49 -0700)]
Input: atmel_mxt_ts - don't report zero pressure from T9

If T9.CTRL DISAMP is set, then pressure is reported as zero. This means
some app layers (eg tslib) will ignore the contact.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - zero terminate config firmware file
Nick Dyer [Fri, 27 Jul 2018 18:46:46 +0000 (11:46 -0700)]
Input: atmel_mxt_ts - zero terminate config firmware file

We use sscanf to parse the configuration file, so it's necessary to zero
terminate the configuration otherwise a truncated file can cause the
parser to run off into uninitialised memory.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - refactor config update code to add context struct
Nick Dyer [Fri, 27 Jul 2018 18:46:29 +0000 (11:46 -0700)]
Input: atmel_mxt_ts - refactor config update code to add context struct

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - config CRC may start at T71
Nick Dyer [Fri, 27 Jul 2018 18:45:47 +0000 (11:45 -0700)]
Input: atmel_mxt_ts - config CRC may start at T71

On devices with the T71 object, the config CRC will start there, rather
than at T7.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - remove unnecessary debug on ENOMEM
Nick Dyer [Fri, 27 Jul 2018 18:45:30 +0000 (11:45 -0700)]
Input: atmel_mxt_ts - remove unnecessary debug on ENOMEM

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - remove duplicate setup of ABS_MT_PRESSURE
Nick Dyer [Fri, 27 Jul 2018 18:45:20 +0000 (11:45 -0700)]
Input: atmel_mxt_ts - remove duplicate setup of ABS_MT_PRESSURE

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - use BIT() macro everywhere
Nick Dyer [Fri, 27 Jul 2018 18:44:41 +0000 (11:44 -0700)]
Input: atmel_mxt_ts - use BIT() macro everywhere

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: atmel_mxt_ts - only use first T9 instance
Nick Dyer [Fri, 27 Jul 2018 18:44:20 +0000 (11:44 -0700)]
Input: atmel_mxt_ts - only use first T9 instance

The driver only registers one input device, which uses the screen
parameters from the first T9 instance. The first T63 instance also uses
those parameters.

It is incorrect to send input reports from the second instances of these
objects if they are enabled: the input scaling will be wrong and the
positions will be mashed together.

This also causes problems on Android if the number of slots exceeds 32.

In the future, this could be handled by looking for enabled touch object
instances and creating an input device for each one.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: aiptek - replace GFP_ATOMIC with GFP_KERNEL in aiptek_probe()
Jia-Ju Bai [Fri, 27 Jul 2018 18:35:17 +0000 (11:35 -0700)]
Input: aiptek - replace GFP_ATOMIC with GFP_KERNEL in aiptek_probe()

aiptek_probe() is never called in atomic context. It calls
usb_alloc_coherent() with GFP_ATOMIC, which is not necessary. GFP_ATOMIC
can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: appletouch - replace GFP_ATOMIC with GFP_KERNEL
Jia-Ju Bai [Fri, 27 Jul 2018 18:34:26 +0000 (11:34 -0700)]
Input: appletouch - replace GFP_ATOMIC with GFP_KERNEL

atp_open(), atp_recover() and atp_resume() are never called in atomic
context. They call usb_submit_urb() with GFP_ATOMIC, which is not
necessary. GFP_ATOMIC can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: yealink - replace GFP_ATOMIC with GFP_KERNEL in usb_probe()
Jia-Ju Bai [Fri, 27 Jul 2018 18:34:13 +0000 (11:34 -0700)]
Input: yealink - replace GFP_ATOMIC with GFP_KERNEL in usb_probe()

usb_probe() is never called in atomic context.  It calls
usb_alloc_coherent() with GFP_ATOMIC, which is not necessary.  GFP_ATOMIC
can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: powermate - replace GFP_ATOMIC with GFP_KERNEL in powermate_alloc_buffers()
Jia-Ju Bai [Fri, 27 Jul 2018 18:33:45 +0000 (11:33 -0700)]
Input: powermate - replace GFP_ATOMIC with GFP_KERNEL in powermate_alloc_buffers()

powermate_alloc_buffers() is never called in atomic context. It calls
usb_alloc_coherent() with GFP_ATOMIC, which is not necessary. GFP_ATOMIC
can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: keyspan_remote - replace GFP_ATOMIC with GFP_KERNEL in keyspan_probe()
Jia-Ju Bai [Fri, 27 Jul 2018 18:32:36 +0000 (11:32 -0700)]
Input: keyspan_remote - replace GFP_ATOMIC with GFP_KERNEL in keyspan_probe()

keyspan_probe() is never called in atomic context. It calls
usb_alloc_coherent() with GFP_ATOMIC, which is not necessary. GFP_ATOMIC
can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: wdt87xx_i2c - replace mdelay() with msleep() in wdt87xx_resume()
Jia-Ju Bai [Fri, 27 Jul 2018 18:29:56 +0000 (11:29 -0700)]
Input: wdt87xx_i2c - replace mdelay() with msleep() in wdt87xx_resume()

wdt87xx_resume() is never called in atomic context.  It calls mdelay() to
busily wait, which is not necessary.  mdelay() can be replaced with
msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: iforce - assign BTN_DEAD only for specific devices
Tim Schumacher [Fri, 27 Jul 2018 18:56:34 +0000 (11:56 -0700)]
Input: iforce - assign BTN_DEAD only for specific devices

Move BTN_DEAD into the arrays with the specific button sets
instead of assigning it for every iforce device.

BTN_DEAD represents an optical sensor which detects if the
user is interacting with the device. On devices without that
optical sensor BTN_DEAD is repeatedly causing false inputs
on every status update of the joystick.

Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: iforce - reformat the packet dump output
Tim Schumacher [Tue, 24 Jul 2018 17:46:47 +0000 (10:46 -0700)]
Input: iforce - reformat the packet dump output

Previously, packets that have been dumped are shown in the
kernel log like this:

drivers/input/joystick/iforce/iforce-packets.c: info cmd = ff04, data =
56
02
04
00

Use dev_dbg to dump the packages only when requested and to list
the parent device as well. Use printf logic to generate the hexdump
instead of looping through every char that needs to be printed (which
in turn fixes the unnecessary newlines and looks more clean in general).

The resulting package dump output does now look like this:

usb 2-8: iforce_dump_packet info cmd = ff04, data = 56 02 04 00

Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: stop telling users to snail-mail Vojtech
Dmitry Torokhov [Tue, 24 Jul 2018 18:38:14 +0000 (11:38 -0700)]
Input: stop telling users to snail-mail Vojtech

I do not think Vojtech wants snail mail these days (and he mentioned that
nobody has ever sent him snail mail), and the address is not even valid
anymore, so let's remove snail-mail instructions from the sources.

Acked-by: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: pxrc - flatten probe code
Dmitry Torokhov [Wed, 18 Jul 2018 18:37:47 +0000 (18:37 +0000)]
Input: pxrc - flatten probe code

Instead of splitting probe code into separate USB and input setup, flatten it.
This allows for easier inspection of order of set up steps, since the probe code
is reasonably small.

Move input-related initialization (phys) from USB block to input block.

Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Tested-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: pxrc - do not store unneeded data in driver structure
Dmitry Torokhov [Wed, 18 Jul 2018 18:24:27 +0000 (18:24 +0000)]
Input: pxrc - do not store unneeded data in driver structure

There is no need to store data buffer size, pointer to the buffer, or endpoint
address in pxrc structure, as they are either only needed during setup, or are
available from elsewhere.

Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Tested-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: pxrc - move module device table closer to where it is used
Dmitry Torokhov [Wed, 18 Jul 2018 18:12:12 +0000 (18:12 +0000)]
Input: pxrc - move module device table closer to where it is used

There is no need to have the device table first in the file.

Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Tested-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: pxrc - fix freeing URB on device teardown
Dmitry Torokhov [Wed, 18 Jul 2018 18:03:36 +0000 (18:03 +0000)]
Input: pxrc - fix freeing URB on device teardown

URB is the only resource that is not managed, and thus is destroyed too early,
before we unregister input device and stop URB in pxrc_close(). To fix it let's
install custom devm handler to free the URB at the right time in devm unwind
sequence.

Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Tested-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: pxrc - do not store USB device in private struct
Marcus Folkesson [Wed, 18 Jul 2018 17:57:31 +0000 (17:57 +0000)]
Input: pxrc - do not store USB device in private struct

The USB device is only needed during setup, so put it back after
initialization and do not store it in our private struct.

Also, the USB device is a parent of USB interface so our driver
model rules ensure that USB device should not disappear while
interface device is still there; there is no need to take reference
to the USB device.

Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: gpio_keys - add missing include to gpio_keys.h
Matti Vaittinen [Wed, 18 Jul 2018 16:40:46 +0000 (16:40 +0000)]
Input: gpio_keys - add missing include to gpio_keys.h

gpio_keys.h uses 'bool' - type which is defined in linux/types.h.
Include this header.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: i8042 - add Lenovo LaVie Z to the i8042 reset list
Chen-Yu Tsai [Wed, 18 Jul 2018 17:24:35 +0000 (17:24 +0000)]
Input: i8042 - add Lenovo LaVie Z to the i8042 reset list

The Lenovo LaVie Z laptop requires i8042 to be reset in order to
consistently detect its Elantech touchpad. The nomux and kbdreset
quirks are not sufficient.

It's possible the other LaVie Z models from NEC require this as well.

Cc: stable@vger.kernel.org
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: egalax_ts - switch to SPDX identifier
Fabio Estevam [Tue, 17 Jul 2018 04:06:00 +0000 (04:06 +0000)]
Input: egalax_ts - switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: elan_i2c - add another ACPI ID for Lenovo Ideapad 330-15AST
KT Liao [Mon, 16 Jul 2018 12:10:03 +0000 (12:10 +0000)]
Input: elan_i2c - add another ACPI ID for Lenovo Ideapad 330-15AST

Add ELAN0622 to ACPI mapping table to support Elan touchpad found in
Ideapad 330-15AST.

Signed-off-by: KT Liao <kt.liao@emc.com.tw>
Reported-by: Anant Shende <anantshende@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: iforce - use GFP_KERNEL in iforce_get_id_packet()
Sebastian Andrzej Siewior [Wed, 4 Jul 2018 15:01:06 +0000 (15:01 +0000)]
Input: iforce - use GFP_KERNEL in iforce_get_id_packet()

iforce_get_id_packet() invokes wait_event_interruptible_timeout() which
means it has to be in non-atomic context at that point, thus we can use
GFP_KERNEL instead of GFP_ATOMIC.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agodt-bindings: input: add common keyboard document bindings
Chen Zhong [Wed, 4 Jul 2018 15:19:05 +0000 (15:19 +0000)]
dt-bindings: input: add common keyboard document bindings

This patch adds the device tree binding documentation for common
keyboard.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chen Zhong <chen.zhong@mediatek.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: cros_ec_keyb - remove redundant variable num_cols
Colin Ian King [Wed, 4 Jul 2018 15:53:42 +0000 (15:53 +0000)]
Input: cros_ec_keyb - remove redundant variable num_cols

Variable num_cols is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable ‘num_cols’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: eeti - fix link to documentation and email address in header
Daniel Mack [Wed, 4 Jul 2018 15:46:55 +0000 (15:46 +0000)]
Input: eeti - fix link to documentation and email address in header

Keep the documentation link up-to-date in case anybody need to dive into it
again, and update email address while at it.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: eeti - drop module parameters, parse DT properties
Daniel Mack [Wed, 4 Jul 2018 15:46:22 +0000 (15:46 +0000)]
Input: eeti - drop module parameters, parse DT properties

The only user of this driver in mainline does not make use of the module
parameters, so let's remove them. All properties for this driver should be
set through DT or pdata.

Use touchscreen_parse_properties() to automatically set some of the common
touchscreen properties and derive the axis inversion through that.

And finally, use touchscreen_report_pos() to handle the DT properties
automatically instead of doing the inversion ourselves.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: eeti - add device tree matching table
Daniel Mack [Wed, 4 Jul 2018 15:45:47 +0000 (15:45 +0000)]
Input: eeti - add device tree matching table

Provide a match table so that the driver can be used in devicetree setups.
More properties are added in a later patch.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agodt-bindings: input: touchscreen: add bindings for eeti touchscreen controller
Daniel Mack [Wed, 4 Jul 2018 15:44:39 +0000 (15:44 +0000)]
dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller

Describe the bindings for EETI touchscreen controllers.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoMAINTAINERS: Add file patterns for serio device tree bindings
Geert Uytterhoeven [Wed, 4 Jul 2018 15:26:18 +0000 (15:26 +0000)]
MAINTAINERS: Add file patterns for serio device tree bindings

Submitters of device tree binding documentation may forget to CC
the subsystem maintainer if this is missing.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: elan_i2c - add ACPI ID for lenovo ideapad 330
Donald Shanty III [Wed, 4 Jul 2018 15:50:47 +0000 (15:50 +0000)]
Input: elan_i2c - add ACPI ID for lenovo ideapad 330

This allows Elan driver to bind to the touchpad found in Lenovo Ideapad 330
series laptops.

Signed-off-by: Donald Shanty III <dshanty@protonmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: psmouse - fix button reporting for basic protocols
Dmitry Torokhov [Mon, 25 Jun 2018 19:02:40 +0000 (12:02 -0700)]
Input: psmouse - fix button reporting for basic protocols

The commit ba667650c568 ("Input: psmouse - clean up code") was pretty
brain-dead and broke extra buttons reporting for variety of PS/2 mice:
Genius, Thinkmouse and Intellimouse Explorer. We need to actually inspect
the data coming from the device when reporting events.

Fixes: ba667650c568 ("Input: psmouse - clean up code")
Reported-by: Jiri Slaby <jslaby@suse.cz>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: add bu21029 touch driver
Zhu Yi [Wed, 30 May 2018 18:41:11 +0000 (11:41 -0700)]
Input: add bu21029 touch driver

Add Rohm BU21029 resistive touch panel controller support with I2C
interface.

Signed-off-by: Zhu Yi <yi.zhu5@cn.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: imx6ul_tsc - switch to SPDX identifier
Fabio Estevam [Tue, 19 Jun 2018 18:19:55 +0000 (11:19 -0700)]
Input: imx6ul_tsc - switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: fsl-imx25-tcq - switch to SPDX identifier
Fabio Estevam [Tue, 19 Jun 2018 18:19:28 +0000 (11:19 -0700)]
Input: fsl-imx25-tcq - switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: snvs_pwrkey - switch to SPDX identifier
Fabio Estevam [Tue, 19 Jun 2018 18:19:14 +0000 (11:19 -0700)]
Input: snvs_pwrkey - switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: imx_keypad - switch to SPDX identifier
Fabio Estevam [Tue, 19 Jun 2018 18:18:50 +0000 (11:18 -0700)]
Input: imx_keypad - switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: xpad - fix GPD Win 2 controller name
Enno Boland [Tue, 19 Jun 2018 18:55:33 +0000 (11:55 -0700)]
Input: xpad - fix GPD Win 2 controller name

This fixes using the controller with SDL2.

SDL2 has a naive algorithm to apply the correct settings to a controller.
For X-Box compatible controllers it expects that the controller name
contains a variation of a 'XBOX'-string.

This patch changes the identifier to contain "X-Box" as substring.  Tested
with Steam and C-Dogs-SDL which both detect the controller properly after
adding this patch.

Fixes: c1ba08390a8b ("Input: xpad - add GPD Win 2 Controller USB IDs")
Cc: stable@vger.kernel.org
Signed-off-by: Enno Boland <gottox@voidlinux.eu>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: elan_i2c_smbus - fix more potential stack buffer overflows
Ben Hutchings [Tue, 19 Jun 2018 18:17:32 +0000 (11:17 -0700)]
Input: elan_i2c_smbus - fix more potential stack buffer overflows

Commit 40f7090bb1b4 ("Input: elan_i2c_smbus - fix corrupted stack")
fixed most of the functions using i2c_smbus_read_block_data() to
allocate a buffer with the maximum block size.  However three
functions were left unchanged:

* In elan_smbus_initialize(), increase the buffer size in the same
  way.
* In elan_smbus_calibrate_result(), the buffer is provided by the
  caller (calibrate_store()), so introduce a bounce buffer.  Also
  name the result buffer size.
* In elan_smbus_get_report(), the buffer is provided by the caller
  but happens to be the right length.  Add a compile-time assertion
  to ensure this remains the case.

Cc: <stable@vger.kernel.org> # 3.19+
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: elan_i2c - add ELAN0618 (Lenovo v330 15IKB) ACPI ID
Alexandr Savca [Fri, 22 Jun 2018 00:12:54 +0000 (17:12 -0700)]
Input: elan_i2c - add ELAN0618 (Lenovo v330 15IKB) ACPI ID

Add ELAN0618 to the list of supported touchpads; this ID is used in
Lenovo v330 15IKB devices.

Signed-off-by: Alexandr Savca <alexandr.savca@saltedge.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: elantech - fix V4 report decoding for module with middle key
??? [Fri, 22 Jun 2018 00:15:32 +0000 (17:15 -0700)]
Input: elantech - fix V4 report decoding for module with middle key

Some touchpad has middle key and it will be indicated in bit 2 of packet[0].
We need to fix V4 formation's byte mask to prevent error decoding.

Signed-off-by: KT Liao <kt.liao@emc.com.tw>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: elantech - enable middle button of touchpads on ThinkPad P52
Aaron Ma [Fri, 22 Jun 2018 00:14:01 +0000 (17:14 -0700)]
Input: elantech - enable middle button of touchpads on ThinkPad P52

PNPID is better way to identify the type of touchpads.
Enable middle button support on 2 types of touchpads on Lenovo P52.

Cc: stable@vger.kernel.org
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoMerge branch 'ib/4.17-xen-kbdfront-runtime-config' into next
Dmitry Torokhov [Tue, 12 Jun 2018 23:38:35 +0000 (16:38 -0700)]
Merge branch 'ib/4.17-xen-kbdfront-runtime-config' into next

Bring in xen-kbdfront changes.

6 years agoInput: i8042 - increment wakeup_count for the respective port
Ravi Chandra Sadineni [Tue, 12 Jun 2018 23:32:40 +0000 (16:32 -0700)]
Input: i8042 - increment wakeup_count for the respective port

Call pm_wakeup_event on every interrupt. This should help us in identifying
if keyboard was a potential wake reason for the last resume.

Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: cros_ec_keyb - remove check before calling pm_wakeup_event
Ravi Chandra Sadineni [Tue, 12 Jun 2018 23:31:38 +0000 (16:31 -0700)]
Input: cros_ec_keyb - remove check before calling pm_wakeup_event

Remove the unnecessary check before calling pm_wakeup_event. If the
device is not wake enabled, this call is no-op anyway.

Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: cros_ec_keyb - switch to SPDX identifier
Enric Balletbo i Serra [Tue, 12 Jun 2018 23:27:52 +0000 (16:27 -0700)]
Input: cros_ec_keyb - switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: cros_ec_keyb - make license text and MODULE_LICENSE match
Enric Balletbo i Serra [Tue, 12 Jun 2018 23:26:26 +0000 (16:26 -0700)]
Input: cros_ec_keyb - make license text and MODULE_LICENSE match

The license text is specifying "GPLv2" but the MODULE_LICENSE is set to
GPL which means GNU Public License v2 or later. When MODULE_LICENSE and
boiler plate does not match, go for boiler plate license.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoMerge branch 'next' into for-linus
Dmitry Torokhov [Tue, 12 Jun 2018 23:24:36 +0000 (16:24 -0700)]
Merge branch 'next' into for-linus

Prepare second round of input updates for 4.18 merge window.

6 years agoInput: xen-kbdfront - allow better run-time configuration
Oleksandr Andrushchenko [Tue, 12 Jun 2018 22:04:43 +0000 (15:04 -0700)]
Input: xen-kbdfront - allow better run-time configuration

It is now only possible to control if multi-touch virtual device
is created or not (via the corresponding XenStore entries),
but keyboard and pointer devices are always created.
In some cases this is not desirable. For example, if virtual
keyboard device is exposed to Android then the latter won't
automatically show on-screen keyboard as it expects that a
physical keyboard device can be used for typing.

Utilize keyboard and pointer device XenStore feature fields to
configure which virtual devices are created:
 - set "feature-disable-keyboard" to 1 if no keyboard device
   needs to be created
 - set "feature-disable-pointer" to 1 if no pointer device
   needs to be created
Keep old behavior by default.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Suggested-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Tested-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
6 years agoInput: xen-kbdfront - fix multi-touch XenStore node's locations
Oleksandr Andrushchenko [Tue, 12 Jun 2018 22:03:36 +0000 (15:03 -0700)]
Input: xen-kbdfront - fix multi-touch XenStore node's locations

kbdif protocol describes multi-touch device parameters as a
part of frontend's XenBus configuration nodes while they
belong to backend's configuration. Fix this by reading the
parameters as defined by the protocol.

Fixes: 49aac8204da5 ("Input: xen-kbdfront - add multi-touch support")
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>