firefly-linux-kernel-4.4.55.git
10 years agoInput: atkbd - do not try 'deactivate' keyboard on any LG laptops
Dmitry Torokhov [Wed, 10 Sep 2014 20:50:37 +0000 (13:50 -0700)]
Input: atkbd - do not try 'deactivate' keyboard on any LG laptops

We are getting more and more reports about LG laptops not having
functioning keyboard if we try to deactivate keyboard during probe.
Given that having keyboard deactivated is merely "nice to have"
instead of a hard requirement for probing, let's disable it on all
LG boxes instead of trying to hunt down particular models.

This change is prompted by patches trying to add "LG Electronics"/"ROCKY"
and "LG Electronics"/"LW60-F27B" to the DMI list.

https://bugzilla.kernel.org/show_bug.cgi?id=77051

Cc: stable@vger.kernel.org
Reported-by: Jaime Velasco Juan <jsagarribay@gmail.com>
Reported-by: Georgios Tsalikis <georgios@tsalikis.net>
Tested-by: Jaime Velasco Juan <jsagarribay@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: serport - add compat handling for SPIOCSTYPE ioctl
John Sung [Tue, 9 Sep 2014 17:06:51 +0000 (10:06 -0700)]
Input: serport - add compat handling for SPIOCSTYPE ioctl

When running a 32-bit inputattach utility in a 64-bit system, there will be
error code "inputattach: can't set device type". This is caused by the
serport device driver not supporting compat_ioctl, so that SPIOCSTYPE ioctl
fails.

Cc: stable@vger.kernel.org
Signed-off-by: John Sung <penmount.touch@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: atmel_mxt_ts - fix double free of input device
Stephen Warren [Wed, 10 Sep 2014 17:01:10 +0000 (10:01 -0700)]
Input: atmel_mxt_ts - fix double free of input device

[Nick Dyer: reworked to move free of input device into separate function
and only call in paths that require it.]
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: synaptics - add support for ForcePads
Dmitry Torokhov [Sat, 30 Aug 2014 20:51:06 +0000 (13:51 -0700)]
Input: synaptics - add support for ForcePads

ForcePads are found on HP EliteBook 1040 laptops. They lack any kind of
physical buttons, instead they generate primary button click when user
presses somewhat hard on the surface of the touchpad. Unfortunately they
also report primary button click whenever there are 2 or more contacts
on the pad, messing up all multi-finger gestures (2-finger scrolling,
multi-finger tapping, etc). To cope with this behavior we introduce a
delay (currently 50 msecs) in reporting primary press in case more
contacts appear.

Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: matrix_keypad - use request_any_context_irq()
Lothar Waßmann [Tue, 9 Sep 2014 21:41:16 +0000 (14:41 -0700)]
Input: matrix_keypad - use request_any_context_irq()

When trying to use the matrix-keypad driver with GPIO drivers that
require nested irq handlers (e.g. I2C GPIO adapters like PCA9554),
request_irq() fails because the GPIO driver requires a threaded
interrupt handler.

Use request_any_context_irq() to be able to use any GPIO driver as
keypad driver.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: atmel_mxt_ts - downgrade warning about empty interrupts
Nick Dyer [Tue, 9 Sep 2014 18:24:21 +0000 (11:24 -0700)]
Input: atmel_mxt_ts - downgrade warning about empty interrupts

In the case where the CHG/interrupt line mode is not configured correctly,
this warning is output to dmesg output for each interrupt. Downgrade the
message to debug.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wm971x - fix typo in module parameter description
Masanari Iida [Tue, 9 Sep 2014 18:23:10 +0000 (11:23 -0700)]
Input: wm971x - fix typo in module parameter description

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: cap1106 - fix register definition
Klaus Goger [Mon, 8 Sep 2014 21:45:30 +0000 (14:45 -0700)]
Input: cap1106 - fix register definition

Use the correct register address for Calibration Active and Interrupt
Enable.

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Acked-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: add missing POINTER / DIRECT properties to a bunch of drivers
Hans de Goede [Mon, 8 Sep 2014 21:44:05 +0000 (14:44 -0700)]
Input: add missing POINTER / DIRECT properties to a bunch of drivers

I've not done a full audit of all mouse drivers, I noticed these ones were
missing the POINTER property while working on the POINTING_STICK property.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: add INPUT_PROP_POINTING_STICK property
Hans de Goede [Mon, 8 Sep 2014 21:42:12 +0000 (14:42 -0700)]
Input: add INPUT_PROP_POINTING_STICK property

It is useful for userspace to know that there not dealing with a regular
mouse but rather with a pointing stick (e.g. a trackpoint) so that
userspace can e.g. automatically enable middle button scrollwheel
emulation.

It is impossible to tell the difference from the evdev info without
resorting to putting a list of device / driver names in userspace, this is
undesirable.

Add a property which allows userspace to see if a device is a pointing
stick, and set it on all the pointing stick drivers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: elantech - fix detection of touchpad on ASUS s301l
Hans de Goede [Mon, 8 Sep 2014 21:39:52 +0000 (14:39 -0700)]
Input: elantech - fix detection of touchpad on ASUS s301l

Adjust Elantech signature validation to account fo rnewer models of
touchpads.

Cc: stable@vger.kernel.org
Reported-and-tested-by: Màrius Monton <marius.monton@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: elantech - add support for trackpoint found on some v3 models
Ulrik De Bie [Sat, 23 Aug 2014 00:06:00 +0000 (17:06 -0700)]
Input: elantech - add support for trackpoint found on some v3 models

Some elantech v3 touchpad equipped laptops also have a trackpoint, before
this commit, these give sync errors. With this patch, the trackpoint is
provided as another input device: 'Elantech PS/2 TrackPoint'

