History log of /linux-master/drivers/input/mouse/appletouch.c
Revision Date Author Comments
# 9f3ccdc3 30-Dec-2021 Pavel Skripkin <paskripkin@gmail.com>

Input: appletouch - initialize work before device registration

Syzbot has reported warning in __flush_work(). This warning is caused by
work->func == NULL, which means missing work initialization.

This may happen, since input_dev->close() calls
cancel_work_sync(&dev->work), but dev->work initalization happens _after_
input_register_device() call.

So this patch moves dev->work initialization before registering input
device

Fixes: 5a6eb676d3bc ("Input: appletouch - improve powersaving for Geyser3 devices")
Reported-and-tested-by: syzbot+b88c5eae27386b252bbd@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/20211230141151.17300-1-paskripkin@gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 6f49c4f5 07-Jul-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

Input: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200707180857.GA30600@embeddedor
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 74ba9207 20-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
675 mass ave cambridge ma 02139 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 441 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 17a4ed55 06-Aug-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

Input: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Warning level 2 was used: -Wimplicit-fallthrough=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 7a082a24 27-Jul-2018 Jia-Ju Bai <baijiaju1990@gmail.com>

Input: appletouch - replace GFP_ATOMIC with GFP_KERNEL

atp_open(), atp_recover() and atp_resume() are never called in atomic
context. They call usb_submit_urb() with GFP_ATOMIC, which is not
necessary. GFP_ATOMIC can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 70851233 14-Mar-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

Input: appletouch - use true and false for boolean values

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a45232d6 07-Aug-2017 Arvind Yadav <arvind.yadav.cs@gmail.com>

Input: appletouch - constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 7bbdba56 31-Mar-2014 Clinton Sprain <clintonsprain@gmail.com>

Input: appletouch - fix jumps when additional fingers are detected

Addresses issues related to when a second finger enters or leaves the
field, causing the cursor to jump or the page to scroll unexpectedly; now,
we discard any movement change that happens at the exact moment we detect a
change in the number of fingers touching the trackpad. This doesn't
completely resolve the issue but does greatly mitigate it.

Signed-off-by: Clinton Sprain <clintonsprain@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 739204bc 31-Mar-2014 Clinton Sprain <clintonsprain@gmail.com>

Input: appletouch - implement sensor data smoothing

Use smoothed version of sensor array data to calculate movement and add
weight to prior values when calculating average. This gives more granular
and more predictable movement.

Signed-off-by: Clinton Sprain <clintonsprain@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 703e1488 26-Mar-2014 Clinton Sprain <clintonsprain@gmail.com>

Input: appletouch - dial back fuzz setting

Let's dial back the default fuzz setting for most devices using this
driver, based on values from user feedback from forums and bug reports.

Signed-off-by: Clinton Sprain <clintonsprain@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# bf9a9f8e 06-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com>

Input: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 3b923993 04-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: input: appletouch: fix up compiler warning

My last patch fixing up the dev_* messages caused a compiler warning
accidentally for an unused variable. Fix this up, as it was my fault.

Cc: Alessandro Rubini <rubini@ipvvis.unipv.it>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2d744b09 04-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: input: appletouch.c: fix up dev_* messages

Previously I had made the struct device point to the input device, but
after talking with Dmitry, he said that the USB device would make more
sense for this driver to point to. So converted it to use that instead.

CC: Alessandro Rubini <rubini@ipvvis.unipv.it>
CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 67946d13 01-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: appletouch.c: remove dbg() usage

dbg() was a very old USB-specific macro that should no longer
be used. This patch removes it from being used in the driver
and uses dev_dbg() instead.

CC: Alessandro Rubini <rubini@ipvvis.unipv.it>
CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 80f8594f 01-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: input: appletouch.c: fix up dev_err() usage

We should always reference the input device for dev_err(), not the USB
device. Fix up the places where I got this wrong.

Reported-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
CC: Alessandro Rubini <rubini@ipvvis.unipv.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9c113dc6 25-Apr-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: appletouch.c: remove err() usage

err() was a very old USB-specific macro that I thought had
gone away. This patch removes it from being used in the
driver and uses dev_err() instead.

CC: Alessandro Rubini <rubini@ipvvis.unipv.it>
CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 08642e7c 18-Nov-2011 Greg Kroah-Hartman <gregkh@suse.de>

