History log of /linux-master/drivers/input/touchscreen/ads7846.c
Revision Date Author Comments
# e9f6aa10 28-Jul-2023 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - use device core to create driver-specific device attributes

Instead of creating driver-specific device attributes with
devm_device_add_group() have device core do this by setting up dev_groups
pointer in the driver structure.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230729005133.1095051-7-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 11ca6056 09-Jun-2023 Arnd Bergmann <arnd@arndb.de>

Input: ads7846 - fix pointer cast warning

The previous bugfix caused a warning on 64-bit builds:

drivers/input/touchscreen/ads7846.c:1126:17: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'const void *' [-Wvoid-pointer-to-int-cast]

Change the cast back to something that works on both 32-bit and 64-bit
kernels.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306100442.jStknDT1-lkp@intel.com/
Fixes: 8f7913c04f6a7 ("Input: ads7846 - Fix usage of match data")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>


# 8f7913c0 06-Jun-2023 Linus Walleij <linus.walleij@linaro.org>

Input: ads7846 - Fix usage of match data

device_get_match_data() returns the match data directly, fix
this up and fix the probe crash.

Fixes: 767d83361aaa ("Input: ads7846 - Convert to use software nodes")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/20230606191304.3804174-1-linus.walleij@linaro.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>


# 767d8336 08-May-2023 Linus Walleij <linus.walleij@linaro.org>

Input: ads7846 - Convert to use software nodes

The Nokia 770 is using GPIOs from the global numberspace on the
CBUS node to pass down to the LCD controller. This regresses when we
let the OMAP GPIO driver use dynamic GPIO base.

The Nokia 770 now has dynamic allocation of IRQ numbers, so this
needs to be fixed for it to work.

As this is the only user of LCD MIPID we can easily augment the
driver to use a GPIO descriptor instead and resolve the issue.

The platform data .shutdown() callback wasn't even used in the
code, but we encode a shutdown asserting RESET in the remove()
callback for completeness sake.

The CBUS also has the ADS7846 touchscreen attached.

Populate the devices on the Nokia 770 CBUS I2C using software
nodes instead of platform data quirks. This includes the LCD
and the ADS7846 touchscreen so the conversion just brings the LCD
along with it as software nodes is an all-or-nothing design
pattern.

The ADS7846 has some limited support for using GPIO descriptors,
let's convert it over completely to using device properties and then
fix all remaining boardfile users to provide all platform data using
software nodes.

Dump the of includes and of_match_ptr() in the ADS7846 driver as part
of the job.

Since we have to move ADS7846 over to obtaining the GPIOs it is
using exclusively from descriptors, we provide descriptor tables
for the two remaining in-kernel boardfiles using ADS7846:

- PXA Spitz
- MIPS Alchemy DB1000 development board

It was too hard for me to include software node conversion of
these two remaining users at this time: the spitz is using a
hscync callback in the platform data that would require further
GPIO descriptor conversion of the Spitz, and moving the hsync
callback down into the driver: it will just become too big of
a job, but it can be done separately.

The MIPS Alchemy DB1000 is simply something I cannot test, so take
the easier approach of just providing some GPIO descriptors in
this case as I don't want the patch to grow too intrusive.

As we see that several device trees have incorrect polarity flags
and just expect to bypass the gpiolib polarity handling, fix up
all device trees too, in a separate patch.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Fixes: 92bf78b33b0b ("gpio: omap: use dynamic allocation of base")
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


# 0e685c3e 07-Feb-2023 Arnd Bergmann <arnd@arndb.de>

gpiolib: remove gpio_set_debounce()

gpio_set_debounce() only has a single user, which is trivially
converted to gpiod_set_debounce().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# fa9f4275 26-Jan-2023 Luca Ellero <l.ellero@asem.it>

Input: ads7846 - don't check penirq immediately for 7845

To discard false readings, one should use "ti,penirq-recheck-delay-usecs".
Checking get_pendown_state() at the beginning, most of the time fails
causing malfunctioning.

Fixes: ffa458c1bd9b ("spi: ads7846 driver")
Signed-off-by: Luca Ellero <l.ellero@asem.it>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230126105227.47648-4-l.ellero@asem.it
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 13f82ca3 26-Jan-2023 Luca Ellero <l.ellero@asem.it>

Input: ads7846 - always set last command to PWRDOWN

Controllers that report pressure (e.g. ADS7846) use 5 commands and the
correct sequence is READ_X, READ_Y, READ_Z1, READ_Z2, PWRDOWN.

Controllers that don't report pressure (e.g. ADS7845/ADS7843) use only 3
commands and the correct sequence should be READ_X, READ_Y, PWRDOWN. But
the sequence sent was incorrect: READ_X, READ_Y, READ_Z1.

Fix this by setting the third (and last) command to PWRDOWN.

Fixes: ffa458c1bd9b ("spi: ads7846 driver")
Signed-off-by: Luca Ellero <l.ellero@asem.it>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230126105227.47648-3-l.ellero@asem.it
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# d50584d7 26-Jan-2023 Luca Ellero <l.ellero@asem.it>

Input: ads7846 - don't report pressure for ads7845

ADS7845 doesn't support pressure.
Avoid the following error reported by libinput-list-devices:
"ADS7845 Touchscreen: kernel bug: device has min == max on ABS_PRESSURE".

Fixes: ffa458c1bd9b ("spi: ads7846 driver")
Signed-off-by: Luca Ellero <l.ellero@asem.it>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230126105227.47648-2-l.ellero@asem.it
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f8909d9a 02-Jan-2023 Jonathan Cameron <Jonathan.Cameron@huawei.com>

Input: ads7846 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
against unused function warnings. The new combination of pm_sleep_ptr()
and DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions,
thus suppressing the warning, but still allowing the unused code to be
removed. Thus also drop the __maybe_unused markings.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230102181842.718010-32-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a0386bba 23-Jan-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

spi: make remove callback a void function

The value returned by an spi driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Claudius Heine <ch@denx.de>
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Acked-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Łukasz Stelmach <l.stelmach@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220123175201.34839-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 36fc5437 09-Sep-2021 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - do not attempt IRQ workaround when deferring probe

When request_irq() returns -EPORBE_DEFER we should abort probe and try
again later instead of trying to engage IRQ trigger workaround.

