With commit 67d0a07544 we mark strict_strtox
as obsolete. Convert all remaining such uses in drivers/input/.
Also change long to appropriate types, and return error conditions
from kstrtox separately, as Dmitry sugguests.
Signed-off-by: JJ Ding <dgdunix@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Also converts from using "old" and "new" to describe the already-known
protocols to using "version 1" and "version 2" to match the code.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This patch adds support for two ALPS touchpad protocols not
supported currently by the driver, which I am arbitrarily naming
version 3 and version 4. Support is single-touch only at this time,
although both protocols are capable of limited multitouch support.
Thanks to Andrew Skalski, who did the initial reverse-engineering
of the v3 protocol.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
In preparation for version 4 protocol support, which has 8-byte
data packets, remove all hard-coded assumptions about packet size
and use psmouse->pktsize instead.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
In preparation for adding support for more ALPS protocol versions,
add a field for the protocol version to the model info instead of
using a field in the flags. OLDPROTO and !OLDPROTO are now called
version 1 and version 2, repsectively.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
In preparation for new protocol support, move the protocol
information currently documented in alps.c to
Documentation/input/alps.txt, where it can be expanded without
cluttering up the driver.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Bamboo's Pen and Touch packets always start with a value
of 0x02 in first byte. In 3rd gen Bamboo's, the hw is now
periodically sending some additional packets with unrelated data
and uses a value other than 0x02 to inform driver this.
Ignore those packets now.
This was reported by users as bad behavior in Gimp. The
invalid packets being processed made the stylus report
out of proximity for the 1 packet and this triggered some
secondary bug which caused Gimp to stop drawing until
user really took pen out of proximity of tablet.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
In addition to some laptops needing i8042 reset after resuming from S2R to
get their touchpads working there is another class of laptops - ones that
need i8042 reset before going to S2R, otherwise they will simply reboot
instead of resuming.
See https://bugzilla.kernel.org/show_bug.cgi?id=15612
This change forces reset of i8042 before doing S2R.
Reported-by: Stefan Koch <stefan_koch@gmx.net>
Tested-by: Alexander van Loon <a.vanloon@alexandervanloon.nl>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This driver has been tested with hardware and works as expected. To use
it add the platform data as appropriate and register it with the
corresponding I2C bus.
Signed-off-by: Kyle Manna <kyle.manna@fuel7.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
3rd generation Bamboo Pen and Touch tablets reuse the older
stylus packet but add an extra fixed zero pad byte to end.
The touch packets are quite different since it supports tracking
of up to 16 touches. The packet is 64-byte fixed size but contains
up to 15 smaller messages indicating data for a single touch or
for tablet button presses.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Override invalid pen based pktlen and x/y_max with touch
values from HID report.
Since active area of pen and touch are same on these
devices, set physical x/y size while pen x/y_max and
resolution are still valid.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Bit 0x02 always means tip versus eraser. Bit 0x01 is something related
to version of stylus and different values are starting to be used.
Relaxing proximity check is required to be used with 3rd generation
Bamboo Pen and Touch tablets.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Bamboo's do not declared a Digitizer-Stylus so the if() was
never executed. wacom_features already contains correct stylus
packet length.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Only the stylus interface on Bamboo's has a feature report that can
be used to set to wacom mode. The touch interface only has 1 report mode
and will return errors for those get/sets requests.
The get request was always erroring out because it was not marked as
an input request. Only down side of error was needlessly resending the
set request 5 times.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
The ADP5585 family keypad decoder and IO expander is similar to the ADP5589,
however it features less IO pins, and lacks hardware assisted key-lock
functionality. Unfortunately the register addresses are different, as well as
the event codes and bit organization within the port related registers.
Move ADP5589 Register defines from the header file into the main source file.
Add new defines while making sure we don't break existing platform_data.
Add register address translation, and turn device specific defines into variables.
Introduce some helper functions and disable functions that doesn't
exist on the added devices.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
The imx_keypad driver was indicating that it was wakeup capable in
imx_keypad_probe(), but it didn't implement suspend or resume methods.
According to the i.MX series MCU Reference Manual, the kpp (keypad
port) is a major wake up source which can detect any key press even
in low power mode and even when there is no clock.
Signed-off-by: Hui Wang <jason77.wang@gmail.com>
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
The problem here is that max_effects can wrap on 32 bits systems.
We'd allocate a smaller amount of data than sizeof(struct ff_device).
The call to kcalloc() on the next line would fail but it would write
the NULL return outside of the memory we just allocated causing data
corruption.
The call path is that uinput_setup_device() get ->ff_effects_max from
the user and sets the value in the ->private_data struct. From there
it is:
-> uinput_ioctl_handler()
-> uinput_create_device()
-> input_ff_create(dev, udev->ff_effects_max);
I've also changed ff_effects_max so it's an unsigned int instead of
a signed int as a cleanup.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Abort driver initialization if X plate resistance was not specified in
platform data as it will cause pressure to be always calculated as 0,
and making userspace ignore touch coordinates.
Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Apparently we never freed memory allocated when users open our char
devices nor removed old users from the list of connected clients.
Also unregister misc device immediately upon disconnecting the port
instead of waiting until last user drops off (refcounting in misc
device code will make sure needed pieces stay around while they
are needed) and make sure we are not holing holding serio_raw_mutex
when registering/unregistering misc device. This should fix potential
deadlock between serio_raw and misc device code uncovered by lockdep
and reported by Thomas Tuttle.
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Send SIGIO/POLL_HUP and otherwise wake up waiters when corresponding serio
port is being disconnected. Also check if port is dead in serio_raw_poll
and signal POLLHUP|POLLERR.
This should speed up process of releasing dead devices by userspace
applications.
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Instead of relying on setting serio_raw->serio to NULL upon disconnecting
ports mark them explicitly as "dead". Also take and carry reference to
underlying serio port to make sure it does not go away until we are done
with it.
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This will ensure our reporting is consistent with the rest of the system.
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Make sure we hold serio lock when adding clients to client list so that
we do not race with serio_raw_release() removing clients from the same
list.
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
'serio_raw_list' and 'list' names do not accurately represent their objects
and are extremely confusing when reading the code. Let's use better suited
names.
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This will ensure our reporting is consistent with the rest of the system
and we do not refer to obsolete source file names.
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: JJ Ding <dgdunix@gmail.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Medium size Bamboo P&T driver reused max X/Y form older Bamboo 1
medium size tablets and never updated to real value. Actual
active area of tablet is slightly larger in Y direction.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Tablet reports a distance of 0 right at highest point possible
to be in proximity and distance_max when touching tablet. Inverse
the distance since user land has no way of knowing ABS_DISTANCE
is not distance from tablet.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
These were left in during removal of touch pressure reports but not
needed now.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
CONFIG_PM is defined when CONFIG_PM_SLEEP or CONFIG_PM_RUNTIME is defined,
however suspend and resume methods are only valid in the context of
CONFIG_PM_SLEEP. If only CONFIG_PM_RUNTIME is defined we get the following
warning (courtesy of Geerts randconfig builds):
lm8323.c: warning: 'lm8323_resume' defined but not used
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
CONFIG_PM is defined when CONFIG_PM_SLEEP or CONFIG_PM_RUNTIME is defined,
however suspend and resume methods are only valid in the context of
CONFIG_PM_SLEEP. If only CONFIG_PM_RUNTIME is defined we get the following
warning (courtesy of Geerts randconfig builds):
ad7879-i2c.c: warning: 'ad7879_i2c_resume' defined but not used
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
CONFIG_PM is defined when CONFIG_PM_SLEEP or CONFIG_PM_RUNTIME is defined,
however suspend and resume methods are only valid in context of
CONFIG_PM_SLEEP. If only CONFIG_PM_RUNTIME is defined we get the following
warning (courtesy of Geerts randconfig builds):
synaptics_i2c.c: warning: 'synaptics_i2c_resume' defined but not used
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Sometimes GCC is not smart enough to recognize that x, y and z are
always used properly initialized in mma8450_poll(). Let's rearrange
the code a bit to help GCC.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Sysfs attribute show methods are always passed a buffer of length
PAGE_SIZE. To keep from overwriting this buffer and causing havoc, use
snprintf() to guarantee we never write more than the buffer can hold.
In addition, at least for my touchscreen, the number and size of objects
was far too big to fit in a single 4K page. Therefore, this patch also
trims some redundant framing text to leave more room for actual data.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Acked-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Cintiq 21ux2 has two sets of four LEDs on right and left side of
the tablet, respectively.
Reviewed-by: Eduard Hasenleithner <eduard@hasenleithner.at>
Tested-by: Eduard Hasenleithner <eduard@hasenleithner.at>
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
The LED also indicates the status of the tablet. Don't turn it off.
Reviewed-by: Eduard Hasenleithner <eduard@hasenleithner.at>
Tested-by: Eduard Hasenleithner <eduard@hasenleithner.at>
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
The LED luminance level is normally lower when no button is pressed.
Reviewed-by: Eduard Hasenleithner <eduard@hasenleithner.at>
Tested-by: Eduard Hasenleithner <eduard@hasenleithner.at>
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This patch adds the TSC-40 serial touchscreen driver and should be
compatible with TSC-10 and TSC-25.
The driver was written by Linutronix on behalf of Bachmann electronic GmbH.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This patch clarifies a few bits of documentation in the header file
for the adxl34x driver.
Signed-off-by: Michael Tandy <lkml@mkt.me.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Use the of_property_read_u32() helper function to retrieve u32 values
from the device tree. Also do not pass the len parameter to
of_get_property if it isn't checked afterwards.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Since touchscreen driver does not handle any events to be sent to the
device we can close serio port first and then unregister the input device.
Tested-by: John Sung <penmount.touch@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Instead of having one large switch based on product ID use pointer to
function actually doing protocol decoding.
Tested-by: John Sung <penmount.touch@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Add multi touch support for PenMount 6250 touch controller.
Signed-off-by: John Sung <penmount.touch@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>