GitHub/moto-9609/android_kernel_motorola_exynos9610.git
7 years agoInput: max11801_ts - drop call to input_set_drvdata()
Dmitry Torokhov [Sun, 22 Jan 2017 07:36:05 +0000 (23:36 -0800)]
Input: max11801_ts - drop call to input_set_drvdata()

Nobody calls input_get_drvdata() so setting it is not required.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: pwm-beeper - switch to using "atomic" PWM API
Dmitry Torokhov [Thu, 19 Jan 2017 21:52:49 +0000 (13:52 -0800)]
Input: pwm-beeper - switch to using "atomic" PWM API

The "atomic" API allows us to configure PWM period and duty cycle and
enable it in one call.

Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: pwm-beeper - add optional amplifier regulator
David Lechner [Mon, 16 Jan 2017 01:09:43 +0000 (17:09 -0800)]
Input: pwm-beeper - add optional amplifier regulator

This adds an optional regulator to the pwm-beeper device. This regulator
acts as an amplifier. The amplifier is only enabled while beeping in order
to reduce power consumption.

Tested on LEGO MINDSTORMS EV3, which has a speaker connected to PWM through
an amplifier.

Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: pwm-beeper - suppress error message on probe defer
David Lechner [Fri, 6 Jan 2017 18:35:16 +0000 (10:35 -0800)]
Input: pwm-beeper - suppress error message on probe defer

This suppress printing an error message when pwm_get returns -EPROBE_DEFER.
Otherwise you get a bunch of noise in the kernel log.

Signed-off-by: David Lechner <david@lechnology.com>
Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: pwm-beeper - fix race when suspending
Dmitry Torokhov [Thu, 19 Jan 2017 19:13:37 +0000 (11:13 -0800)]
Input: pwm-beeper - fix race when suspending

Usually userspace sends SND_BELL and SND_TONE events, and by the time
pwm_beeper_suspend() runs userpsace is already frozen, but theoretically
in-kernel users may send these events too, and that may cause
pwm_beeper_event() scheduling another work after we canceled it.

Let's introduce a "suspended" flag and check it in pwm_beeper_event() to
avoid this race.

Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: pwm-beeper - use input_set_capability()
Dmitry Torokhov [Fri, 6 Jan 2017 17:54:14 +0000 (09:54 -0800)]
Input: pwm-beeper - use input_set_capability()

Instead of manipulating capability bits directly, let's use
input_set_capability() API.

Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: pwm-beeper - switch to using managed resources
Dmitry Torokhov [Fri, 6 Jan 2017 17:50:14 +0000 (09:50 -0800)]
Input: pwm-beeper - switch to using managed resources

Use of managed resources (devm) simplifies error handling and tear down
of the driver.

Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: pwm-beeper - remove calls to legacy pwm_request API
Dmitry Torokhov [Fri, 6 Jan 2017 17:48:20 +0000 (09:48 -0800)]
Input: pwm-beeper - remove calls to legacy pwm_request API

There are no more users of pwm-beeper driver in mainline relying on
this legacy API, so let's remove it and simplify the driver code.

Acked-by: Thierry Reding <thierry.reding@gmail.com>
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: misc - drop empty remove functions
Guenter Roeck [Sun, 22 Jan 2017 07:50:09 +0000 (23:50 -0800)]
Input: misc - drop empty remove functions

Empty remove functions don't serve a useful purpose and can be removed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: serio - drop unnecessary calls to device_init_wakeup
Guenter Roeck [Sun, 22 Jan 2017 07:49:38 +0000 (23:49 -0800)]
Input: serio - drop unnecessary calls to device_init_wakeup

Calling device_init_wakeup in the remove function is unnecessary since the
device is going away, and thus won't be able to cause any wakeups under any
circumstances. Besides, the driver cleanup code already handles the
necessary cleanup.

Similarly, disabling wakeup in the probe error path is unnecessary, as is
disabling wakeup in the probe function in the first place.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: touchscreen - drop unnecessary calls to device_init_wakeup
Guenter Roeck [Sun, 22 Jan 2017 07:49:13 +0000 (23:49 -0800)]
Input: touchscreen - drop unnecessary calls to device_init_wakeup

Calling device_init_wakeup in the remove function is unnecessary since the
device is going away, and thus won't be able to cause any wakeups under any
circumstances. Besides, the driver cleanup code already handles the
necessary cleanup.

Similarly, disabling wakeup in the probe error path is unnecessary, as is
disabling wakeup in the probe function in the first place.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: misc - drop unnecessary calls to device_init_wakeup
Guenter Roeck [Sun, 22 Jan 2017 07:48:45 +0000 (23:48 -0800)]
Input: misc - drop unnecessary calls to device_init_wakeup

Calling device_init_wakeup in the remove function is unnecessary since the
device is going away, and thus won't be able to cause any wakeups under any
circumstances. Besides, the driver cleanup code already handles the
necessary cleanup.

Similarly, disabling wakeup in the probe error path is unnecessary, as is
disabling wakeup in the probe function in the first place.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: keyboard - drop unnecessary calls to device_init_wakeup
Guenter Roeck [Sun, 22 Jan 2017 07:47:44 +0000 (23:47 -0800)]
Input: keyboard - drop unnecessary calls to device_init_wakeup

Calling device_init_wakeup in the remove function is unnecessary since the
device is going away, and thus won't be able to cause any wakeups under any
circumstances. Besides, the driver cleanup code already handles the
necessary cleanup.

Similarly, disabling wakeup in the probe error path is unnecessary, as is
disabling wakeup in the probe function in the first place.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: touchscreen - use local variables consistently
Guenter Roeck [Sun, 22 Jan 2017 07:46:47 +0000 (23:46 -0800)]
Input: touchscreen - use local variables consistently

