]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/log
mirror_ubuntu-jammy-kernel.git
3 years agoInput: elants_i2c - detect enum overflow
Josh Poimboeuf [Thu, 11 Feb 2021 20:50:37 +0000 (12:50 -0800)]
Input: elants_i2c - detect enum overflow

If an enum value were to get added without updating this switch
statement, the unreachable() annotation would trigger undefined
behavior, causing execution to fall through the end of the function,
into the next one.

Make the error handling more robust for an unexpected enum value, by
doing BUG() instead of unreachable().

Fixes the following objtool warning:

  drivers/input/touchscreen/elants_i2c.o: warning: objtool: elants_i2c_initialize() falls through to next function elants_i2c_resume()

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/59e2e82d1e40df11ab38874c03556a31c6b2f484.1612974132.git.jpoimboe@redhat.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: zinitix - remove unneeded semicolon
Yang Li [Fri, 5 Feb 2021 19:50:52 +0000 (11:50 -0800)]
Input: zinitix - remove unneeded semicolon

Eliminate the following coccicheck warning:
./drivers/input/touchscreen/zinitix.c:164:31-32: Unneeded semicolon

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/r/1612319443-115831-1-git-send-email-yang.lee@linux.alibaba.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: iqs5xx - initialize an uninitialized variable
Jeff LaBundy [Mon, 25 Jan 2021 18:13:14 +0000 (10:13 -0800)]
Input: iqs5xx - initialize an uninitialized variable

If execution jumps to the err_kfree label, error_bl is evaluated
before it is initialized. Fix this by initializing it to zero.

Fixes: 2539da6677b6 ("Input: iqs5xx - preserve bootloader errors")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/1611592500-32209-1-git-send-email-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: Add N64 controller driver
Lauri Kasanen [Mon, 25 Jan 2021 04:53:53 +0000 (20:53 -0800)]
Input: Add N64 controller driver

This adds support for the four built-in controller
ports on the Nintendo 64 console. The N64 controller
includes an analog stick, a d-pad, and several buttons.

No module support as the target has only 8mb ram.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Link: https://lore.kernel.org/r/20210115133408.0acd70163b582b77ad0a029b@gmx.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: iqs5xx - allow device to be a wake-up source
Jeff LaBundy [Mon, 25 Jan 2021 04:44:26 +0000 (20:44 -0800)]
Input: iqs5xx - allow device to be a wake-up source

Avoid placing the device in suspend mode (from which it cannot
generate interrupts) if it is defined as a wake-up source. The
device is still permitted to enter a low-power sensing mode on
its own.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/1611002626-5889-11-git-send-email-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: iqs5xx - allow more time for ATI to complete
Jeff LaBundy [Mon, 25 Jan 2021 04:41:38 +0000 (20:41 -0800)]
Input: iqs5xx - allow more time for ATI to complete

After the device is initialized, it runs ATI (calibration) during
which it cannot readily respond to I2C communication. To keep the
open and close callbacks from writing to the device too soon, the
driver waits 100 ms before returning from probe.

The vendor reports that ATI may actually take up to 250 ms to run
(including margin), so increase the delay accordingly. Update the
comments to clarify the reason for the delay as well.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/1611002626-5889-9-git-send-email-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: iqs5xx - eliminate unnecessary register read
Jeff LaBundy [Mon, 25 Jan 2021 04:40:51 +0000 (20:40 -0800)]
Input: iqs5xx - eliminate unnecessary register read

Instead of relying on firmware to enable important register fields
and performing read-modify-write operations to additionally enable
the fields the driver cares about, it's much simpler just to write
all of the pertinent fields explicitly.

This avoids an unnecessary register read operation at start-up and
makes way for the iqs5xx_read_byte() helper to be dropped.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/1611002626-5889-8-git-send-email-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: iqs5xx - simplify axis setup logic
Jeff LaBundy [Mon, 25 Jan 2021 04:33:37 +0000 (20:33 -0800)]
Input: iqs5xx - simplify axis setup logic

The present implementation manipulates axis swap and inversion fields
in the device to more or less duplicate what touchscreen_report_pos()
does. The resulting logic is convoluted and difficult to follow.

Instead report the maximum X and Y coordinates in earnest as they are
read from the device, then let touchscreen_parse_properties() fix the
axes up as necessary. Finally, use touchscreen_report_pos() to report
the transformed coordinates.

Last but not least, the maximum X and Y coordinates are not functions
of the number of rows/columns that comprise the touch surface. Either
coordinate is simply limited to 1 below what is reported for absolute
X or Y coordinates when no fingers are present (0xFFFF).

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/1611002626-5889-7-git-send-email-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: iqs5xx - re-initialize device upon warm reset
Jeff LaBundy [Mon, 25 Jan 2021 04:29:38 +0000 (20:29 -0800)]
Input: iqs5xx - re-initialize device upon warm reset

The device may be inadvertently reset during runtime in the event
of ESD strike, etc. To protect against this case, acknowledge the
SHOW_RESET interrupt and re-initialize the device.

To facilitate this change, expand the range of registers that are
read in the interrupt handler to include the system status fields.

Also, update the unrelated (but nearby) SUSPEND register field to
use the BIT() macro. The remaining register fields are cleaned up
in another patch.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/1611002626-5889-6-git-send-email-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: iqs5xx - accommodate bootloader latency
Jeff LaBundy [Mon, 25 Jan 2021 04:17:08 +0000 (20:17 -0800)]
Input: iqs5xx - accommodate bootloader latency

The bootloader NAK's all I2C communication after the first 64-byte
bulk write if the bus frequency is equal to 400 kHz. This prevents
the platform from pushing updated firmware to the device.

The vendor's USB bootloader programming dongle appears to insert a
delay between the "open" command and the first 64-byte bulk write.
Adding a similar delay to the driver seems to eliminate the issue.

Furthermore, the dongle does not access the bootloader immediately
after powering up the device. Follow suit by adding a delay before
the "open" command to avoid wasted retries at 400 kHz.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/1611002626-5889-4-git-send-email-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: iqs5xx - preserve bootloader errors
Jeff LaBundy [Mon, 25 Jan 2021 04:14:50 +0000 (20:14 -0800)]
Input: iqs5xx - preserve bootloader errors

After user space writes the fw_file attribute to push new firmware
to the device, the driver calls iqs5xx_dev_init() to re-initialize
the device with the updated firmware or recover the device in case
the update failed.

In the case of the latter, however, iqs5xx_fw_file_write() returns
zero (success) so long as iqs5xx_dev_init() does not fail, and any
error encountered during the update process is lost. Solve this by
saving the error before calling iqs5xx_dev_init().

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/1611002626-5889-3-git-send-email-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: iqs5xx - minor cosmetic improvements
Jeff LaBundy [Mon, 25 Jan 2021 04:14:35 +0000 (20:14 -0800)]
Input: iqs5xx - minor cosmetic improvements

