History log of /linux-master/drivers/input/touchscreen/atmel_mxt_ts.c
Revision Date Author Comments
# e50389f2 12-Dec-2023 ye xingchen <ye.xingchen@zte.com.cn>

Input: touchscreen - use sysfs_emit[_at]() instead of scnprintf()

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Oliver Graute <oliver.graute@kococonnector.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 80c2b40a 11-Dec-2023 Benjamin Gaignard <benjamin.gaignard@collabora.com>

media: videobuf2: core: Rename min_buffers_needed field in vb2_queue

Rename min_buffers_needed into min_queued_buffers and update
the documentation about it.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: Drop the change where min_queued_buffers + 1 buffers would be]
[hverkuil: allocated. Now this patch only renames this field instead of making]
[hverkuil: a functional change as well.]
[hverkuil: Renamed 3 remaining min_buffers_needed occurrences.]


# d8bde56d 17-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Input: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230517164645.162294-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 97804321 01-May-2023 André Apitzsch <git@apitzsch.eu>

Input: atmel_mxt_ts - support capacitive keys

Add support for touch keys found in some Atmel touch controller
configurations.

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Link: https://lore.kernel.org/r/20230407-atmel_keys-v2-2-92446a4343cb@apitzsch.eu
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


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

Input: atmel_mxt_ts - 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: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230102181842.718010-34-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 1d0fd91f 18-Nov-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Input: atmel_mxt_ts - Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221118224540.619276-228-uwe@kleine-koenig.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a9f08ad7 18-Aug-2022 Wolfram Sang <wsa+renesas@sang-engineering.com>

Input: move from strlcpy with unused retval to strscpy

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20220818210022.6865-1-wsa+renesas@sang-engineering.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# ed5c2f5f 15-Aug-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

i2c: Make remove callback return void

The value returned by an i2c 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.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# 12f247ab 12-Dec-2021 José Expósito <jose.exposito89@gmail.com>

Input: atmel_mxt_ts - fix double free in mxt_read_info_block

The "id_buf" buffer is stored in "data->raw_info_block" and freed by
"mxt_free_object_table" in case of error.

Return instead of jumping to avoid a double free.

Addresses-Coverity-ID: 1474582 ("Double free")
Fixes: 068bdb67ef74 ("Input: atmel_mxt_ts - fix the firmware update")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://lore.kernel.org/r/20211212194257.68879-1-jose.exposito89@gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# bcd9730a 25-Mar-2021 Barry Song <song.bao.hua@hisilicon.com>

Input: move to use request_irq by IRQF_NO_AUTOEN flag

disable_irq() after request_irq() still has a time gap in which
interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
disable IRQ auto-enable because of requesting.

On the other hand, request_irq() after setting IRQ_NOAUTOEN as
below
irq_set_status_flags(irq, IRQ_NOAUTOEN);
request_irq(dev, irq...);
can also be replaced by request_irq() with IRQF_NO_AUTOEN flag.

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
Link: https://lore.kernel.org/r/20210302224916.13980-3-song.bao.hua@hisilicon.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 8b488ef2 20-Mar-2021 Dmitry Osipenko <digetx@gmail.com>

Input: atmel_mxt_ts - support wakeup methods

According to datasheets, chips like mXT1386 have a WAKE line, it is used
to wake the chip up from deep sleep mode before communicating with it via
the I2C-compatible interface.

If the WAKE line is connected to a GPIO line, the line must be asserted
25 ms before the host attempts to communicate with the controller. If the
WAKE line is connected to the SCL pin, the controller will send a NACK on
the first attempt to address it, the host must then retry 25 ms later.

Implement the wake-up methods in the driver. Touchscreen now works
properly on devices like Acer A500 tablet, fixing problems like this:

atmel_mxt_ts 0-004c: __mxt_read_reg: i2c transfer failed (-121)
atmel_mxt_ts 0-004c: mxt_bootloader_read: i2c recv failed (-121)
atmel_mxt_ts 0-004c: Trying alternate bootloader address
atmel_mxt_ts 0-004c: mxt_bootloader_read: i2c recv failed (-121)
atmel_mxt_ts: probe of 0-004c failed with error -121

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20210302102158.10533-3-digetx@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 3d722dd4 10-Dec-2020 Zheng Yongjun <zhengyongjun3@huawei.com>

Input: atmel_mxt_ts - simplify the return expression of mxt_send_bootloader_cmd()

Simplify the return expression.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201210135943.1612-1-zhengyongjun3@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# d69f0a43 04-Oct-2020 Andrzej Pietrasiewicz <andrzej.p@collabora.com>

Input: use input_device_enabled()

Use the newly added helper in relevant input drivers.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 8c3b55a2 01-Dec-2020 Linus Walleij <linus.walleij@linaro.org>

Input: atmel_mxt_ts - fix lost interrupts

After commit 74d905d2d38a devices requiring the workaround for edge
triggered interrupts stopped working.

The hardware needs the quirk to be used before even proceeding to
check if the quirk is needed because mxt_acquire_irq() is called
before mxt_check_retrigen() is called and at this point pending IRQs
need to be checked, and if the workaround is not active, all
interrupts will be lost from this point.

Solve this by switching the calls around.

Reported-by: Andre Müller <andre.muller@web.de>
Tested-by: Andre Müller <andre.muller@web.de>
Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Fixes: 74d905d2d38a ("Input: atmel_mxt_ts - only read messages in mxt_acquire_irq() when necessary")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201201123026.1416743-1-linus.walleij@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# c6c74650 09-Nov-2020 Linus Walleij <linus.walleij@linaro.org>

Input: atmel_mxt_ts - support regulator supplies

This adds the code for the Atmel touchscreens such as mXT224 to obtain
power regulators for the supply voltages AVDD and VDD. On mobile phones
such as Samsung GT-I8190 (Golden) this is needed to explicitly bring power
online.

We just enable the regulators at probe() and disable them at remove()
or in the error path for now.

As regulators are naturally stubbed if not available, this should have no
impact on existing systems.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201104153032.1387747-3-linus.walleij@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# feedaacd 09-Nov-2020 Linus Walleij <linus.walleij@linaro.org>

Input: atmel_mxt_ts - fix up inverted RESET handler

This driver uses GPIO descriptors to drive the touchscreen RESET line. In
the existing device trees this has in conflict with intution been flagged
as GPIO_ACTIVE_HIGH and the driver then applies the reverse action by
driving the line low (setting to 0) to enter reset state and driving the
line high (setting to 1) to get out of reset state.

The correct way to handle active low GPIO lines is to provide the
GPIO_ACTIVE_LOW in the device tree (thus properly describing the hardware)
and letting the GPIO framework invert the assertion (driving high) to a
low level and vice versa.

This is considered a bug since the device trees are incorrectly
mis-specifying the line as active high.