Link: https://lore.kernel.org/r/20210910045039.4020199-3-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# ccd66139 09-Sep-2021 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - use input_set_capability()

Instead of manipulating capability bits directly use
input_set_capability(). Also stop setting EV_ABS explicitly as
input_set_abs_params() does it for us.

Link: https://lore.kernel.org/r/20210910045039.4020199-2-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 9271cda2 09-Sep-2021 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - set input device bus type and product ID

Set input device's bus type as BUS_SPI and use model as product ID.

Link: https://lore.kernel.org/r/20210910045039.4020199-1-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 845ef3a7 09-Sep-2021 Daniel Mack <daniel@zonque.org>

Input: ads7846 - switch to devm initialization

This simplies the code a lot and fixes some potential resource leaks in
the error return paths.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Link: https://lore.kernel.org/r/20210907200726.2034962-4-daniel@zonque.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 937f5d5e 09-Sep-2021 Daniel Mack <daniel@zonque.org>

Input: ads7846 - remove custom filter handling functions from pdata

The functions in the platform data struct to initialize, cleanup and
apply custom filters are not in use by any mainline board.

Remove support for them to pave the road for more cleanups to come.

The enum was moved as it has no users outside of the driver code
itself.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.kernel.org/r/20210907200726.2034962-3-daniel@zonque.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# de609b56 09-Sep-2021 Daniel Mack <daniel@zonque.org>

Input: ads7846 - add short-hand for spi->dev in probe() function

This will make the code a bit more terse.
No functional change intended.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.kernel.org/r/20210907200726.2034962-2-daniel@zonque.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 6965eece 21-Jan-2021 Oleksij Rempel <linux@rempel-privat.de>

Input: ads7846 - convert to one message

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

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

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

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

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

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

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

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

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20201110085041.16303-3-o.rempel@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 23fd34a5 11-Nov-2020 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - drop unneeded asm/irq.h include

This is essentially a revert of:

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

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

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 03e2c9c7 11-Nov-2020 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - fix unaligned access on 7845

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

Fixes: 3eac5c7e44f3 ("Input: ads7846 - extend the driver for ads7845 controller support")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 820830ec 17-Nov-2020 Oleksij Rempel <linux@rempel-privat.de>

Input: ads7846 - fix integer overflow on Rt calculation

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

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

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

Fixes: ffa458c1bd9b6f653008d450f337602f3d52a646 ("spi: ads7846 driver")
Co-developed-by: David Jander <david@protonic.nl>
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20201113112240.1360-1-o.rempel@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 9c950971 11-Nov-2020 Oleksij Rempel <linux@rempel-privat.de>

Input: ads7846 - convert to full duplex

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

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

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20201110085041.16303-2-o.rempel@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# e52cd628 11-Nov-2020 David Jander <david@protonic.nl>

Input: ads7846 - fix race that causes missing releases

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

Fixes: f5a28a7d4858f94a ("Input: ads7846 - avoid pen up/down when reading hwmon")
Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20201027105416.18773-1-o.rempel@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 376ccca8 27-Oct-2020 Oleksij Rempel <linux@rempel-privat.de>

Input: ads7846: do not overwrite spi->mode flags set by spi framework

Do not overwrite spi->mode flags set by spi framework, otherwise the
chip select polarity will get lost.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/20201027095724.18654-3-o.rempel@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3fe781f4 08-Nov-2020 Wang Qing <wangqing@vivo.com>

Input: ads7846 - use kobj_to_dev() API

Use kobj_to_dev() instead of container_of().

Signed-off-by: Wang Qing <wangqing@vivo.com>
Link: https://lore.kernel.org/r/1604893436-20206-1-git-send-email-wangqing@vivo.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 0dfed6dc 10-Jan-2020 Alexandru Ardelean <alexandru.ardelean@analog.com>

Input: ads7846 - use new `delay` structure for SPI transfer delays

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

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

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

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20191210141103.15910-1-alexandru.ardelean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a2f99330 09-Aug-2019 Marco Felsch <m.felsch@pengutronix.de>

Input: ads7846 - add support for general touchscreen bindings

A few vendor specific bindings are now covered by common bindings.

Let the driver parse the common bindings to make use of common
inverting and swapping mechnism. Aslo make use of
touchscreen_report_pos() to ensure the correct inverting-swapping
order.

The vendor specific properties are used as default (backward
compatibility) and gets overwritten by common bindings.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

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

Based on 2 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 version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9e938dec 10-Jul-2017 Arvind Yadav <arvind.yadav.cs@gmail.com>

Input: ads7846 - constify attribute_group structures

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

File size before:
text data bss dec hex filename
9086 624 0 9710 25ee drivers/input/touchscreen/ads7846.o

File size After adding 'const':
text data bss dec hex filename
9198 496 0 9694 25de drivers/input/touchscreen/ads7846.o

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


# f5a28a7d 20-Mar-2017 David Jander <david@protonic.nl>

Input: ads7846 - avoid pen up/down when reading hwmon

Each time the HWMON devices are read (e.g. battery voltage) while the
touchscreen is held pressed, extra pen-up and pen-down events are
generated. This is fixed by avoiding the UP event when the touchscreen is
stopped.

Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 8e1b4d83 22-Jan-2017 Guenter Roeck <linux@roeck-us.net>

Input: touchscreen - drop unnecessary calls to device_init_wakeup

Calling device_init_wakeup in the remove function is unnecessary since the
device is going away, and thus won't be able to cause any wakeups under any
circumstances. Besides, the driver cleanup code already handles the
necessary cleanup.

Similarly, disabling wakeup in the probe error path is unnecessary, as is
disabling wakeup in the probe function in the first place.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# e3a888a4 19-Aug-2016 Petr Cvek <petr.cvek@tul.cz>

Input: ads7846 - remove redundant regulator_disable call

ADS7846 regulator is disabled twice in a row in ads7846_remove(). Valid
one is in ads7846_disable().

Removing the ads7846 module causes warning about unbalanced disables.