If a function declares a variable to access a structure element,
use it consistently.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: mouse - use local variables consistently
Guenter Roeck [Sun, 22 Jan 2017 07:44:46 +0000 (23:44 -0800)]
Input: mouse - use local variables consistently

If a function declares a variable to access a structure element,
use it consistently.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: misc - use local variables consistently
Guenter Roeck [Sun, 22 Jan 2017 07:44:18 +0000 (23:44 -0800)]
Input: misc - use local variables consistently

If a function declares a variable to access a structure element,
use it consistently.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: keyboard - use local variables consistently
Guenter Roeck [Sun, 22 Jan 2017 07:40:45 +0000 (23:40 -0800)]
Input: keyboard - use local variables consistently

If a function declares a variable to access a structure element,
use it consistently.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: touchscreen - drop calls to platform_set_drvdata and i2c_set_clientdata
Guenter Roeck [Sun, 22 Jan 2017 07:33:01 +0000 (23:33 -0800)]
Input: touchscreen - drop calls to platform_set_drvdata and i2c_set_clientdata

There is no call to i2c_get_clientdata(), platform_get_drvdata(),
or dev_get_drvdata() in any of the drivers in this patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: misc - drop calls to platform_set_drvdata and i2c_set_clientdata
Guenter Roeck [Sun, 22 Jan 2017 07:32:34 +0000 (23:32 -0800)]
Input: misc - drop calls to platform_set_drvdata and i2c_set_clientdata

There is no call to i2c_get_clientdata(), platform_get_drvdata(),
or dev_get_drvdata() in any of the drivers in this patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: keyboard - drop calls to platform_set_drvdata and i2c_set_clientdata
Guenter Roeck [Sun, 22 Jan 2017 07:29:36 +0000 (23:29 -0800)]
Input: keyboard - drop calls to platform_set_drvdata and i2c_set_clientdata

There is no call to i2c_get_clientdata(), platform_get_drvdata(),
or dev_get_drvdata() in any of the drivers in this patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: gpio-keys - add support for setkeycode
Hans de Goede [Sat, 21 Jan 2017 19:16:47 +0000 (11:16 -0800)]
Input: gpio-keys - add support for setkeycode

gpio-keys input devices created by the soc_button_array driver are
configured with key-codes based on ACPI provided information.

Unfortunately on some tablets this info is wrong, and we need to have
a quirk to fix things up.

Add support for input_setkeycode to the gpio-keys driver, so that
the existing udev hwdb mechanism can be used to fix things up on these
tablets.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: soc_button_array - debounce the buttons
Hans de Goede [Sat, 21 Jan 2017 19:14:14 +0000 (11:14 -0800)]
Input: soc_button_array - debounce the buttons

The soc_button_array driver was initializing (kzalloc) the
debounce_interval value to 0, leading to no debouncing at all,
while the buttons are simple mechanical switches.

This commit sets debounce_interval to 50ms to avoid spurious button
press reports both on press and release of the button. Note 50ms may
seem like a lot but soc_button_array is typically used with cheap
tablets, with not so great buttons. I tried 10ms on my tablet and it
is not enough, where as 50ms works well.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: tm2-touchkey - add touchkey driver support for TM2
Jaechul Lee [Wed, 18 Jan 2017 22:35:42 +0000 (14:35 -0800)]
Input: tm2-touchkey - add touchkey driver support for TM2

This patch adds support for the TM2 touch key and led functionality.

The driver interfaces with userspace through an input device and reports
KEY_PHONE and KEY_BACK event types. LED brightness can be controlled by
"/sys/class/leds/tm2-touchkey/brightness".

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: sis_i2c - drop unnecessary call to i2c_set_clientdata
Guenter Roeck [Wed, 18 Jan 2017 22:26:47 +0000 (14:26 -0800)]
Input: sis_i2c - drop unnecessary call to i2c_set_clientdata

There is no call to i2c_get_clientdata() or dev_get_drvdata().
Drop the unnecessary call to i2c_set_clientdata().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: bcm-keypad - drop unnecessary call to platform_set_drvdata
Guenter Roeck [Wed, 18 Jan 2017 19:48:11 +0000 (11:48 -0800)]
Input: bcm-keypad - drop unnecessary call to platform_set_drvdata

There is no call to platform_get_drvdata() or dev_get_drvdata().
Drop the unnecessary call to platform_set_drvdata().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: twl4030_keypad - drop unnecessary call to platform_set_drvdata
Guenter Roeck [Wed, 18 Jan 2017 19:45:25 +0000 (11:45 -0800)]
Input: twl4030_keypad - drop unnecessary call to platform_set_drvdata

There is no call to platform_get_drvdata() or dev_get_drvdata().
Drop the unnecessary call to platform_set_drvdata().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: ab8500-ponkey - drop unnecessary call to platform_set_drvdata
Guenter Roeck [Wed, 18 Jan 2017 19:44:55 +0000 (11:44 -0800)]
Input: ab8500-ponkey - drop unnecessary call to platform_set_drvdata

There is no call to platform_get_drvdata() or dev_get_drvdata().
Drop the unnecessary call to platform_set_drvdata().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: tps65218-pwrbutton - drop unnecessary call to platform_set_drvdata
Guenter Roeck [Wed, 18 Jan 2017 19:42:44 +0000 (11:42 -0800)]
Input: tps65218-pwrbutton - drop unnecessary call to platform_set_drvdata