Fix the driver and all device trees specifying a reset line.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Philippe Schenker <philippe.schenker@toradex.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20201104153032.1387747-1-linus.walleij@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# df561f66 23-Aug-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

treewide: 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/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>


# 74d905d2 28-Jul-2020 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - only read messages in mxt_acquire_irq() when necessary

The workaround of reading all messages until an invalid is received is a
way of forcing the CHG line high, which means that when using
edge-triggered interrupts the interrupt can be acquired.

With level-triggered interrupts the workaround is unnecessary.

Also, most recent maXTouch chips have a feature called RETRIGEN which, when
enabled, reasserts the interrupt line every cycle if there are messages
waiting. This also makes the workaround unnecessary.

Note: the RETRIGEN feature is only in some firmware versions/chips, it's
not valid simply to enable the bit.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
(cherry picked from ndyer/linux/for-upstream commit 1ae4e8281e491b22442cd5acdfca1862555f8ecb)
[gdavis: Fix conflicts due to v4.6-rc7 commit eb43335c4095 ("Input:
atmel_mxt_ts - use mxt_acquire_irq in mxt_soft_reset").]
Signed-off-by: George G. Davis <george_davis@mentor.com>
[jiada: reset use_retrigen_workaround at beginning of mxt_check_retrigen()
call mxt_check_retrigen() after mxt_acquire_irq() in mxt_initialize()
replace white-spaces with tab for MXT_COMMS_RETRIGEN
Changed to check if IRQ is level type]
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Link: https://lore.kernel.org/r/20200727151637.23810-1-jiada_wang@mentor.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 5fc70e35 11-May-2020 Jiada Wang <jiada_wang@mentor.com>

Input: introduce input_mt_report_slot_inactive()

input_mt_report_slot_state() ignores "tool" argument when the slot is
closed, which has caused a bit of confusion. Let's introduce
input_mt_report_slot_inactive() to report inactive slot state.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Link: https://lore.kernel.org/r/20200508055656.96389-2-jiada_wang@mentor.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 463fa44e 02-Oct-2019 Evan Green <evgreen@chromium.org>

Input: atmel_mxt_ts - disable IRQ across suspend

Across suspend and resume, we are seeing error messages like the following:

atmel_mxt_ts i2c-PRP0001:00: __mxt_read_reg: i2c transfer failed (-121)
atmel_mxt_ts i2c-PRP0001:00: Failed to read T44 and T5 (-121)

This occurs because the driver leaves its IRQ enabled. Upon resume, there
is an IRQ pending, but the interrupt is serviced before both the driver and
the underlying I2C bus have been resumed. This causes EREMOTEIO errors.

Disable the IRQ in suspend, and re-enable it on resume. If there are cases
where the driver enters suspend with interrupts disabled, that's a bug we
should fix separately.

Signed-off-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 9ed05c94 12-Aug-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Input: atmel_mxt_ts - switch to use device_property_count_u32()

Use use device_property_count_u32() directly, that makes code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f0dd6878 04-Jul-2019 Ian Ray <ian.ray@ge.com>

Input: atmel_mxt_ts - fix leak in mxt_update_cfg()

Fix leak (whose magnitude is the configuration file size) when the CRCs
match in mxt_update_cfg().

Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 5cecc2bc 01-Jul-2019 Nathan Huckleberry <nhuck@google.com>

Input: atmel_mxt_ts - fix -Wunused-const-variable

Clang produces the following warning

drivers/input/touchscreen/atmel_mxt_ts.c:259:42: warning: unused
variable 'mxt_video_fops' [-Wunused-const-variable]
static const struct v4l2_file_operations mxt_video_fops = {

Since mxt_video_fops is only used inside an ifdef. It should
be moved inside the ifdef.

Link: https://github.com/ClangBuiltLinux/linux/issues/527
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 2874c5fd 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

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

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

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

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

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


# 1e3c336a 28-Dec-2018 Sanjeev Chugh <sanjeev_chugh@mentor.com>

Input: atmel_mxt_ts - don't try to free unallocated kernel memory

If the user attempts to update Atmel device with an invalid configuration
cfg file, error handling code is trying to free cfg file memory which is
not allocated yet hence results into kernel crash.

This patch fixes the order of memory free operations.

Signed-off-by: Sanjeev Chugh <sanjeev_chugh@mentor.com>
Fixes: a4891f105837 ("Input: atmel_mxt_ts - zero terminate config firmware file")
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 03bf6781 15-Oct-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

Input: atmel_mxt_ts - mark expected switch fall-through

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

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


# d2587800 28-Sep-2018 George G. Davis <ggdavisiv@gmail.com>

Input: atmel_mxt_ts - fix multiple <linux/property.h> includes

Both v4.16-rc7 commit 93afb1d6e72a ("Input: atmel_mxt_ts - switch from
OF to generic device properties") and v4.16-rc7 commit 96a938aa214e
("Input: atmel_mxt_ts - remove platform data support") added includes of
"<linux/property.h>". Remove one of the duplicate includes to fix this.

Signed-off-by: George G. Davis <george_davis@mentor.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 19a7121e 27-Jul-2018 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - move completion to after config crc is updated

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 2ca3ba0a 27-Jul-2018 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - don't report zero pressure from T9

If T9.CTRL DISAMP is set, then pressure is reported as zero. This means
some app layers (eg tslib) will ignore the contact.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a4891f10 27-Jul-2018 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - zero terminate config firmware file

We use sscanf to parse the configuration file, so it's necessary to zero
terminate the configuration otherwise a truncated file can cause the
parser to run off into uninitialised memory.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f865df73 27-Jul-2018 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - refactor config update code to add context struct

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 15082bdb 27-Jul-2018 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - config CRC may start at T71

On devices with the T71 object, the config CRC will start there, rather
than at T7.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 01cc75f9 27-Jul-2018 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - remove unnecessary debug on ENOMEM

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# e9326857 27-Jul-2018 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - remove duplicate setup of ABS_MT_PRESSURE

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 204b4eae 27-Jul-2018 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - use BIT() macro everywhere

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 36f5d9ef 27-Jul-2018 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - only use first T9 instance

The driver only registers one input device, which uses the screen
parameters from the first T9 instance. The first T63 instance also uses
those parameters.

It is incorrect to send input reports from the second instances of these
objects if they are enabled: the input scaling will be wrong and the
positions will be mashed together.

This also causes problems on Android if the number of slots exceeds 32.

In the future, this could be handled by looking for enabled touch object
instances and creating an input device for each one.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# ca1cd36c 24-May-2018 Sebastian Reichel <sre@kernel.org>

Input: atmel_mxt_ts - fix reset-gpio for level based irqs

The current reset-gpio support triggers an interrupt storm on platforms
using the maxtouch with level based interrupt. The Motorola Droid 4,
which I used for some of the tests is not affected, since it uses a edge
based interrupt.

This change avoids the interrupt storm by enabling the device while its
interrupt is disabled. Afterwards we wait 100ms. This is important for
two reasons: The device is unresponsive for some time (~22ms for
mxt224E) and the CHG (interrupt) line is not working properly for 100ms.
We don't need to wait for any following interrupts, since the following
mxt_initialize() checks for bootloader mode anyways.

This fixes a boot issue on GE PPD (watchdog kills device due to
interrupt storm) and does not cause regression on Motorola Droid 4.

Fixes: f657b00df22e ("Input: atmel_mxt_ts - add support for reset line")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 7cf432bf 03-May-2018 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - require device properties present when probing

The driver needs help determining whether it is dealing with a touchscreen
or a touchpad, and with button mapping. Previously we supported passing
this data via device properties, and also had DMI lists for Chromebooks
that specified Atmel devices in ACPI, but did not provide enough data
there. Now that chromeos_laptop driver is adjusted to supply necessary
device properties even for ACPI devices, we can drop the DMI tables and
refuse to probe if device properties are not attached to the device.

We use presence of "compatible" property to determine if device properties
are attached to the device or not and rely on chromeos_laptop to re-probe
the device after attaching missing device properties to it.

Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f6eeb9e5 01-May-2018 Javier Martinez Canillas <javierm@redhat.com>

Input: atmel_mxt_ts - add missing compatible strings to OF device table

Commit af503716ac14 ("i2c: core: report OF style module alias for devices
registered via OF") fixed how the I2C core reports the module alias when
devices are registered via OF.

But the atmel_mxt_ts driver only has an "atmel,maxtouch" compatible in its
OF device ID table, so if a Device Tree is using a different one, autoload
won't be working for the module (the matching works because the I2C device
ID table is used as a fallback).

So add compatible strings for each of the entries in the I2C device table.

Fixes: af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF")
Reported-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Rob Herring <robh@kernel.org>
[dtor: document which compatibles are deprecated and should not be used]
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 068bdb67 01-May-2018 Nick Dyer <nick@shmanahar.org>

Input: atmel_mxt_ts - fix the firmware update

The automatic update mechanism will trigger an update if the
info block CRCs are different between maxtouch configuration
file (maxtouch.cfg) and chip.

The driver compared the CRCs without retrieving the chip CRC,
resulting always in a failure and firmware flashing action
triggered. Fix this issue by retrieving the chip info block
CRC before the check.

Note that this solution has the benefit that by reading the
information block and the object table into a contiguous region
of memory, we can verify the checksum at probe time. This means
we make sure that we are indeed talking to a chip that supports
object protocol correctly.

Using this patch on a kevin chromebook, the touchscreen and
touchpad drivers are able to match the CRC:

atmel_mxt_ts 3-004b: Family: 164 Variant: 14 Firmware V2.3.AA Objects: 40
atmel_mxt_ts 5-004a: Family: 164 Variant: 17 Firmware V2.0.AA Objects: 31
atmel_mxt_ts 3-004b: Resetting device
atmel_mxt_ts 5-004a: Resetting device
atmel_mxt_ts 3-004b: Config CRC 0x573E89: OK
atmel_mxt_ts 3-004b: Touchscreen size X4095Y2729
input: Atmel maXTouch Touchscreen as /devices/platform/ff130000.i2c/i2c-3/3-004b/input/input5
atmel_mxt_ts 5-004a: Config CRC 0x0AF6BA: OK
atmel_mxt_ts 5-004a: Touchscreen size X1920Y1080
input: Atmel maXTouch Touchpad as /devices/platform/ff140000.i2c/i2c-5/5-004a/input/input6

Signed-off-by: Nick Dyer <nick.dyer@shmanahar.org>
Acked-by: Benson Leung <bleung@chromium.org>
[Ezequiel: minor patch massage]
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f372b811 25-Apr-2018 Vittorio Gambaletta (VittGam) <linuxbugs@vittgam.net>

Input: atmel_mxt_ts - add touchpad button mapping for Samsung Chromebook Pro

This patch adds the correct platform data information for the Caroline
Chromebook, so that the mouse button does not get stuck in pressed state
after the first click.

The Samus button keymap and platform data definition are the correct
ones for Caroline, so they have been reused here.

Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
Signed-off-by: Salvatore Bellizzi <lkml@seppia.net>
Tested-by: Guenter Roeck <groeck@chromium.org>
Cc: stable@vger.kernel.org
[dtor: adjusted vendor spelling to match shipping firmware]
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 96a938aa 20-Mar-2018 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - remove platform data support

Now that there are no users of custom Atmel platform data, and everyone
has switched to the generic device properties, we can remove support for
the platform data.

Acked-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>


# d3f810ce 20-Mar-2018 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - switch ChromeOS ACPI devices to generic props

Move older ChromeOS devices describing Atmel controllers in ACPI, but not
providing enough details to configure the controllers properly, from
platform data over to generic device properties. This will allow us
remove support for platform data later on, leaving only generic device
properties in place.

Acked-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>


# 93afb1d6 20-Mar-2018 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - switch from OF to generic device properties

Instead of using OF-specific APIs to fecth device properties, let's switch
to generic device properties API. This will allow us to use device
properties on legacy ChromeOS devices and get rid of platform data down
the road.

Acked-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>


# d80808e1 20-Mar-2018 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - do not pass suspend mode in platform data

The way we are supposed to put controller to sleep and wake it up does not
depend on the platform, but rather on controller itself, so we want to get
rid of suspend mode in platform data (and eventually get rid of platform
data completely). Unfortunately some early chromebooks (the original Pixel,
Acer C720) were shipped with config that requires manually re-enabling
touch reporting in T9. We will sort it out, but in the meantime let's
switch to a simple DMI quirk.

We'll keep pdata->suspend_mode for now and remove it when we rework
chromeos-laptop driver.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>


# f657b00d 25-Jul-2017 Sebastian Reichel <sre@kernel.org>

Input: atmel_mxt_ts - add support for reset line

Provide support for controlling reset pin. If this is not driven
correctly the device will be held in reset and will not respond.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 8cc8446b 25-Jul-2017 Sebastian Reichel <sre@kernel.org>

Input: atmel_mxt_ts - use more managed resources

Switch mxt_data and interrupt to resource managed allocation methods,
which cleans up the driver slightly and prepares for adding
reset GPIO support.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 089b50d9 19-May-2017 Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>

Input: atmel_mxt_ts - add T100 as a readable object

When using the 'object' sysfs attribute, T100 is not displayed in
the output.

Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


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

Input: touchscreen - use local variables consistently

If a function declares a variable to access a structure element,
use it consistently.

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


# f3c4a8f8 15-Sep-2016 Nick Dyer <nick@shmanahar.org>

[media] Input: v4l-touch - add copyright lines

Add copyright lines for Zodiac who paid for the V4L touch work.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 06b3d3f3 18-Jul-2016 Nick Dyer <nick@shmanahar.org>

[media] Input: atmel_mxt_ts - add support for reference data

There are different datatypes available from a maXTouch chip. Add
support to retrieve reference data as well.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 566d533a 18-Jul-2016 Nick Dyer <nick@shmanahar.org>

[media] Input: atmel_mxt_ts - add diagnostic data support for mXT1386

The mXT1386 family of chips have a different architecture which splits
the diagnostic data into 3 columns.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# de601f71 18-Jul-2016 Nick Dyer <nick@shmanahar.org>

[media] Input: atmel_mxt_ts - handle diagnostic data orientation

Invert the diagnostic data to match the orientation of the input device.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 2786489f 18-Jul-2016 Nick Dyer <nick@shmanahar.org>

[media] Input: atmel_mxt_ts - read touchscreen size

The touchscreen may have a margin where not all the matrix is used. Read
the parameters from T9 and T100 and take account of the difference.

Note: this does not read the XORIGIN/YORIGIN fields so it assumes that
the touchscreen starts at (0,0)

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# ecfdd7e2 18-Jul-2016 Nick Dyer <nick@shmanahar.org>

[media] Input: atmel_mxt_ts - output diagnostic debug via V4L2 device

Register a video device to output T37 diagnostic data.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# d6a39404 18-Jul-2016 Nick Dyer <nick@shmanahar.org>

[media] Input: atmel_mxt_ts - add support for T37 diagnostic data

Atmel maXTouch devices have a T37 object which can be used to read raw
touch deltas from the device. This consists of an array of 16-bit
integers, one for each node on the touchscreen matrix.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# eb43335c 25-Apr-2016 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - use mxt_acquire_irq in mxt_soft_reset

If using IRQF_TRIGGER_FALLING, then there is a race here: if the reset
completes before we enable the IRQ, then CHG is already low and touch
will be broken.

This has been seen on Chromebook Pixel 2.

A workaround is to reconfig T18 COMMSCONFIG to enable the RETRIGEN bit
using mxt-app:
mxt-app -W -T18 44
mxt-app --backup

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 1c0276d5 10-Jan-2016 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - improve touchscreen size/orientation handling

Both T100 and T9 handle range and orientation in a similar fashion.
Reduce duplication between the two implementations.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# b7d21058 11-Dec-2015 Javier Martinez Canillas <javier@osg.samsung.com>

Input: atmel_mxt_ts - add maxtouch to I2C table for module autoload

The Atmel maxtouch DT binding documents that the compatible string for
the device is "atmel,maxtouch" and the I2C core always reports a module
alias of the form i2c:alias where alias is the compatible string model:

$ grep MODALIAS /sys/devices/platform/12e00000.i2c/i2c-8/8-004b/uevent
MODALIAS=i2c:maxtouch

But there isn't maxtouch entry in the I2C device ID table so when the
i2c:maxtouch MODALIAS uevent is reported, kmod is not able to match the
alias with a module to load:

$ modinfo atmel_mxt_ts | grep alias
alias: of:N*T*Catmel,maxtouch
alias: i2c:mXT224
alias: i2c:atmel_mxt_tp
alias: i2c:atmel_mxt_ts
alias: i2c:qt602240_ts

So add the maxtouch entry to the I2C device ID table to allow the module
to be autoloaded when the device is registered via OF.

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


# c67566c6 20-Nov-2015 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - add generic platform data for Chromebooks

Apparently people are installing generic Linux distributions not only on
Pixels but also on other Chromebooks. Unfortunately on all of them Atmel
parts assigned names ATML0000 and ATML0001, and do not carry any other
configuration data. So let's create generic instance of platform data that
should cover most of them (we assume that they will not be using T100
objects, since with those Google mapped BTN_LEFT onto a different GPIO, so
slightly different keymap would be needed, but I think we used parts with
T100 on ARM devices where we thankfully have DTS and can describe the
devices better).

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


# 507584e2 04-Aug-2015 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - remove warning on zero T44 count

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# eafc0c87 04-Aug-2015 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - initialise input slots with INPUT_MT_DIRECT

This indicates the device coordinates should be directly mapped to screen.
This is valid since scaling/flipping/rotation should be done by configuring
the MXT device.

It also flags to Android using INPUT_PROP_DIRECT that the device should be
treated as a touch screen by default, and removes the necessity for a
default IDC file.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 885f3fb9 04-Aug-2015 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - disable interrupt for 50ms after reset

The CHG/interrupt line is momentarily set (approximately 100 ms) as an
input after power-up or reset for diagnostic purposes. This may cause
spurious interrupts, so disable interrupt handler during this period.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 20447664 04-Aug-2015 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - improve device tree parsing

Use function rather than loop, define np to reduce wrapping.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 50fabb02 04-Aug-2015 Pan Xinhui <xinhuix.pan@intel.com>

Input: atmel_mxt_ts - suspend/resume causes panic if input_dev fails to init

input_dev may be NULL if mxt_initialize_input_device fails. But pm ops is
still available and suspend/resume assume
input_dev is not NULL. To fix this issue, we add a check if (!input_dev).

Signed-off-by: Pan Xinhui <xinhuix.pan@intel.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 146c6a66 04-Aug-2015 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - remove unused defines

Many of these values are out of date and they aren't used in the driver
- all they do is increase the size of the kernel source.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 7f3884f7 04-Aug-2015 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - use deep sleep mode when stopped

The hardcoded 0x83 CTRL setting overrides other settings in that byte,
enabling extra reporting that may not be useful on a particular platform.

Implement improved suspend mechanism via deep sleep. By writing zero to
both the active and idle cycle times the maXTouch device can be put into a
deep sleep mode, using minimal power. It is necessary to issue a calibrate
command after the chip has spent any time in deep sleep, however a soft
reset is unnecessary.

Use the old method on Chromebook Pixel via platform data option.

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

After a config download, the T7 power configuration may have changed so it
is necessary to re-read it.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 800e3b9a 17-Jul-2015 Krzysztof Kozlowski <krzk@kernel.org>

Input: drop owner assignment from i2c_driver

i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# c37f6d38 15-Apr-2015 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - use BIT() macro when reporting button state

This makes the intent a tad more clear.

Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 4f8d8088 07-Apr-2015 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - add support for Google Pixel 2

This change allows atmel_mxt_ts to bind to ACPI-enumerated devices in
Google Pixel 2 (2015).

While newer version of ACPI standard allow use of device-tree-like
properties in device descriptions, the version of ACPI implemented in
Google BIOS does not support them, and we have to resort to DMI data to
specify exact characteristics of the devices (touchpad vs. touchscreen,
GPIO to button mapping, etc).

Pixel 1 continues to use i2c devices and platform data created by
chromeos-laptop driver, since ACPI does not enumerate them.

Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# b6d2d328 06-Apr-2015 Sjoerd Simons <sjoerd.simons@collabora.co.uk>

Input: atmel_mxt_ts - split out touchpad initialisation logic

If the "linux,gpio-keymap" DT property is defined, the T19 keys are
configured and the device is setup as a touchpad rather than a touchscreen.
The logic is part of the input device initialization routine but it can be
factored out to its own function to simplify the former.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# b23157dc 06-Apr-2015 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - implement support for T100 touch object

Add support for the new T100 object which replaces the previous T9
multitouch touchscreen object in recent maXTouch devices. T100 provides
improved reporting with selectable auxiliary information, and a type field
for hover/stylus/glove reporting.

The hovering finger support was based on Chung-Yih's work in the ChromiumOS
downstream kernel:

https://chromium-review.googlesource.com/#/c/219280/

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Yufeng Shen <miletus@chromium.org>
[javier: Factor out T9 and T100 init functions and rework hover support]
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 7f405483 31-Dec-2014 Linus Torvalds <torvalds@linux-foundation.org>

Revert "Input: atmel_mxt_ts - use deep sleep mode when stopped"

This reverts commit 9d469d033d135d80742a4e39e6bbb4519dd5eee1.

It breaks the Chromebook Pixel touchpad (and touchscreen).

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Bisected-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nick Dyer <nick.dyer@itdev.co.uk>
Cc: Benson Leung <bleung@chromium.org>
Cc: Yufeng Shen <miletus@chromium.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: stable@vger.kernel.org # v3.16+
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.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>


# 58e4aeee 10-Sep-2014 Stephen Warren <swarren@wwwdotorg.org>

Input: atmel_mxt_ts - fix double free of input device

[Nick Dyer: reworked to move free of input device into separate function
and only call in paths that require it.]
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 651b4608 09-Sep-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - downgrade warning about empty interrupts

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

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 041fa159 11-Aug-2014 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - fix a few issues reported by Coverity

This should fix the following issues reported by Coverity:

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

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

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

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

Acked-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# efdbd7ae 08-Aug-2014 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - split config update a bit

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

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>


# 6cd1ab0f 08-Aug-2014 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: atmel_mxt_ts - simplify mxt_initialize a bit

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

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>


# 437d4f37 07-Aug-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - mXT224 DMA quirk was fixed in firmware v2.0.AA

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 9d469d03 28-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - use deep sleep mode when stopped

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

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

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

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 9d8dc3e5 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - implement T44 message handling

maXTouch chips allow the reading of multiple messages in a single I2C
transaction, which reduces bus overhead and improves performance/latency. The
number of messages available to be read is given by the value in the T44
object which is located directly before the T5 object.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# b9b05a89 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - split message handler into separate functions

This is in preparation for support of the T44 message count object.

Also, cache T5 address to avoid lookup on every interrupt cycle.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 497767d1 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - decode T6 status messages

By storing the previous T6 status byte multiple debug output of the same
status can be suppressed (for example CFGERR).

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 5f3f9bc2 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - add support for dynamic message size

The T5 object may have various sizes depending on the objects used on the
particular maXTouch chip and firmware version, therefore it can't be
hardcoded in the driver. Allocate a buffer on probe instead.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 8efaa5e5 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - recover from bootloader on probe

The MXT device may be in bootloader mode on probe, due to:
1) APP CRC failure, either:
a) flash corruption
b) bad power or other intermittent problem while checking CRC
2) If the device has been reset 10 or more times without accessing comms
3) Warm probe, device was in bootloader mode already