...
WARNING: CPU: 0 PID: 29269 at drivers/regulator/core.c:2251 _regulator_disable+0xf8/0x130
unbalanced disables for vads7846
CPU: 0 PID: 29269 Comm: rmmod Tainted: G D W 4.7.0+ #3
Hardware name: HTC Magician
...
show_stack+0x10/0x14
__warn+0xd8/0x100
warn_slowpath_fmt+0x38/0x48
_regulator_disable+0xf8/0x130
regulator_disable+0x34/0x60
ads7846_remove+0x58/0xd4 [ads7846]
spi_drv_remove+0x1c/0x34
__device_release_driver+0x84/0x114
driver_detach+0x8c/0x90
bus_remove_driver+0x5c/0xc8
SyS_delete_module+0x1a0/0x238
ret_fast_syscall+0x0/0x38

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 3821a065 23-Oct-2015 Andrew F. Davis <afd@ti.com>

spi: Drop owner assignment from spi_drivers

An spi_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 879f2fea 06-Oct-2015 Andrey Gelman <andrey.gelman@compulab.co.il>

Input: ads7846 - correct the value got from SPI

According to the touch controller spec, SPI return a 16 bit value, only 12
bits are valid, they are bit[14-3].

The value of MISO and MOSI can be configured when SPI is in idle mode.
Currently this touch driver assumes the SPI bus sets the MOSI and MISO in
low level when SPI bus is in idle mode. So the bit[15] of the value got
from SPI bus is always 0. But when SPI bus congfigures the MOSI and MISO in
high level during the SPI idle mode, the bit[15] of the value get from SPI
is always 1. If bit[15] is not masked, we may get the wrong value.

Mask the invalid bit to make sure the correct value gets returned.
Regardless of the SPI bus idle configuration.

Signed-off-by: Andrey Gelman <andrey.gelman@compulab.co.il>
Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# c4517f82 02-Oct-2015 Javier Martinez Canillas <javier@osg.samsung.com>

Input: ads7846 - use PTR_ERR_OR_ZERO()

The PTR_ERR_OR_ZERO() helper function checks if a pointer contains an
errno code and returns it or return 0 if that's not the case. Use the
helper instead of open coding the same logic in the driver. This was
found with make coccicheck that complains with the following warning:

drivers/input/touchscreen/ads7846.c:532:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# abf77a32 16-Jul-2015 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - change name of wakeup property to "wakeup-source"

Wakeup property of device is not Linux-specific, it describes intended
system behavior regardless of the OS being used. Therefore let's drop
"linux," prefix, and, while at it, use the same name as I2C bus does:
"wakeup-source".

We keep parsing old name to keep compatibility with old DTSes.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 02b6a58b 02-Nov-2014 Jingoo Han <jg1.han@samsung.com>

Input: touchscreen - use __maybe_unused instead of ifdef around suspend/resume

Use __maybe_unused instead of ifdef guards around suspend/resume
functions, in order to increase build coverage and fix build warnings.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a1cd3fd0 30-Jul-2014 Pramod Gurav <pramod.gurav@smartplayin.com>

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>


# c8986208 22-Apr-2014 Mark Brown <broonie@linaro.org>

Input: ads7846 - correct log message for spi_sync() errors

While searching for users of spi_async() I got a false positive in the
ads7846 driver, fix that.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 2fdf4cd9 12-Apr-2014 Alexander Stein <alexanders83@web.de>

Input: ads7846 - fix device usage within attribute show

With commit e585c40ba (Input: ads7846 - convert to
hwmon_device_register_with_groups()) the device passed to the attribute's
show function isn't the spi device as before.
So fixup the passed device to ads7846_read12_ser.

Signed-off-by: Alexander Stein <alexanders83@web.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
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>


# e585c40b 27-Nov-2013 Guenter Roeck <linux@roeck-us.net>

Input: ads7846 - convert to hwmon_device_register_with_groups()

Simplify the code and create mandatory 'name' attribute by using
new hwmon API.

Also use is_visible to determine visible attributes instead of creating
several different attribute groups.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# c52b4fc7 01-Dec-2013 Fabio Estevam <fabio.estevam@freescale.com>

Input: ads7846 - use IS_ENABLED() macro

Using the IS_ENABLED() macro can make the code shorter and simpler

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a608026e 28-Jun-2013 Daniel Mack <zonque@gmail.com>

Input: ads7846 - add device tree bindings

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 57691a1e 28-Jun-2013 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - make sure we do not change platform data

Let's declare platform data a const pointer so that we don't accitentally
change it. Also fetch it with dev_get_platdata().

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# c12454fa 07-Apr-2013 Jingoo Han <jg1.han@samsung.com>

Input: ads7846 - use spi_get_drvdata() and spi_set_drvdata()

Use the wrapper functions for getting and setting the driver data using
spi_device instead of using dev_{get|set}_drvdata with &spi->dev, so we
can directly pass a struct spi_device.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f94352f8 03-Mar-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

Input: ads7864 - check return value of regulator enable

At least print a warning if we can't power the device up.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# e2619cf7 23-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

Input: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 5298cc4c 23-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

Input: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 1cb0aa88 23-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

Input: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# c4f49254 21-Nov-2012 Igor Grinberg <grinberg@compulab.co.il>

Input: ads7846 - enable pendown GPIO debounce time setting

Some platforms need the pendown GPIO debounce time setting programmed.
Since the pendown GPIO is handled by the driver, the debounce time
should also be handled along with the pendown GPIO request.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# ca83922e 17-Mar-2012 Axel Lin <axel.lin@gmail.com>

Input: convert SPI drivers to use module_spi_driver()

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

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# a6c61789 29-Nov-2011 Lars-Peter Clausen <lars@metafoo.de>

Input: remove redundant spi driver bus initialization

In ancient times it was necessary to manually initialize the bus field of an
spi_driver to spi_bus_type. These days this is done in spi_driver_register(),
so we can drop the manual assignment.

The patch was generated using the following coccinelle semantic patch:
// <smpl>
@@
identifier _driver;
@@
struct spi_driver _driver = {
.driver = {
- .bus = &spi_bus_type,
},
};
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 76496e7a 09-Nov-2011 JJ Ding <dgdunix@gmail.com>

Input: convert obsolete strict_strtox to kstrtox

With commit 67d0a0754455f89ef3946946159d8ec9e45ce33a 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>


# d2d8442d 03-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com>

drivers/input: Add module.h to modular drivers implicitly using it

A pending cleanup will mean that module.h won't be implicitly
everywhere anymore. Make sure the modular drivers in input dir
are actually calling out for <module.h> explicitly in advance.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# 58c24400 27-Jun-2011 Igor Grinberg <grinberg@compulab.co.il>