Copyrights are generally followed by the name of a person or a
company (i.e. the copyright holder) but that was not done here.
Fix this by squashing the 'copyright' and 'author' lines.

Also, trim some leading whitespace ahead of the parameters for
the fw_file_store() function and re-align them for readability.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/1611002626-5889-2-git-send-email-jeff@labundy.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: elants_i2c - add support for eKTF3624
Michał Mirosław [Sun, 24 Jan 2021 22:28:01 +0000 (14:28 -0800)]
Input: elants_i2c - add support for eKTF3624

Add ELAN KTF3624 touchscreen support to the elants_i2c driver.
The eKTF3624 TS is found on a series of ASUS Transformer tablet devices,
Nexus 7 tablet and etc. The firmware interface of eKTF3624 is nearly
identical to eKTH3500, which is already supported by the driver.
The minor differences of the firmware interface are now handled by
the driver. The eKTF3624 support was tested on ASUS Transformer TF700T,
TF300T and Nexus 7 tablets.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20210124195414.27333-1-digetx@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: ads7846 - convert to one message
Oleksij Rempel [Thu, 21 Jan 2021 07:18:28 +0000 (23:18 -0800)]
Input: ads7846 - convert to one message

Convert multiple full duplex transfers in to a single transfer to reduce
CPU load.

Current driver version support following filtering modes:
- ads7846_no_filter() - not filtered
- ads7846_debounce_filter() - driver specific debounce filter
- pdata->filter - platform specific debounce filter (do any platform
provides such filter?)

Without filter this HW is not really usable, since the physic of
resistive touchscreen can provide some bounce effects. With driver internal
filter, we have constant amount of retries + debounce retries if some anomaly
was detected.

High amount of tiny SPI transfers is the primer reason of high CPU load
and interrupt frequency.

This patch create one SPI transfer with all fields and not optional retires. If
bounce anomaly was detected, we will make more transfer if needed.

Without this patch, we will get about 10% CPU load on iMX6S on pen-down event.
For example by holding stylus on the screen.

With this patch, depending in the amount of retries, the CPU load will
be 1% with "ti,debounce-rep = <3>".

One buffer transfer allows us to use PIO FIFO or DMA engine, depending
on the platform.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20201110085041.16303-3-o.rempel@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: stmpe-ts - add description for 'prop' struct member
Lee Jones [Wed, 20 Jan 2021 02:23:23 +0000 (18:23 -0800)]
Input: stmpe-ts - add description for 'prop' struct member

Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/stmpe-ts.c:82: warning: Function parameter or member 'prop' not described in 'stmpe_touch'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210114152323.2382283-6-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: surface3_spi - remove set but unused variable 'timestamp'
Lee Jones [Wed, 20 Jan 2021 02:22:29 +0000 (18:22 -0800)]
Input: surface3_spi - remove set but unused variable 'timestamp'

Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/surface3_spi.c: In function ‘surface3_spi_process_touch’:
 drivers/input/touchscreen/surface3_spi.c:97:6: warning: variable ‘timestamp’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20210114152323.2382283-5-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: usbtouchscreen - actually check return value of usb_submit_urb()
Lee Jones [Wed, 20 Jan 2021 02:19:04 +0000 (18:19 -0800)]
Input: usbtouchscreen - actually check return value of usb_submit_urb()

Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/usbtouchscreen.c: In function ‘nexio_read_data’:
 drivers/input/touchscreen/usbtouchscreen.c:1052:50: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210114152323.2382283-4-lee.jones@linaro.org
[dtor: log error code as well]
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: melfas_mip4 - mark a bunch of variables as __always_unused
Lee Jones [Wed, 20 Jan 2021 02:17:53 +0000 (18:17 -0800)]
Input: melfas_mip4 - mark a bunch of variables as __always_unused

Dmitry requested to keep these around for the purposes of documentation.

Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/melfas_mip4.c: In function ‘mip4_report_touch’:
 drivers/input/touchscreen/melfas_mip4.c:474:5: warning: variable ‘size’ set but not used [-Wunused-but-set-variable]
 drivers/input/touchscreen/melfas_mip4.c:472:5: warning: variable ‘pressure_stage’ set but not used [-Wunused-but-set-variable]
 drivers/input/touchscreen/melfas_mip4.c:469:7: warning: variable ‘palm’ set but not used [-Wunused-but-set-variable]
 drivers/input/touchscreen/melfas_mip4.c:468:7: warning: variable ‘hover’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210114152323.2382283-3-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: synaptics - replace NOOP with suitable commentary
Lee Jones [Wed, 20 Jan 2021 02:43:11 +0000 (18:43 -0800)]
Input: synaptics - replace NOOP with suitable commentary

Fixes the following W=1 kernel build warning(s):

 drivers/input/mouse/synaptics.c: In function ‘synaptics_process_packet’:
 drivers/input/mouse/synaptics.c:1110:6: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210114152323.2382283-2-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: omap4-keypad - implement errata check for lost key-up events
Tony Lindgren [Mon, 11 Jan 2021 06:20:25 +0000 (22:20 -0800)]
Input: omap4-keypad - implement errata check for lost key-up events

We are still missing handling for errata i689 related issues for the
case where we never see a key up interrupt for the last pressed key.

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

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

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

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/X/vrygoBxzGyXhfc@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: omap4-keypad - use PM runtime autosuspend
Tony Lindgren [Mon, 11 Jan 2021 06:16:51 +0000 (22:16 -0800)]
Input: omap4-keypad - use PM runtime autosuspend

Implement PM runtime autosuspend support to prepare for adding handling to
clear stuck last pressed key in the following patches. The hardware has
support for autoidle and can wake up to keypress events.

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

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/X/vqCs5/EDURprAJ@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: omap4-keypad - move rest of key scanning to a separate function
Tony Lindgren [Mon, 11 Jan 2021 04:28:40 +0000 (20:28 -0800)]
Input: omap4-keypad - move rest of key scanning to a separate function

Let's move rest of the key scanning code to omap4_keypad_scan_keys().
We will use omap4_keypad_scan_keys() also for implementing errata
handling to clear the stuck last key in the following patch.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20210110190529.46135-4-tony@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: omap4-keypad - scan keys in two phases and simplify with bitmask
Tony Lindgren [Mon, 11 Jan 2021 02:50:53 +0000 (18:50 -0800)]
Input: omap4-keypad - scan keys in two phases and simplify with bitmask

Because of errata i689 the keyboard can idle with state where no key
up interrupts are seen until after the next key press.

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

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

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

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20210110190529.46135-3-tony@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: omap4-keypad - disable unused long interrupts
Tony Lindgren [Mon, 11 Jan 2021 02:29:45 +0000 (18:29 -0800)]
Input: omap4-keypad - disable unused long interrupts