This code attempts to recover from 1(b) and 3.

There is an additional complexity: we have to try two possible bootloader
addresses because the mapping is not one-to-one and we don't know the exact
model yet.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 44a0bab2 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - add bootloader addresses for new chips

Later chips (for example mXT1664S) different mappings for bootloader
addresses. This means that we must look at the family ID to determine
which address to use.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 385deb96 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - handle bootloader previously unlocked

On a warm probe, the device might be in a state where an flash operation was
not completed.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a9fdd1e6 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - handle APP_CRC_FAIL on startup

If the bootloader on the touchscreen controller fails to initialise the
firmware image, it stays in bootloader mode and reports a failure. It is
possible to reflash a working firmware image from this state.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 4ce6fa01 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - calculate and check CRC in config file

By validating the checksum, we can identify if the configuration is
corrupt. In addition, this patch writes the configuration in a short
series of block writes rather than as many individual values.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 50a77c65 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - download device config using firmware loader

The existing implementation which encodes the configuration as a binary
blob in platform data is unsatisfactory since it requires a kernel
recompile for the configuration to be changed, and it doesn't deal well
with firmware changes that move values around on the chip.

Atmel define an ASCII format for the configuration which can be exported
from their tools. This patch implements a parser for that format which
loads the configuration via the firmware loader and sends it to the MXT
chip.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 78188be3 23-Jul-2014 Stephen Warren <swarren@nvidia.com>

