aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/input/elants_i2c.txt33
-rw-r--r--drivers/input/touchscreen/Kconfig12
-rw-r--r--drivers/input/touchscreen/Makefile1
-rw-r--r--drivers/input/touchscreen/elants_i2c.c1271
4 files changed, 1317 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/input/elants_i2c.txt b/Documentation/devicetree/bindings/input/elants_i2c.txt
new file mode 100644
index 000000000000..a765232e6446
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/elants_i2c.txt
@@ -0,0 +1,33 @@
1Elantech I2C Touchscreen
2
3Required properties:
4- compatible: must be "elan,ekth3500".
5- reg: I2C address of the chip.
6- interrupt-parent: a phandle for the interrupt controller (see interrupt
7 binding[0]).
8- interrupts: interrupt to which the chip is connected (see interrupt
9 binding[0]).
10
11Optional properties:
12- wakeup-source: touchscreen can be used as a wakeup source.
13- pinctrl-names: should be "default" (see pinctrl binding [1]).
14- pinctrl-0: a phandle pointing to the pin settings for the device (see
15 pinctrl binding [1]).
16
17[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
18[1]: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
19
20Example:
21 &i2c1 {
22 /* ... */
23
24 touchscreen@10 {
25 compatible = "elan,ekth3500";
26 reg = <0x10>;
27 interrupt-parent = <&gpio4>;
28 interrupts = <0x0 IRQ_TYPE_EDGE_FALLING>;
29 wakeup-source;
30 };
31
32 /* ... */
33 };
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 568a0200fbc2..58917525126e 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -347,6 +347,18 @@ config TOUCHSCREEN_GUNZE
347 To compile this driver as a module, choose M here: the 347 To compile this driver as a module, choose M here: the
348 module will be called gunze. 348 module will be called gunze.
349 349
350config TOUCHSCREEN_ELAN
351 tristate "Elan eKTH I2C touchscreen"
352 depends on I2C
353 help
354 Say Y here if you have an Elan eKTH I2C touchscreen
355 connected to your system.
356
357 If unsure, say N.
358
359 To compile this driver as a module, choose M here: the
360 module will be called elants_i2c.
361
350config TOUCHSCREEN_ELO 362config TOUCHSCREEN_ELO
351 tristate "Elo serial touchscreens" 363 tristate "Elo serial touchscreens"
352 select SERIO 364 select SERIO
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index dab4a56ac98e..0242fea2102a 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o
31obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o 31obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o
32obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o 32obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
33obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o 33obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o
34obj-$(CONFIG_TOUCHSCREEN_ELAN) += elants_i2c.o
34obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o 35obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o
35obj-$(CONFIG_TOUCHSCREEN_EGALAX) += egalax_ts.o 36obj-$(CONFIG_TOUCHSCREEN_EGALAX) += egalax_ts.o
36obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o 37obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o
diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
new file mode 100644
index 000000000000..a510f7ef9b66
--- /dev/null
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -0,0 +1,1271 @@
1/*
2 * Elan Microelectronics touch panels with I2C interface
3 *
4 * Copyright (C) 2014 Elan Microelectronics Corporation.
5 * Scott Liu <scott.liu@emc.com.tw>
6 *
7 * This code is partly based on hid-multitouch.c:
8 *
9 * Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr>
10 * Copyright (c) 2010-2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
11 * Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France
12 *
13 *
14 * This code is partly based on i2c-hid.c:
15 *
16 * Copyright (c) 2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
17 * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France
18 * Copyright (c) 2012 Red Hat, Inc
19 */
20
21/*
22 * This software is licensed under the terms of the GNU General Public
23 * License version 2, as published by the Free Software Foundation, and
24 * may be copied, distributed, and modified under those terms.
25 */
26
27#include <linux/module.h>
28#include <linux/input.h>
29#include <linux/interrupt.h>
30#include <linux/platform_device.h>
31#include <linux/async.h>
32#include <linux/i2c.h>
33#include <linux/delay.h>
34#include <linux/uaccess.h>
35#include <linux/buffer_head.h>
36#include <linux/version.h>
37#include <linux/slab.h>
38#include <linux/firmware.h>
39#include <linux/version.h>
40#include <linux/input/mt.h>
41#include <linux/acpi.h>
42#include <linux/of.h>
43#include <asm/unaligned.h>
44
45/* Device, Driver information */
46#define DEVICE_NAME "elants_i2c"
47#define DRV_VERSION "1.0.9"
48
49/* Convert from rows or columns into resolution */
50#define ELAN_TS_RESOLUTION(n, m) (((n) - 1) * (m))
51
52/* FW header data */
53#define HEADER_SIZE 4
54#define FW_HDR_TYPE 0
55#define FW_HDR_COUNT 1
56#define FW_HDR_LENGTH 2
57
58/* Buffer mode Queue Header information */
59#define QUEUE_HEADER_SINGLE 0x62
60#define QUEUE_HEADER_NORMAL 0X63
61#define QUEUE_HEADER_WAIT 0x64
62
63/* Command header definition */
64#define CMD_HEADER_WRITE 0x54
65#define CMD_HEADER_READ 0x53
66#define CMD_HEADER_6B_READ 0x5B
67#define CMD_HEADER_RESP 0x52
68#define CMD_HEADER_6B_RESP 0x9B
69#define CMD_HEADER_HELLO 0x55
70#define CMD_HEADER_REK 0x66
71
72/* FW position data */
73#define PACKET_SIZE 55
74#define MAX_CONTACT_NUM 10
75#define FW_POS_HEADER 0
76#define FW_POS_STATE 1
77#define FW_POS_TOTAL 2
78#define FW_POS_XY 3
79#define FW_POS_CHECKSUM 34
80#define FW_POS_WIDTH 35
81#define FW_POS_PRESSURE 45
82
83#define HEADER_REPORT_10_FINGER 0x62
84
85/* Header (4 bytes) plus 3 fill 10-finger packets */
86#define MAX_PACKET_SIZE 169
87
88#define BOOT_TIME_DELAY_MS 50
89
90/* FW read command, 0x53 0x?? 0x0, 0x01 */
91#define E_ELAN_INFO_FW_VER 0x00
92#define E_ELAN_INFO_BC_VER 0x10
93#define E_ELAN_INFO_TEST_VER 0xE0
94#define E_ELAN_INFO_FW_ID 0xF0
95#define E_INFO_OSR 0xD6
96#define E_INFO_PHY_SCAN 0xD7
97#define E_INFO_PHY_DRIVER 0xD8
98
99#define MAX_RETRIES 3
100#define MAX_FW_UPDATE_RETRIES 30
101
102#define ELAN_FW_PAGESIZE 132
103#define ELAN_FW_FILENAME "elants_i2c.bin"
104
105/* calibration timeout definition */
106#define ELAN_CALI_TIMEOUT_MSEC 10000
107
108enum elants_state {
109 ELAN_STATE_NORMAL,
110 ELAN_WAIT_QUEUE_HEADER,
111 ELAN_WAIT_RECALIBRATION,
112};
113
114enum elants_iap_mode {
115 ELAN_IAP_OPERATIONAL,
116 ELAN_IAP_RECOVERY,
117};
118