We are not using the long events and they produce extra interrupts.
Let's not enable them at all.

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

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20210110190529.46135-2-tony@atomide.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: omap4-keypad - switch to use managed resources
Dmitry Torokhov [Mon, 11 Jan 2021 02:19:59 +0000 (18:19 -0800)]
Input: omap4-keypad - switch to use managed resources

Now that input core supports devres-managed input devices we can clean
up this driver a bit.

Link: https://lore.kernel.org/r/X/qfJKiM21uyksYl@google.com
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: imx_keypad - add dependency on HAS_IOMEM
Dmitry Torokhov [Fri, 18 Dec 2020 18:03:12 +0000 (10:03 -0800)]
Input: imx_keypad - add dependency on HAS_IOMEM

devm_platform_ioremap_resource() depends on CONFIG_HAS_IOMEM, so let's add
it to the dependencies when COMPILE_TEST is enabled.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: c8834032ffe2 ("Input: imx_keypad - add COMPILE_TEST support")
Link: https://lore.kernel.org/r/X9llpA3w1zlZCHXU@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: da7280 - protect OF match table with CONFIG_OF
Dmitry Torokhov [Fri, 18 Dec 2020 18:01:33 +0000 (10:01 -0800)]
Input: da7280 - protect OF match table with CONFIG_OF

The OF match table is only used when OF is enabled.

Fixes: cd3f609823a5 ("Input: new da7280 haptic driver")
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Roy Im <roy.im.opensource@diasemi.com>
Link: https://lore.kernel.org/r/X9xRLVPt9eBi0CT6@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: raydium_ts_i2c - do not send zero length
jeffrey.lin [Tue, 15 Dec 2020 18:50:12 +0000 (10:50 -0800)]
Input: raydium_ts_i2c - do not send zero length

Add default write command package to prevent i2c quirk error of zero
data length as Raydium touch firmware update is executed.

Signed-off-by: jeffrey.lin <jeffrey.lin@rad-ic.com>
Link: https://lore.kernel.org/r/1608031217-7247-1-git-send-email-jeffrey.lin@raydium.corp-partner.google.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: da7280 - fix missing error test
Dmitry Torokhov [Wed, 16 Dec 2020 01:41:16 +0000 (17:41 -0800)]
Input: da7280 - fix missing error test

An "if" testing for error condition has accidentally been dropped from
the code.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: cd3f609823a5 ("Input: new da7280 haptic driver")
Reviewed-by: Roy Im <Roy.Im.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/X9j8lGFgijzHyYZZ@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: da7280 - fix spelling mistake "sequemce" -> "sequence"
Colin Ian King [Mon, 14 Dec 2020 22:59:44 +0000 (14:59 -0800)]
Input: da7280 - fix spelling mistake "sequemce" -> "sequence"

There is a spelling mistake in a dev_err message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20201214223109.82924-1-colin.king@canonical.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: cyapa_gen6 - fix out-of-bounds stack access
Arnd Bergmann [Mon, 14 Dec 2020 21:37:46 +0000 (13:37 -0800)]
Input: cyapa_gen6 - fix out-of-bounds stack access

gcc -Warray-bounds warns about a serious bug in
cyapa_pip_retrieve_data_structure:

drivers/input/mouse/cyapa_gen6.c: In function 'cyapa_pip_retrieve_data_structure.constprop':
include/linux/unaligned/access_ok.h:40:17: warning: array subscript -1 is outside array bounds of 'struct retrieve_data_struct_cmd[1]' [-Warray-bounds]
   40 |  *((__le16 *)p) = cpu_to_le16(val);
drivers/input/mouse/cyapa_gen6.c:569:13: note: while referencing 'cmd'
  569 |  } __packed cmd;
      |             ^~~

Apparently the '-2' was added to the pointer instead of the value,
writing garbage into the stack next to this variable.

