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

Input: ad7877 - 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.

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230729005133.1095051-5-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


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

Input: ad7877 - 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>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230102181842.718010-31-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 6782b5da 10-Dec-2020 Sergiu Cuciurean <sergiu.cuciurean@analog.com>

Input: ad7877 - use new 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 bebcfd272df6 ("spi: introduce `delay` field for
`spi_transfer` + spi_transfer_delay_exec()")

Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
Link: https://lore.kernel.org/r/20200228104508.15564-1-sergiu.cuciurean@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


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

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

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 see the file copying or write to the free
software foundation inc 51 franklin st fifth floor boston ma 02110
1301 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 4 file(s).

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


# fbe6a536 22-Jan-2018 Andi Shyti <andi@etezian.org>

Input: ad7877 - use managed resource allocations

Use managed resource allocations to simplify error handling during
probing failure and module exiting.

With this all the goto labels in the probe function together with
the cleanups in the remove function are unnecessary, therefore
removed.

Signed-off-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 8446b32b 23-Oct-2017 stephen lu <lumotuwe@gmail.com>

Input: ad7877 - convert to using timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Signed-off-by: Stephen Lu <lumotuwe@gmail.com>
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>


# 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>


# c728601e 25-Apr-2014 Mark Brown <broonie@linaro.org>

Input: ads7877 - remove bitrotted comment

While searching for users of spi_async() I found a reference in the ad7877
driver to using it to initiate data transfer from the interrupt handler.
However there is no code for this, instead the interrupt handler is a
threaded handler and uses spi_sync() instead.

Remove the bitrotted comment, though in actual fact the use case mentioned
is a great use for spi_async() since it would cut down on latency handling
the interrupt by saving us a context switch before we start SPI.

This was previously implemented, it was removed in commit b534422b2d11
(Input: ad7877 - switch to using threaded IRQ) for code complexity reasons.
It may be better to revert that commit instead.

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


# 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>


# c838cb3d 05-Dec-2013 Jingoo Han <jg1.han@samsung.com>

Input: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead
of accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

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


# 993c3792 20-Sep-2013 Sachin Kamat <sachin.kamat@linaro.org>

Input: ad7877 - remove redundant spi_set_drvdata

Driver core sets driver data to NULL upon failure or remove.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


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

Input: ad7877 - 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>


# 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>


# 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>


# 587a1f16 23-Jul-2011 Al Viro <viro@zeniv.linux.org.uk>

switch ->is_visible() to returning umode_t

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# 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>


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

Input: ad7877 - 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 ad7879 SPI 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>


# b534422b 18-Oct-2010 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ad7877 - switch to using threaded IRQ

Instead of using asynchronous SPI API and then spinning waiting for SPI
transfer to complete when disabling the device, let's use threaded IRQ
model and spi_sync().

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Tested-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 2fd18aba 18-Oct-2010 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: ad7877 - use attribute group to control visibility of attributes

Instead of manually creating one set of attributes or another set up
is_visible method in attribute group structure to control whether
aux3 or gpio3 attribute is presented to userspace.

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 1d02ad43 15-Oct-2010 Michael Hennerich <michael.hennerich@analog.com>

Input: ad7877 - filter events where pressure is beyond the maximum

Suppress events where pressure > pressure_max.
These events come typically along with inaccurate X and Y samples.

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


# 47026b25 15-Oct-2010 Michael Hennerich <michael.hennerich@analog.com>

Input: ad7877 - implement EV_KEY:BTN_TOUCH reporting

Some input users such as Android or X require BTN_TOUCH events.
Implement EV_KEY:BTN_TOUCH and make sure that the release event
is not erroneous scheduled without a preceding valid touch.

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


# e92c27fb 15-Oct-2010 Michael Hennerich <michael.hennerich@analog.com>

Input: ad7877 - implement specified chip select behavior

According to the AD7877 datasheet:

Each transfer operation is 16-bit. If multiple read/write operations are
to be performed, CS must be taken high after the end of each read/write
operation before another read/write operation can be performed by
taking CS low again.

Make sure CS toggles after each transfer in the message.

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


# cd9b6fdf 08-Jun-2010 Oskar Schirmer <os@emlix.com>

Input: ad7877 - fix spi word size to 16 bit

With no word size given in the users platform data, a generic spi host
controller driver will assume a default word size of eight bit. This
causes transmission to be performed bytewise, which will fail on little
endian machines for sure. Failure on big endian depends on usage
of slave select to mark word boundaries.

Anyway, ad7877 is specified to work with 16 bit per word, so
unconditionally set the word size accordingly. Flag an error where 16
bit per word is not available.

Signed-off-by: Oskar Schirmer <os@emlix.com>
Signed-off-by: Daniel Glöckner <dg@emlix.com>
Signed-off-by: Oliver Schneidewind <osw@emlix.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 3843384a 13-May-2010 Oskar Schirmer <os@emlix.com>

Input: ad7877 - keep dma rx buffers in seperate cache lines

With dma based spi transmission, data corruption is observed
occasionally. With dma buffers located right next to msg and
xfer fields, cache lines correctly flushed in preparation for
dma usage may be polluted again when writing to fields in the
same cache line.

Make sure cache fields used with dma do not share cache lines
with fields changed during dma handling. As both fields are part
of a struct that is allocated via kzalloc, thus cache aligned,
moving the fields to the 1st position and insert padding for
alignment does the job.

Signed-off-by: Oskar Schirmer <os@emlix.com>
Signed-off-by: Daniel Glöckner <dg@emlix.com>
Signed-off-by: Oliver Schneidewind <osw@emlix.com>
Signed-off-by: Johannes Weiner <jw@emlix.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
[dtor@mail.ru - changed to use ___cacheline_aligned as suggested
by akpm]
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 4eb6f91b 09-Mar-2010 Michael Hennerich <michael.hennerich@analog.com>

Input: ad7877 - increase pen up imeout

The time interval between consecutive interrupts depends on a number of
tunables: first_conversion_delay, acquisition_time, averaging and foremost
the pen_down_acc_interval.

Since the mod_timer() action for the PEN UP event happens in the
spi_async() callback function, latencies incurred by the spi bus drivers
also need to be taken into account.

So all in all, give the PEN UP event a bit more wiggle room and increase
timeout to 100ms.

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>


# 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>


# 0bc69ce6 14-Apr-2009 Michael Hennerich <michael.hennerich@analog.com>

Input: ad7877, ad7879 - remove depreciated IRQF_SAMPLE_RANDOM flag

This patch removes depreciated IRQF_SAMPLE_RANDOM flags from
ad7877 and ad7879 touchscreen drivers.

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


# 331b78ed 09-Mar-2009 Michael Hennerich <michael.hennerich@analog.com>

Input: add AD7877 touchscreen driver

[dtor@mail.ru: locking and other fixups]
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>