The patch will also output messages that do not follow the expected pattern.
In the mean time I've seen 2 unknown packets occasionally:
0x04 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00
I don't know what those are for, but they can be safely ignored.

Currently all packets that are not known to v3 touchpad and where
packet[3] (the fourth byte) lowest nibble is 6 are now recognized as
PACKET_TRACKPOINT and processed by the new elantech_report_trackpoint.

This has been verified to work on a laptop Lenovo L530 where the
touchpad/trackpoint combined identify themselves as:
psmouse serio1: elantech: assuming hardware version 3 (with firmware version 0x350f02)
psmouse serio1: elantech: Synaptics capabilities query result 0xb9, 0x15, 0x0c.

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ulrik De Bie <ulrik.debie-os@e2big.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: elantech - reset the device when elantech probe fails
Ulrik De Bie [Sat, 23 Aug 2014 00:08:21 +0000 (17:08 -0700)]
Input: elantech - reset the device when elantech probe fails

elantech_init() calls elantech_set_absolute_mode which sets the driver in
an absolute mode. When after this the elantech_init fails, it is best to
turn the ps/2 mouse emulation mode back on by calling psmouse_reset() so
that it can work as a regular mouse.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ulrik De Bie <ulrik.debie-os@e2big.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: ALPS - suppress message about 'Unknown touchpad'
Dmitry Torokhov [Mon, 25 Aug 2014 18:24:47 +0000 (11:24 -0700)]
Input: ALPS - suppress message about 'Unknown touchpad'

When we fail to match data returned by E7 and EC reports we state that we
found "Unknown ALPS touchpad" whereas it is most likely it is not ALPS
touchpad at all. Change wording a bit and reduce the message to debug so
that it does not litter users logs and confuse them.

Reported-by: Paul Menzel <paulepanter@users.sourceforge.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: fix used slots detection breakage
Dmitry Torokhov [Mon, 25 Aug 2014 18:31:02 +0000 (11:31 -0700)]
Input: fix used slots detection breakage

Commit f8ec894945e7d205ce62be59e55e72c4304e4739 allowed external callers
use slot dropping logic, unfortunately it also broke external users of
input_mt_is_used() as we stopped incrementing frame count unless input
device was set up to automatically drop unused slots.