Fixes: c2c06c41f700 ("Input: cyapa - add gen6 device module support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20201026161332.3708389-1-arnd@kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: sc27xx - add support for sc2730 and sc2721
Nemo Han [Sat, 12 Dec 2020 02:44:50 +0000 (18:44 -0800)]
Input: sc27xx - add support for sc2730 and sc2721

Add new compatible strings and match data to support sc2730 and sc2721
which are two varieties of SC27XX family.

Signed-off-by: Nemo Han <nemo.han@unisoc.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
Link: https://lore.kernel.org/r/20201117034949.47877-2-zhang.lyra@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agodt-bindings: input: Add compatible string for SC2721 and SC2730
Chunyan Zhang [Sat, 12 Dec 2020 02:44:30 +0000 (18:44 -0800)]
dt-bindings: input: Add compatible string for SC2721 and SC2730

Add new compatible strings to support sc2730 and sc2721 which are
two varieties of SC27XX family.

Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20201117034949.47877-4-zhang.lyra@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agodt-bindings: input: Convert sc27xx-vibra.txt to json-schema
Chunyan Zhang [Sat, 12 Dec 2020 02:44:14 +0000 (18:44 -0800)]
dt-bindings: input: Convert sc27xx-vibra.txt to json-schema

Convert the sprd sc27xx vibrator binding to DT schema using json-schema.

Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20201117034949.47877-3-zhang.lyra@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: stmpe - add axis inversion and swapping capability
Stefan Riedmueller [Mon, 5 Oct 2020 04:12:31 +0000 (21:12 -0700)]
Input: stmpe - add axis inversion and swapping capability

Make use of generic touchscreen_properties structure to add axis
inversion and swapping capabilities. It's configurable via devicetree
properties:
  touchscreen-inverted-x
  touchscreen-inverted-y
  touchscreen-swapped-x-y

Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
Link: https://lore.kernel.org/r/20200922093903.157232-1-s.riedmueller@phytec.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: adp5589-keys - do not explicitly control IRQ for wakeup
Dmitry Torokhov [Fri, 11 Dec 2020 21:14:00 +0000 (13:14 -0800)]
Input: adp5589-keys - do not explicitly control IRQ for wakeup

If device is set up as a wakeup source, I2C core configures the interrupt
line as wake IRQ and PM core automatically configures it for waking up the
system on system suspend transition, so we do not have to explicitly call
enable_irq_wake() and disable_irq_wake() in suspend/resume.

Link: https://lore.kernel.org/r/20201120073920.3214492-2-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: adp5589-keys - do not unconditionally configure as wakeup source
Dmitry Torokhov [Fri, 11 Dec 2020 21:13:25 +0000 (13:13 -0800)]
Input: adp5589-keys - do not unconditionally configure as wakeup source

We should not be configuring the controller as a wakeup source in the
driver, but rather rely on I2C core to mark it as such by either
instantiating as I2C_CLIENT_WAKEUP or specifying "wakeup-source" device
property.

Link: https://lore.kernel.org/r/20201120073920.3214492-1-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: ipx4xx-beeper - convert comma to semicolon
Zheng Yongjun [Fri, 11 Dec 2020 21:00:14 +0000 (13:00 -0800)]
Input: ipx4xx-beeper - convert comma to semicolon

Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201211085032.2598-1-zhengyongjun3@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: parkbd - convert comma to semicolon
Zheng Yongjun [Fri, 11 Dec 2020 20:58:58 +0000 (12:58 -0800)]
Input: parkbd - convert comma to semicolon

Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201211084957.2540-1-zhengyongjun3@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: new da7280 haptic driver
Roy Im [Sun, 29 Nov 2020 03:36:26 +0000 (19:36 -0800)]
Input: new da7280 haptic driver

Adds support for the Dialog DA7280 LRA/ERM Haptic Driver with
multiple mode and integrated waveform memory and wideband support.
It communicates via an I2C bus to the device.

Signed-off-by: Roy Im <roy.im.opensource@diasemi.com>
Reviewed-by: Jes Sorensen <Jes.Sorensen@gmail.com>.
Link: https://lore.kernel.org/r/1e293e8c4830b09255af3b7e1721b73afaefdfa3.1606320459.git.Roy.Im@diasemi.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agodt-bindings: input: Add document bindings for DA7280
Roy Im [Sun, 29 Nov 2020 03:34:58 +0000 (19:34 -0800)]
dt-bindings: input: Add document bindings for DA7280

Add device tree binding information for DA7280 haptic driver.
Example bindings for DA7280 are added.

Signed-off-by: Roy Im <roy.im.opensource@diasemi.com>
Reviewed-by: Rob Herring <robh@kernel.org>.
Link: https://lore.kernel.org/r/2bc9a4a9d083ea8f360ec75f6281b6de6c4ef284.1606320459.git.Roy.Im@diasemi.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoMAINTAINERS: da7280 updates to the Dialog Semiconductor search terms
Roy Im [Sun, 29 Nov 2020 03:34:14 +0000 (19:34 -0800)]
MAINTAINERS: da7280 updates to the Dialog Semiconductor search terms

This patch adds the da7280 bindings doc and driver to the Dialog
Semiconductor support list.

Signed-off-by: Roy Im <roy.im.opensource@diasemi.com>
Link: https://lore.kernel.org/r/e2a01173699486519f8da85b9283c6af8481fbdb.1606320459.git.Roy.Im@diasemi.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: elantech - fix protocol errors for some trackpoints in SMBus mode
jingle.wu [Fri, 11 Dec 2020 07:49:16 +0000 (23:49 -0800)]
Input: elantech - fix protocol errors for some trackpoints in SMBus mode

There are some version of Elan trackpads that send incorrect data when
in SMbus mode, unless they are switched to use 0x5f reports instead of
standard 0x5e. This patch implements querying device to retrieve chips
identifying data, and switching it, when needed to the alternative
report.

Signed-off-by: Jingle Wu <jingle.wu@emc.com.tw>
Link: https://lore.kernel.org/r/20201211071531.32413-1-jingle.wu@emc.com.tw
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: elan_i2c - add new trackpoint report type 0x5F
Jingle Wu [Fri, 11 Dec 2020 07:40:09 +0000 (23:40 -0800)]
Input: elan_i2c - add new trackpoint report type 0x5F

The 0x5F is a new trackpoint report type used by some modules.

Signed-off-by: Jingle Wu <jingle.wu@emc.com.tw>
Link: https://lore.kernel.org/r/20201211071511.32349-1-jingle.wu@emc.com.tw
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: elants - document some registers and values
Michał Mirosław [Fri, 11 Dec 2020 07:11:17 +0000 (23:11 -0800)]
Input: elants - document some registers and values

Add information found in downstream kernels, to make the code less
magic.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/728fff020bc92be10d84cc2a7ea8af6fd99af96c.1607669375.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: atmel_mxt_ts - simplify the return expression of mxt_send_bootloader_cmd()
Zheng Yongjun [Fri, 11 Dec 2020 06:25:52 +0000 (22:25 -0800)]
Input: atmel_mxt_ts - simplify the return expression of mxt_send_bootloader_cmd()

Simplify the return expression.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201210135943.1612-1-zhengyongjun3@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: imx_keypad - add COMPILE_TEST support
Anson Huang [Fri, 11 Dec 2020 06:01:38 +0000 (22:01 -0800)]
Input: imx_keypad - add COMPILE_TEST support

Add COMPILE_TEST support to imx_keypad driver for better compile
testing coverage.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Link: https://lore.kernel.org/r/1583137573-16628-1-git-send-email-Anson.Huang@nxp.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: applespi - use new structure for SPI transfer delays
Sergiu Cuciurean [Fri, 11 Dec 2020 05:57:36 +0000 (21:57 -0800)]
Input: applespi - use new structure for SPI transfer delays

In a recent change to the SPI subsystem [1], a new `delay` struct was added
to replace the `delay_usecs`. This change replaces the current
`delay_usecs` with `delay` for this driver.

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

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

Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
Tested-by: Ronald Tschalär <ronald@innovation.ch>
Reviewed-by: Ronald Tschalär <ronald@innovation.ch>
Link: https://lore.kernel.org/r/20200227124534.23399-1-sergiu.cuciurean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: synaptics-rmi4 - use new structure for SPI transfer delays
Sergiu Cuciurean [Fri, 11 Dec 2020 05:56:36 +0000 (21:56 -0800)]
Input: synaptics-rmi4 - use new structure for SPI transfer delays

In a recent change to the SPI subsystem [1], a new `delay` struct was added
to replace the `delay_usecs`. This change replaces the current
`delay_usecs` with `delay` for this driver.

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

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

Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
Link: https://lore.kernel.org/r/20200227130336.27042-1-sergiu.cuciurean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: ad7877 - use new structure for SPI transfer delays
Sergiu Cuciurean [Fri, 11 Dec 2020 05:55:31 +0000 (21:55 -0800)]
Input: ad7877 - use new structure for SPI transfer delays

In a recent change to the SPI subsystem [1], a new `delay` struct was added
to replace the `delay_usecs`. This change replaces the current
`delay_usecs` with `delay` for this driver.

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

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

Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
Link: https://lore.kernel.org/r/20200228104508.15564-1-sergiu.cuciurean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: edt-ft5x06 - consolidate handling of number of electrodes
Dmitry Torokhov [Fri, 11 Dec 2020 05:44:00 +0000 (21:44 -0800)]
Input: edt-ft5x06 - consolidate handling of number of electrodes

Instead of special-casing retrieval of number of X/Y electrodes based on
the firmware, let's select default values and mark registers as
non-existent on firmwares that do not support this operation.

Also mark "report rate" register as non-existent for generic firmwares
as having it set to 0 does not make sense.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Simon Budig <simon.budig@kernelconcepts.de>
Link: https://lore.kernel.org/r/X9FZFs3NZADoIhhH@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: tm2-touchkey - add vddio regulator
Stephan Gerhold [Thu, 10 Dec 2020 03:39:07 +0000 (19:39 -0800)]
Input: tm2-touchkey - add vddio regulator

The Samsung touchkey controllers are often used with external pull-up
for the interrupt line and the I2C lines, so we might need to enable
a regulator to bring the lines into usable state. Otherwise, this might
cause spurious interrupts and reading from I2C will fail.

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

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201203131242.44397-3-stephan@gerhold.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agodt-bindings: input: tm2-touchkey: document vddio-supply
Stephan Gerhold [Thu, 10 Dec 2020 03:37:46 +0000 (19:37 -0800)]
dt-bindings: input: tm2-touchkey: document vddio-supply

The Samsung touchkey controllers are often used with external pull-up
for the interrupt line and the I2C lines, so we might need to enable
a regulator to bring the lines into usable state. Otherwise, this might
cause spurious interrupts and reading from I2C will fail.

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

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20201203131242.44397-2-stephan@gerhold.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agodt-bindings: input: tm2-touchkey: convert to yaml
Stephan Gerhold [Thu, 10 Dec 2020 03:37:14 +0000 (19:37 -0800)]
dt-bindings: input: tm2-touchkey: convert to yaml

Convert the device tree bindings for tm2-touchkey to the YAML format.

While we're at it, clarify the descriptions a bit to make it clear that
this driver can be used for many different MCUs that all implement
a similar I2C protocol. Depending on the MCU the voltage requirements
may be different, on some devices the controller uses 2.2V, 2.8V or
even 3.3V for vcc-supply instead of 1.8V.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20201203131242.44397-1-stephan@gerhold.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: cyapa - switch to using devm_add_action_or_reset()
Fuqian Huang [Sat, 13 Jul 2019 08:04:12 +0000 (01:04 -0700)]
Input: cyapa - switch to using devm_add_action_or_reset()

devm_add_action_or_reset() is introduced as a helper function which
internally calls devm_add_action(). If devm_add_action() fails
then it will execute the action mentioned and return the error code.
This reduce source code size (avoid writing the action twice)
and reduce the likelyhood of bugs.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Link: https://lore.kernel.org/linux-input/20190708123323.11943-1-huangfq.daxian@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: add driver for power button on Dell Wyse 3020
Lubomir Rintel [Thu, 10 Dec 2020 01:45:14 +0000 (17:45 -0800)]
Input: add driver for power button on Dell Wyse 3020

This adds support for the power button attached to the Embedded Controller
on a Dell Wyse 3020 "Ariel" board.

The Embedded Controller's SPI interface is actually capable sending and
receiving the PS/2 keyboard and mouse protocol data, which looks like
a good fit for a serio driver. Howerver, I don't know of any machines where
this is actually used.

My board only has a single power button and no way to connect an actual
keyboard or a mouse. Using the atkbd driver with serio would be an overkill
and would be inconvenient for the userspace. Therefore this driver
registers an input device that is only capable of reporting the power
button presses and releases.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20201201083533.1724287-3-lkundrak@v3.sk
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agodt-bindings: input: Add Dell Wyse 3020 Power Button binding
Lubomir Rintel [Thu, 10 Dec 2020 01:44:35 +0000 (17:44 -0800)]
dt-bindings: input: Add Dell Wyse 3020 Power Button binding

Add binding document for the Dell Wyse 3020 a.k.a. "Ariel" Power Button.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20201201083533.1724287-2-lkundrak@v3.sk
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: gtco - remove driver
Dmitry Torokhov [Thu, 10 Dec 2020 01:26:35 +0000 (17:26 -0800)]
Input: gtco - remove driver

The driver has its own HID descriptor parsing code, that had and still
has several issues discovered by syzbot and other tools. Ideally we
should move the driver over to the HID subsystem, so that it uses proven
parsing code.  However the devices in question are EOL, and GTCO is not
willing to extend resources for that, so let's simply remove the driver.

Note that our HID support has greatly improved over the last 10 years,
we may also consider reverting 6f8d9e26e7de ("hid-core.c: Adds all GTCO
CalComp Digitizers and InterWrite School Products to blacklist") and see
if GTCO devices actually work with normal HID drivers.

Link: https://lore.kernel.org/r/X8wbBtO5KidME17K@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: vsxxxaa - fix Kconfig spelling mistake
Colin Ian King [Fri, 4 Dec 2020 20:13:17 +0000 (12:13 -0800)]
Input: vsxxxaa - fix Kconfig spelling mistake

There is a spelling mistake in the Kconfig help text. Fix it by replacing
"theses" with "these".

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20201204193635.1152241-1-colin.king@canonical.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: document inhibiting
Andrzej Pietrasiewicz [Wed, 2 Dec 2020 22:44:26 +0000 (14:44 -0800)]
Input: document inhibiting

Document inhibiting input devices and its relation to being
a wakeup source.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20200617101822.8558-1-andrzej.p@collabora.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: Add "inhibited" property
Patrik Fimml [Wed, 2 Dec 2020 22:42:04 +0000 (14:42 -0800)]
Input: Add "inhibited" property

Userspace might want to implement a policy to temporarily disregard input
from certain devices, including not treating them as wakeup sources.

An example use case is a laptop, whose keyboard can be folded under the
screen to create tablet-like experience. The user then must hold the laptop
in such a way that it is difficult to avoid pressing the keyboard keys. It
is therefore desirable to temporarily disregard input from the keyboard,
until it is folded back. This obviously is a policy which should be kept
out of the kernel, but the kernel must provide suitable means to implement
such a policy.

This patch adds a sysfs interface for exactly this purpose.

To implement the said interface it adds an "inhibited" property to struct
input_dev, and effectively creates four states a device can be in: closed
uninhibited, closed inhibited, open uninhibited, open inhibited. It also
defers calling driver's ->open() and ->close() to until they are actually
needed, e.g. it makes no sense to prepare the underlying device for
generating events (->open()) if the device is inhibited.

              uninhibit
closed      <------------ closed
uninhibited ------------> inhibited
      | ^     inhibit        | ^
 1st  | |               1st  | |
 open | |               open | |
      | |                    | |
      | | last               | | last
      | | close              | | close
      v |     uninhibit      v |
open        <------------ open
uninhibited ------------> inhibited

The top inhibit/uninhibit transition happens when users == 0.
The bottom inhibit/uninhibit transition happens when users > 0.
The left open/close transition happens when !inhibited.
The right open/close transition happens when inhibited.
Due to all transitions being serialized with dev->mutex, it is impossible
to have "diagonal" transitions between closed uninhibited and open
inhibited or between open uninhibited and closed inhibited.

No new callbacks are added to drivers, because their open() and close()
serve exactly the purpose to tell the driver to start/stop providing
events to the input core. Consequently, open() and close() - if provided
- are called in both inhibit and uninhibit paths.

Signed-off-by: Patrik Fimml <patrikf@chromium.org>
Co-developed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Link: https://lore.kernel.org/r/20200608112211.12125-8-andrzej.p@collabora.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: use input_device_enabled()
Andrzej Pietrasiewicz [Mon, 5 Oct 2020 04:16:07 +0000 (21:16 -0700)]
Input: use input_device_enabled()

Use the newly added helper in relevant input drivers.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: add input_device_enabled()
Andrzej Pietrasiewicz [Mon, 5 Oct 2020 04:15:46 +0000 (21:15 -0700)]
Input: add input_device_enabled()

A helper function for drivers to decide if the device is used or not.
A lockdep check is introduced as inspecting ->users should be done under
input device's mutex.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Link: https://lore.kernel.org/r/20200608112211.12125-2-andrzej.p@collabora.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: omap4-keypad - set up interrupt as wakeup source
Dmitry Torokhov [Mon, 23 Nov 2020 01:52:32 +0000 (17:52 -0800)]
Input: omap4-keypad - set up interrupt as wakeup source

Marking main interrupt as wakeup interrupt in probe allows us to drop
custom suspend/resume methods whose only purpose was to configure interrupt
for waking up the system.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: remove input_polled_dev implementation
Dmitry Torokhov [Wed, 2 Oct 2019 17:33:02 +0000 (10:33 -0700)]
Input: remove input_polled_dev implementation

Now that normal input devices support polling mode, and all users of
input_polled_dev API have been converted, we can remove it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: libps2 - fix fall-through warnings for Clang
Gustavo A. R. Silva [Mon, 23 Nov 2020 06:15:43 +0000 (22:15 -0800)]
Input: libps2 - fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a
warning by replacing a /* Fall through */ comment with the new
pseudo-keyword macro fallthrough.

Notice that Clang doesn't recognize /* Fall through */ comments as
implicit fall-through markings.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/d2944854e3e118b837755abf4cbdb497662001b7.1605896060.git.gustavoars@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: pcspkr - fix fall-through warnings for Clang
Gustavo A. R. Silva [Mon, 23 Nov 2020 06:15:30 +0000 (22:15 -0800)]
Input: pcspkr - fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of just letting the code
fall through to the next case.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/4b659e3e65f2fa3c8bb7ed153e2016c3fb395bbc.1605896059.git.gustavoars@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: omap4-keypad - fix runtime PM error handling
Zhang Qilong [Sat, 21 Nov 2020 00:36:49 +0000 (16:36 -0800)]
Input: omap4-keypad - fix runtime PM error handling

In omap4_keypad_probe, the patch fix several bugs.

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

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

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

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

Fixes: f77621cc640a7 ("Input: omap-keypad - dynamically handle register offsets")
Fixes: 5ad567ffbaf20 ("Input: omap4-keypad - wire up runtime PM handling")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201120133918.2559681-1-zhangqilong3@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: vmmouse - demote obvious abuse of kernel-doc header
Lee Jones [Fri, 20 Nov 2020 03:20:33 +0000 (19:20 -0800)]
Input: vmmouse - demote obvious abuse of kernel-doc header

Fixes the following W=1 kernel build warning(s):

 drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'cmd' not described in 'VMMOUSE_CMD'
 drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'in1' not described in 'VMMOUSE_CMD'
 drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'out1' not described in 'VMMOUSE_CMD'
 drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'out2' not described in 'VMMOUSE_CMD'
 drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'out3' not described in 'VMMOUSE_CMD'
 drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'out4' not described in 'VMMOUSE_CMD'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-16-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: applespi - provide missing struct 'message' descriptions
Lee Jones [Fri, 20 Nov 2020 03:20:09 +0000 (19:20 -0800)]
Input: applespi - provide missing struct 'message' descriptions

Fixes the following W=1 kernel build warning(s):

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

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-15-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: goodix - fix misspelling of 'ctx'
Lee Jones [Fri, 20 Nov 2020 03:19:38 +0000 (19:19 -0800)]
Input: goodix - fix misspelling of 'ctx'

Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/goodix.c:1168: warning: Function parameter or member 'ctx' not described in 'goodix_config_cb'
 drivers/input/touchscreen/goodix.c:1168: warning: Excess function parameter 'ts' description in 'goodix_config_cb'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-14-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: synaptics - demote non-conformant kernel-doc header
Lee Jones [Fri, 20 Nov 2020 03:15:44 +0000 (19:15 -0800)]
Input: synaptics - demote non-conformant kernel-doc header

Fixes the following W=1 kernel build warning(s):

 drivers/input/mouse/synaptics.c:1781: warning: Function parameter or member 'psmouse' not described in 'synaptics_setup_intertouch'
 drivers/input/mouse/synaptics.c:1781: warning: Function parameter or member 'info' not described in 'synaptics_setup_intertouch'
 drivers/input/mouse/synaptics.c:1781: warning: Function parameter or member 'leave_breadcrumbs' not described in 'synaptics_setup_intertouch'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-13-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: wm97xx-ts - provide missing description for 'status'
Lee Jones [Fri, 20 Nov 2020 03:14:04 +0000 (19:14 -0800)]
Input: wm97xx-ts - provide missing description for 'status'

Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/wm97xx-core.c:204: warning: Function parameter or member 'status' not described in 'wm97xx_set_gpio'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20201112110204.2083435-12-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: surface3_spi - fix naming issue with 'surface3_spi_get_gpio_config's header
Lee Jones [Fri, 20 Nov 2020 03:13:46 +0000 (19:13 -0800)]
Input: surface3_spi - fix naming issue with 'surface3_spi_get_gpio_config's header

Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/surface3_spi.c: In function ‘surface3_spi_process_touch’:
 drivers/input/touchscreen/surface3_spi.c:97:6: warning: variable ‘timestamp’ set but not used [-Wunused-but-set-variable]
 drivers/input/touchscreen/surface3_spi.c:225: warning: Function parameter or member 'data' not described in 'surface3_spi_get_gpio_config'
 drivers/input/touchscreen/surface3_spi.c:225: warning: Excess function parameter 'ts' description in 'surface3_spi_get_gpio_config'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-11-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: wm831x-on - source file headers are not good candidates for kernel-doc
Lee Jones [Fri, 20 Nov 2020 03:13:20 +0000 (19:13 -0800)]
Input: wm831x-on - source file headers are not good candidates for kernel-doc

Fixes the following W=1 kernel build warning(s):

 drivers/input/misc/wm831x-on.c:30: warning: cannot understand function prototype: 'struct wm831x_on '

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20201112110204.2083435-10-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: goodix - provide some missing function parameter descriptions
Lee Jones [Fri, 20 Nov 2020 03:12:42 +0000 (19:12 -0800)]
Input: goodix - provide some missing function parameter descriptions

Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/goodix.c:569: warning: Function parameter or member 'len' not described in 'goodix_check_cfg'
 drivers/input/touchscreen/goodix.c:587: warning: Function parameter or member 'len' not described in 'goodix_send_cfg'
 drivers/input/touchscreen/goodix.c:1165: warning: Function parameter or member 'cfg' not described in 'goodix_config_cb'
 drivers/input/touchscreen/goodix.c:1165: warning: Function parameter or member 'ctx' not described in 'goodix_config_cb'
 drivers/input/touchscreen/goodix.c:1165: warning: Excess function parameter 'ts' description in 'goodix_config_cb'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-5-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: mc13783-pwrbutton - file headers are not good candidates for kernel-doc
Lee Jones [Fri, 20 Nov 2020 03:12:16 +0000 (19:12 -0800)]
Input: mc13783-pwrbutton - file headers are not good candidates for kernel-doc

Fixes the following W=1 kernel build warning(s):

 drivers/input/misc/mc13783-pwrbutton.c:32: warning: cannot understand function prototype: 'struct mc13783_pwrb '

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-4-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: xpad - demote non-conformant kernel-doc header
Lee Jones [Fri, 20 Nov 2020 03:11:55 +0000 (19:11 -0800)]
Input: xpad - demote non-conformant kernel-doc header

Fixes the following W=1 kernel build warning(s):

 drivers/input/joystick/xpad.c:1361: warning: Function parameter or member 'xpad' not described in 'xpad_send_led_command'
 drivers/input/joystick/xpad.c:1361: warning: Function parameter or member 'command' not described in 'xpad_send_led_command'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-2-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: adp5589-keys - use BIT()
Dmitry Torokhov [Thu, 19 Nov 2020 18:11:22 +0000 (10:11 -0800)]
Input: adp5589-keys - use BIT()

Let's use BIT() macro instead of explicitly shifting '1'.

Acked-by: Alexandru Ardelean <Alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201119072440.GA116840@dtor-ws
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: adp5589-keys - mark suspend and resume methods as __maybe_unused
Dmitry Torokhov [Thu, 19 Nov 2020 18:10:58 +0000 (10:10 -0800)]
Input: adp5589-keys - mark suspend and resume methods as __maybe_unused

This improves compile coverage of the code; unused code will be dropped by
the linker.

Acked-by: Alexandru Ardelean <Alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201119072418.GA114677@dtor-ws
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: adp5589-keys - use devm_add_action_or_reset() for register clear
Alexandru Ardelean [Thu, 19 Nov 2020 06:55:39 +0000 (22:55 -0800)]
Input: adp5589-keys - use devm_add_action_or_reset() for register clear

The driver clears the general configuration register during the remove()
hook. This should also be done in case the driver exits on error.

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

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-6-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: adp5589-keys - use devm_gpiochip_add_data() for gpios
Alexandru Ardelean [Thu, 19 Nov 2020 06:50:02 +0000 (22:50 -0800)]
Input: adp5589-keys - use devm_gpiochip_add_data() for gpios

This change makes use of the devm_gpiochip_add_data() function. With this
the gpiochip_remove() function can be removed, and the
adp5589_gpio_remove() function as well.

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

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-5-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: adp5589-keys - remove setup/teardown hooks for gpios
Alexandru Ardelean [Thu, 19 Nov 2020 06:49:27 +0000 (22:49 -0800)]
Input: adp5589-keys - remove setup/teardown hooks for gpios

This is currently just dead code. It's from around a time when
platform-data was used, and a board could hook it's own special callback
for setup/teardown, and a private object (via 'context').

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

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-4-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: adp5589-keys - use device-managed function in adp5589_keypad_add()
Alexandru Ardelean [Thu, 19 Nov 2020 06:41:46 +0000 (22:41 -0800)]
Input: adp5589-keys - use device-managed function in adp5589_keypad_add()

This change makes use of the devm_input_allocate_device() function, which
gets rid of the input_free_device() and input_unregister_device() calls.

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

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

This cleans up the error & exit paths.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-3-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: adp5589-keys - use devm_kzalloc() to allocate the kpad object
Alexandru Ardelean [Thu, 19 Nov 2020 06:40:22 +0000 (22:40 -0800)]
Input: adp5589-keys - use devm_kzalloc() to allocate the kpad object

This removes the need to manually free the kpad object and cleans up some
exit/error paths.  The error path cleanup should reduce the risk of any
memory leaks with this object.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201112074308.71351-2-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: atmel_mxt_ts - support regulator supplies
Linus Walleij [Tue, 10 Nov 2020 02:02:50 +0000 (18:02 -0800)]
Input: atmel_mxt_ts - support regulator supplies

This adds the code for the Atmel touchscreens such as mXT224 to obtain
power regulators for the supply voltages AVDD and VDD. On mobile phones
such as Samsung GT-I8190 (Golden) this is needed to explicitly bring power
online.

We just enable the regulators at probe() and disable them at remove()
or in the error path for now.

As regulators are naturally stubbed if not available, this should have no
impact on existing systems.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201104153032.1387747-3-linus.walleij@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: atmel_mxt_ts - convert bindings to YAML and extend
Linus Walleij [Tue, 10 Nov 2020 02:01:03 +0000 (18:01 -0800)]
Input: atmel_mxt_ts - convert bindings to YAML and extend

This converts the Armel MXT touchscreen bindings to YAML format and
extends them with the following two properties:

- vdda-supply: the optional analog supply voltage
- vdd-supply: the optional digital supply voltage

Tested the schema with all in-tree users and they verify fine.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20201104153032.1387747-2-linus.walleij@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: atmel_mxt_ts - fix up inverted RESET handler
Linus Walleij [Tue, 10 Nov 2020 02:00:06 +0000 (18:00 -0800)]
Input: atmel_mxt_ts - fix up inverted RESET handler

This driver uses GPIO descriptors to drive the touchscreen RESET line. In
the existing device trees this has in conflict with intution been flagged
as GPIO_ACTIVE_HIGH and the driver then applies the reverse action by
driving the line low (setting to 0) to enter reset state and driving the
line high (setting to 1) to get out of reset state.

The correct way to handle active low GPIO lines is to provide the
GPIO_ACTIVE_LOW in the device tree (thus properly describing the hardware)
and letting the GPIO framework invert the assertion (driving high) to a
low level and vice versa.

This is considered a bug since the device trees are incorrectly
mis-specifying the line as active high.

Fix the driver and all device trees specifying a reset line.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Philippe Schenker <philippe.schenker@toradex.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20201104153032.1387747-1-linus.walleij@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoMerge tag 'v5.9' into next
Dmitry Torokhov [Wed, 18 Nov 2020 02:13:23 +0000 (18:13 -0800)]
Merge tag 'v5.9' into next

Sync up with mainline to bring in the latest DTS files.

3 years agoInput: elan_i2c_core - move header inclusion inside
Lee Jones [Tue, 17 Nov 2020 21:46:18 +0000 (13:46 -0800)]
Input: elan_i2c_core - move header inclusion inside

The same clause as its use.

Fixes the following W=1 kernel build warning(s):

 include/linux/input/elan-i2c-ids.h:26:36: warning: ‘elan_acpi_id’ defined but not used [-Wunused-const-variable=]

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112104420.GG1997862@dell
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: ads7846 - drop unneeded asm/irq.h include
Dmitry Torokhov [Thu, 12 Nov 2020 01:34:49 +0000 (17:34 -0800)]
Input: ads7846 - drop unneeded asm/irq.h include

This is essentially a revert of:

3ac8bf077d0f ("[PATCH] ads7846: sparc32 warning fix")

By now enable_irq() and disable_irq() are properly defined in
linux/interrupt.h and we do not need to pull in architecture-specific
bits.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: ads7846 - fix unaligned access on 7845
Dmitry Torokhov [Thu, 12 Nov 2020 01:17:11 +0000 (17:17 -0800)]
Input: ads7846 - fix unaligned access on 7845

req->sample[1] is not naturally aligned at word boundary, and therefore we
should use get_unaligned_be16() when accessing it.

Fixes: 3eac5c7e44f3 ("Input: ads7846 - extend the driver for ads7845 controller support")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: ads7846 - fix integer overflow on Rt calculation
Oleksij Rempel [Tue, 17 Nov 2020 23:33:24 +0000 (15:33 -0800)]
Input: ads7846 - fix integer overflow on Rt calculation

In some rare cases the 32 bit Rt value will overflow if z2 and x is max,
z1 is minimal value and x_plate_ohms is relatively high (for example 800
ohm). This would happen on some screen age with low pressure.

There are two possible fixes:
- make Rt 64bit
- reorder calculation to avoid overflow

The second variant seems to be preferable, since 64 bit calculation on
32 bit system is a bit more expensive.

Fixes: ffa458c1bd9b6f653008d450f337602f3d52a646 ("spi: ads7846 driver")
Co-developed-by: David Jander <david@protonic.nl>
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20201113112240.1360-1-o.rempel@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: ads7846 - convert to full duplex
Oleksij Rempel [Thu, 12 Nov 2020 00:39:05 +0000 (16:39 -0800)]
Input: ads7846 - convert to full duplex

Starting with 3eac5c7e44f3 ("Input: ads7846 - extend the driver for ads7845
controller support"), the ads7845 was partially converted to full duplex
mode.

Since it is not touchscreen controller specific, it is better to extend
this conversion to cover entire driver. This will reduce CPU load and make
driver more readable.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20201110085041.16303-2-o.rempel@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: ads7846 - fix race that causes missing releases
David Jander [Wed, 11 Nov 2020 19:00:59 +0000 (11:00 -0800)]
Input: ads7846 - fix race that causes missing releases

If touchscreen is released while busy reading HWMON device, the release
can be missed. The IRQ thread is not started because no touch is active
and BTN_TOUCH release event is never sent.

Fixes: f5a28a7d4858f94a ("Input: ads7846 - avoid pen up/down when reading hwmon")
Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20201027105416.18773-1-o.rempel@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: imx6ul_tsc - remove set but unused variable 'value'
Lee Jones [Fri, 13 Nov 2020 07:34:13 +0000 (23:34 -0800)]
Input: imx6ul_tsc - remove set but unused variable 'value'

Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/imx6ul_tsc.c: In function ‘adc_irq_fn’:
 drivers/input/touchscreen/imx6ul_tsc.c:307:6: warning: variable ‘value’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://lore.kernel.org/r/20201112110204.2083435-6-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: samsung-keypad - remove set but unused variable 'var'
Lee Jones [Fri, 13 Nov 2020 07:27:03 +0000 (23:27 -0800)]
Input: samsung-keypad - remove set but unused variable 'var'

Fixes the following W=1 kernel build warning(s):

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

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201112110204.2083435-3-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: st1232 - add support resolution reading
Andrej Valek [Thu, 12 Nov 2020 01:52:50 +0000 (17:52 -0800)]
Input: st1232 - add support resolution reading

Hard-coding resolution for st1633 device was wrong. Some of LCDs like
YTS700TLBC-02-100C has assembled Sitronix st1633 touchcontroller too. But
the resolution is not 320x480 as was hard-coded.
Add new function which reads correct resolution directly from register.

Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Link: https://lore.kernel.org/r/20201103073949.12198-1-andrej.valek@siemens.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: synaptics-rmi4 - fix kerneldoc warnings
Lee Jones [Wed, 4 Nov 2020 19:11:56 +0000 (11:11 -0800)]
Input: synaptics-rmi4 - fix kerneldoc warnings

Fixes the kerneldoc warnings from building the driver with W=1.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201104162427.2984742-2-lee.jones@linaro.org
[dtor: folded together several Lee's patches; added more descriptions]
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
3 years agoInput: cyttsp4 - move 'cyttsp4_tch_abs_string' to the only file that references it
Lee Jones [Mon, 9 Nov 2020 06:34:17 +0000 (22:34 -0800)]
Input: cyttsp4 - move 'cyttsp4_tch_abs_string' to the only file that references it

Fixes the following W=1 kernel build warning(s):

In file included from drivers/input/touchscreen/cyttsp_i2c_common.c:24:
 drivers/input/touchscreen/cyttsp4_core.h:236:27: warning: ‘cyttsp4_tch_abs_string’ defined but not used [-Wunused-const-variable=]
 236 | static const char  const cyttsp4_tch_abs_string[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~
 In file included from drivers/input/touchscreen/cyttsp4_i2c.c:17:
 drivers/input/touchscreen/cyttsp4_core.h:236:27: warning: ‘cyttsp4_tch_abs_string’ defined but not used [-Wunused-const-variable=]
 236 | static const char * const cyttsp4_tch_abs_string[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~
 In file included from drivers/input/touchscreen/cyttsp4_spi.c:17:
 drivers/input/touchscreen/cyttsp4_core.h:236:27: warning: ‘cyttsp4_tch_abs_string’ defined but not used [-Wunused-const-variable=]
 236 | static const char * const cyttsp4_tch_abs_string[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201104162427.2984742-16-lee.jones@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>