Input: ads7846 - cleanup GPIO initialization

Use gpio_request_one() instead of multiple gpiolib calls.
This also simplifies error handling a bit.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 1201e7e6 11-May-2011 Igor Grinberg <grinberg@compulab.co.il>

Input: ads7846 - fix gpio_pendown configuration

The pendown gpio was requested but not configured for input.
Configure it for input.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# ebcaaad9 11-May-2011 Alexander Stein <alexander.stein@systec-electronic.com>

Input: ads7846 - add possibility to use external vref on ads7846

Just set vref_mv in your platform config to use external vref. Otherwise
the internal one is used.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 28350e33 05-May-2011 Alexander Stein <alexander.stein@systec-electronic.com>

Input: ads7846 - remove unused variable from struct ads7845_ser_req

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 1dbe7dad 05-May-2011 Alexander Stein <alexander.stein@systec-electronic.com>

Input: ads7846 - make transfer buffers DMA safe

req.sample needs its own cacheline otherwise accessing req.msg fetches
it in again.

Note: This effect doesn't occur if the underlying SPI driver doesn't use
DMA at all.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 0fbc9fdb 04-Feb-2011 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - check proper condition when freeing gpio

When driver uses custom pendown detection method gpio_pendown is not
set up and so we should not try to free it, otherwise we are presented
with:

------------[ cut here ]------------
WARNING: at drivers/gpio/gpiolib.c:1258 gpio_free+0x100/0x12c()
Modules linked in:
[<c0061208>] (unwind_backtrace+0x0/0xe4) from [<c0091f58>](warn_slowpath_common+0x4c/0x64)
[<c0091f58>] (warn_slowpath_common+0x4c/0x64) from [<c0091f88>](warn_slowpath_null+0x18/0x1c)
[<c0091f88>] (warn_slowpath_null+0x18/0x1c) from [<c024e610>](gpio_free+0x100/0x12c)
[<c024e610>] (gpio_free+0x100/0x12c) from [<c03e9fbc>](ads7846_probe+0xa38/0xc5c)
[<c03e9fbc>] (ads7846_probe+0xa38/0xc5c) from [<c02cff14>](spi_drv_probe+0x18/0x1c)
[<c02cff14>] (spi_drv_probe+0x18/0x1c) from [<c028bca4>](driver_probe_device+0xc8/0x184)
[<c028bca4>] (driver_probe_device+0xc8/0x184) from [<c028bdc8>](__driver_attach+0x68/0x8c)
[<c028bdc8>] (__driver_attach+0x68/0x8c) from [<c028b4c8>](bus_for_each_dev+0x48/0x74)
[<c028b4c8>] (bus_for_each_dev+0x48/0x74) from [<c028ae08>](bus_add_driver+0xa0/0x220)
[<c028ae08>] (bus_add_driver+0xa0/0x220) from [<c028c0c0>](driver_register+0xa8/0x134)
[<c028c0c0>] (driver_register+0xa8/0x134) from [<c0050550>](do_one_initcall+0xcc/0x1a4)
[<c0050550>] (do_one_initcall+0xcc/0x1a4) from [<c00084e4>](kernel_init+0x14c/0x214)
[<c00084e4>] (kernel_init+0x14c/0x214) from [<c005b494>](kernel_thread_exit+0x0/0x8)
---[ end trace 4053287f8a5ec18f ]---

Also rearrange ads7846_setup_pendown() to have only one exit point
returning success.

Reported-by: Sourav Poddar <sourav.poddar@ti.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Reviewed-by: Charulatha V <charu@ti.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 3c36e719 20-Jan-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

Input: ads7846 - convert to dev_pm_ops

There is a move to deprecate bus-specific PM operations and move to
using dev_pm_ops instead in order to reduce the amount of boilerplate
code in buses and facilitate updates to the PM core. Do this move for
the ads7846 driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 2991a1ca 13-Oct-2010 Jason Wang <jason77.wang@gmail.com>

Input: ads7846 - switch to using threaded IRQ

Commit 9114337 introduces regulator operations in ads7846 touchscreen
driver. Among these operations, some are called while holding a
spinlock. On many platforms regulators reside on slow buses, such as
I2C/SPI and require sleep while accessing them.

The touchscreen itself is also a SPI device and currently relies on
asynchronous SPI access to avoid sleeping in interrupt context. Let's
switch to using threaded IRQ to be able to access SPI bus
synchronously (which simplifies driver a bit); it also allows safe
access to the regulators as well.

This has been tested on the ti_omap3530evm board:
1) using ts_lib after normal boot
2) using ts_lib after "#echo 1/0 > /sys/bus/spi/devices/spi0.1/disable"
3) using ts_lib after "#echo mem > /sys/power/state" and "wake up"

Also tested on pandora.

Based on original patch by Dmitry Torokhov.

Tested-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Jason Wang <jason77.wang@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 3eac5c7e 01-Jul-2010 Anatolij Gustschin <agust@denx.de>

Input: ads7846 - extend the driver for ads7845 controller support

ADS7845 is a controller for 5-wire touch screens and somewhat
different from 7846. It requires three serial communications to
accomplish one complete conversion. Unlike 7846 it doesn't allow
Z1-/Z2- position measurement.

The patch extends the ads7846 driver to also support ads7845.
The packet struct is extended to contain needed command and
conversion buffers. ads7846_rx() and ads7846_rx_val() now
differentiate between 7845 and 7846 case. ads7846_probe() is
modified to setup ads7845 specific command and conversion
messages and to switch ads7845 into power-down mode, since
this is needed to be prepared to respond to pendown interrupts.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 0f622bf4 01-Jul-2010 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - do not allow altering platform data

Tested-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 7804302b 28-Jun-2010 Anatolij Gustschin <agust@denx.de>

Input: ads7846 - allow specifying irq trigger type in platform data

On some platforms, for example with GPIO interrupts on mpc5121,
it is not possible to configure falling edge interrupts.

Specifying irq trigger type in platform data structure
allows using ads7846 driver on such platforms.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 56960b36 02-Jun-2010 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - fix compiler warning in ads7846_probe()