There is no call to platform_get_drvdata() or dev_get_drvdata().
Drop the unnecessary call to platform_set_drvdata().

Also use existing variable 'dev' instead of dereferencing it several times.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: soc_button_array - use 'dev' instead of dereferencing it
Guenter Roeck [Wed, 18 Jan 2017 19:41:51 +0000 (11:41 -0800)]
Input: soc_button_array - use 'dev' instead of dereferencing it

Use local variable 'dev' instead of dereferencing it several times.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: mma8450 - drop unnecessary call to i2c_set_clientdata
Guenter Roeck [Wed, 18 Jan 2017 19:41:01 +0000 (11:41 -0800)]
Input: mma8450 - drop unnecessary call to i2c_set_clientdata

There is no call to i2c_get_clientdata() or dev_get_drvdata().
Drop the unnecessary call to i2c_set_clientdata().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: gpio_decoder - drop unnecessary call to platform_set_drvdata
Guenter Roeck [Wed, 18 Jan 2017 19:40:04 +0000 (11:40 -0800)]
Input: gpio_decoder - drop unnecessary call to platform_set_drvdata

There is no call to platform_get_drvdata() or dev_get_drvdata().
Drop the unnecessary call to platform_set_drvdata().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: bfin_rotary - switch to using devm_add_action_or_reset()
Guenter Roeck [Wed, 18 Jan 2017 19:36:25 +0000 (11:36 -0800)]
Input: bfin_rotary - switch to using devm_add_action_or_reset()

Use local variable 'dev' instead of dereferencing it several times and
replace devm_add_action() and manual error handling with
devm_add_action_or_reset().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: eeti_ts - drop goto to return statement
Guenter Roeck [Wed, 18 Jan 2017 19:24:06 +0000 (11:24 -0800)]
Input: eeti_ts - drop goto to return statement

Replace 'goto l; ... l: return e;' with 'return e;'

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: atmel-wm97xx - drop unnecessary error messages
Guenter Roeck [Wed, 18 Jan 2017 19:21:24 +0000 (11:21 -0800)]
Input: atmel-wm97xx - drop unnecessary error messages

Error messages after memory allocation failures are unnecessary and
can be dropped, especially give that they were emitted as dev_dbg() so
noone except person actively debugging the driver would see them.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: ar1021_i2c - drop unnecessary call to i2c_set_clientdata
Guenter Roeck [Wed, 18 Jan 2017 19:20:18 +0000 (11:20 -0800)]
Input: ar1021_i2c - drop unnecessary call to i2c_set_clientdata

There is no call to i2c_get_clientdata() or dev_get_drvdata().
Drop the unnecessary call to i2c_set_clientdata().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: xilinx_ps2 - use 'dev' instead of dereferencing it
Guenter Roeck [Wed, 18 Jan 2017 19:16:12 +0000 (11:16 -0800)]
Input: xilinx_ps2 - use 'dev' instead of dereferencing it

Use local variable 'dev' instead of dereferencing it several times.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: at32psif - drop unnecessary error messages and other changes
Guenter Roeck [Wed, 18 Jan 2017 19:12:00 +0000 (11:12 -0800)]
Input: at32psif - drop unnecessary error messages and other changes

Error messages after memory allocation failures are unnecessary and
can be dropped, given that they are emitted as dev_dbg() so nobody except
person actively debugging the driver would see them.

Also replace jump to return 'goto l; ... l: return e;' with 'return e;'

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: cros_ec_keyb - drop unnecessary call to dev_set_drvdata and other changes
Guenter Roeck [Wed, 18 Jan 2017 18:37:49 +0000 (10:37 -0800)]
Input: cros_ec_keyb - drop unnecessary call to dev_set_drvdata and other changes

There is no call to platform_get_drvdata() or dev_get_drvdata().
Drop the unnecessary call to dev_set_drvdata().
Other relevant changes:
  Use existing variable 'dev' instead of dereferencing it several times

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Drop dev_set_drvdata()
- Use local variable 'struct device *dev' consistently

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: tca8418 - use the interrupt trigger from the device tree
Maxime Ripard [Tue, 17 Jan 2017 21:24:22 +0000 (13:24 -0800)]
Input: tca8418 - use the interrupt trigger from the device tree

The TCA8418 might be used using different interrupt triggers on various
boards. This is not working so far because the current code forces a
falling edge trigger.

The device tree already provides a trigger type, so let's use whatever it
sets up, and since we can be loaded without DT, keep the old behaviour for
the non-DT case.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: cyapa - use msleep() for long delay
Nicholas Mc Guire [Sun, 15 Jan 2017 23:19:27 +0000 (15:19 -0800)]
Input: cyapa - use msleep() for long delay

ulseep_range() uses hrtimers and provides no advantage over msleep()
for larger delays. Fix up the 50ms delays here to use msleep() and
reduce the load on the hrtimer subsystem.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: cyapa - use time based retry loop
Nicholas Mc Guire [Sun, 15 Jan 2017 23:18:03 +0000 (15:18 -0800)]
Input: cyapa - use time based retry loop

Using counter based retry loops for peripherals results in the delay
being significantly overrun during high-load situations where delay
functions tend to be vary imprecise and overrun there timeouts. So
condition the termination on the actual condition of 2s for the
re-calibration to have been successful.

As this is a very long delay there is no advantage in using
high-resolution timers thus switching this to msleep().

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: mpr121 - switch to device tree probe
Akinobu Mita [Sun, 15 Jan 2017 22:51:12 +0000 (14:51 -0800)]
Input: mpr121 - switch to device tree probe