Input: atmel_mxt_ts - implement device tree support

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# b735fbe0 23-Jul-2014 Benson Leung <bleung@chromium.org>

Input: atmel_mxt_ts - set pointer emulation on touchpads

Touchpads are pointers, so make sure to pass the correct values to
input_mt_report_pointer_emulation(). Without this, tap-to-click doesn't
work.

Signed-off-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 7a53d609 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - move input device init into separate function

It is useful to initialise the input device later:
- Screen parameters may not be not known yet, for instance if waiting for
firmware loader to return.
- Device may be in bootloader mode on probe (but could still be recovered by
firmware download).

In addition, later devices have a different touchscreen object (T100) which
requires handling differently.

This also reduces the complexity of the probe function.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# dd24dcf5 23-Jul-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - initialise IRQ before probing

The maXTouch chips use the CHG line to generate status events in bootloader
mode, and during configuration download, before there is enough information
to configure the input device. Therefore set up the interrupt handler
earlier.

However, this introduces states where parts of the interrupt processing
must not run. Use data->object_table as a way to tell whether the chip
information is valid, and data->input_dev as a way to tell whether it is
valid to generate input report.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 68807a0c 08-Jun-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - fix invalid return from mxt_get_bootloader_version

The patch e57a66aa8534: "Input: atmel_mxt_ts - read and report
bootloader version" from May 18, 2014, leads to the following static
checker warning:

drivers/input/touchscreen/atmel_mxt_ts.c:437 mxt_get_bootloader_version()
warn: signedness bug returning '(-5)'

drivers/input/touchscreen/atmel_mxt_ts.c
429 static u8 mxt_get_bootloader_version(struct mxt_data *data, u8 val)
430 {
431 struct device *dev = &data->client->dev;
432 u8 buf[3];
433
434 if (val & MXT_BOOT_EXTENDED_ID) {
435 if (mxt_bootloader_read(data, &buf[0], 3) != 0) {
436 dev_err(dev, "%s: i2c failure\n", __func__);
437 return -EIO;
^^^^
This gets truncated into a number from 0-255 and anyway the caller
doesn't check for errors.

(reported by Dan Carpenter)

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# eef820dc 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - handle multiple input reports in one message

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f3889ed1 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - rename touchscreen defines to include T9

This avoids confusion with the newer T100 touchscreen object.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# fea9e467 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - rename pressure to amplitude to match spec

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 61dc1aba 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - read screen config from chip

By reading the touchscreen configuration from the settings that the
maXTouch chip is actually using, we can remove some platform data.

The matrix size is not used for anything, and results in some rather
confusing code to re-read it because it may change when configuration
is downloaded, so don't print it out.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f2ac6cb9 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - add check for incorrect firmware file format

Atmel supplies firmware files in ASCII HEX format (.enc) which must be
converted before they can be loaded by kernel driver. Try to detect
the error and print a friendly error message rather than feeding junk
to the bootloader.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f477c758 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - improve bootloader progress output

By implementing a frame counter, print out fewer debug messages (the
firmware may contain hundreds of frames).

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f943c74a 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - implement bootloader frame retries

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# e57a66aa 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - read and report bootloader version

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# f28a842d 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - add additional bootloader addresses

Move bootloaders reads/writes into separate functions. Instead of switching
client->addr, define new field bootloader_addr in mxt_data. Implement
lookup calculation for bootloader addresses.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# c3f78043 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - implement CRC check for configuration data

The configuration is stored in NVRAM on the maXTouch chip. When the device
is reset it reports a CRC of the stored configuration values. Therefore it
isn't necessary to send the configuration on each probe - we can check the
CRC matches and avoid a timeconsuming backup/reset cycle.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 7bed6805 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - improve error reporting and debug

- Add error messages for probe errors
- Report type in invalid object type
- Tweak some other debug output messages

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a4a2ef46 19-May-2014 Iiro Valkonen <iiro.valkonen@atmel.com>

Input: atmel_mxt_ts - make wait-after-reset period compatible with all chips

The delay before the chip can be accessed after reset varies between
different chips in maXTouch family. Waiting for an interrupt and a T6
status message with the RESET bit set is a better behaviour.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# a0434b75 19-May-2014 Benson Leung <bleung@chromium.org>

Input: atmel_mxt_ts - wait for CHG after bootloader resets

Rather than msleep for MXT_RESET_TIME and MXT_FWRESET_TIME during the
transition to bootloader mode and the transition back from app, wait for
the CHG assert to indicate that the transition is done.

This change replaces the msleep with a wait for completion that the
mxt_interrupt handler signals.

Also add CHG poll after last firmware frame - some bootloader versions will
assert the interrupt line after the final frame, in testing this meant that
the driver attempts to read the info block too early whilst the chip is
still resetting.

This improves firmware update time as we no longer wait longer than
necessary for each reset.

Signed-off-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# d79e7e47 19-May-2014 Benson Leung <bleung@chromium.org>

Input: atmel_mxt_ts - wait for CHG assert in mxt_check_bootloader

The driver should not immediately read bootloader status when in
Application Update Mode. The CHG line will assert when the device has made
a state transition and is ready to report a new status via i2c.

This change adds a wait for completion in mxt_check_bootloader, and changes
the mxt_interrupt handler to signal the completion.

Signed-off-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 1e0c0c5b 19-May-2014 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - define helper functions for size and instances

These two object table entry fields are reported 1 less than their value.
When used, however, we always want the actual size and instances.

To keep the object size and instances 1-byte fields, and thus preserve
the object-table struct's 6-byte packed alignment, add some convenient
accessor functions that do the +1 every time these fields are accessed.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 8d4e1639 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - return IRQ_NONE when interrupt handler fails

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# fb5e4c3e 19-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - improve T19 GPIO keys handling

* The mapping of the GPIO numbers into the T19 status byte varies between
different maXTouch chips. Some have up to 7 GPIOs. Allowing a keycode array
of up to 8 items is simpler and more generic. So replace #define with
configurable number of keys which also allows the removal of is_tp.
* Rename platform data parameters to include "t19" to prevent confusion with
T15 key array.
* Probe aborts early on when pdata is NULL, so no need to check.
* Move "int i" to beginning of function (mixed declarations and code)
* Use API calls rather than __set_bit()
* Remove unused dev variable.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Yufeng Shen <miletus@chromium.org>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# 2cefdb1f 18-May-2014 Nick Dyer <nick.dyer@itdev.co.uk>

Input: atmel_mxt_ts - remove unnecessary platform data

It is not necessary to download these values to the maXTouch chip on every
probe, since they are stored in NVRAM. It makes life difficult when tuning
the device to keep them in sync with the config array/file, and requires a
new kernel build for minor tweaks.

These parameters only represent a tiny subset of the available
configuration options, tracking all of these options in platform data would
be a endless task. In addition, different versions of maXTouch chips may
have these values in different places or may not even have them at all.

Having these values also makes life more complex for device tree and other
platforms where having to define a static configuration isn't helpful.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Acked-by: Benson Leung <bleung@chromium.org>
Acked-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


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


# 8343bce1 09-Mar-2013 Linus Torvalds <torvalds@linux-foundation.org>

Atmel MXT touchscreen: increase reset timeouts

There is a more complete atmel patch-series out by Nick Dyer that fixes
this and other things, but in the meantime this is the minimal thing to
get the touchscreen going on (at least my) Pixel Chromebook.

Not that I want my dirty fingers near that beautiful screen, but it
seems that a non-initialized touchscreen will also end up being a
constant wakeup source, so you have to disable it to go to sleep. And
it's easier to just fix the initialization sequence.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 22dfab7f 07-Mar-2013 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - Support for touchpad variant

This same driver can be used by atmel based touchscreens and touchpads
(buttonpads). Platform data may specify a device is a touchpad
using the is_tp flag.

This will cause the driver to perform some touchpad specific
initializations, such as:
* register input device name "Atmel maXTouch Touchpad" instead of
Touchscreen.
* register BTN_LEFT & BTN_TOOL_* event types.
* register axis resolution (as a fixed constant, for now)
* register BUTTONPAD property
* process GPIO buttons using reportid T19

Input event GPIO mapping is done by the platform data key_map array.

key_map[x] should contain the KEY or BTN code to send when processing
GPIOx from T19. To specify a GPIO as not an input source, populate
with KEY_RESERVED, or 0.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Tested-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


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


# eb007c86 04-Oct-2012 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Input: atmel_mxt_ts - simplify mxt_dump_message

Use %*ph format specifier to print small buffer.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# b4adbbef 11-Aug-2012 Henrik Rydberg <rydberg@euromail.se>

Input: MT - Add flags to input_mt_init_slots()

Preparing to move more repeated code into the mt core, add a flags
argument to the input_mt_slots_init() function.

Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Tested-by: Ping Cheng <pingc@wacom.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# c45361a1 05-Jul-2012 Henrik Rydberg <rydberg@euromail.se>

Revert "Input: atmel_mxt_ts - warn if sysfs could not be created"

Dmitry: I understand that I am a bit late to the party :) but I do not
agree with this change. Failure to create attributes is not sometihng
that user could cause (at least not easily) and thus would not be a
setup issue but something more severe. I believe we should fail
loading the driver so sysfs attribute breakage will be noticed as soon
as possible, instead of discovering it much much later in the process.

This reverts commit 639900380062ecd78ee8b265ea23929c565469b4.

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


# 9b7e31bb 04-Jul-2012 Lars-Peter Clausen <lars@metafoo.de>

Input: request threaded-only IRQs with IRQF_ONESHOT

Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail. This patch adds the
IRQF_ONESHOT to input drivers where it is missing. Not modified by
this patch are those drivers where the requested IRQ will always be a
nested IRQ (e.g. because it's part of an MFD), since for this special
case IRQF_ONESHOT is not required to be specified when requesting the
IRQ.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>


# fdf80421 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - parse T6 reports

The normal messages sent after boot or NVRAM update are T6 reports,
containing a status, and the config memory checksum. Parse them and dump
a useful info message.

This patch tested on an MXT224E.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 64464ae8 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - send all MT-B slots in one input report

Each interrupt contains information for all contacts with changing
properties. Process all of this information at once, and send it all in a
a single input report (ie input events ending in EV_SYN/SYN_REPORT).

This patch was tested using an MXT224E.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# cb159115 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - use T9 reportid range to init number of mt slots

Atmel mxt devices can report one finger for each T9 reportid.
Therefore, this range can be used to report the max number of MT-B slots
to userspace instead of assuming a fixed 10.

Note that mxt_initialized() must complete early, since the input_dev
properties now depend on values in the object table.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 04a79181 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - refactor reportid checking in mxt_interrupt

This small refactor is in preparation for checking more report types
in the mxt_interrupt message processing loop.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 333e5a9a 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - cache T9 reportid range when reading object table

Streamline interrupt processing by caching the T9 reportid range when
first reading the object table.

In the process, refactor reading the object descriptor table.
First, since the object_table entries are now exactly the same layout
in device memory and in the driver, allocate an appropriately sized
array and fetch the entire table directly into it in a single i2c
transaction. Since a 6 byte table object requires 10 bytes to read,
doing this dramatically reduces overhead.

Note: The cached T9 reportid's are initialized to 0, which is an invalid
reportid. Thus, the checks in the interrupt handler will always fail for
devices that do not support the T9 object. Therefore, after doing a
firmware update, the old object table is destroyed and all cached object
values are reset to 0, before reading the new object table, in case
the new firmware does not have the old objects.

This patch tested on an MXT224E.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 7d4fa100 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - refactor when and how object table is freed

The Object Table is freed in three cases:
1) When the driver is being removed.
2) In the error path of mxt_initialize().
3) Just after a firmware update, when a new object table is
about to be read.