This patch fixes the follwing warning introduced by commit
067fb2f648543894ce775082c5636f4c32b99e4f ("Input: ads7846 - return error on
regulator_get() failure"):

drivers/input/touchscreen/ads7846.c: In function 'ads7846_probe':
drivers/input/touchscreen/ads7846.c:1167: warning: format '%ld' expects
type 'long int', but argument 4 has type 'int'

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


# 067fb2f6 27-May-2010 Kevin Hilman <khilman@deeprootsystems.com>

Input: ads7846 - return error on regulator_get() failure

In probe(), if regulator_get() failed, an error code was not being
returned causing the driver to be successfully bound, even though
probe failed. This in turn caused the suspend, resume and remove
methods to be registered and accessed via the SPI core. Since these
functions all access private driver data using pointers that had been
freed during the failed probe, this would lead to unpredictable
behavior.

This patch ensures that probe() returns an error code in this failure
case so the driver is not bound.

Found using lockdep and noticing the lock used in the suspend/resum
path pointed to a bogus lock due to the freed memory.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# fdba2bb1 11-Mar-2010 Ranjith Lohithakshan <ranjithl@ti.com>

Input: ads7846 - add wakeup support

Add wakeup support to the ads7846 driver. Platforms can enable wakeup
capability by setting the wakeup flag in ads7846_platform_data. With this
patch the ads7846 driver can be used to wake the system from suspend.

Signed-off-by: Ranjith Lohithakshan <ranjithl@ti.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 06a09124 09-Mar-2010 Michael Hennerich <michael.hennerich@analog.com>

Input: ads7846 - add support for AD7843 parts

The AD7873 is almost identical to the ADS7846; the only difference is
related to the Power Management bits PD0 and PD1. This results in a
slightly different PENIRQ enable behavior. For the AD7873, VREF should
be turned off during differential measurements.

So, add the AD7873/43 to the list of driver supported devices, and prevent
VREF usage during differential/ratiometric conversion modes.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 91143379 25-Feb-2010 Grazvydas Ignotas <notasas@gmail.com>

Input: ads7846 - add regulator support

The ADS7846/TSC2046 touchscreen controllers can (and usually are)
connected to various regulators for power, so add regulator support.

Valid regulator will now be required, so boards without complete
regulator setup should either disable regulator framework or enable
CONFIG_REGULATOR_DUMMY.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 52ce4eaa 23-Nov-2009 Pavel Machek <pavel@ucw.cz>

Input: ads7846 - switch to using dev_vdbg()

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 30ad7ba0 23-Nov-2009 Pavel Machek <pavel@ucw.cz>

Input: ads7846 - fix pressure reporting

On Zaurus, hx4700 and others pressure is reported inverted -- the lighter
the pressure, the bigger numerical value.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# e0626e38 22-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

spi: prefix modalias with "spi:"

This makes it consistent with other buses (platform, i2c, vio, ...). I'm
not sure why we use the prefixes, but there must be a reason.

This was easy enough to do it, and I did it.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Samuel Ortiz <sameo@openedhand.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Acked-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# c57c0a2a 11-Jun-2009 Michael Roth <mroth@nessie.de>

Input: ads7846 - pin change interrupt support

Some SoCs support only pin change interrupts on GPIO pins used as irq
lines.

The ads7846 core is not affected from the additional irqs on the rising
edge because the code accounts touch bounce anyway by kicking in a timer
and disabling the irq after the first request and reenabling the irq after
a timeout when there is no longer pen down detected.

Signed-off-by: Michael Roth <mroth@nessie.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# b58895f8 18-May-2009 Michael Roth <mroth@nessie.de>

Input: ads7846 - more detailed model name in sysfs

Signed-off-by: Michael Roth <mroth@nessie.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 86579a4c 18-May-2009 Michael Roth <mroth@nessie.de>

Input: ads7846 - support swapping x and y axes

Signed-off-by: Michael Roth <mroth@nessie.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 3f3e7c6e 15-Apr-2009 Ben Nizette <bn@niasdigital.com>

Input: ads7846 - fix unsafe disable_irq

The use of disable_irq inside the handler for the interrupt being
disabled has always been dangerous. disable_irq should wait for that
handler to complete before returning -> deadlock.

For some reason this wasn't actually the case until 3aa551c9b was merged
but since this time, the ads7846 driver has deadlocked the system on
first interrupt.

Convert the driver to use the handler-safe _nosync variant.

Signed-off-by: Ben Nizette <bn@niasdigital.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# fd746d54 11-Apr-2009 Eric Miao <eric.miao@marvell.com>

Input: ads7846 - introduce platform specific way to synchronize sampling

Noises can be introduced when LCD signals are being driven, some platforms
provide a signal to assist the synchronization of this sampling procedure.

Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# b731d7b6 12-Mar-2009 Adam Buchbinder <adam.buchbinder@gmail.com>

trivial: Fix misspelling of "Celsius".

A few comments say "Celcius"; this fixes them. No code changes.

Signed-off-by: Adam Buchbinder <adam.buchbinder@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 3a0c58dd 23-Dec-2008 Harvey Harrison <harvey.harrison@gmail.com>

Input: ads7846 - strict_strtoul takes unsigned long

Fix sparse warning introduced by:
commit 160f1fef7e52e974489b3c70fbd4e094c06965c2 Input: convert drivers to use strict_strtoul()

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# ca109491 24-Nov-2008 Peter Zijlstra <peterz@infradead.org>

hrtimer: removing all ur callback modes

Impact: cleanup, move all hrtimer processing into hardirq context

This is an attempt at removing some of the hrtimer complexity by
reducing the number of callback modes to 1.

This means that all hrtimer callback functions will be ran from HARD-irq
context.

I went through all the 30 odd hrtimer callback functions in the kernel
and saw only one that I'm not quite sure of, which is the one in
net/can/bcm.c - hence I'm CC-ing the folks responsible for that code.

Furthermore, the hrtimer core now calls callbacks directly with IRQs
disabled in case you try to enqueue an expired timer. If this timer is a
periodic timer (which should use hrtimer_forward() to advance its time)
then it might be possible to end up in an inf. recursive loop due to the
fact that hrtimer_forward() doesn't round up to the next timer
granularity, and therefore keeps on calling the callback - obviously
this needs a fix.

Aside from that, this seems to compile and actually boot on my dual core
test box - although I'm sure there are some bugs in, me not hitting any
makes me certain :-)

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


