Input: atmel_mxt_ts - fixed vdd being checked instead of avdd

Fixed the wrong check where vdd was being checked instead of avdd
after regulator_get function for avdd

Signed-off-by: Prajosh Premdas <premdas.prajosh@gmail.com>
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - fix build error in mxt_read_t9_resolution

Stephen Rothwell reported this build error:

drivers/input/touchscreen/atmel_mxt_ts.c: In function 'mxt_read_t9_resolution':
drivers/input/touchscreen/atmel_mxt_ts.c:1043:2: warning: passing argument 1 of '__swab16s' makes pointer from integer without a cast [enabled by default]
  le16_to_cpus(range.x);
  ^

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - address code indentation issues

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - allow input name to be specified in platform data

Android systems identify the input device and map to IDC file by using the
input device name. To avoid unnecessary deltas to the driver file, allow this
to be set from the platform data.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - implement device tree support

Signed-off-by: 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>
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>
Input: atmel_mxt_ts - rename mxt_check_reg_init to mxt_update_cfg

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - change reset GPIO warning to debug message

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - do not reset slots when input device is null

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - Use async firmware loader interface for config

Using request_firmware_nowait() allows the driver to be built into the kernel
and use the firmware loader interface, without the probe failing with a 60s
timeout due to the root filesystem not being available.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - Add early suspend support

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - improve error handling in initialise functions

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - Improve device tree parsing for earlier kernels

of_property_read_u32_index() was only introduced in v3.10. Using the array
operation is simpler anyway.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - add cfg name and input name to device tree

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - reorder mxt_free_object_table to improve robustness

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - move functions in file to improve code layout

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - check gpio validity in mxt_probe_regulators

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - support config checksum attribute in sysfs

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Input: atmel_mxt_ts - allocate pdata using devm_kzalloc

By using this function instead, there is no necessity to free on remove or
probe failure, since it is handled for us. This also fixes an failure when
kfree() is called on memory allocated using devm_kzalloc() in the DT parse
function.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>