For cases 2 & 3, the driver is not immediately unloaded, so this patch
refactors these cases to use a common cleanup function. It also refactors
the mxt_initialize error paths to ensure that this cleanup happens.

Note: mxt_update_fw_store() does not handle errors during mxt_initialize().
A proposed fix for this is in a subsequent patchset.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# b2e459b8 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - add detail to touchevent debug message

Update the debug message:
* print inidividual status bits
* print the pressure value
* use '%u' for unsigned quantities

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# fba5bc31 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - simplify event reporting

Instead of carrying around per-finger state in the driver instance, just
report each finger as it arrives to the input layer, and let the input
layer (evdev) hold the event state (which it does anyway).

Note: this driver does not really do MT-B properly. Each input report
(a group of input events followed by a SYN_REPORT) only contains data for
a single contact. When multiple fingers are present on a device, each is
properly reported in its own MT_SLOT. However, there is only ever one
MT_SLOT per SYN_REPORT. This is fixed in a subsequent patch.

This patch was tested with an mXT224E.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# b19fc9ec 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - add sysfs entries to read fw and hw version

Make firmware and hardware version strings available to userspace.
This is useful, for example, to allow a userspace program to implement
a firwmare update policy.

Change-Id: I1eddb4bbf5f3f9ae6947a8528598973ddead18cf
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# e0e0269f 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - update driver ID info logging