This driver currently only supports legacy platform data probe.  This
change adds device tree support and gets rid of platform data probe code
since no one is actually using mpr121 platform data in the mainline.

The device tree property parsing code is based on the work of
atmel_captouch driver.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: mpr121 - handle multiple bits change of status register
Akinobu Mita [Sun, 15 Jan 2017 22:44:30 +0000 (14:44 -0800)]
Input: mpr121 - handle multiple bits change of status register

This driver reports input events on their interrupts which are triggered
by the sensor's status register changes.  But only single bit change is
reported in the interrupt handler.  So if there are multiple bits are
changed at almost the same time, other press or release events are ignored.

This fixes it by detecting all changed bits in the status register.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: mpr121 - set missing event capability
Akinobu Mita [Sun, 15 Jan 2017 22:44:05 +0000 (14:44 -0800)]
Input: mpr121 - set missing event capability

This driver reports misc scan input events on the sensor's status
register changes.  But the event capability for them was not set in the
device initialization, so these events were ignored.

This change adds the missing event capability.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: mpr121 - remove unused field in struct mpr121_touchkey
Akinobu Mita [Sun, 15 Jan 2017 22:43:40 +0000 (14:43 -0800)]
Input: mpr121 - remove unused field in struct mpr121_touchkey

Remove unused key_val field in struct mpr121_touchkey.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: mpr121 - annotate PM methods as __maybe_unused
Akinobu Mita [Sun, 15 Jan 2017 22:43:15 +0000 (14:43 -0800)]
Input: mpr121 - annotate PM methods as __maybe_unused

Instead of using #ifdef, let's mark suspend and resume methods as
__maybe_unused to provide better compile coverage.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: intel-mid-touch - remove driver
Andy Shevchenko [Thu, 5 Jan 2017 22:19:01 +0000 (14:19 -0800)]
Input: intel-mid-touch - remove driver

