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

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

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: ads7846 - add device tree bindings

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: cyttsp4 - use 16bit address for I2C/SPI communication

In TSG4, register map is 512bytes long and to access all of it,
one bit from address byte is used (which bit to use differs for
I2C and SPI);

Since common code used for TSG3 and TSG4 for I2C, this parameter
wrongly used as u8. TSG3 does not access beyond 255 bytes
but TSG4 may.

Tested-on:TMA3XX DVB && TMA4XX DVB

Signed-off-by: Ferruh Yigit <fery@cypress.com>
Acked-by: Javier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: elantech - fix for newer hardware versions (v7)

* Fix version recognition in elantech_set_properties

  The new hardware reports itself as v7 but the packets'
  structure is unaltered.

* Fix packet type recognition in elantech_packet_check_v4

  The bitmask used for v6 is too wide, only the last three bits of
  the third byte in a packet (packet[3] & 0x03) are actually used to
  distinguish between packet types.
  Starting from v7, additional information (to be interpreted) is
  stored in the remaining bits (packets[3] & 0x1c).
  In addition, the value stored in (packet[0] & 0x0c) is no longer
  a constant but contains additional information yet to be deciphered.
  This change should be backwards compatible with v6 hardware.

Additional-author: Giovanni Frigione <gio.frigione@gmail.com>
Signed-off-by: Matteo Delfino <kendatsuba@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: nspire-keypad - replace magic offset with define

Signed-off-by: Daniel Tang <dt.tangr@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
hp-wmi: Enable hotkeys on some systems

Kyle Evans discovered that he needed to set some bits in an EC register in
order to receive hotkey events. Doing so blindly broke some otherwise
working HP laptops. It turns out that there's a WMI call that accesses
the same register, so let's try calling that instead.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Cc: Kyle Evans <kvans32@gmail.com>
dell-laptop: fix error return code in dell_init()

Fix to return -ENOMEM in the alloc_page() error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
amilo-rfkill: Add dependency on SERIO_I8042

I forgot to add this when changing the driver to use the proper
i8042 functions.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
x86: msi-laptop: fix memleak

1. fix two visible mistakes:
    * when load_scm_model_init faild, we should call platform_device_del(msipf_device)
    * msipf_attribute_group should be remove in err case

2. change some tags, give them real meaning.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
x86: asus-laptop: fix invalid point access

asus->name is null or point to const string,so it is not suitable to kfree it.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
asus-wmi: append newline to messages

Append newline to messages.

Signed-off-by: Viktar Vauchkevich <victorenator@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
asus-nb-wmi: ignore ALS notification key code

Ignore Ambient Light Sensor notification key code 0xC6 found in ASUS UX31a.
When the illuminance changes dmesg shows:
[10814.939979] asus_wmi: Unknown key c6 pressed

Signed-off-by: Viktar Vauchkevich <victorenator@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
drivers/platform/x86/intel_ips: Convert to module_pci_driver

use module_pci_driver instead of init/exit, make code clean.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
asus-wmi: control wlan-led only if wapf == 4

Controlling the wlan led seems to have some side effects to the machines
with wapf value is not equal to 4. It will make the keyboard backlight
out of order.
So, the patch will enable the wlan led function only if the wapf == 4.

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=46791

Reported-by: Mirto Silvio Busico <m.busico@ieee.org>
Tested-by: Karol Herbst <karolherbst@me.com>
Tested-by: drunkenbatman <drunkenbatman@gmail.com>
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
hp-wmi: add supports for POST code error

HP laptops include a POST code error query 0x2A that reports
which point BIOS fails to boot at. The error code is kept in CMOS
until it is cleared.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Add support driver for Intel Rapid Start Technology

Intel Rapid Start Technology is a firmware-based suspend-to-disk
implementation. Once placed in S3, the device will wake once either a
timeout elapses or the battery reaches a critical level. It will then resume
to the firmware and copy the contents of RAM to a specialised partition, and
then power off the machine. If the user turns the machine back on the
firmware will copy the contents of the partition back to RAM and then resume
from S3 as normal.

This driver provides an interface for configuring the wakeup events and
timeout. It still requires firmware support and an appropriate suspend
partition.

Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Add trivial driver to disable Intel Smart Connect

Intel Smart Connect is an Intel-specific ACPI interface for configuring
devices to wake up at regular intervals so they can pull down mail or other
internet updates, and then go to sleep again. If a user enables this in
Windows and then reboots into Linux, the device may wake up if it's put to
sleep. Since there's no Linux userland support for any of this, the machine
will then remain awake until something else puts it back to sleep.

I haven't figured out all that much about how this works (there's a bunch
of different ACPI calls available on the device), but this seems to be
enough to turn it off. We can add more features to this driver if anyone
ever cares about figuring out what the rest of the calls do or writing some
Linux userspace to implement the rest of it.

Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
asus-nb-wmi: set wapf=4 for ASUSTeK COMPUTER INC. 1015E/U

Need to set wapf to 4 for ASUSTeK COMPUTER INC. 1015E/U, so that
user can toggle wifi function through function key correctly.

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
toshiba_acpi: Add dependency on SERIO_I8042

Configuring this option as a module with ACPI_TOSHIBA built-in
results in the following errors:

   drivers/built-in.o: In function `toshiba_acpi_remove':
>> toshiba_acpi.c:(.text+0x314bb0): undefined reference to `i8042_remove_filter'
   drivers/built-in.o: In function `toshiba_acpi_add':
>> toshiba_acpi.c:(.devinit.text+0xb822): undefined reference to `i8042_install_filter'
>> toshiba_acpi.c:(.devinit.text+0xb98b): undefined reference to `i8042_remove_filter'

Add a dependency to prevent ACPI_TOSHIBA from being built-in when
SERIO_I8042=m.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
x86 platform drivers: fix gpio leak

when request_irq fails, we should release gpiochip

v2:
  fix warning: ignoring return value of 'gpiochip_remove

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>