Print unsigned values as '%u'.
Also, parse and print the firmware version in its canonical format, as
suggested by Nick Dyer.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 23003a84 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - read ID information block in one i2c transaction

Reading the whole info block in one i2c transaction speeds up driver
probe significantly, especially on slower i2c busses.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# cf94bc09 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - optimize writing of object table entries

Write each object using a single bulk i2c write transfer.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 9638ab7c 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - add variable length __mxt_write_reg

The i2c bus requires 4 bytes to do a 1-byte write
(1 byte i2c address + 2 byte offset + 1 byte data).

By taking a length with writes, the driver can amortize transaction
overhead by performing larger transactions where appropriate.

This patch just sets up the new API. Later patches refactor writes
to take advantage of the larger transactions.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 771733e3 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - return errors from i2c layer

The i2c layer can report a variety of errors, including -ENXIO for an i2c
NAK. Instead of treating them all as -EIO, pass the actual i2c layer
error up to the caller.

However, still report as -EIO the unlikely case that a transaction was
partially completed, and no error message was returned from i2c_*().

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 794eb67e 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - print all instances when dumping objects

For objects with multiple instances, dump them all, prepending each with
its "Instance #".

[rydberg@euromail.se: break out mxt_show_instance()]
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 91630955 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - print less overhead when dumping objects

Conserve limited (PAGE_SIZE) sysfs output buffer space by only showing
readable objects and not printing the object's index, which is not useful
to userspace.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 43a91d51 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - optimize reading objects in object sysfs entry

Read each object in a single i2c transaction instead of byte-by-byte

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 9c67b789 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - use scnprintf for object sysfs entry

Using scnprintf() is a cleaner way to ensure that we don't overwrite the
PAGE_SIZE sysfs output buffer.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 55d6867f 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - don't read T5 when dumping objects

T5 is the message processor object. Reading it will only have two
outcomes, neither of which is particularly useful:
1) the message count decrements, and a valid message will be lost
2) an invalid message will be read (reportid == 0xff)

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 63990038 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - warn if sysfs could not be created