The Moorestown support was removed by commit 1a8359e411eb ("x86/mid: Remove
Intel Moorestown").

Remove this leftover.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: edt_ft5x06 - change msleep to usleep_range for small msecs
Aniroop Mathur [Wed, 4 Jan 2017 18:57:51 +0000 (10:57 -0800)]
Input: edt_ft5x06 - change msleep to usleep_range for small msecs

msleep(1~20) may not do what the caller intends, and will often sleep
longer (~20 ms actual sleep for any value given in the 1~20ms range).  This
is not the desired behaviour for many cases like device resume time, device
suspend time, device enable time, retry logic, etc.  Thus, change msleep to
usleep_range for precise wakeups.

Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
Acked-by: Simon Budig <simon.budig@kernelconcepts.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: xpad - don't depend on endpoint order
Cameron Gutman [Wed, 4 Jan 2017 06:40:38 +0000 (22:40 -0800)]
Input: xpad - don't depend on endpoint order

The order of endpoints is well defined on official Xbox pads, but
we have found at least one 3rd-party pad that doesn't follow the
standard ("Titanfall 2 Xbox One controller" 0e6f:0165).

Fortunately, we get lucky with this specific pad because it uses
endpoint addresses that differ only by direction. We know that
there are other pads out where this is not true, so let's go
ahead and fix this.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: xpad - simplify error condition in init_output
Pavel Rojtberg [Fri, 27 May 2016 23:26:33 +0000 (16:26 -0700)]
Input: xpad - simplify error condition in init_output

Replace first goto with simple returns as we really are just returning
one error code.

Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: xpad - move reporting xbox one home button to common function
Daniel Tobias [Fri, 27 May 2016 23:25:32 +0000 (16:25 -0700)]
Input: xpad - move reporting xbox one home button to common function

xbox one was the only device that has a *_process_buttons routine.

Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: xpad - correctly sort vendor id's
Daniel Tobias [Fri, 27 May 2016 23:25:10 +0000 (16:25 -0700)]
Input: xpad - correctly sort vendor id's

Signed-off-by: Daniel Tobias <dan.g.tob@gmail.com>
Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: bma150 - switch to using usleep_range instead of msleep
Aniroop Mathur [Tue, 27 Dec 2016 21:22:42 +0000 (13:22 -0800)]
Input: bma150 - switch to using usleep_range instead of msleep

msleep (1~20) may not do what the caller intends, and will often sleep
longer.  (~20 ms actual sleep for any value given in the 1~20ms range) This
is not the desired behaviour for many cases like device resume time, device
suspend time, device enable time, etc.  Thus, change msleep to usleep_range
for precise wakeups.

Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
Acked by: Albert Zhang <xu.zhang@bosch-sensortec.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: i8042 - force synchronous probing of PNP drivers
Dmitry Torokhov [Mon, 12 Dec 2016 22:33:37 +0000 (14:33 -0800)]
Input: i8042 - force synchronous probing of PNP drivers

We rely on the result of scanning PNP bus for keyboard and mouse devices to
decide whether we should continue initialization of i8042 driver or not, so
the probes can not be asynchronous.

Also, it is not a good idea to unbind either of the PNP devices while i8042
is running, so let's disable bind/unbind for the PNP drivers through sysfs
and rely on i8042 cleaning after itself properly. User can still unbind and
rebind entire i8042 and that will take care of PNP drivers as well.

Reviewed-by: Luis R. Rodriguez <mgrof@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoMerge branch 'synaptics-rmi4' into next
Dmitry Torokhov [Fri, 16 Dec 2016 05:36:09 +0000 (21:36 -0800)]
Merge branch 'synaptics-rmi4' into next

Merge updated Synaptics RMI4 support, including support for SMBus
controllers and flashing firmware.

7 years agoInput: imx6ul_tsc - generalize the averaging property
Guy Shapiro [Fri, 16 Dec 2016 05:23:02 +0000 (21:23 -0800)]
Input: imx6ul_tsc - generalize the averaging property

Make the avarage-samples property a general touchscreen property
rather than imx6ul device specific.

Signed-off-by: Guy Shapiro <guy.shapiro@mobi-wize.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: drv260x - use generic device properties
Jingkui Wang [Sun, 11 Dec 2016 06:44:10 +0000 (22:44 -0800)]
Input: drv260x - use generic device properties

Update driver drv260x to use generic device properties so that it can be
used on non-DT systems. We also remove platform data as generic device
properties work on static board code as well.

Signed-off-by: Jingkui Wang <jkwang@google.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: drv260x - use temporary for &client->dev
Dmitry Torokhov [Sun, 11 Dec 2016 07:03:33 +0000 (23:03 -0800)]
Input: drv260x - use temporary for &client->dev

Let's introduce a temporary for "client->dev" is probe() as we use
it quite a few times and "dev" is shorter.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: drv260x - fix input device's parent assignment
Jingkui Wang [Mon, 12 Dec 2016 21:51:46 +0000 (13:51 -0800)]
Input: drv260x - fix input device's parent assignment

We were assigning I2C bus controller instead of client as parent device.
Besides being logically wrong, it messed up with devm handling of input
device. As a result we were leaving input device and event node behind
after rmmod-ing the driver, which lead to a kernel oops if one were to
access the event node later.

Let's remove the assignment and rely on devm_input_allocate_device() to
set it up properly for us.

Signed-off-by: Jingkui Wang <jkwang@google.com>
Fixes: 7132fe4f5687 ("Input: drv260x - add TI drv260x haptics driver")
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - add support for F34 V7 bootloader
Nick Dyer [Sun, 11 Dec 2016 07:27:32 +0000 (23:27 -0800)]
Input: synaptics-rmi4 - add support for F34 V7 bootloader

Port firmware update code from Samsung Galaxy S7 driver into
mainline framework.

This patch has been tested on Synaptics S7813.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Tested-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: drv260x - fix initializing overdrive voltage
Dmitry Torokhov [Sun, 11 Dec 2016 06:56:21 +0000 (22:56 -0800)]
Input: drv260x - fix initializing overdrive voltage

We were accidentally initializing haptics->rated_voltage twice, and did not
initialize overdrive voltage.

Acked-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: ALPS - fix protcol -> protocol
Marcos Paulo de Souza [Mon, 12 Dec 2016 18:59:56 +0000 (10:59 -0800)]
Input: ALPS - fix protcol -> protocol

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: i8042 - comment #else/#endif of CONFIG_PNP
Marcos Paulo de Souza [Sat, 10 Dec 2016 01:59:56 +0000 (17:59 -0800)]
Input: i8042 - comment #else/#endif of CONFIG_PNP

As this define check if huge, this makes easier to read the code.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: lpc32xx-keys - fix invalid error handling of a requested irq
Vladimir Zapolskiy [Thu, 8 Dec 2016 01:22:36 +0000 (17:22 -0800)]
Input: lpc32xx-keys - fix invalid error handling of a requested irq

Semantics of NR_IRQS is different on machines with SPARSE_IRQ option
disabled or enabled, in the latter case IRQs are allocated starting
at least from the value specified by NR_IRQS and going upwards, so
the check of (irq >= NR_IRQ) to decide about an error code returned by
platform_get_irq() is completely invalid, don't attempt to overrule
irq subsystem in the driver.

The change fixes lpc32xx_keys driver initialization on boot:

  lpc32xx_keys 40050000.key: failed to get platform irq
  lpc32xx_keys: probe of 40050000.key failed with error -22

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - fix debug for sensor clip
Nick Dyer [Thu, 8 Dec 2016 01:20:06 +0000 (17:20 -0800)]
Input: synaptics-rmi4 - fix debug for sensor clip

The debug would only ever output zero for the clip information.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Reviewed-by: Andrew Duggan <aduggan@synaptics.com>
Tested-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - store the attn data in the driver
Benjamin Tissoires [Sat, 3 Dec 2016 01:49:10 +0000 (17:49 -0800)]
Input: synaptics-rmi4 - store the attn data in the driver

Now that we have a proper API to set the attention data, there is
no point in keeping it in the transport driver.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - allow to add attention data
Benjamin Tissoires [Sat, 3 Dec 2016 01:48:51 +0000 (17:48 -0800)]
Input: synaptics-rmi4 - allow to add attention data

The HID implementation of RMI4 provides the data during
the interrupt (in the input report). We need to provide
a way for this transport driver to provide the attention
data while calling an IRQ.

We use a fifo in rmi_core to not lose any incoming event.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - f03 - grab data passed by transport device
Dennis Wassenberg [Sat, 3 Dec 2016 01:45:29 +0000 (17:45 -0800)]
Input: synaptics-rmi4 - f03 - grab data passed by transport device

First check if there are data available passed by the transport device.
If data available use these data. If there are no data available
try to read the rmi block if dsata are passed this way.

This is the way the other rmi function handlers will do this.

This patch is needed on HID devices because the firmware reads F03 data
registers and adds them to the HID attention report. Reading those
registers from the driver after the firmware read them will result in
invalid data.

Reviewed-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - add support for F03
Lyude Paul [Sat, 3 Dec 2016 00:59:07 +0000 (16:59 -0800)]
Input: synaptics-rmi4 - add support for F03

This adds basic functionality for PS/2 passthrough on Synaptics
Touchpads using RMI4 through smbus.

Reviewed-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: imx6ul_tsc - convert int to u32
Guy Shapiro [Wed, 30 Nov 2016 18:25:11 +0000 (10:25 -0800)]
Input: imx6ul_tsc - convert int to u32

The code uses of_property_read_u32 and expects positive values.  However,
the values are stored in signed int variables.  Additionally, the registers
values are also stored in signed variables without a good reason
(readl/writel expect u32).

The only time this caused a real bug was in the new average-samples
property, in which the property is numerically compared and implicitly
expected to be positive.

I believe it's better to change all the properties and registers to u32,
for consistency and warnings reduction.

Signed-off-by: Guy Shapiro <guy.shapiro@mobi-wize.com>
Reported-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: imx6ul_tsc - add mask when set REG_ADC_CFG
Haibo Chen [Wed, 30 Nov 2016 17:02:06 +0000 (09:02 -0800)]
Input: imx6ul_tsc - add mask when set REG_ADC_CFG

Add mask of each function bits of REG_ADC_CFG, and clear these
function bits first, otherwise use '|=' operation may get the
wrong setting which depends on the original value of REG_ADC_CFG.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Guy Shapiro <guy.shapiro@mobi-wize.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - have only one struct platform data
Benjamin Tissoires [Thu, 1 Dec 2016 01:01:50 +0000 (17:01 -0800)]
Input: synaptics-rmi4 - have only one struct platform data

If struct rmi_device_platform_data contains pointers to other struct,
it gets difficult to allocate a fixed size struct and copy it over between
drivers.

Change the pointers into a struct and change the code in rmi4 accordingly.

Reviewed-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - remove EXPORT_SYMBOL_GPL for internal functions
Benjamin Tissoires [Thu, 1 Dec 2016 01:00:28 +0000 (17:00 -0800)]
Input: synaptics-rmi4 - remove EXPORT_SYMBOL_GPL for internal functions

those functions should not be used outside of rmi_core.ko.
There is no point in exporting them to the world.

It looks like rmi_read_pdt_entry() should be static too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - remove mutex calls while updating the firmware
Benjamin Tissoires [Thu, 1 Dec 2016 00:59:30 +0000 (16:59 -0800)]
Input: synaptics-rmi4 - remove mutex calls while updating the firmware

This partially reverts commit 29fd0ec2bdbe ("Input: synaptics-rmi4 -
add support for F34 device reflash")

irq_mutex should be used only to protect data->current_irq_mask, not
preventing incoming input to be processed while the upgrade of the
firmware is happening. We can simply disable the irqs when we don't
want them to interfere with the upgrade process.

Tested on S7300 and S7800 (with F34 v7 patch added)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: drv2667 - fix misuse of regmap_update_bits
Florian Vaussard [Wed, 30 Nov 2016 01:39:25 +0000 (17:39 -0800)]
Input: drv2667 - fix misuse of regmap_update_bits

Using regmap_update_bits(..., mask, 1) with 'mask' following (1 << k)
and k greater than 0 is wrong. Indeed, _regmap_update_bits will perform
(mask & 1), which results in 0 if LSB of mask is 0. Thus the call
regmap_update_bits(..., mask, 1) is in reality equivalent to
regmap_update_bits(..., mask, 0).

In such a case, the correct use is regmap_update_bits(..., mask, mask).

This driver is performing such a mistake with the DRV2667_STANDBY mask,
which equals (1 << 6). Fix the driver to make it consistent with the
API, and fix the alignment problem at the same time. Please note that
this change is untested, as I do not have this piece of hardware.
Testers are welcome!

Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: drv2665 - fix misuse of regmap_update_bits
Florian Vaussard [Wed, 30 Nov 2016 01:38:58 +0000 (17:38 -0800)]
Input: drv2665 - fix misuse of regmap_update_bits

Using regmap_update_bits(..., mask, 1) with 'mask' following (1 << k)
and k greater than 0 is wrong. Indeed, _regmap_update_bits will perform
(mask & 1), which results in 0 if LSB of mask is 0. Thus the call
regmap_update_bits(..., mask, 1) is in reality equivalent to
regmap_update_bits(..., mask, 0).

In such a case, the correct use is regmap_update_bits(..., mask, mask).

This driver is performing such a mistake with the DRV2665_STANDBY mask,
which equals BIT(6). Fix the driver to make it consistent with the API,
and fix the alignment problem at the same time. Please note that this
change is untested, as I do not have this piece of hardware. Testers
are welcome!

Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - add rmi_enable/disable_irq
Benjamin Tissoires [Wed, 30 Nov 2016 01:42:13 +0000 (17:42 -0800)]
Input: synaptics-rmi4 - add rmi_enable/disable_irq

Set the .enabled boolean and trigger an event processing when enabling
for edge-triggered systems.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - remove unused fields in struct rmi_driver_data
Benjamin Tissoires [Wed, 30 Nov 2016 01:42:01 +0000 (17:42 -0800)]
Input: synaptics-rmi4 - remove unused fields in struct rmi_driver_data

These fields are not used anywhere, there is no point in carrying them.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - fix documentation of rmi_2d_sensor_platform_data
Benjamin Tissoires [Wed, 30 Nov 2016 01:41:50 +0000 (17:41 -0800)]
Input: synaptics-rmi4 - fix documentation of rmi_2d_sensor_platform_data

Typos...

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: ALPS - clean up code for SS5 hardware
Paul Donohue [Tue, 29 Nov 2016 04:16:21 +0000 (20:16 -0800)]
Input: ALPS - clean up code for SS5 hardware

The return value of alps_get_pkt_id_ss4_v2() should really be "enum
SS4_PACKET_ID", not "unsigned char".  Correct this.

Also, most of the Alps SS5 (SS4 v2) packet byte parsing code is implemented
using macros, but there are a few places where bytes are directly
manipulated in alps.c.  For consistency, migrate the rest of these to
macros.

Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Paul Donohue <linux-kernel@PaulSD.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: ALPS - clean up TrackStick handling for SS5 hardware
Paul Donohue [Tue, 29 Nov 2016 04:13:47 +0000 (20:13 -0800)]
Input: ALPS - clean up TrackStick handling for SS5 hardware

For consistency and clarity, the input_report_*() functions should be
called by alps_process_packet_ss4_v2() instead of by alps_decode_ss4_v2().

Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Paul Donohue <linux-kernel@PaulSD.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: ALPS - fix TrackStick support for SS5 hardware
Paul Donohue [Tue, 29 Nov 2016 04:11:25 +0000 (20:11 -0800)]
Input: ALPS - fix TrackStick support for SS5 hardware

The current Alps SS5 (SS4 v2) code generates bogus TouchPad events when
TrackStick packets are processed.

This causes the xorg synaptics driver to print
"unable to find touch point 0" and
"BUG: triggered 'if (priv->num_active_touches > priv->num_slots)'"
messages.  It also causes unexpected TouchPad button release and re-click
event sequences if the TrackStick is moved while holding a TouchPad
button.

This commit corrects the problem by adjusting alps_process_packet_ss4_v2()
so that it only sends TrackStick reports when processing TrackStick
packets.

Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Paul Donohue <linux-kernel@PaulSD.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: imx6ul_tsc - add support for sample averaging
Guy Shapiro [Mon, 28 Nov 2016 04:40:39 +0000 (20:40 -0800)]
Input: imx6ul_tsc - add support for sample averaging

The i.MX6UL internal touchscreen controller contains an option to
average upon samples. This feature reduces noise from the produced
touch locations.

This patch adds sample averaging support to the imx6ul_tsc device
driver.

Signed-off-by: Guy Shapiro <guy.shapiro@mobi-wize.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: xpad - fix Xbox One rumble stopping after 2.5 secs
Cameron Gutman [Mon, 28 Nov 2016 04:37:56 +0000 (20:37 -0800)]
Input: xpad - fix Xbox One rumble stopping after 2.5 secs

Unlike previous Xbox pads, the Xbox One pad doesn't have "sticky" rumble
packets. The duration is encoded into the command and expiration is handled
by the pad firmware.

ff-memless needs pseudo-sticky behavior for rumble effects to behave
properly for long duration effects. We already specify the maximum rumble
on duration in the command packets, but it's still only good for about 2.5
seconds of rumble. This is easily reproducible running fftest's sine
vibration test.

It turns out there's a repeat count encoded in the rumble command. We can
abuse that to get the pseudo-sticky behavior needed for rumble to behave as
expected for effects with long duration.

By my math, this change should allow a single ff_effect to rumble for 10
minutes straight, which should be more than enough for most needs.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: xpad - add product ID for Xbox One S pad
Cameron Gutman [Mon, 28 Nov 2016 04:37:31 +0000 (20:37 -0800)]
Input: xpad - add product ID for Xbox One S pad

This is the new gamepad that ships with the Xbox One S which
includes Bluetooth functionality.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: soc_button_array - bail out earlier if gpiod_count is zero
Benjamin Tissoires [Fri, 25 Nov 2016 19:36:01 +0000 (11:36 -0800)]
Input: soc_button_array - bail out earlier if gpiod_count is zero

The PNP0C40 device of the Surface 3 doesn't have any GPIO attached to it.
Instead of trying to access the GPIO, request the count beforehand and
bail out if it is null or if an error is returned.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: soc_button_array - use gpio_is_valid()
Benjamin Tissoires [Fri, 25 Nov 2016 19:20:43 +0000 (11:20 -0800)]
Input: soc_button_array - use gpio_is_valid()

gpio_keys will later use gpio_is_valid(). To match the actual
behavior, we should use it here too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: i8042 - fix typo from i8042_aux_close to i8042_port_close
Marcos Paulo de Souza [Wed, 23 Nov 2016 02:03:35 +0000 (18:03 -0800)]
Input: i8042 - fix typo from i8042_aux_close to i8042_port_close

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - propagate correct number of rx and tx electrodes to F54
Guenter Roeck [Wed, 23 Nov 2016 01:57:02 +0000 (17:57 -0800)]
Input: synaptics-rmi4 - propagate correct number of rx and tx electrodes to F54

F54 diagnostics report functions provide data based on the number of
enabled rx and tx electrodes, which is not identical to the number of
electrodes reported with F54:Query0 and F54:Query1. Those values report
the number of supported electrodes, not the number of enabled electrodes.
The number of enabled electrodes can be determined by analyzing F55:Ctrl1
(sensor receiver assignment) and F55:Ctrl2 (sensor transmitter assignment).

Propagate the number of enabled electrodes from F55 to F54 to avoid
corrupted output if not all electrodes are enabled.

Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 ...")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - add support for F55 sensor tuning
Guenter Roeck [Wed, 23 Nov 2016 01:53:26 +0000 (17:53 -0800)]
Input: synaptics-rmi4 - add support for F55 sensor tuning

Sensor tuning support is needed to determine the number of enabled
tx and rx electrodes for use in F54 functions.

The number of enabled electrodes is not identical to the total number
of electrodes as reported with F55:Query0 and F55:Query1. It has to be
calculated by analyzing F55:Ctrl1 (sensor receiver assignment) and
F55:Ctrl2 (sensor transmitter assignment).

Support for additional sensor tuning functions may be added later.

Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 ...")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - add support for F34 device reflash
Nick Dyer [Wed, 23 Nov 2016 01:44:12 +0000 (17:44 -0800)]
Input: synaptics-rmi4 - add support for F34 device reflash

Add support for updating firmware, triggered by a sysfs attribute.

This patch has been tested on Synaptics S7300.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Tested-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: gpio_keys - set input direction explicitly
Sudeep Holla [Thu, 17 Nov 2016 01:01:26 +0000 (17:01 -0800)]
Input: gpio_keys - set input direction explicitly

Commit 700a38b27eef ("Input: gpio_keys - switch to using generic device
properties") switched to use generic device properties for GPIO keys and
commit 5feeca3c1e39 ("Input: gpio_keys - add support for GPIO descriptors")
switched from legacy GPIO numbers to GPIO descriptors.

Previously devm_gpio_request_one was explicitly passed GPIOF_DIR_IN flag
to set the GPIO direction as input. However devm_get_gpiod_from_child
doesn't have such provisions and hence fwnode_get_named_gpiod can't set
it as input.

This breaks few platforms with the following error:
" gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
  unable to lock HW IRQ <n> for IRQ
  genirq: Failed to request resources for POWER (irq <x>) on irqchip
  gpio_keys: Unable to claim irq <x>; error -22
  gpio-keys: probe failed with error -22 "

This patch fixes the issue by setting input direction explicitly for
gpio lines described by generic properties.

Fixes: 700a38b27eef ("Input: gpio_keys - switch to using generic device properties")
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: synaptics-rmi4 - unlock on error
Dan Carpenter [Thu, 17 Nov 2016 01:23:22 +0000 (17:23 -0800)]
Input: synaptics-rmi4 - unlock on error

We should unlock before returning on this error path.

Fixes: 3a762dbd5347 ('[media] Input: synaptics-rmi4 - add support for F54 diagnostics')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: raydium_i2c_ts - fix spelling mistake in dev_err message
Colin Ian King [Thu, 17 Nov 2016 01:19:57 +0000 (17:19 -0800)]
Input: raydium_i2c_ts - fix spelling mistake in dev_err message

Trivial fix to spelling mistake "failied" to "failed" in
dev_err message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: silead - add regulator support
Hans de Goede [Wed, 16 Nov 2016 17:37:08 +0000 (09:37 -0800)]
Input: silead - add regulator support

On some tablets the touchscreen controller is powered by separate
regulators, add support for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
7 years agoInput: bma150 - avoid binding to bma180 if IIO bma180 driver present
Hans de Goede [Mon, 14 Nov 2016 18:51:36 +0000 (10:51 -0800)]
Input: bma150 - avoid binding to bma180 if IIO bma180 driver present

commit ef3714fdbc8d ("Input: bma150 - extend chip detection for bma180"),
adds bma180 chip-ids to the input bma150 driver, assuming that they are
100% compatible, but the bma180 is not compatible with the bma150 at all,
it has 14 bits resolution instead of 10, and it has quite different
control registers too.

Treating the bma180 as a bma150 wrt its data registers will just result
in throwing away the lowest 4 bits, which is not too bad. But the ctrl
registers are a different story. Things happen to just work but supporting
that certainly does not make treating the bma180 the same as the bma150
right.

Since some setups depend on the evdev interface the bma150 driver offers
on top of the bma180, we cannot simply remove the bma180 ids.

So this commit only removes the bma180 id when the bma180 iio driver,
which does treat the bma180 properly, is enabled.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
8 years agoInput: synaptics-rmi4 - add SMBus support
Benjamin Tissoires [Wed, 9 Nov 2016 01:05:58 +0000 (17:05 -0800)]
Input: synaptics-rmi4 - add SMBus support

Code obtained from https://raw.githubusercontent.com/mightybigcar/synaptics-rmi4/jf/drivers/input/rmi4/rmi_smbus.c
and updated to match upstream. And fixed to make it work.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
8 years agoInput: synaptics-rmi4 - set the ABS_MT_TOOL_TYPE bit to report tool type
Andrew Duggan [Wed, 9 Nov 2016 01:03:16 +0000 (17:03 -0800)]
Input: synaptics-rmi4 - set the ABS_MT_TOOL_TYPE bit to report tool type

The rmi4 2D sensor functions report the tool type via
input_mt_report_slot_state(), but the abs parameter bit has not been
set so the tool type is not reported to userspace. This patch set
the ABS_MT_TOOL_TYPE bit.

Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
8 years agoInput: synaptics-rmi4 - add support for controlling dribble packets in F12
Andrew Duggan [Wed, 9 Nov 2016 00:47:58 +0000 (16:47 -0800)]
Input: synaptics-rmi4 - add support for controlling dribble packets in F12

Implements reading and setting the dribble bit in F12's control registers.

Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
8 years agoInput: synaptics-rmi4 - add parameters for dribble packets and palm detect gesture
Andrew Duggan [Wed, 9 Nov 2016 00:48:48 +0000 (16:48 -0800)]
Input: synaptics-rmi4 - add parameters for dribble packets and palm detect gesture

The rmi_f11 driver currently disables dribble packets and the palm detect
gesture for all devices. This patch creates a parameter in the 2d sensor
platform data for controlling this functionality on a per device basis.

For more information on dribble packets:
Commit 05ba999fcabb ("HID: rmi: disable dribble packets on Synaptics
touchpads")

For more information on the palm detect gesture:
Commit f097deef59a6 ("HID: rmi: disable palm detect gesture when present")

Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>