diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 21:25:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 21:25:15 -0400 |
commit | 8691c130fae136bb2b7d0554422a2dff4c6ac169 (patch) | |
tree | 9c75c86ab04e66d756c55f37e594c3e27a2963d5 /drivers/input/touchscreen/goodix.c | |
parent | c3a416a669eb83cfa9ccb52db030e72d654bd105 (diff) | |
parent | 85a3685852d9ac7d92be9d824533c915a4597fa4 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input subsystem updates from Dmitry Torokhov:
"You will get the following new drivers:
- Qualcomm PM8941 power key drver
- ChipOne icn8318 touchscreen controller driver
- Broadcom iProc touchscreen and keypad drivers
- Semtech SX8654 I2C touchscreen controller driver
ALPS driver now supports newer SS4 devices; Elantech got a fix that
should make it work on some ASUS laptops; and a slew of other
enhancements and random fixes"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (51 commits)
Input: alps - non interleaved V2 dualpoint has separate stick button bits
Input: alps - fix touchpad buttons getting stuck when used with trackpoint
Input: atkbd - document "no new force-release quirks" policy
Input: ALPS - make alps_get_pkt_id_ss4_v2() and others static
Input: ALPS - V7 devices can report 5-finger taps
Input: ALPS - add support for SS4 touchpad devices
Input: ALPS - refactor alps_set_abs_params_mt()
Input: elantech - fix absolute mode setting on some ASUS laptops
Input: atmel_mxt_ts - split out touchpad initialisation logic
Input: atmel_mxt_ts - implement support for T100 touch object
Input: cros_ec_keyb - fix clearing keyboard state on wakeup
Input: gscps2 - drop pci_ids dependency
Input: synaptics - allocate 3 slots to keep stability in image sensors
Input: Revert "Revert "synaptics - use dmax in input_mt_assign_slots""
Input: MT - make slot assignment work for overcovered solutions
mfd: tc3589x: enforce device-tree only mode
Input: tc3589x - localize platform data
Input: tsc2007 - Convert msecs to jiffies only once
Input: edt-ft5x06 - remove EV_SYN event report
Input: edt-ft5x06 - allow to setting the maximum axes value through the DT
...
Diffstat (limited to 'drivers/input/touchscreen/goodix.c')
-rw-r--r-- | drivers/input/touchscreen/goodix.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index ca196689f025..3af16984d57c 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/acpi.h> | ||
27 | #include <linux/of.h> | ||
26 | #include <asm/unaligned.h> | 28 | #include <asm/unaligned.h> |
27 | 29 | ||
28 | struct goodix_ts_data { | 30 | struct goodix_ts_data { |
@@ -48,6 +50,7 @@ struct goodix_ts_data { | |||
48 | #define GOODIX_REG_VERSION 0x8140 | 50 | #define GOODIX_REG_VERSION 0x8140 |
49 | 51 | ||
50 | #define RESOLUTION_LOC 1 | 52 | #define RESOLUTION_LOC 1 |
53 | #define MAX_CONTACTS_LOC 5 | ||
51 | #define TRIGGER_LOC 6 | 54 | #define TRIGGER_LOC 6 |
52 | 55 | ||
53 | static const unsigned long goodix_irq_flags[] = { | 56 | static const unsigned long goodix_irq_flags[] = { |
@@ -99,7 +102,7 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) | |||
99 | } | 102 | } |
100 | 103 | ||
101 | touch_num = data[0] & 0x0f; | 104 | touch_num = data[0] & 0x0f; |
102 | if (touch_num > GOODIX_MAX_CONTACTS) | 105 | if (touch_num > ts->max_touch_num) |
103 | return -EPROTO; | 106 | return -EPROTO; |
104 | 107 | ||
105 | if (touch_num > 1) { | 108 | if (touch_num > 1) { |
@@ -141,7 +144,7 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) | |||
141 | */ | 144 | */ |
142 | static void goodix_process_events(struct goodix_ts_data *ts) | 145 | static void goodix_process_events(struct goodix_ts_data *ts) |
143 | { | 146 | { |
144 | u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS]; | 147 | u8 point_data[1 + GOODIX_CONTACT_SIZE * ts->max_touch_num]; |
145 | int touch_num; | 148 | int touch_num; |
146 | int i; | 149 | int i; |
147 | 150 | ||
@@ -202,21 +205,23 @@ static void goodix_read_config(struct goodix_ts_data *ts) | |||
202 | ts->abs_x_max = GOODIX_MAX_WIDTH; | 205 | ts->abs_x_max = GOODIX_MAX_WIDTH; |
203 | ts->abs_y_max = GOODIX_MAX_HEIGHT; | 206 | ts->abs_y_max = GOODIX_MAX_HEIGHT; |
204 | ts->int_trigger_type = GOODIX_INT_TRIGGER; | 207 | ts->int_trigger_type = GOODIX_INT_TRIGGER; |
208 | ts->max_touch_num = GOODIX_MAX_CONTACTS; | ||
205 | return; | 209 | return; |
206 | } | 210 | } |
207 | 211 | ||
208 | ts->abs_x_max = get_unaligned_le16(&config[RESOLUTION_LOC]); | 212 | ts->abs_x_max = get_unaligned_le16(&config[RESOLUTION_LOC]); |
209 | ts->abs_y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]); | 213 | ts->abs_y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]); |
210 | ts->int_trigger_type = (config[TRIGGER_LOC]) & 0x03; | 214 | ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; |
211 | if (!ts->abs_x_max || !ts->abs_y_max) { | 215 | ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; |
216 | if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { | ||
212 | dev_err(&ts->client->dev, | 217 | dev_err(&ts->client->dev, |
213 | "Invalid config, using defaults\n"); | 218 | "Invalid config, using defaults\n"); |
214 | ts->abs_x_max = GOODIX_MAX_WIDTH; | 219 | ts->abs_x_max = GOODIX_MAX_WIDTH; |
215 | ts->abs_y_max = GOODIX_MAX_HEIGHT; | 220 | ts->abs_y_max = GOODIX_MAX_HEIGHT; |
221 | ts->max_touch_num = GOODIX_MAX_CONTACTS; | ||
216 | } | 222 | } |
217 | } | 223 | } |
218 | 224 | ||
219 | |||
220 | /** | 225 | /** |
221 | * goodix_read_version - Read goodix touchscreen version | 226 | * goodix_read_version - Read goodix touchscreen version |
222 | * | 227 | * |
@@ -295,7 +300,7 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts) | |||
295 | input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); | 300 | input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); |
296 | input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); | 301 | input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); |
297 | 302 | ||
298 | input_mt_init_slots(ts->input_dev, GOODIX_MAX_CONTACTS, | 303 | input_mt_init_slots(ts->input_dev, ts->max_touch_num, |
299 | INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); | 304 | INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); |
300 | 305 | ||
301 | ts->input_dev->name = "Goodix Capacitive TouchScreen"; | 306 | ts->input_dev->name = "Goodix Capacitive TouchScreen"; |
@@ -372,11 +377,27 @@ static const struct i2c_device_id goodix_ts_id[] = { | |||
372 | { } | 377 | { } |
373 | }; | 378 | }; |
374 | 379 | ||
380 | #ifdef CONFIG_ACPI | ||
375 | static const struct acpi_device_id goodix_acpi_match[] = { | 381 | static const struct acpi_device_id goodix_acpi_match[] = { |
376 | { "GDIX1001", 0 }, | 382 | { "GDIX1001", 0 }, |
377 | { } | 383 | { } |
378 | }; | 384 | }; |
379 | MODULE_DEVICE_TABLE(acpi, goodix_acpi_match); | 385 | MODULE_DEVICE_TABLE(acpi, goodix_acpi_match); |
386 | #endif | ||
387 | |||
388 | #ifdef CONFIG_OF | ||
389 | static const struct of_device_id goodix_of_match[] = { | ||
390 | { .compatible = "goodix,gt911" }, | ||
391 | { .compatible = "goodix,gt9110" }, | ||
392 | { .compatible = "goodix,gt912" }, | ||
393 | { .compatible = "goodix,gt927" }, | ||
394 | { .compatible = "goodix,gt9271" }, | ||
395 | { .compatible = "goodix,gt928" }, | ||
396 | { .compatible = "goodix,gt967" }, | ||
397 | { } | ||
398 | }; | ||
399 | MODULE_DEVICE_TABLE(of, goodix_of_match); | ||
400 | #endif | ||
380 | 401 | ||
381 | static struct i2c_driver goodix_ts_driver = { | 402 | static struct i2c_driver goodix_ts_driver = { |
382 | .probe = goodix_ts_probe, | 403 | .probe = goodix_ts_probe, |
@@ -384,7 +405,8 @@ static struct i2c_driver goodix_ts_driver = { | |||
384 | .driver = { | 405 | .driver = { |
385 | .name = "Goodix-TS", | 406 | .name = "Goodix-TS", |
386 | .owner = THIS_MODULE, | 407 | .owner = THIS_MODULE, |
387 | .acpi_match_table = goodix_acpi_match, | 408 | .acpi_match_table = ACPI_PTR(goodix_acpi_match), |
409 | .of_match_table = of_match_ptr(goodix_of_match), | ||
388 | }, | 410 | }, |
389 | }; | 411 | }; |
390 | module_i2c_driver(goodix_ts_driver); | 412 | module_i2c_driver(goodix_ts_driver); |