If sysfs entry creation fails, the driver is still usable, so don't
just abort probe. Just warn and continue.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# e1e1658d 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - detect OOM when creating mt slots

Hopefully this new code path will never be used, but better safe than
sorry...

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# c2ef9a1a 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - use client name for irq

The atmel_mxt_ts driver can support multiple devices simultaneously.
Use the i2c_client name instead of the driver name when requesting an
interrupt to make the different interrupts distinguishable in
/proc/interrupts and top.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# ec02ac2b 28-Jun-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - derive phys from i2c client adapter

This allows userspace to more easily distinguish which bus a particular
atmel_mxt_ts device is attached to.

The resulting phys will be something like:
i2c-1-0067/input0

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>


# 6ee3dbf9 08-May-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - dump each message on just 1 line

Helps ensure all bytes for a single message together in the system log.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 822115ff 08-May-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - do not read extra (checksum) byte

atmel_mxt devices will send a checksum byte at the end of a message if
the MSB of the object address is set.
However, since this driver does not set this bit, the checksum byte
isn't actually sent, so don't even try to read it.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# d1ff320f 08-May-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - verify object size in mxt_write_object

Don't allow writing past the length of an object.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 71b3e938 08-May-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - only allow root to update firmware

Restrict permissions on the update_fw sysfs entry to read only for root
only.

Also, update object permission to use a macro S_IRUGO macro instead of
hard coded 0444.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 3a73c816 08-May-2012 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - use CONFIG_PM_SLEEP

Simple cleanup to use newer PM APIs.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


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

Input: convert I2C drivers to use module_i2c_driver()

This patch converts the drivers in drivers/input/* to use the
module_i2c_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>


# 626af861 06-Oct-2011 Daniel Kurtz <djkurtz@chromium.org>

Input: atmel_mxt_ts - use snprintf for sysfs attribute show method

Sysfs attribute show methods are always passed a buffer of length
PAGE_SIZE. To keep from overwriting this buffer and causing havoc, use
snprintf() to guarantee we never write more than the buffer can hold.

In addition, at least for my touchscreen, the number and size of objects
was far too big to fit in a single 4K page. Therefore, this patch also
trims some redundant framing text to leave more room for actual data.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Acked-by: Nick Dyer <nick.dyer@itdev.co.uk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 28ac2933 16-Aug-2011 Yufeng Shen <miletus@chromium.org>

Input: atmel_mxt_ts - report pressure information from the driver

Atmel mxt1386 touch controller has the touch pressure information so
let's report it to the user space.

[dtor@mail.ru: added ABS_RESSURE reporting for ST emulation.]

Signed-off-by: Yufeng Shen <miletus@chromium.org>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# a93d4f2d 04-Jul-2011 Iiro Valkonen <iiro.valkonen@atmel.com>

Input: atmel_mxt_ts - handle objects with multiple instances correctly

Handle the objects with multiple instances correctly when the configuration
data is loaded.

Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 81c88a71 04-Jul-2011 Iiro Valkonen <iiro.valkonen@atmel.com>

Input: atmel_mxt_ts - update object list

Update the object list to include new objects, and add unique identifiers
so we can distinguish between old & new generation of the same object.

Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 8b86c1c2 13-Apr-2011 Joonyoung Shim <jy0922.shim@samsung.com>

Input: atmel_mxt_ts - convert to MT protocol B

Atmel touchscreen chips can use MT protocol B because they can assign
unique id to ABS_MT_TRACKING_ID from finger id provided by hardware.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 08960a07 13-Apr-2011 Iiro Valkonen <iiro.valkonen@atmel.com>

Input: atmel_mxt_ts - make CHG line high after enabling interrupts

Make the CHG line (interrupt line) go high after the interrupts have been
enabled to make sure we don't miss the falling edge.

Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 910d8051 13-Apr-2011 Joonyoung Shim <jy0922.shim@samsung.com>

Input: atmel_mxt_ts - support 12bit resolution

Atmel touchscreen chip can support 12bit resolution and this patch
modifies to get maximum x and y size from platform data.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 4c75de32 14-Mar-2011 Joonyoung Shim <jy0922.shim@samsung.com>

Input: atmel_mxt_ts - add objects of mXT1386 chip

Atmel mXT1386 chip is operated by atmel_mxt_ts driver and it has some
different objects.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 979a72da 14-Mar-2011 Joonyoung Shim <jy0922.shim@samsung.com>

Input: atmel_mxt_ts - remove firmware version check

Atmel touchscreen chips have different firmware version with each chip,
so we cannot distinguish attribute of chip by firmware version.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 0d3c0737 23-Feb-2011 Iiro Valkonen <iiro.valkonen@atmel.com>

Input: atmel_mxt_ts - remove matrix size check

The mxt_check_matrix_size() is currently setting the CTE mode to match
xline/yline information that is in the platform data, but it does not
take into account for example the fact that we could have a key array
in use too (key array would use some x/y lines as well).

It would be better to simply rely on the configuration data, and make
sure that the CTE mode set in there matches the touch object (touchscreen,
key array, proximity) configuration (which are set in the config data too).

Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 919ed895 15-Feb-2011 Iiro Valkonen <iiro.valkonen@atmel.com>

Input: atmel_mxt_ts - allow board code to specify IRQ flags

Different board have different requirements/setups so let's be more
flexible.

Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 71749f5c 15-Feb-2011 Iiro Valkonen <iiro.valkonen@atmel.com>

Input: atmel_mxt_ts - allow board code to suppliy controller config

As there is no common configuration settings that would work in every
situation, remove the fixed config data from driver code and add
config data to platform data.

Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 46ee2a05 15-Feb-2011 Chris Leech <christopher.leech@linux.intel.com>

Input: atmel_mxt_ts - add mXT224 identifier to id_table

"mXT224" is used in the Intel mid firmware in SFI tables to identify the
presence of this I2C device.

Signed-off-by: Chris Leech <christopher.leech@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 26cdb1ae 04-Feb-2011 Iiro Valkonen <iiro.valkonen@atmel.com>

Input: atmel_mxt_ts - read whole message to make CHG low

Read the whole message, as reading just the first byte isn't always
guaranteed to clear the message.

Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 7686b108 03-Feb-2011 Iiro Valkonen <iiro.valkonen@atmel.com>

Input: atmel_mxt_ts - get rid of qt602240 prefixes in names

Change prefixes from qt602240 to mxt to reflect that the driver supports
whole line of mXT touchscreens.

Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


# 964de521 03-Feb-2011 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: qt602240_ts - rename to atmel_mxt_ts

Since the driver will be supporting whole range of Atmels mXT touchscreen
controllers we better rename it to atmel_mxt_ts.

Acked-by: Iiro Valkonen <iiro.valkonen@atmel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>