Fixes: f8ec894945e7d ("Input: MT - make slot cleanup callable outside
mt_sync_frame()")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=83081

Reported-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: sparc - i8042-sparcio.h: fix unused kbd_res warning
Vincent Stehlé [Tue, 19 Aug 2014 21:17:37 +0000 (14:17 -0700)]
Input: sparc - i8042-sparcio.h: fix unused kbd_res warning

kbd_res is used only when CONFIG_PCI is defined; condition its declaration as
well. This fixes the following compilation warning:

  drivers/input/serio/i8042-sparcio.h:20:25: warning: ‘kbd_res’ defined but not used [-Wunused-variable]

Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: atmel_mxt_ts - improve description of gpio-keymap property
Nick Dyer [Sun, 17 Aug 2014 16:08:42 +0000 (09:08 -0700)]
Input: atmel_mxt_ts - improve description of gpio-keymap property

The below patch improves the documentation for the gpio-property. Stephen
Warren has a good example here:
https://github.com/swarren/linux-tegra/commit/09789801

trackpad@4b {
  compatible = "atmel,maxtouch";
  reg = <0x4b>;
  interrupt-parent = <&gpio>;
  interrupts = <TEGRA_GPIO(W, 3) IRQ_TYPE_LEVEL_LOW>;
  linux,gpio-keymap = <0 0 0 BTN_LEFT>;
};

This maps BTN_LEFT to the 4th bit of the T19 message.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoMerge branch 'next' into for-linus
Dmitry Torokhov [Fri, 15 Aug 2014 06:02:58 +0000 (23:02 -0700)]
Merge branch 'next' into for-linus

Prepare second round of input updates for 3.17.

10 years agoInput: edt-ft5x06 - remove superfluous assignment
Maks Naumov [Wed, 13 Aug 2014 22:27:52 +0000 (15:27 -0700)]
Input: edt-ft5x06 - remove superfluous assignment

Somehow we ended up with a duplicate line in edt_ft5x06_register_write()

Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: xpad - add support for Xbox One controllers
Ted Mielczarek [Fri, 8 Aug 2014 18:21:59 +0000 (11:21 -0700)]
Input: xpad - add support for Xbox One controllers

Xbox One controllers require an initialization message to start sending
data, so xpad_init_output becomes a required function. The Xbox One
controller does not have LEDs like the Xbox 360 controller, so that
functionality is not implemented. The format of messages controlling rumble
is currently undocumented, so rumble support is not yet implemented.

Note that Xbox One controller advertises three interfaces with the same
interface class, subclass and protocol, so we have to also match against
interface number.

Signed-off-by: Ted Mielczarek <ted@mielczarek.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: atmel_mxt_ts - fix a few issues reported by Coverity
Dmitry Torokhov [Mon, 11 Aug 2014 17:58:29 +0000 (10:58 -0700)]
Input: atmel_mxt_ts - fix a few issues reported by Coverity

This should fix the following issues reported by Coverity:

*** CID 1230625:  Logically dead code  (DEADCODE)
/drivers/input/touchscreen/atmel_mxt_ts.c: 1692 in mxt_initialize()

*** CID 1230627:  Missing break in switch  (MISSING_BREAK)
/drivers/input/touchscreen/atmel_mxt_ts.c: 1436 in mxt_get_object_table()

*** CID 1230629:  Out-of-bounds write  (OVERRUN)
/drivers/input/touchscreen/atmel_mxt_ts.c: 1267 in mxt_update_cfg()

*** CID 1230632:  Unused pointer value  (UNUSED_VALUE)
/drivers/input/touchscreen/atmel_mxt_ts.c: 1211 in mxt_update_cfg()

Acked-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: atmel_mxt_ts - split config update a bit
Dmitry Torokhov [Fri, 8 Aug 2014 16:29:06 +0000 (09:29 -0700)]
Input: atmel_mxt_ts - split config update a bit

Let's split config update code a bit so it is hopefully a bit easier to
read. Also, the firmware update callback should be the entity releasing
firmware blob, not lower layers.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
10 years agoInput: atmel_mxt_ts - simplify mxt_initialize a bit
Dmitry Torokhov [Fri, 8 Aug 2014 16:28:45 +0000 (09:28 -0700)]
Input: atmel_mxt_ts - simplify mxt_initialize a bit

I think having control flow with 2 goto/labels/flags is quite hard to read,
this version is a bit more readable IMO.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
10 years agoInput: joystick - use get_cycles on ARMv8
Mark Brown [Mon, 11 Aug 2014 18:08:56 +0000 (11:08 -0700)]
Input: joystick - use get_cycles on ARMv8

As with ARM the ARMv8 architecture provides a cycle counter which can be
used to provide a high resolution time for the joystick driver and
silence the build warning that results from not having a precise timer
on ARMv8, making allmodconfig and allyesconfig quieter.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - fix compiler warning if !CONFIG_PM
Geert Uytterhoeven [Mon, 11 Aug 2014 18:03:19 +0000 (11:03 -0700)]
Input: wacom - fix compiler warning if !CONFIG_PM

If CONFIG_PM is not set:

drivers/hid/wacom_sys.c:1436: warning: ‘wacom_reset_resume’ defined but
not used

Protect the unused functions by #ifdef CONFIG_PM to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: cap1106 - allow changing key mapping from userspace
Dmitry Torokhov [Mon, 21 Jul 2014 01:09:54 +0000 (18:09 -0700)]
Input: cap1106 - allow changing key mapping from userspace

Wire up support for EVIOC{G|S}KEYCODE to allow users change key mappings
from userspace.

Reviewed-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: synaptics - use firmware data for Cr-48
Henrik Rydberg [Mon, 14 Jul 2014 17:26:56 +0000 (10:26 -0700)]
Input: synaptics - use firmware data for Cr-48

The profile sensor clickpad in a Cr-48 Chromebook does a reasonable job
of tracking individual fingers. This tracking isn't perfect, but,
experiments show that it works better than just passing "semi-mt" data
to userspace, and making userspace try to deduce where the fingers are
given a bounding box.

This patch tries to report correct two-finger positions instead of the
{(min_x, min_y), (max_x, max_y)} for profile sensor clickpads on Cr-48
chromebooks. Note that this device's firmware always reports the higher
(smaller y) finger in the "sgm" packet, and the lower (larger y) finger
in the "agm" packet. Thus, when a new finger arrives on the pad, the
kernel driver uses input core's contact tracking facilities to match
contacts with slots.

Inspired by patch by Daniel Kurtz <djkurtz@chromium.org> and Chung-yih
Wang <cywang@chromium.org>

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: synaptics - properly initialize slots for semi-MT
Dmitry Torokhov [Sat, 26 Jul 2014 00:12:12 +0000 (17:12 -0700)]
Input: synaptics - properly initialize slots for semi-MT

Semi-MT devices are pointers too, so let's tell that to
input_mt_init_slots(), as well as let it set up the devices as semi-MT,
instead of us doing it manually.

Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: MT - make slot cleanup callable outside mt_sync_frame()
Henrik Rydberg [Sat, 26 Jul 2014 00:16:42 +0000 (17:16 -0700)]
Input: MT - make slot cleanup callable outside mt_sync_frame()

Some semi-mt drivers use the slots in a manual way, but may still
want to call parts of the frame synchronization logic. This patch
makes input_mt_drop_unused callable from those drivers.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: atmel_mxt_ts - mXT224 DMA quirk was fixed in firmware v2.0.AA
Nick Dyer [Thu, 7 Aug 2014 16:56:01 +0000 (09:56 -0700)]
Input: atmel_mxt_ts - mXT224 DMA quirk was fixed in firmware v2.0.AA

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - update the ABI doc according to latest changes
Benjamin Tissoires [Fri, 8 Aug 2014 06:22:37 +0000 (23:22 -0700)]
Input: wacom - update the ABI doc according to latest changes

Now the devices show up under hid no matter the connection (for USB
and Bluetooth, not serial nor i2c).

The USB devices can now be easily found under
/sys/bus/hid/devices/<bus>:<vid>:<pid>.<n>

The Bluetooth devices could also be found under this path since their
inclusion (April 2010), so this patch fixes the non-precise "hidraw*" path
for them.

The ABI has been unified while setting the LEDs and OLEDs. So Bluetooth
devices lost their own LED selector but use the USB sysfs attribute.
For OLEDs, Bluetooth devices handle only 1-bit images instead of 4 for USB.
The documentation has been updated to match this.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoMerge branch 'next' into for-linus
Dmitry Torokhov [Thu, 7 Aug 2014 06:36:12 +0000 (23:36 -0700)]
Merge branch 'next' into for-linus

Prepare first round of input updates for 3.17.

10 years agoMerge branch 'wacom' into next
Dmitry Torokhov [Thu, 7 Aug 2014 06:31:48 +0000 (23:31 -0700)]
Merge branch 'wacom' into next

Merge large update to Wacom driver, converting it from USB to a HID
driver and unifying wired and bluetooth support, from Benjamin
Tissoires.

10 years agoInput: wacom - only register once the MODULE_* macros
Benjamin Tissoires [Wed, 6 Aug 2014 21:07:49 +0000 (14:07 -0700)]
Input: wacom - only register once the MODULE_* macros

Putting the various MODULE_* makes them appear several times in modinfo
because wacom.h is used both in wacom_sys.c and wacom_wac.h.
Having the macros near the module declaration makes them appear only once.

Add also MODULE_VERSION(DRIVER_VERSION) to export the current version
number.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: HID - remove hid-wacom Bluetooth driver
Benjamin Tissoires [Wed, 6 Aug 2014 21:06:26 +0000 (14:06 -0700)]
Input: HID - remove hid-wacom Bluetooth driver

Bluetooth Wacom tablets are now handled by the regular wacom.ko driver.
Remove the now useless hid-wacom driver.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Tested-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - add copyright note and bump version to 2.0
Benjamin Tissoires [Wed, 6 Aug 2014 21:04:23 +0000 (14:04 -0700)]
Input: wacom - add copyright note and bump version to 2.0

Reviewed-by: Ping Cheng <pingc@wacom.com>
Tested-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - remove passing id for wacom_set_report
Przemo Firszt [Wed, 6 Aug 2014 21:00:38 +0000 (14:00 -0700)]
Input: wacom - remove passing id for wacom_set_report

Every call of wacom_set_report was passing "id" as a separate parameter
and buffer also passed the same information. We can use first u8 of the
buffer instead of "id"

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Tested-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - check for bluetooth protocol while setting OLEDs
Benjamin Tissoires [Wed, 6 Aug 2014 20:58:25 +0000 (13:58 -0700)]
Input: wacom - check for bluetooth protocol while setting OLEDs

Bluetooth Intuos 4 use 1-bit definition while the USB ones use a 4-bits
definition. This changes the size of the raw image we receive, and thus
the kernel will only accept 1-bit images for Bluetooth and 4-bits for
USB.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Tested-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - handle Intuos 4 BT in wacom.ko
Benjamin Tissoires [Wed, 6 Aug 2014 20:55:56 +0000 (13:55 -0700)]
Input: wacom - handle Intuos 4 BT in wacom.ko

A good point of this change is that now, the Intuos4 bluetooth can handle
the different tools (artpen, airbrush, mice), and we get a common interface
between USB and BT for accessing the LEDs/OLEDs.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Tested-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - handle Graphire BT tablets in wacom.ko
Benjamin Tissoires [Wed, 6 Aug 2014 20:52:56 +0000 (13:52 -0700)]
Input: wacom - handle Graphire BT tablets in wacom.ko

First, merge the Graphire BT tablet.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Tested-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - prepare the driver to include BT devices
Benjamin Tissoires [Wed, 6 Aug 2014 20:48:01 +0000 (13:48 -0700)]
Input: wacom - prepare the driver to include BT devices

Now that wacom is a hid driver, there is no point in having a separate
driver for bluetooth devices. This patch prepares the common paths of
Bluetooth devices in the common wacom driver. It also adds the sysfs file
"speed" used by Bluetooth devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Tested-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: hyperv-keyboard - register as a wakeup source
Dexuan Cui [Wed, 6 Aug 2014 20:33:54 +0000 (13:33 -0700)]
Input: hyperv-keyboard - register as a wakeup source

With this patch, we can press a key to wake up the VM after the VM executes
"echo freeze > /sys/power/state".

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: imx_keypad - remove ifdef round PM methods
Fabio Estevam [Thu, 31 Jul 2014 18:57:08 +0000 (11:57 -0700)]
Input: imx_keypad - remove ifdef round PM methods

We can annotate the suspend/resume functions with '__maybe_unused' and get
rid of the ifdef, which makes the code smaller and simpler.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: jornada720_ts - get rid of space indentation and use tab
Pramod Gurav [Thu, 31 Jul 2014 05:14:46 +0000 (22:14 -0700)]
Input: jornada720_ts - get rid of space indentation and use tab

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: jornada720_ts - switch to using managed resources
Pramod Gurav [Thu, 31 Jul 2014 05:13:58 +0000 (22:13 -0700)]
Input: jornada720_ts - switch to using managed resources

This switches the driver to using managed resources to simplify error
handling and to do away with remove function.

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - Rushmore and v7 resolution support
Hans de Goede [Tue, 29 Jul 2014 18:22:07 +0000 (11:22 -0700)]
Input: alps - Rushmore and v7 resolution support

Add support for querying the physical size from the touchpad for Rushmore
and v7 touchpads, and use that to tell userspace the device resolution.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: mcs5000_ts - remove ifdef around power management methods
Fabio Estevam [Wed, 30 Jul 2014 18:34:49 +0000 (11:34 -0700)]
Input: mcs5000_ts - remove ifdef around power management methods

We can annonate the suspend/resume functions with '__maybe_unused' and get
rid of the ifdef, which makes the code smaller and simpler.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: mcs5000_ts - protect PM functions with CONFIG_PM_SLEEP
Fabio Estevam [Wed, 30 Jul 2014 18:34:31 +0000 (11:34 -0700)]
Input: mcs5000_ts - protect PM functions with CONFIG_PM_SLEEP

When a kernel has CONFIG_PM=y and CONFIG_PM_SLEEP=n the following warnings are
seen:
drivers/input/touchscreen/mcs5000_ts.c:252:12: warning: 'mcs5000_ts_suspend' defined but not used [-Wunused-function]
 static int mcs5000_ts_suspend(struct device *dev)
            ^
drivers/input/touchscreen/mcs5000_ts.c:262:12: warning: 'mcs5000_ts_resume' defined but not used [-Wunused-function]
 static int mcs5000_ts_resume(struct device *dev)

Protect the suspend/resume functions with CONFIG_PM_SLEEP in order to fix these
build warnings.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: ads7846 - release resources on failure for clean exit
Pramod Gurav [Thu, 31 Jul 2014 05:48:24 +0000 (22:48 -0700)]
Input: ads7846 - release resources on failure for clean exit

Input device must be released(input_free_device) when ads7846_probe_dt
fails. This fixes the same by releasing resources on failure.

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - add support for 0x12C ISDv4 sensor
Jason Gerecke [Mon, 28 Jul 2014 17:53:16 +0000 (10:53 -0700)]
Input: wacom - add support for 0x12C ISDv4 sensor

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: atmel_mxt_ts - use deep sleep mode when stopped
Nick Dyer [Mon, 28 Jul 2014 17:14:34 +0000 (10:14 -0700)]
Input: atmel_mxt_ts - use deep sleep mode when stopped

By writing zero to both the active and idle cycle times the maXTouch device
is put into a deep sleep mode when it consumes minimal power. It is
unnecessary to change the configuration of any other objects (for example
to disable T9 touchscreen).

It is counterproductive to reset the chip on resume, it will result in a
long delay. However it is necessary to issue a calibrate command after the
chip has spent any time in deep sleep.

This patch also deals with the situation where the power configuration is
zero on probe, which would mean that the device never wakes up to execute
commands.

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>
10 years agoARM: dts: am437x-gp-evm: Update binding for touchscreen size
Roger Quadros [Mon, 28 Jul 2014 17:11:37 +0000 (10:11 -0700)]
ARM: dts: am437x-gp-evm: Update binding for touchscreen size

Update the bindings for touchscreen size.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoARM: dts: am43x-epos-evm: Update binding for touchscreen size
Roger Quadros [Mon, 28 Jul 2014 17:10:58 +0000 (10:10 -0700)]
ARM: dts: am43x-epos-evm: Update binding for touchscreen size

Update the bindings for touchscreen size.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: pixcir_i2c_ts - add device tree support
Roger Quadros [Mon, 28 Jul 2014 17:05:39 +0000 (10:05 -0700)]
Input: pixcir_i2c_ts - add device tree support

Provide device tree support and binding information.  Also provide support
for a new chip "pixcir_tangoc".

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: pixcir_i2c_ts - support up to 5 fingers and hardware tracking IDs
Roger Quadros [Mon, 28 Jul 2014 17:01:07 +0000 (10:01 -0700)]
Input: pixcir_i2c_ts - support up to 5 fingers and hardware tracking IDs

Some variants of the Pixcir touch controller support up to 5 simultaneous
fingers and hardware tracking IDs. Prepare the driver for that.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: pixcir_i2c_ts - use Type-B Multi-Touch protocol
Roger Quadros [Mon, 28 Jul 2014 16:58:54 +0000 (09:58 -0700)]
Input: pixcir_i2c_ts - use Type-B Multi-Touch protocol

Switch to using the Type-B Multi-Touch protocol.

Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - add support for v7 devices
Yunkang Tang [Sat, 26 Jul 2014 20:51:41 +0000 (13:51 -0700)]
Input: alps - add support for v7 devices

Such as found on the new Toshiba Portégé Z30-A and Z40-A.

Signed-off-by: Yunkang Tang <yunkang.tang@cn.alps.com>
[hdegoede@redhat.com: Remove softbutton handling, this is done in userspace]
[hdegoede@redhat.com: Report INPUT_PROP_BUTTONPAD]
[hdegoede@redhat.com: Do not report fake PRESSURE, reporting BTN_TOUCH is
 enough]
[hdegoede@redhat.com: Various cleanups / refactoring]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - cache firmware version
Hans de Goede [Sat, 26 Jul 2014 05:49:14 +0000 (22:49 -0700)]
Input: alps - cache firmware version

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - change decode function prototype to return an int
Hans de Goede [Sat, 26 Jul 2014 05:48:44 +0000 (22:48 -0700)]
Input: alps - change decode function prototype to return an int

So that decode functions can return a failure when appropriate.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - report 2 touches when we've > 2 fingers
Hans de Goede [Sat, 26 Jul 2014 05:48:02 +0000 (22:48 -0700)]
Input: alps - report 2 touches when we've > 2 fingers

If we detect more then 2 fingers report 2 touches, rather then only
reporting the upper left corner of the bounding box.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - add an alps_report_semi_mt_data function
Hans de Goede [Sat, 26 Jul 2014 05:47:25 +0000 (22:47 -0700)]
Input: alps - add an alps_report_semi_mt_data function

Move all the semi-mt specific handling shared between the v3 and v4
handling code to a common helper function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - use single touch data when v3 mt data contains only one finger
Hans de Goede [Sat, 26 Jul 2014 05:46:53 +0000 (22:46 -0700)]
Input: alps - use single touch data when v3 mt data contains only one finger

For v3 protocol devices, use the more accurate single touch data when the
mt data contains only one finger. Note the mt data reporting a finger count
of 1 should never happen, but better safe then sorry.

This brings the v3 bitmap handling in line with what the v4 code does,
allowing to factor out the common bits into a helper function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - use standard contact tracking instead of DIY
Hans de Goede [Sat, 26 Jul 2014 05:44:42 +0000 (22:44 -0700)]
Input: alps - use standard contact tracking instead of DIY

When there are 2 fingers on the pad we don't know which one is which, so
use input_mt_assign_slots to make sure the right set of coordinates ends
up in the right slot.

Besides ensuring things end up in the right slot, this also results in a
nice cleanup, since sync_frame also handles non mt position and btn_touch
reporting.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - use struct input_mt_pos to track coordinates
Hans de Goede [Sat, 26 Jul 2014 05:43:35 +0000 (22:43 -0700)]
Input: alps - use struct input_mt_pos to track coordinates

This is a preparation patch for switching the DIY mt handling to using
input_mt_assign_slots && input_mt_sync_frame.

struct alps_fields is quite large, so while making changes to almost all uses
of it lets put it in our priv data instead of on the stack.

Having it in our priv data also allows using it directly for storing values
which need to be cached, rather then having separate x, y, z, fingers, etc.
copies in our priv data.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - process_bitmap: round down when spreading adjescent fingers over 2...
Hans de Goede [Sat, 26 Jul 2014 05:42:53 +0000 (22:42 -0700)]
Input: alps - process_bitmap: round down when spreading adjescent fingers over 2 points

This fixes 2 fingers at the same height or width on the touchpad getting
reported at different y / x coordinates.

Note num_bits is always at least 1.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - process_bitmap: fix counting of high point bits
Hans de Goede [Sat, 26 Jul 2014 05:41:51 +0000 (22:41 -0700)]
Input: alps - process_bitmap: fix counting of high point bits

alps_process_bitmap was resetting the point bit-count as soon as it saw
2 0 bits in a row. This means that unless the high point actually is at
the end of the bitmap, it would always get its num_bits set to 0.

Instead reset num_bits to 0 on a 0->1 transition, so that with > 2 fingers
we only count the number of bits occupied by the highest finger.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - process_bitmap: add alps_get_bitmap_points() helper function
Hans de Goede [Sat, 26 Jul 2014 05:38:51 +0000 (22:38 -0700)]
Input: alps - process_bitmap: add alps_get_bitmap_points() helper function

Factor out the identical code for getting the bitmap points for x and y into
a helper function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - process_bitmap: don't invert the Y-axis on Rushmore
Hans de Goede [Sat, 26 Jul 2014 05:37:15 +0000 (22:37 -0700)]
Input: alps - process_bitmap: don't invert the Y-axis on Rushmore

Rushmore models don't have the Y-axis data in the bitmap inverted. Since
we now have 2 different Y orientations, make the Y bitmap data processing
use a forward loop like the X bitmap data processing, unifying the 2,
and invert the data later, except on Rushmore.

So far no-one has noticed this because the synaptics driver only uses the
non mt coordinates (except on clickpads, and there are no alps clickpads
using process_bitmap).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - improve 2-finger reporting on v3 models
Hans de Goede [Sat, 26 Jul 2014 05:33:33 +0000 (22:33 -0700)]
Input: alps - improve 2-finger reporting on v3 models

V3 models only report mt bitmap data when there are 2 or more fingers on
the touchpad. So always generate 2 positions in alps_process_bitmap, and
for v3 models only fall back to st data when there was no mt data in a
mt packet (which should never happen).

This fixes 2 finger scrolling not working when using 2 fingers close to
each other.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: alps - fix rushmore packet decoding
Yunkang Tang [Sat, 26 Jul 2014 05:29:24 +0000 (22:29 -0700)]
Input: alps - fix rushmore packet decoding

Signed-off-by: Yunkang Tang <yunkang.tang@cn.alps.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: soc_button_array - add missing memory allocation check
Pramod Gurav [Sat, 26 Jul 2014 01:41:39 +0000 (18:41 -0700)]
Input: soc_button_array - add missing memory allocation check

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - register an ac power supply for wireless devices
Benjamin Tissoires [Sat, 26 Jul 2014 00:32:41 +0000 (17:32 -0700)]
Input: wacom - register an ac power supply for wireless devices

This is used by HID Bluetooth devices but also add some more information
to the USB Wireless Receiver.
We are just porting the bits from hid-wacom.c to the common driver here.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Przemo Firszt <przemo@firszt.eu>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - use a uniq name for the battery device
Benjamin Tissoires [Sat, 26 Jul 2014 00:31:51 +0000 (17:31 -0700)]
Input: wacom - use a uniq name for the battery device

The current implementation uses "wacom_battery" as a generic name for
batteries. This prevents us to have two Wacom devices with a battery
attached as the power system will complain about the name which is already
registered.

Use an incremental name for each battery attached.

Related bug:
https://sourceforge.net/p/linuxwacom/bugs/248/

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Przemo Firszt <przemo@firszt.eu>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - enhance Wireless Receiver battery reporting
Benjamin Tissoires [Sat, 26 Jul 2014 00:29:48 +0000 (17:29 -0700)]
Input: wacom - enhance Wireless Receiver battery reporting

- Reports the current status of the battery (discharging, charging, full).
- Also notify the upower daemon when there is a change in the battery
  value.
- keep the battery value as a percentage, not the raw value
- add WACOM_QUIRK_BATTERY to easily add a battery to a device (required
  for Bluetooth devices)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Przemo Firszt <przemo@firszt.eu>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - put a flag when the led are initialized
Benjamin Tissoires [Thu, 24 Jul 2014 20:16:17 +0000 (13:16 -0700)]
Input: wacom - put a flag when the led are initialized

This solves a bug with the wireless receiver:
- at plug, the wireless receiver does not know which Wacom device it is
  connected to, so it does not actually creates all the LEDs
- when the tablet connects, wacom->wacom_wac.features.type is set to the
  proper device so that wacom_wac can understand the packets
- when the receiver is unplugged, it detects that a LED should have been
  created (based on wacom->wacom_wac.features.type) and tries to remove
  it: crash when removing the sysfs group.

Side effect, we can now safely call several times wacom_destroy_leds().

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - support up to 2048 pressure levels with ISDv4
Jason Gerecke [Thu, 24 Jul 2014 20:15:31 +0000 (13:15 -0700)]
Input: wacom - support up to 2048 pressure levels with ISDv4

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - move the USB (now hid) Wacom driver in drivers/hid
Benjamin Tissoires [Thu, 24 Jul 2014 20:10:09 +0000 (13:10 -0700)]
Input: wacom - move the USB (now hid) Wacom driver in drivers/hid

wacom.ko is now a full HID driver, we have to move it into the proper
subdirectory: drivers/hid.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - keep wacom_ids ordered
Benjamin Tissoires [Thu, 24 Jul 2014 20:05:49 +0000 (13:05 -0700)]
Input: wacom - keep wacom_ids ordered

No Functional changes, just some reordering.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - remove field pktlen declaration in the list of devices
Benjamin Tissoires [Thu, 24 Jul 2014 20:05:19 +0000 (13:05 -0700)]
Input: wacom - remove field pktlen declaration in the list of devices

pktlen is now overwritten by the driver directly by reading the hid
report descriptor. There is no need to declare it statically.
We also move down the position of the field in the struct so that
we can keep the current declaration of Wacom devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - use hidinput_calc_abs_res instead of duplicating its code
Benjamin Tissoires [Thu, 24 Jul 2014 20:03:05 +0000 (13:03 -0700)]
Input: wacom - use hidinput_calc_abs_res instead of duplicating its code

This may infer a small difference with the previous implementation
due to the DIV_ROUND_CLOSEST() in the hid implementation.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - use in-kernel HID parser
Benjamin Tissoires [Thu, 24 Jul 2014 20:02:14 +0000 (13:02 -0700)]
Input: wacom - use in-kernel HID parser

HID already parses the report descriptor, so use it instead of implementing
our own.  The special case for Bamboo PT 3rd gen is also removed and
handled in the same way Intuos 5 is treated, by hardcoding it in the
driver.  Last, the unit_exponent stored into the hid field already is
signed, so there is no need to handle a two's complement anymore.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - use hid_info instead of plain dev_info
Benjamin Tissoires [Thu, 24 Jul 2014 20:01:56 +0000 (13:01 -0700)]
Input: wacom - use hid_info instead of plain dev_info

Removes one more need of usb and intf.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - register power device at the HID level
Benjamin Tissoires [Thu, 24 Jul 2014 20:01:40 +0000 (13:01 -0700)]
Input: wacom - register power device at the HID level

Use the HID device as the parent for the power device when dealing with
a wireless receiver.
Removes one more usb dependency and does not break user space.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - remove usb dependency for siblings devices
Benjamin Tissoires [Thu, 24 Jul 2014 20:01:05 +0000 (13:01 -0700)]
Input: wacom - remove usb dependency for siblings devices

Wacom tablets can share different physical sensors on one physical device.
These are called siblings in the code. The current way of implementation
relies on the USB topology to be able to share data amongs those sensors.

We can replace the code to match a HID subsystem, without involving the USB
topology:
- the first probed sensor does not find any siblings in the list
  wacom_udev_list, so it creates its own wacom_hdev_data with its own
  struct hid_device
- the other sensor checks the current list of siblings in wacom_hdev_data,
  and if there is a match, it associates itself to the matched device.

To be sure that we are not associating different sensors from different
physical devices, we also check for the phys path of the hid device which
contains the USB topology.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - register the input devices on top of the HID one
Benjamin Tissoires [Thu, 24 Jul 2014 20:00:03 +0000 (13:00 -0700)]
Input: wacom - register the input devices on top of the HID one

Matches the current behavior of the HID subsystem and removes one more
dependency over USB.

The current user space clients which relies on this to fetch the
LEDs path need an update. However, we already break them in the
kernel v3.11 for the Bluetooth Wacom devices. They are going to be fixed
soon.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - install LED/OLED sysfs files in the HID device instead of USB
Benjamin Tissoires [Thu, 24 Jul 2014 19:59:45 +0000 (12:59 -0700)]
Input: wacom - install LED/OLED sysfs files in the HID device instead of USB

Removes one more dependency over USB, but requires some changes in
the user space to find the sysfs files correctly.

This patch breaks the user space. However, the number of program
accessing the LEDs is quite limited and we can easily patch them
to handle the new HID behavior.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - compute the HID report size to get the actual packet size
Benjamin Tissoires [Thu, 24 Jul 2014 19:59:11 +0000 (12:59 -0700)]
Input: wacom - compute the HID report size to get the actual packet size

This removes an USB dependency and is more accurate: the computed pktlen
is the actual maximum size of the reports forwarded by the device.

Given that the pktlen is correctly computed/validated, we can store it now
in the features struct instead of having a special handling in the rest of
the code.

Likewise, this information is not mandatory anymore in the description
of devices in wacom_wac.c. They will be removed in a separate patch.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - use HID core to actually fetch the report descriptor
Benjamin Tissoires [Thu, 24 Jul 2014 19:58:45 +0000 (12:58 -0700)]
Input: wacom - use HID core to actually fetch the report descriptor

HID core already retrieves the report descritor. There is no need
to ask ourself for one.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - use hid communication instead of plain usb
Benjamin Tissoires [Thu, 24 Jul 2014 19:56:22 +0000 (12:56 -0700)]
Input: wacom - use hid communication instead of plain usb

Wacom.ko was a plain USB driver for a HID device. The communications
from/to the devices can actually be replaced with the HID API.

At the USB level, the reports are exactly the same.

This will allow to use uhid virtual devices instead of true USB devices.
This step is necessary to implement regression tests.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - switch from an USB driver to a HID driver
Benjamin Tissoires [Thu, 24 Jul 2014 19:52:23 +0000 (12:52 -0700)]
Input: wacom - switch from an USB driver to a HID driver

All USB Wacom tablets are actually HID devices.
For historical reasons, they are handled as plain USB devices.
The current code makes more and more reference to the HID subsystem
like implementing its own HID report descriptor parser to handle new
devices.

From the user point of view, we can transparently switch from this state
to a driver handled in the HID subsystem and clean up a lot of USB specific
code in the wacom.ko driver.

The other benefit once the USB dependecies have been removed is that we can
use a tool like uhid to make regression tests and allow further cleanup or
new implementations without risking breaking current behaviors.

To match the current handling of devices in wacom_wac.c, we rely on the
hid_type set by usbhid. usbhid sets the hid_type to HID_TYPE_USBMOUSE when
it sees a USB boot mouse protocol declared and HID_TYPE_USBNONE when the
device is plain HID. There is thus a one to one matching between the list
of supported devices before and after the switch from USB to HID.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - include and use linux/hid.h
Benjamin Tissoires [Thu, 24 Jul 2014 19:52:00 +0000 (12:52 -0700)]
Input: wacom - include and use linux/hid.h

The current wacom code redefines constants that are already in linux/hid.h
This patch includes the official implementation and use it accross the code.

There is a conflict with HID_USAGE and others at the same level:
- in the wacom.ko implementation, those are the #define regarding the
  value of the field in the report descriptor
- in the hid.h, those are bitmask
So add HDESC_ in their current definition.

Also, the struct hid_descriptor slightly differs from the linux/hid.h
point of view, so mark it as custom for this driver.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - split out the pad device for the wireless receiver
Benjamin Tissoires [Thu, 24 Jul 2014 19:51:26 +0000 (12:51 -0700)]
Input: wacom - split out the pad device for the wireless receiver

The Wireless Receiver should also behave in the same way than regular
USB devices.

To simplify the unregistering of the different devices,
wacom_unregister_inputs() is introduced.
For consistency, the function wacom_register_input() is renamed into
wacom_register_inputs().

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - split out the pad device for Graphire G4 and MO
Benjamin Tissoires [Thu, 24 Jul 2014 19:51:03 +0000 (12:51 -0700)]
Input: wacom - split out the pad device for Graphire G4 and MO

MSC_SERIAL can be safely removed from pad devices. If it is not
here, xf86-input-wacom correctly generates ones for its internal
use.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - split out the pad device for DTUS
Benjamin Tissoires [Thu, 24 Jul 2014 19:50:39 +0000 (12:50 -0700)]
Input: wacom - split out the pad device for DTUS

MSC_SERIAL can be safely removed from the pad device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - split out the pad device for Bamboos
Benjamin Tissoires [Thu, 24 Jul 2014 19:50:10 +0000 (12:50 -0700)]
Input: wacom - split out the pad device for Bamboos

We rely on the return code of wacom_bpt*() to do the input_sync().
wacom_wac_irq() then properly sync the input devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - split out the pad device for Intuos/Cintiq
Benjamin Tissoires [Thu, 24 Jul 2014 19:49:08 +0000 (12:49 -0700)]
Input: wacom - split out the pad device for Intuos/Cintiq

MSC_SERIAL can be safely dropped for pad input devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - create a separate input device for pads
Benjamin Tissoires [Thu, 24 Jul 2014 19:48:28 +0000 (12:48 -0700)]
Input: wacom - create a separate input device for pads

Currently, the pad events are sent through the stylus input device
for the Intuos/Cintiqs, and through the touch input device for the
Bamboos.

To differentiate the buttons pressed on the pad from the ones pressed
on the stylus, the Intuos/Cintiq uses MISC_SERIAL and ABS_MISC. This
lead to a multiplexing of the events into one device, which are then
splitted out in xf86-input-wacom. Bamboos are not using MISC events
because the pad is attached to the touch interface, and only BTN_TOUCH
is used for the finger (and DOUBLE_TAP, etc...). However, the user space
driver still splits out the pad from the touch interface in the same
way it does for the pro line devices.

The other problem we can see with this fact is that some of the Intuos
and Cintiq have a wheel, and the effective range of the reported values
is [0..71]. Unfortunately, the airbrush stylus also sends wheel events
(there is a small wheel on it), but in the range [0..1023]. From the user
space point of view it is kind of difficult to understand that because
the wheel on the pad are quite common, while the airbrush tool is not.

A solution to fix all of these problems is to split out the pad device
from the stylus/touch. This decision makes more sense because the pad is
not linked to the absolute position of the finger or pen, and usually, the
events from the pad are filtered out by the compositor, which then convert
them into actions or keyboard shortcuts.

For backward compatibility with current xf86-input-wacom, the pad devices
still present the ABS_X, ABS_Y and ABS_MISC events, but they can be
completely ignored in the new implementation.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom - assign phys field from struct wacom into input_dev
Benjamin Tissoires [Thu, 24 Jul 2014 19:48:06 +0000 (12:48 -0700)]
Input: wacom - assign phys field from struct wacom into input_dev

This field was not used for 9 years, it is time to assign it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: Revert "wacom - testing result shows get_report is unnecessary."
Benjamin Tissoires [Thu, 24 Jul 2014 19:47:47 +0000 (12:47 -0700)]
Input: Revert "wacom - testing result shows get_report is unnecessary."

This reverts commit 1b2faaf7e219fc2905d75afcd4c815e5d39eda80.

The Intuos4 series presents a bug in which it hangs if it receives
a set feature command while switching to the enhanced mode.
This bug is triggered when plugging an Intuos 4 while having
a gnome user session up and running.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Aristeu Rozanski <aris@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
10 years agoInput: wacom_serial4 - prepare for wacom USB moving to HID
Dmitry Torokhov [Thu, 24 Jul 2014 20:27:18 +0000 (13:27 -0700)]
Input: wacom_serial4 - prepare for wacom USB moving to HID

wacom_wac.h will be moving to drivers/hid. Since we only need 3 definitions
from it let's simply copy them over.

Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>