USB: convert drivers/input/* to use module_usb_driver()

This converts the drivers in drivers/input/* to use the
module_usb_driver() macro which makes the code smaller and a bit
simpler.

Added bonus is that it removes some unneeded kernel log messages about
drivers loading and/or unloading.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Ville Syrjala <syrjala@sci.fi>
Cc: Henk Vergonet <Henk.Vergonet@gmail.com>
Cc: Alessandro Rubini <rubini@ipvvis.unipv.it>
Cc: Henrik Rydberg <rydberg@euromail.se>
Cc: "Magnus Hörlin" <magnus@alefors.se>
Cc: Chris Moeller <kode54@gmail.c>
Cc: Christoph Fritz <chf.fritz@googlemail.com>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: Jesper Juhl <jj@chaosbits.net>
Cc: Edwin van Vliet <edwin@cheatah.nl>
Cc: Ping Cheng <pingc@wacom.com>
Cc: Eduard Hasenleithner <eduard@hasenleithner.at>
Cc: Alexander Strakh <strakh@ispras.ru>
Cc: Glenn Sommer <gsommer@datanordisk.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d745b532 30-Oct-2010 Joe Perches <joe@perches.com>

Input: appletouch - remove extra KERN_DEBUG use from dprintk

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 6e49c1a4 08-Aug-2010 Benjamin Herrenschmidt <benh@kernel.crashing.org>

Revert "Input: appletouch - fix integer overflow issue"

This reverts commit 04b4b88cca0ebe3813b4b6f014fb6a0db380b137.

While the original problem only caused a slight disturbance on the
edge of the touchpad, the commit above to "fix" it completely breaks
operation on some other models such as mine.

We'll sort this out separately, revert the patch for now.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# 997ea58e 12-Apr-2010 Daniel Mack <daniel@caiaq.de>

USB: rename usb_buffer_alloc() and usb_buffer_free() users

For more clearance what the functions actually do,

usb_buffer_alloc() is renamed to usb_alloc_coherent()
usb_buffer_free() is renamed to usb_free_coherent()

They should only be used in code which really needs DMA coherency.

All call sites have been changed accordingly, except for staging
drivers.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Pedro Ribeiro <pedrib@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 04b4b88c 11-Mar-2010 Vadim Zaliva <lord@crocodile.org>

Input: appletouch - fix integer overflow issue

When reading data from Geyser 2 touchpads used on post Oct 2005 Apple
PowerBooks the driver was casting X and Y coordinates values to
'signed char'. Testing on one of such PowerBooks I have noticed that
touchpad always generates positive values, but some of them are greater
that 127, and thus, when cast to 'signed char' being interpreted as
a negative.

Such bigger values have been observed infrequently, closer to the
edges of a touchpad, so the problem was not very visible.
Nevertheless, the patch would potentially improve touchpad
driver accuracy.

Signed-off-by: Vadim Zaliva <lord@crocodile.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 05e882f8 03-Jun-2009 Jeremy Huddleston <jeremyhu@freedesktop.org>

Input: appletouch - improve finger detection

The appletouch driver is prone to reporting multiple fingers when only
one is pressing. The appletouch driver queries an array of pressure
sensors and counts local maxima in pressure to determine the number of
fingers. It just does this on the raw values, so a data stream like:

0 100 250 300 299 300 250 100 0

actually registers as 2 fingers.

This patch updates the logic to ignore small dips in pressure that are
less than the threshold.

Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 0385c5ee 28-Apr-2009 Bob Copeland <me@bobcopeland.com>

Input: appletouch - fix DMA to/from stack buffer

CONFIG_DMA_API_DEBUG spotted an instance of appletouch using
an array on the stack as a DMA buffer for certain hardware.
Change it to use a kmalloc()ed buffer instead.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 09779678 28-Oct-2008 Stelian Pop <stelian@popies.net>

Input: appletouch - driver refactoring

The appletouch driver has grown up from supporting only a couple of
touchpads into supporting many touchpads, which can have different
number of sensors, different aspect ratios etc.

This patch cleans up the current driver code and makes it easy to
support the features of each different touchpad.

As a side effect, this patch also modifies the 'Y' multiplication factor
of the 'geyser3' and 'geyser4' touchpads (found on Core Duo and Core2
Duo MacBook and MacBook Pro laptops) in order to make the touchpad
output match the aspect ratio of the touchpad (Y factor changed from 43
to 64).

[dtor@mail.ru: make atp_info constant]
Signed-off-by: Stelian Pop <stelian@popies.net>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 82a196f4 08-Aug-2008 Sven Anders <anders@anduras.de>

Input: appletouch - handle geyser 3/4 status bits

Implement support for status bits on Geyser 3/4.

Signed-off-by: Sven Anders <anders@anduras.de>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# d83d213d 08-Aug-2008 Sven Anders <anders@anduras.de>

Input: appletouch - prepare for geyser 3/4 handling

Split complete function into separate functions for GEYSER1/2 and GEYSER 3/4.

Signed-off-by: Sven Anders <anders@anduras.de>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 90d95ef6 17-Jun-2008 Oliver Neukum <oliver@neukum.org>

Input: appletouch - implement reset-resume logic

On some boxes the touchpad needs to be reinitialized after resume to make
it function again. This fixes bugzilla #10825.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# e9542dff 05-May-2008 Sven Anders <anders@anduras.de>

Input: appletouch - simplify touchpad type detection

This patch simplifies type detection and removes unnecessary code.

Signed-off-by: Sven Anders <anders@anduras.de>
[jberg: don't typedef, checkpatch clean, remove useless comments, ...]
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 7dce869f 05-May-2008 Johannes Berg <johannes@sipsolutions.net>

Input: appletouch - miscellaneous code cleanups

This patch does some code cleanups in appletouch:
* useless comment removal
* make almost checkpatch clean
* make sparse clean

Signed-off-by: Sven Anders <anders@anduras.de>
[jberg: most of the changes including removing much of the original patch]
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# ea3e6c59 05-May-2008 Harvey Harrison <harvey.harrison@gmail.com>

Input: replace remaining __FUNCTION__ occurrences

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 0035a1dc 02-Apr-2008 Tobias Mueller <Tobias_Mueller@twam.info>

Input: appletouch - add product IDs for the 4th generation MacBooks

Signed-off-by: Tobias Mueller <Tobias_Mueller@twam.info>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# f23c1d75 02-Apr-2008 Tobias Mueller <Tobias_Mueller@twam.info>

Input: appletouch - add product IDs for the 4th generation MacBooks

Signed-off-by: Tobias Mueller <Tobias_Mueller@twam.info>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 2a3e480d 01-Nov-2007 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: appletouch - idle reset logic broke older Fountains

Fountains do not support change mode request and therefore
should be excluded from idle reset attempts.

Also:
- do not re-submit URB when we decide that touchpad needs to be
reinicialized
- do not repeat size detection when reinitializing the touchpad
- Add missing KERN_* prefixes to messages

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Johannes Berg <johannes@sipsolutions.net>


# 46249ea6 21-Oct-2007 Anton Ekblad <valderman@gmail.com>

Input: appletouch - apply idle reset logic to all touchpads

Not only Geyser 3 but also Geyser 1 need to be reset after they become
idle to stop them from needlessly waking up the kernel. Do idle reset
on all touchpads, regardless of their version - if we see 10 empty
packets the touchpad needs to be reset; good touchpads should not send
empty packets anyway.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 937ad5c1 12-Oct-2007 Soeren Sonnenburg <kernel@nn7.de>

Input: appletouch - another fix for idle reset logic

Make sure we reset idlecount when we get a good (non-empty) packet.

Signed-off-by: Soeren Sonnenburg <kernel@nn7.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# cb560737 24-Sep-2007 Thomas Rohwer <tr@tng.de>

Input: appletouch - fix idle reset logic

Idle count should only be incremented when touchpad button
is not pressed, otherwise reset may happen at a wrong time
and touchpad will never report button release event.

Signed-off-by: Thomas Rohwer <trohwer@tng.de>
Acked-by: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 5a6eb676 19-Jul-2007 Soeren Sonnenburg <kernel@nn7.de>

Input: appletouch - improve powersaving for Geyser3 devices

The appletouch geyser3 devices found in the Intel Macs (and possibly
some later PPC ones?) send a constant stream of packets after the first
touch. This results in the kernel waking up around once every couple of
milliseconds to process them, making it almost impossible to spend any
significant amount of time in C3 state on a dynamic HZ kernel. Sending
the mode initialization code makes the device shut up until it's touched
again. This patch does so after receiving 10 packets with no interesting
content.

Signed-off-by: Soeren Sonnenburg <kernel@nn7.de>
Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# b5da20f8 07-May-2007 Dmitry Torokhov <dtor@insightbb.com>

Input: move USB mice under drivers/input/mouse

This will allow concentrating all input devices in one place
in {menu|x|q}config.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>