# a6c2490f 29-Oct-2008 Kay Sievers <kay.sievers@vrfy.org>

Input: struct device - replace bus_id with dev_name(), dev_set_name()

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# e8f462d2 08-Oct-2008 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ads7846 - fix cache line sharing issue

We had a report a while back that the ads7846 driver had some issues
when used with DMA-based SPI controllers (like atmel_spi) on systems
where main memory is not DMA-coherent (most non-x86 boards). Allocate
memory potentially used for DMA separately to avoid cache line issues.

Reported-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 6ae19b04 09-Sep-2008 Eric Miao <eric.y.miao@gmail.com>

Input: ads7846 - introduce .gpio_pendown to get pendown state

The GPIO connected to ADS7846 nPENIRQ signal is usually used to get
the pendown state as well. Introduce a .gpio_pendown, and use this
to decide the pendown state if .get_pendown_state is NULL.

Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 4d5975e5 09-Sep-2008 Eric Miao <eric.y.miao@gmail.com>

Input: ads7846 - introduce .gpio_pendown to get pendown state

The GPIO connected to ADS7846 nPENIRQ signal is usually used to get
the pendown state as well. Introduce a .gpio_pendown, and use this
to decide the pendown state if .get_pendown_state is NULL.

Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 160f1fef 09-Aug-2008 Joe Rouvier <joe@rouvier.org>

Input: convert drivers to use strict_strtoul()

strict_strtoul() allows newline character at the end of the the input
string and therefore is more user-friendly.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 9460b652 23-Jul-2008 Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>

Input: ads7846 - optimize order of calculating Rt in ads7846_rx()

Alter the if expression for calculating Rt. The old implementation would
run unnecessary code when the ADS7843 device was used.

The patch also fixes the code style to kernel standard.

Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 494f6857 23-Jul-2008 Harvey Harrison <harvey.harrison@gmail.com>

Input: ads7846 - fix sparse endian warnings

Also remove the temporary pointer and use ->rx_buf directly.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# ac37a0b0 26-Feb-2008 David Brownell <david-b@pacbell.net>

ARM: OMAP: 5912 OSK GPIO updates

Start cleaning up GPIO handling for OMAP5912 OSK board:

- Initialize GPIOs using the cross-platform calls, not the old
OMAP-private ones.

- Move touchscreen setup out of ads7846 code into board-specfic
setup code, where it belongs.

This doesn't depend on the patches to update OMAP to use the
gpiolib implementation framework.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>


# 7c6d0ee1 01-Apr-2008 David Brownell <david-b@pacbell.net>

Input: ads7846 - simplify support of external vREF (and ads7843)

This updates the ads7846 driver to handle external vREF (required
on boards using ads7843 chips) without module parameters, and also
removes a needless variable with its associated bogus gcc warning.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 05be5fc4 10-Mar-2008 Andrew Morton <akpm@linux-foundation.org>

Input: ads7846 - fix uninitialized var warning

drivers/input/touchscreen/ads7846.c: In function 'ads7846_read12_ser':
drivers/input/touchscreen/ads7846.c:216: warning: 'sample' may be used uninitialized in this function

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# fbb38e30 13-Dec-2007 David Brownell <david-b@pacbell.net>

Input: ads7846 - stop updating dev->power.power_state

This stops the ads7846 driver from using dev->power.power_state; that field is
deprecated (overdue for removal) and the only reason to update it was to make
the /sys/devices/.../power/state files (now removed) work better.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# c24b2602 05-Dec-2007 Marc Pignat <marc.pignat@hevs.ch>

spi: use simplified spi_sync() calling convention

