Nick Dyer [Wed, 23 Jul 2014 19:45:26 +0000 (12:45 -0700)]
Input: atmel_mxt_ts - add bootloader addresses for new chips
Later chips (for example mXT1664S) different mappings for bootloader
addresses. This means that we must look at the family ID to determine
which address to use.
Nick Dyer [Wed, 23 Jul 2014 19:41:58 +0000 (12:41 -0700)]
Input: atmel_mxt_ts - handle APP_CRC_FAIL on startup
If the bootloader on the touchscreen controller fails to initialise the
firmware image, it stays in bootloader mode and reports a failure. It is
possible to reflash a working firmware image from this state.
Nick Dyer [Wed, 23 Jul 2014 19:40:09 +0000 (12:40 -0700)]
Input: atmel_mxt_ts - calculate and check CRC in config file
By validating the checksum, we can identify if the configuration is
corrupt. In addition, this patch writes the configuration in a short
series of block writes rather than as many individual values.
Nick Dyer [Wed, 23 Jul 2014 19:38:48 +0000 (12:38 -0700)]
Input: atmel_mxt_ts - download device config using firmware loader
The existing implementation which encodes the configuration as a binary
blob in platform data is unsatisfactory since it requires a kernel
recompile for the configuration to be changed, and it doesn't deal well
with firmware changes that move values around on the chip.
Atmel define an ASCII format for the configuration which can be exported
from their tools. This patch implements a parser for that format which
loads the configuration via the firmware loader and sends it to the MXT
chip.
Nick Dyer [Wed, 23 Jul 2014 19:21:26 +0000 (12:21 -0700)]
Input: atmel_mxt_ts - move input device init into separate function
It is useful to initialise the input device later:
- Screen parameters may not be not known yet, for instance if waiting for
firmware loader to return.
- Device may be in bootloader mode on probe (but could still be recovered by
firmware download).
In addition, later devices have a different touchscreen object (T100) which
requires handling differently.
This also reduces the complexity of the probe function.
Nick Dyer [Wed, 23 Jul 2014 18:25:55 +0000 (11:25 -0700)]
Input: atmel_mxt_ts - initialise IRQ before probing
The maXTouch chips use the CHG line to generate status events in bootloader
mode, and during configuration download, before there is enough information
to configure the input device. Therefore set up the interrupt handler
earlier.
However, this introduces states where parts of the interrupt processing
must not run. Use data->object_table as a way to tell whether the chip
information is valid, and data->input_dev as a way to tell whether it is
valid to generate input report.
David Herrmann [Mon, 21 Jul 2014 00:16:23 +0000 (17:16 -0700)]
Input: uinput - uinput_validate_absbits() cleanup
This moves basic checks and setup from uinput_setup_device() into
uinput_validate_absbits() to make it easier to use. This way, we can call
it from other places without copying the boilerplate code.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Hans de Goede [Sun, 20 Jul 2014 20:35:44 +0000 (13:35 -0700)]
Input: add support for Wacom protocol 4 serial tablets
Recent version of xf86-input-wacom no longer support directly accessing
serial tablets. Instead xf86-input-wacom now expects all wacom tablets to
be driven by the kernel and to show up as evdev devices.
This has caused old serial Wacom tablets to stop working for people who still
have such tablets. Julian Squires has written a serio input driver to fix this:
https://github.com/tokenrove/wacom-serial-iv
This is a cleaned up version of this driver with improved Graphire support
(I own an old Graphire myself).
Signed-off-by: Julian Squires <julian@cipht.net> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: max7359 - introduce the use of managed interfaces
This patch introduces the use of managed interfaces like devm_kzalloc,
devm_input_allocate_device, devm_request_threaded_irq etc. and does away
with the calls to free the allocated memory. The remove function is no
longer required and is completely done away with. Also, the labels in the
probe function are removed.
Daniel Mack [Tue, 15 Jul 2014 16:47:52 +0000 (09:47 -0700)]
Input: add driver for Microchip's CAP1106
This patch adds a driver for Microchips CAP1106, an I2C driven, 6-channel
capacitive touch sensor.
For now, only the capacitive buttons are supported, and no specific
settings that can be tweaked for individual channels, except for the
device-wide sensitivity gain. The defaults seem to work just fine out of
the box, so I'll leave configurable parameters for someone who's in need
of them and who can actually measure the impact. All registers are
prepared, however. Many of them are just not used for now.
The implementation does not make any attempt to be compatible to platform
data driven boards, but fully depends on CONFIG_OF.
Power management functions are also left for volounteers with the ability
to actually test them.
Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Sachin Kamat [Sun, 8 Jun 2014 06:10:25 +0000 (23:10 -0700)]
Input: max8997_haptic - add error handling for regulator and pwm
Let's start checking return value of regulator_enable and pwm_enable to
avoid errors. Fixes the following warning:
drivers/input/misc/max8997_haptic.c:185:19: warning: ignoring return value of ‘regulator_enable’, declared with attribute warn_unused_result [-Wunused-result]
Hans de Goede [Sun, 8 Jun 2014 06:07:13 +0000 (23:07 -0700)]
Input: elantech - don't set bit 1 of reg_10 when the no_hw_res quirk is set
The touchpad on the GIGABYTE U2442 not only stops communicating when we try
to set bit 3 (enable real hardware resolution) of reg_10, but on some BIOS
versions also when we set bit 1 (enable two finger mode auto correct).
I've asked the original reporter of:
https://bugzilla.kernel.org/show_bug.cgi?id=61151
To check that not setting bit 1 does not lead to any adverse effects on his
model / BIOS revision, and it does not, so this commit fixes the touchpad
not working on these versions by simply never setting bit 1 for laptop
models with the no_hw_res quirk.
Reported-and-tested-by: James Lademann <jwlademann@gmail.com> Tested-by: Philipp Wolfer <ph.wolfer@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This is different from how (elantech) clickpads normally operate, normally
no matter where the user clicks on the pad the pad always reports a left
button event, since there is only 1 hardware button beneath the path.
It looks like Dell has put 2 buttons under the pad, one under each bottom
corner, causing this.
Since this however still clearly is a real clickpad hardware-wise, we still
want to report it as such to userspace, so that things like finger movement
in the bottom area can be properly ignored as it should be on clickpads.
So deal with this weirdness by simply mapping a right click to a left click
on elantech clickpads. As an added advantage this is something which we can
simply do on all elantech clickpads, so no need to add special quirks for
this weird model.
Reported-and-tested-by: Elder Marco <eldermarco@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Add common DT binding documentation for touchscreen devices and
implement input_parse_touchscreen_of_params, which parses the common
properties and configures the input device accordingly.
The method currently does not interpret the axis inversion properties,
since there is no matching flag in the generic linux input device.
Reviewed-by: Pavel Machek <pavel@ucw.cz> Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Nick Dyer [Mon, 19 May 2014 06:16:49 +0000 (23:16 -0700)]
Input: atmel_mxt_ts - read screen config from chip
By reading the touchscreen configuration from the settings that the
maXTouch chip is actually using, we can remove some platform data.
The matrix size is not used for anything, and results in some rather
confusing code to re-read it because it may change when configuration
is downloaded, so don't print it out.
Nick Dyer [Mon, 19 May 2014 06:15:01 +0000 (23:15 -0700)]
Input: atmel_mxt_ts - add check for incorrect firmware file format
Atmel supplies firmware files in ASCII HEX format (.enc) which must be
converted before they can be loaded by kernel driver. Try to detect
the error and print a friendly error message rather than feeding junk
to the bootloader.
Move bootloaders reads/writes into separate functions. Instead of switching
client->addr, define new field bootloader_addr in mxt_data. Implement
lookup calculation for bootloader addresses.
Nick Dyer [Mon, 19 May 2014 06:04:46 +0000 (23:04 -0700)]
Input: atmel_mxt_ts - implement CRC check for configuration data
The configuration is stored in NVRAM on the maXTouch chip. When the device
is reset it reports a CRC of the stored configuration values. Therefore it
isn't necessary to send the configuration on each probe - we can check the
CRC matches and avoid a timeconsuming backup/reset cycle.
Iiro Valkonen [Mon, 19 May 2014 06:03:44 +0000 (23:03 -0700)]
Input: atmel_mxt_ts - make wait-after-reset period compatible with all chips
The delay before the chip can be accessed after reset varies between
different chips in maXTouch family. Waiting for an interrupt and a T6
status message with the RESET bit set is a better behaviour.
Benson Leung [Mon, 19 May 2014 06:03:09 +0000 (23:03 -0700)]
Input: atmel_mxt_ts - wait for CHG after bootloader resets
Rather than msleep for MXT_RESET_TIME and MXT_FWRESET_TIME during the
transition to bootloader mode and the transition back from app, wait for
the CHG assert to indicate that the transition is done.
This change replaces the msleep with a wait for completion that the
mxt_interrupt handler signals.
Also add CHG poll after last firmware frame - some bootloader versions will
assert the interrupt line after the final frame, in testing this meant that
the driver attempts to read the info block too early whilst the chip is
still resetting.
This improves firmware update time as we no longer wait longer than
necessary for each reset.
Signed-off-by: Benson Leung <bleung@chromium.org> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk> Acked-by: Yufeng Shen <miletus@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Benson Leung [Mon, 19 May 2014 06:02:52 +0000 (23:02 -0700)]
Input: atmel_mxt_ts - wait for CHG assert in mxt_check_bootloader
The driver should not immediately read bootloader status when in
Application Update Mode. The CHG line will assert when the device has made
a state transition and is ready to report a new status via i2c.
This change adds a wait for completion in mxt_check_bootloader, and changes
the mxt_interrupt handler to signal the completion.
Signed-off-by: Benson Leung <bleung@chromium.org> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk> Acked-by: Yufeng Shen <miletus@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Daniel Kurtz [Mon, 19 May 2014 06:01:12 +0000 (23:01 -0700)]
Input: atmel_mxt_ts - define helper functions for size and instances
These two object table entry fields are reported 1 less than their value.
When used, however, we always want the actual size and instances.
To keep the object size and instances 1-byte fields, and thus preserve
the object-table struct's 6-byte packed alignment, add some convenient
accessor functions that do the +1 every time these fields are accessed.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk> Acked-by: Benson Leung <bleung@chromium.org> Acked-by: Yufeng Shen <miletus@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* The mapping of the GPIO numbers into the T19 status byte varies between
different maXTouch chips. Some have up to 7 GPIOs. Allowing a keycode array
of up to 8 items is simpler and more generic. So replace #define with
configurable number of keys which also allows the removal of is_tp.
* Rename platform data parameters to include "t19" to prevent confusion with
T15 key array.
* Probe aborts early on when pdata is NULL, so no need to check.
* Move "int i" to beginning of function (mixed declarations and code)
* Use API calls rather than __set_bit()
* Remove unused dev variable.
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk> Acked-by: Yufeng Shen <miletus@chromium.org> Reviewed-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Nick Dyer [Mon, 19 May 2014 05:59:20 +0000 (22:59 -0700)]
Input: atmel_mxt_ts - remove unnecessary platform data
It is not necessary to download these values to the maXTouch chip on every
probe, since they are stored in NVRAM. It makes life difficult when tuning
the device to keep them in sync with the config array/file, and requires a
new kernel build for minor tweaks.
These parameters only represent a tiny subset of the available
configuration options, tracking all of these options in platform data would
be a endless task. In addition, different versions of maXTouch chips may
have these values in different places or may not even have them at all.
Having these values also makes life more complex for device tree and other
platforms where having to define a static configuration isn't helpful.
Roger Quadros [Mon, 19 May 2014 05:44:35 +0000 (22:44 -0700)]
Input: pixcir_i2c_ts - initialize interrupt mode and power mode
Introduce helper functions to configure power and interrupt registers.
Default to IDLE mode on probe as device supports auto wakeup to ACVIE mode
on detecting finger touch.
Configure interrupt mode and polarity on start up. Power down on device
closure or module removal.
Signed-off-by: Roger Quadros <rogerq@ti.com> Acked-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: ims-pcu - fix uninitialized use of 'error' in ims_pcu_buffers_alloc()
In case allocation via usb_alloc_coherent() fails in ims_pcu_buffers_alloc(),
the function jumps to the exit path without initializing local variable
'error' that is used as return value. Detected by Coverity - CID 1016531.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Jason Gerecke [Thu, 15 May 2014 00:14:29 +0000 (17:14 -0700)]
Input: wacom - add support for three new ISDv4 sensors
This patch adds support for the 0x4004, 0x5000, and 0x5002 sensors found
on what should be the Motion R12, Fujitsu Q704, and Fujitsu T904. These
tablets use a new report ID (3) for their touch packets and a slightly
different HID descriptor format, but are otherwise largely identical in
protocol to the "MTTPC" tablets.
Note:
* The R12 uses its 0x4004 sensor for touch input only. A pen interface
is not present in its HID descriptor, though its possible a 0x4004
may be used for pen input by other tablet PCs in the future.
* The 0x5002 sensor appears to use a new report ID (8) for its pen
packets. The other sensors continue to use the traditional report
ID (2).
Stephen Boyd [Wed, 14 May 2014 18:58:55 +0000 (11:58 -0700)]
Input: pmic8xxx-pwrkey - set sane default for debounce time
If the debounce time is 0 our usage of ilog2() later on in this driver will
cause undefined behavior. If CONFIG_OF=n this fact is evident to the
compiler, and it emits a call to ____ilog2_NaN() which doesn't exist. Fix
this by setting a sane default for debounce and failing to probe if
debounce is 0 in the DT.
Jason Gerecke [Wed, 14 May 2014 18:42:22 +0000 (11:42 -0700)]
Input: wacom - add support for 0x116 sensor on Win8 Panasonic CF-H2
The Win8 version of the Panasonic CF-H2 includes a new Wacom device.
The pen interface appears to use the same protocol as before, but the
touch interface has been tweaked to send Win8-compatible reports.
Hans de Goede [Wed, 14 May 2014 18:22:09 +0000 (11:22 -0700)]
Input: sun4i-ts - add support for temperature sensor
The sun4i resisitive touchscreen controller also comes with a built-in
temperature sensor. This commit adds support for it.
This commit also introduces a new "ts-attached" device-tree property,
when this is not set, the input part of the driver won't register. This way
the internal temperature sensor can be used to measure the SoC temperature
independent of there actually being a touchscreen attached to the controller.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Hans de Goede [Wed, 14 May 2014 18:20:45 +0000 (11:20 -0700)]
Input: add driver for Allwinner sunxi SoC's rtp controller
Note the sun4i-ts controller is capable of detecting a second touch, but
when a second touch is present then the accuracy becomes so bad the
reported touch location is not useable.
The original android driver contains some complicated heuristics using the
aprox. distance between the 2 touches to see if the user is making a pinch
open / close movement, and then reports emulated multi-touch events around
the last touch coordinate (as the dual-touch coordinates are worthless).
These kinds of heuristics are just asking for trouble (and don't belong in
the kernel). So this driver offers straight forward, reliable single touch
functionality only.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Alexander Shiyan [Mon, 28 Apr 2014 17:48:49 +0000 (10:48 -0700)]
Input: gpio_keys_polled - convert to devm-* API
Replace existing resource handling in the driver with managed device
resources, this ensures more consistent error values and simplifies error
handling paths:
Managed resources are becoming more and more popular in drivers. Let's
implement managed polled input devices, to complement managed regular input
devices.
Similarly to managed regular input devices only one new call
devm_input_allocate_polled_device() is added and the rest of APIs is
modified to work with both managed and non-managed devices.
Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Tested-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: remove race when instantiating polled device attributes
Polled device's attributes controlling polling rate and whether polling is
enabled are attached to input device. We should have device core
instantiate them for us, so that they are created by the time new device
notification is sent to userspace, instead of doing it ourselves
afterwards.
Tested-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Alexander Shiyan [Sat, 26 Apr 2014 06:45:05 +0000 (23:45 -0700)]
Input: gpio-beeper - simplify GPIO handling
This patch simplifies GPIO handling in the driver by using GPIO functions
based on descriptors. As a result this driver now can be used for boards
without DT support.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Using devm_regulator_bulk_get() and devm_input_allocate_device() can make
the code cleaner and smaller as we do not need to manually free resources
the error and remove paths.
Mark Brown [Fri, 25 Apr 2014 06:37:56 +0000 (23:37 -0700)]
Input: ads7877 - remove bitrotted comment
While searching for users of spi_async() I found a reference in the ad7877
driver to using it to initiate data transfer from the interrupt handler.
However there is no code for this, instead the interrupt handler is a
threaded handler and uses spi_sync() instead.
Remove the bitrotted comment, though in actual fact the use case mentioned
is a great use for spi_async() since it would cut down on latency handling
the interrupt by saving us a context switch before we start SPI.
This was previously implemented, it was removed in commit b534422b2d11
(Input: ad7877 - switch to using threaded IRQ) for code complexity reasons.
It may be better to revert that commit instead.
Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>