Given the patch which simplifies the spi_sync calling convention, this one
updates the callers of that routine which tried using it according to the
previous specification. (Most didn't.)

Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 7b19ada2 19-Oct-2007 Jiri Slaby <jirislaby@kernel.org>

get rid of input BIT* duplicate defines

get rid of input BIT* duplicate defines

use newly global defined macros for input layer. Also remove includes of
input.h from non-input sources only for BIT macro definiton. Define the
macro temporarily in local manner, all those local definitons will be
removed further in this patchset (to not break bisecting).
BIT macro will be globally defined (1<<x)

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <dtor@mail.ru>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Cc: <lenb@kernel.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Cc: <perex@suse.cz>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: <vernux@us.ibm.com>
Cc: <malattia@linux.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 1beeffe4 20-Aug-2007 Tony Jones <tonyj@suse.de>

hwmon: Convert from class_device to device

Convert from class_device to device for hwmon_device_register/unregister

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>


# 1d25891f 17-Jul-2007 Semih Hazar <semih.hazar@indefia.com>

Input: ads7846 - re-check pendown status before reporting events

Pendown status from the PENIRQ pin is currently read only at the beginning
of a sample set. If the pen is lifted just after sampling has began then
sampled values become wrong.

This patch adds an optional platform penirq_recheck_delay attribute. If
non-zero, samples are only reported to the input subsystem if PENIRQ is
still active that long after the samples taken.

Signed-off-by: Semih Hazar <semih.hazar@indefia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# e4f48861 17-Jul-2007 Semih Hazar <semih.hazar@indefia.com>

Input: ads7846 - introduce sample settling delay

The ads7846 driver has support for filtering, but when the chip gets
deselected between samples this causes noise. This patch adds support
for an optional settling delay time, so that two consecutive samples
will be taken with the specified delay time apart. This ensures that
the chip won't be deselected, so the noise won't appear.

Filtering can still be done, but will have less work to do since each
time a new sample is taken the same delay applies.

Signed-off-by: Semih Hazar <semih.hazar@indefia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 230ffc8e 22-May-2007 Semih Hazar <semih.hazar@indefia.com>

Input: ads7846 - SPI_CPHA mode bugfix

In commit [1] the SPI mode is set to 1, but it should be 0. As stated
in the commit, ads784x samples the data on the rising edge. SPI mode 1
samples on the falling edge [2] though.

The root cause of this is a bug in the omap_uwire code, which treats
CPHA=1 incorrectly; so these two bugs cancel each other out on one
of the main regression test platforms for this driver.

[1] kernel.org GIT 7937e86a70235e1584486654687dc9908a11e00a
[2] http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# bff0de5f 22-May-2007 David Brownell <david-b@pacbell.net>

Input: ads7846 - document that it handles tsc2046 too

The TSC2046 is an updated version of the ADS7846 ... mention that in
the Kconfig helptext and driver source.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# a5394fb0 11-Apr-2007 Dmitry Torokhov <dtor@insightbb.com>

Input: touchscreens - switch to using input_dev->dev.parent

In preparation for struct class_device -> struct device input
core conversion, switch to using input_dev->dev.parent when
specifying device position in sysfs tree.

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


# 969111e9 28-Feb-2007 Nicolas Ferre <nicolas.ferre@rfo.atmel.com>

Input: ads7846 - add support for the ads7843 touchscreen

The ads7843 support has now become almost trivial since the last
rework.

Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# c9cb2e3d 16-Feb-2007 Thomas Gleixner <tglx@linutronix.de>

[PATCH] hrtimers: namespace and enum cleanup

- hrtimers did not use the hrtimer_restart enum and relied on the implict
int representation. Fix the prototypes and the functions using the enums.
- Use seperate name spaces for the enumerations
- Convert hrtimer_restart macro to inline function
- Add comments

No functional changes.

[akpm@osdl.org: fix input driver]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 2c8dc071 17-Jan-2007 David Brownell <dbrownell@users.sourceforge.net>

Input: ads7846 - be more compatible with the hwmon framework

- Hook up to hwmon
* show sensor attributes only if hwmon is present
* ... and the board's reference voltage is known
* otherwise be just a touchscreen
- Report voltages per hwmon convention
* measure in millivolts
* voltages are named in[0-8]_input (ugh)
* for 7846 chips, properly range-adjust vBATT/in1_input

Battery measurements help during recharge monitoring. On OSK/Mistral,
the measured voltage agreed with a multimeter to several decimal places.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 15e3589e 17-Jan-2007 Imre Deak <imre.deak@solidboot.com>

Input: ads7846 - detect pen up from GPIO state

We can't depend on the pressure value to determine when the pen was
lifted, so use the GPIO line state instead. This also helps with
chips (like ads7843) that don't have pressure sensors.

Signed-off-by: Imre Deak <imre.deak@solidboot.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 7937e86a 17-Jan-2007 Imre Deak <imre.deak@nokia.com>

Input: ads7846 - select correct SPI mode

Talk to ADS7846 chip using SPI mode 1, which is what the chip
supports: writes on falling clock edge, reads on rising.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 1936d590 17-Jan-2007 Imre Deak <imre.deak@solidboot.com>

Input: ads7846 - switch to using hrtimer

Use hrtimer instead of the normal timer, since it provides better
sampling resolution. This will:

- avoid a problem where we have a 1 jiffy poll period and
dynamic tick on
- utilize high resolution HW clocks when they are added to
the hrtimer framework

Signed-off-by: Imre Deak <imre.deak@solidboot.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# de2defd9 17-Jan-2007 Imre Deak <imre.deak@solidboot.com>

Input: ads7846 - optionally leave Vref on during differential measurements

On some LCDs leaving the Vref on provides much better readings.

Signed-off-by: Jarkko Oikarinen <jarkko.oikarinen@nokia.com>
Signed-off-by: Imre Deak <imre.deak@solidboot.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# da970e69 17-Jan-2007 Imre Deak <imre.deak@solidboot.com>

Input: ads7846 - pluggable filtering logic

Some LCDs like the LS041Y3 require a customized filtering
logic for reliable readings, so make the filtering function
replacable through platform specific hooks.

Signed-off-by: Imre Deak <imre.deak@solidboot.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# e94b1766 06-Dec-2006 Christoph Lameter <clameter@sgi.com>

[PATCH] slab: remove SLAB_KERNEL

SLAB_KERNEL is an alias of GFP_KERNEL.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 8dd51650 02-Nov-2006 Dmitry Torokhov <dtor@insightbb.com>

Input: ads7846 - handle errors from sysfs

Add sysfs error handling and switch to using attribute groups
to simplify it.

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


# 7d12e780 05-Oct-2006 David Howells <dhowells@redhat.com>

IRQ: Maintain regs pointer globally rather than passing to IRQ handlers

Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.

(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.

(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)


# dace1453 01-Jul-2006 Thomas Gleixner <tglx@linutronix.de>

[PATCH] irq-flags: misc drivers: Use the new IRQF_ constants

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 6ceab8a9 25-Jun-2006 Matt Mackall <mpm@selenic.com>

[PATCH] random: remove redundant SA_SAMPLE_RANDOM from touchscreen drivers

The core input layer is already calling add_input_randomness.

Signed-off-by: Matt Mackall <mpm@selenic.com>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 9084533e 25-May-2006 David Brownell <david-b@pacbell.net>

[PATCH] ads7846 conversion accuracy

This improves accuracy of the touchscreen and hwmon sensor readings,
addressing an issue noted by Imre Deak: there's an extra bit written before
the sample (12 bits) gets written out.

It also catches up to various comments, and makes the /proc/interrupts
entry sensible again.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Imre Deak <imre.deak@nokia.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# d5b415c9 25-Apr-2006 Imre Deak <imre.deak@nokia.com>

Input: ads7846 - improve filtering for thumb press accuracy

Providing more accurate coordinates for thumb press requires additional
steps in the filtering logic:

- Ignore samples found invalid by the debouncing logic, or the ones that
have out of bound pressure value.
- Add a parameter to repeat debouncing, so that more then two consecutive
good readings are required for a valid sample.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Acked-by: Juha Yrjola <juha.yrjola@nokia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# ae82d5ab 25-Apr-2006 Imre Deak <imre.deak@nokia.com>

Input: ads7846 - report 0 pressure value along with pen up event

X touchscreen drivers that don't interpret the designated pen up message
assume a pen up event from a pressure value 0. For these we generate a
pressure 0 message along with the pen up message.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Acked-by: Juha Yrjola <juha.yrjola@nokia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# c9e617a5 11-Apr-2006 Imre Deak <imre.deak@nokia.com>

Input: ads7846 - handle IRQs that were latched during disabled IRQs

The pen down IRQ will toggle during each X,Y,Z measurement cycle.
Even though the IRQ is disabled it will be latched and delivered
when after enable_irq. Thus in the IRQ handler we must avoid
starting a new measurement cycle when such an "unwanted" IRQ happens.
Add a get_pendown_state platform function, which will probably
determine this by reading the current GPIO level of the pen IRQ pin.

Move the IRQ reenabling from the SPI RX function to the timer. After
the last power down message the pen IRQ pin is still active for a
while and get_pendown_state would report incorrectly a pen down state.

When suspending we should check the ts->pending flag instead of
ts->pendown, since the timer can be pending regardless of ts->pendown.
Also if ts->pending is set we can be sure that the timer is running,
so no need to rearm it. Similarly if ts->pending is not set we can
be sure that the IRQ is enabled (and the timer is not).

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 7de90a8c 11-Apr-2006 Imre Deak <imre.deak@nokia.com>

Input: ads7846 - miscellaneous fixes

- Add disable attribute to support device locking mode where
unintentional touch event shouldn't wake up the system;
- Update comments;
- Add missing spin_lock_init;
- Do device resume with the lock held;
- Do cleanup calls / free memory in the reverse order of initialization.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# c4febb94 11-Apr-2006 Juha Yrjola <juha.yrjola@nokia.com>

Input: ads7846 - use msleep() instead of udelay() in suspend

Sometimes a polling loop had a hard time changing state without
pre-emption enabled. Use msleep instead, it's better anyway.

Signed-off-by: Juha Yrjola <juha.yrjola@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 0b7018aa 11-Apr-2006 Imre Deak <imre.deak@nokia.com>

Input: ads7846 - debouncing and rudimentary sample filtering

Some touchscreens seem to oscillate heavily for a while after touching
the screen.  Implement support for sampling the screen until we get two
consecutive values that are close enough.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 53a0ef89 11-Apr-2006 Imre Deak <imre.deak@nokia.com>

Input: ads7846 - power down ADC a bit later

Submit a seperate request for powering down the ADC in ads7846,
doing it after the last read request. Otherwise some of the read
values are incorrect.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 438f2a74 11-Apr-2006 Imre Deak <imre.deak@nokia.com>

Input: ads7846 - add pen_down sysfs attribute

It's handy for userspace diagnostics to see the pen down status, to
see whether the touchscreen is "stuck" (shortcircuited).

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 3ac8bf07 26-Mar-2006 Andrew Morton <akpm@osdl.org>

[PATCH] ads7846: sparc32 warning fix

drivers/input/touchscreen/ads7846.c: In function `ads7846_read12_ser':
drivers/input/touchscreen/ads7846.c:207: warning: implicit declaration of function `disable_irq'
drivers/input/touchscreen/ads7846.c:209: warning: implicit declaration of function `enable_irq'

Cc: Dmitry Torokhov <dtor_core@ameritech.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 4cae59d2 25-Mar-2006 Andrew Morton <akpm@osdl.org>

[PATCH] ads7846 build fix

sparc32:

drivers/input/touchscreen/ads7846.c: In function `ads7846_read12_ser':
drivers/input/touchscreen/ads7846.c:206: warning: implicit declaration of function `disable_irq'
drivers/input/touchscreen/ads7846.c:208: warning: implicit declaration of function `enable_irq'

Cc: Dmitry Torokhov <dtor_core@ameritech.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# d93f70b2 14-Feb-2006 David Brownell <dbrownell@users.sourceforge.net>

Input: ads7846 - assorted updates

This updates the ads7846 touchscreen driver:
- to allow faster clocking (this driver doesn't push sample rates);
- bugfixes the conversion of spi_transfer to lists;
- some dma-unsafe command buffers are fixed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# a90f7e98 14-Feb-2006 Dmitry Torokhov <dtor_core@ameritech.net>

Input: ads7846 - convert to to dynamic input_dev allocation

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


# f43aaba1 18-Jan-2006 Russell King <rmk@dyn-67.arm.linux.org.uk>

[ARM] Convert request_irq+set_irq_type to request_irq with SA_TRIGGER

There's no need to have request_irq followed by set_irq_type.
Just use request_irq with the appropriate SA_TRIGGER flags.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>


# 8275c642 08-Jan-2006 Vitaly Wool <vwool@ru.mvista.com>

[PATCH] spi: use linked lists rather than an array

This makes the SPI core and its users access transfers in the SPI message
structure as linked list not as an array, as discussed on LKML.

From: David Brownell <dbrownell@users.sourceforge.net>

Updates including doc, bugfixes to the list code, add
spi_message_add_tail(). Plus, initialize things _before_ grabbing the
locks in some cases (in case it grows more expensive). This also merges
some bitbang updates of mine that didn't yet make it into the mm tree.

Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: Dmitry Pervushin <dpervushin@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 2e5a7bd9 08-Jan-2006 David Brownell <david-b@pacbell.net>

[PATCH] spi: ads7836 uses spi_driver

This updates the ads7864 driver to use the new "spi_driver" struct, and
includes some minor unrelated cleanup.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# ffa458c1 08-Jan-2006 David Brownell <david-b@pacbell.net>

[PATCH] spi: ads7846 driver

This is a driver for the ADS7846 touchscreen sensor, derived from
the corgi_ts and omap_ts drivers. Key differences from those two:

- Uses the new SPI framework (minimalist version)
- <linux/spi/ads7846.h> abstracts board-specific touchscreen info
- Sysfs attributes for the temperature and voltage sensors
- Uses fewer ARM-specific IRQ primitives

The temperature and voltage sensors show up in sysfs like this:

$ pwd
/sys/devices/platform/omap-uwire/spi2.0
$ ls
bus@ input:event0@ power/ temp1 vbatt
driver@ modalias temp0 vaux
$ cat modalias
ads7846
$ cat temp0
991
$ cat temp1
1177
$

So far only basic testing has been done. There's a fair amount of hardware
that uses this sensor, and which also runs Linux, which should eventually
be able to use this driver.

One portability note may be of special interest. It turns out that not all
SPI controllers are happy issuing requests that do things like "write 8 bit
command, read 12 bit response". Most of them seem happy to handle various
word sizes, so the issue isn't "12 bit response" but rather "different rx
and tx write sizes", despite that being a common MicroWire convention. So
this version of the driver no longer reads 12 bit native-endian words; it
reads 16-bit big-endian responses, then byteswaps them and shifts the
results to discard the noise.

Signed-off-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>