diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-02 17:53:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-02 17:53:25 -0400 |
commit | 978ab6a009e6691375a0b6f8a44ebbb471a64b6d (patch) | |
tree | eec7ee99a0502a38ed82a67ab880da66d29a7f08 | |
parent | 5634347dee31373a8faf084f4cdbf6d5ea0b03a4 (diff) | |
parent | 62d78461447198b49383f20301aaa15fe97dfa4f (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input layer fixes from Dmitry Torokhov:
"Fixes for two recent regressions (in Synaptics PS/2 and uinput
drivers) and some more driver fixups"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Revert "Input: synaptics - fix handling of disabling gesture mode"
Input: psmouse - fix data race in __ps2_command
Input: elan_i2c - add all valid ic type for i2c/smbus
Input: zhenhua - ensure we have BITREVERSE
Input: omap4-keypad - fix memory leak
Input: serio - fix blocking of parport
Input: uinput - fix crash when using ABS events
Input: elan_i2c - expand maximum product_id form 0xFF to 0xFFFF
Input: elan_i2c - add ic type 0x03
Input: elan_i2c - don't require known iap version
Input: imx6ul_tsc - fix controller name
Input: imx6ul_tsc - use the preferred method for kzalloc()
Input: imx6ul_tsc - check for negative return value
Input: imx6ul_tsc - propagate the errors
Input: walkera0701 - fix abs() calculations on 64 bit values
Input: mms114 - remove unneded semicolons
Input: pm8941-pwrkey - remove unneded semicolon
Input: fix typo in MT documentation
Input: cyapa - fix address of Gen3 devices in device tree documentation
-rw-r--r-- | Documentation/devicetree/bindings/input/cypress,cyapa.txt | 2 | ||||
-rw-r--r-- | Documentation/input/multi-touch-protocol.txt | 2 | ||||
-rw-r--r-- | drivers/input/joystick/walkera0701.c | 4 | ||||
-rw-r--r-- | drivers/input/keyboard/omap4-keypad.c | 2 | ||||
-rw-r--r-- | drivers/input/misc/pm8941-pwrkey.c | 2 | ||||
-rw-r--r-- | drivers/input/misc/uinput.c | 2 | ||||
-rw-r--r-- | drivers/input/mouse/elan_i2c.h | 2 | ||||
-rw-r--r-- | drivers/input/mouse/elan_i2c_core.c | 26 | ||||
-rw-r--r-- | drivers/input/mouse/elan_i2c_i2c.c | 4 | ||||
-rw-r--r-- | drivers/input/mouse/elan_i2c_smbus.c | 4 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 12 | ||||
-rw-r--r-- | drivers/input/serio/libps2.c | 22 | ||||
-rw-r--r-- | drivers/input/serio/parkbd.c | 1 | ||||
-rw-r--r-- | drivers/input/touchscreen/imx6ul_tsc.c | 34 | ||||
-rw-r--r-- | drivers/input/touchscreen/mms114.c | 4 |
15 files changed, 74 insertions, 49 deletions
diff --git a/Documentation/devicetree/bindings/input/cypress,cyapa.txt b/Documentation/devicetree/bindings/input/cypress,cyapa.txt index 635a3b036630..8d91ba9ff2fd 100644 --- a/Documentation/devicetree/bindings/input/cypress,cyapa.txt +++ b/Documentation/devicetree/bindings/input/cypress,cyapa.txt | |||
@@ -25,7 +25,7 @@ Example: | |||
25 | /* Cypress Gen3 touchpad */ | 25 | /* Cypress Gen3 touchpad */ |
26 | touchpad@67 { | 26 | touchpad@67 { |
27 | compatible = "cypress,cyapa"; | 27 | compatible = "cypress,cyapa"; |
28 | reg = <0x24>; | 28 | reg = <0x67>; |
29 | interrupt-parent = <&gpio>; | 29 | interrupt-parent = <&gpio>; |
30 | interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO 2 */ | 30 | interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO 2 */ |
31 | wakeup-source; | 31 | wakeup-source; |
diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt index b85d000faeb4..c51f1146f3bd 100644 --- a/Documentation/input/multi-touch-protocol.txt +++ b/Documentation/input/multi-touch-protocol.txt | |||
@@ -361,7 +361,7 @@ For win8 devices with both T and C coordinates, the position mapping is | |||
361 | ABS_MT_POSITION_X := T_X | 361 | ABS_MT_POSITION_X := T_X |
362 | ABS_MT_POSITION_Y := T_Y | 362 | ABS_MT_POSITION_Y := T_Y |
363 | ABS_MT_TOOL_X := C_X | 363 | ABS_MT_TOOL_X := C_X |
364 | ABS_MT_TOOL_X := C_Y | 364 | ABS_MT_TOOL_Y := C_Y |
365 | 365 | ||
366 | Unfortunately, there is not enough information to specify both the touching | 366 | Unfortunately, there is not enough information to specify both the touching |
367 | ellipse and the tool ellipse, so one has to resort to approximations. One | 367 | ellipse and the tool ellipse, so one has to resort to approximations. One |
diff --git a/drivers/input/joystick/walkera0701.c b/drivers/input/joystick/walkera0701.c index b76ac580703c..a8bc2fe170dd 100644 --- a/drivers/input/joystick/walkera0701.c +++ b/drivers/input/joystick/walkera0701.c | |||
@@ -150,7 +150,7 @@ static void walkera0701_irq_handler(void *handler_data) | |||
150 | if (w->counter == 24) { /* full frame */ | 150 | if (w->counter == 24) { /* full frame */ |
151 | walkera0701_parse_frame(w); | 151 | walkera0701_parse_frame(w); |
152 | w->counter = NO_SYNC; | 152 | w->counter = NO_SYNC; |
153 | if (abs(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ | 153 | if (abs64(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ |
154 | w->counter = 0; | 154 | w->counter = 0; |
155 | } else { | 155 | } else { |
156 | if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE) | 156 | if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE) |
@@ -161,7 +161,7 @@ static void walkera0701_irq_handler(void *handler_data) | |||
161 | } else | 161 | } else |
162 | w->counter = NO_SYNC; | 162 | w->counter = NO_SYNC; |
163 | } | 163 | } |
164 | } else if (abs(pulse_time - SYNC_PULSE - BIN0_PULSE) < | 164 | } else if (abs64(pulse_time - SYNC_PULSE - BIN0_PULSE) < |
165 | RESERVE + BIN1_PULSE - BIN0_PULSE) /* frame sync .. */ | 165 | RESERVE + BIN1_PULSE - BIN0_PULSE) /* frame sync .. */ |
166 | w->counter = 0; | 166 | w->counter = 0; |
167 | 167 | ||
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index b052afec9a11..6639b2b8528a 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c | |||
@@ -266,7 +266,7 @@ static int omap4_keypad_probe(struct platform_device *pdev) | |||
266 | 266 | ||
267 | error = omap4_keypad_parse_dt(&pdev->dev, keypad_data); | 267 | error = omap4_keypad_parse_dt(&pdev->dev, keypad_data); |
268 | if (error) | 268 | if (error) |
269 | return error; | 269 | goto err_free_keypad; |
270 | 270 | ||
271 | res = request_mem_region(res->start, resource_size(res), pdev->name); | 271 | res = request_mem_region(res->start, resource_size(res), pdev->name); |
272 | if (!res) { | 272 | if (!res) { |
diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c index 867db8a91372..e317b75357a0 100644 --- a/drivers/input/misc/pm8941-pwrkey.c +++ b/drivers/input/misc/pm8941-pwrkey.c | |||
@@ -93,7 +93,7 @@ static int pm8941_reboot_notify(struct notifier_block *nb, | |||
93 | default: | 93 | default: |
94 | reset_type = PON_PS_HOLD_TYPE_HARD_RESET; | 94 | reset_type = PON_PS_HOLD_TYPE_HARD_RESET; |
95 | break; | 95 | break; |
96 | }; | 96 | } |
97 | 97 | ||
98 | error = regmap_update_bits(pwrkey->regmap, | 98 | error = regmap_update_bits(pwrkey->regmap, |
99 | pwrkey->baseaddr + PON_PS_HOLD_RST_CTL, | 99 | pwrkey->baseaddr + PON_PS_HOLD_RST_CTL, |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 345df9b03aed..5adbcedcb81c 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -414,7 +414,7 @@ static int uinput_setup_device(struct uinput_device *udev, | |||
414 | dev->id.product = user_dev->id.product; | 414 | dev->id.product = user_dev->id.product; |
415 | dev->id.version = user_dev->id.version; | 415 | dev->id.version = user_dev->id.version; |
416 | 416 | ||
417 | for_each_set_bit(i, dev->absbit, ABS_CNT) { | 417 | for (i = 0; i < ABS_CNT; i++) { |
418 | input_abs_set_max(dev, i, user_dev->absmax[i]); | 418 | input_abs_set_max(dev, i, user_dev->absmax[i]); |
419 | input_abs_set_min(dev, i, user_dev->absmin[i]); | 419 | input_abs_set_min(dev, i, user_dev->absmin[i]); |
420 | input_abs_set_fuzz(dev, i, user_dev->absfuzz[i]); | 420 | input_abs_set_fuzz(dev, i, user_dev->absfuzz[i]); |
diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h index 73670f2aebfd..c0ec26118732 100644 --- a/drivers/input/mouse/elan_i2c.h +++ b/drivers/input/mouse/elan_i2c.h | |||
@@ -60,7 +60,7 @@ struct elan_transport_ops { | |||
60 | int (*get_sm_version)(struct i2c_client *client, | 60 | int (*get_sm_version)(struct i2c_client *client, |
61 | u8* ic_type, u8 *version); | 61 | u8* ic_type, u8 *version); |
62 | int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum); | 62 | int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum); |
63 | int (*get_product_id)(struct i2c_client *client, u8 *id); | 63 | int (*get_product_id)(struct i2c_client *client, u16 *id); |
64 | 64 | ||
65 | int (*get_max)(struct i2c_client *client, | 65 | int (*get_max)(struct i2c_client *client, |
66 | unsigned int *max_x, unsigned int *max_y); | 66 | unsigned int *max_x, unsigned int *max_y); |
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index fa945304b9a5..5e1665bbaa0b 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "elan_i2c.h" | 40 | #include "elan_i2c.h" |
41 | 41 | ||
42 | #define DRIVER_NAME "elan_i2c" | 42 | #define DRIVER_NAME "elan_i2c" |
43 | #define ELAN_DRIVER_VERSION "1.6.0" | 43 | #define ELAN_DRIVER_VERSION "1.6.1" |
44 | #define ETP_MAX_PRESSURE 255 | 44 | #define ETP_MAX_PRESSURE 255 |
45 | #define ETP_FWIDTH_REDUCE 90 | 45 | #define ETP_FWIDTH_REDUCE 90 |
46 | #define ETP_FINGER_WIDTH 15 | 46 | #define ETP_FINGER_WIDTH 15 |
@@ -76,7 +76,7 @@ struct elan_tp_data { | |||
76 | unsigned int x_res; | 76 | unsigned int x_res; |
77 | unsigned int y_res; | 77 | unsigned int y_res; |
78 | 78 | ||
79 | u8 product_id; | 79 | u16 product_id; |
80 | u8 fw_version; | 80 | u8 fw_version; |
81 | u8 sm_version; | 81 | u8 sm_version; |
82 | u8 iap_version; | 82 | u8 iap_version; |
@@ -98,15 +98,25 @@ static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count, | |||
98 | u16 *signature_address) | 98 | u16 *signature_address) |
99 | { | 99 | { |
100 | switch (iap_version) { | 100 | switch (iap_version) { |
101 | case 0x00: | ||
102 | case 0x06: | ||
101 | case 0x08: | 103 | case 0x08: |
102 | *validpage_count = 512; | 104 | *validpage_count = 512; |
103 | break; | 105 | break; |
106 | case 0x03: | ||
107 | case 0x07: | ||
104 | case 0x09: | 108 | case 0x09: |
109 | case 0x0A: | ||
110 | case 0x0B: | ||
111 | case 0x0C: | ||
105 | *validpage_count = 768; | 112 | *validpage_count = 768; |
106 | break; | 113 | break; |
107 | case 0x0D: | 114 | case 0x0D: |
108 | *validpage_count = 896; | 115 | *validpage_count = 896; |
109 | break; | 116 | break; |
117 | case 0x0E: | ||
118 | *validpage_count = 640; | ||
119 | break; | ||
110 | default: | 120 | default: |
111 | /* unknown ic type clear value */ | 121 | /* unknown ic type clear value */ |
112 | *validpage_count = 0; | 122 | *validpage_count = 0; |
@@ -266,11 +276,10 @@ static int elan_query_device_info(struct elan_tp_data *data) | |||
266 | 276 | ||
267 | error = elan_get_fwinfo(data->iap_version, &data->fw_validpage_count, | 277 | error = elan_get_fwinfo(data->iap_version, &data->fw_validpage_count, |
268 | &data->fw_signature_address); | 278 | &data->fw_signature_address); |
269 | if (error) { | 279 | if (error) |
270 | dev_err(&data->client->dev, | 280 | dev_warn(&data->client->dev, |
271 | "unknown iap version %d\n", data->iap_version); | 281 | "unexpected iap version %#04x (ic type: %#04x), firmware update will not work\n", |
272 | return error; | 282 | data->iap_version, data->ic_type); |
273 | } | ||
274 | 283 | ||
275 | return 0; | 284 | return 0; |
276 | } | 285 | } |
@@ -486,6 +495,9 @@ static ssize_t elan_sysfs_update_fw(struct device *dev, | |||
486 | const u8 *fw_signature; | 495 | const u8 *fw_signature; |
487 | static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF}; | 496 | static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF}; |
488 | 497 | ||
498 | if (data->fw_validpage_count == 0) | ||
499 | return -EINVAL; | ||
500 | |||
489 | /* Look for a firmware with the product id appended. */ | 501 | /* Look for a firmware with the product id appended. */ |
490 | fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id); | 502 | fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id); |
491 | if (!fw_name) { | 503 | if (!fw_name) { |
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c index 683c840c9dd7..a679e56c44cd 100644 --- a/drivers/input/mouse/elan_i2c_i2c.c +++ b/drivers/input/mouse/elan_i2c_i2c.c | |||
@@ -276,7 +276,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client, | |||
276 | return 0; | 276 | return 0; |
277 | } | 277 | } |
278 | 278 | ||
279 | static int elan_i2c_get_product_id(struct i2c_client *client, u8 *id) | 279 | static int elan_i2c_get_product_id(struct i2c_client *client, u16 *id) |
280 | { | 280 | { |
281 | int error; | 281 | int error; |
282 | u8 val[3]; | 282 | u8 val[3]; |
@@ -287,7 +287,7 @@ static int elan_i2c_get_product_id(struct i2c_client *client, u8 *id) | |||
287 | return error; | 287 | return error; |
288 | } | 288 | } |
289 | 289 | ||
290 | *id = val[0]; | 290 | *id = le16_to_cpup((__le16 *)val); |
291 | return 0; | 291 | return 0; |
292 | } | 292 | } |
293 | 293 | ||
diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c index ff36a366b2aa..cb6aecbc1dc2 100644 --- a/drivers/input/mouse/elan_i2c_smbus.c +++ b/drivers/input/mouse/elan_i2c_smbus.c | |||
@@ -183,7 +183,7 @@ static int elan_smbus_get_sm_version(struct i2c_client *client, | |||
183 | return 0; | 183 | return 0; |
184 | } | 184 | } |
185 | 185 | ||
186 | static int elan_smbus_get_product_id(struct i2c_client *client, u8 *id) | 186 | static int elan_smbus_get_product_id(struct i2c_client *client, u16 *id) |
187 | { | 187 | { |
188 | int error; | 188 | int error; |
189 | u8 val[3]; | 189 | u8 val[3]; |
@@ -195,7 +195,7 @@ static int elan_smbus_get_product_id(struct i2c_client *client, u8 *id) | |||
195 | return error; | 195 | return error; |
196 | } | 196 | } |
197 | 197 | ||
198 | *id = val[1]; | 198 | *id = be16_to_cpup((__be16 *)val); |
199 | return 0; | 199 | return 0; |
200 | } | 200 | } |
201 | 201 | ||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 994ae7886156..6025eb430c0a 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -519,18 +519,14 @@ static int synaptics_set_mode(struct psmouse *psmouse) | |||
519 | struct synaptics_data *priv = psmouse->private; | 519 | struct synaptics_data *priv = psmouse->private; |
520 | 520 | ||
521 | priv->mode = 0; | 521 | priv->mode = 0; |
522 | 522 | if (priv->absolute_mode) | |
523 | if (priv->absolute_mode) { | ||
524 | priv->mode |= SYN_BIT_ABSOLUTE_MODE; | 523 | priv->mode |= SYN_BIT_ABSOLUTE_MODE; |
525 | if (SYN_CAP_EXTENDED(priv->capabilities)) | 524 | if (priv->disable_gesture) |
526 | priv->mode |= SYN_BIT_W_MODE; | ||
527 | } | ||
528 | |||
529 | if (!SYN_MODE_WMODE(priv->mode) && priv->disable_gesture) | ||
530 | priv->mode |= SYN_BIT_DISABLE_GESTURE; | 525 | priv->mode |= SYN_BIT_DISABLE_GESTURE; |
531 | |||
532 | if (psmouse->rate >= 80) | 526 | if (psmouse->rate >= 80) |
533 | priv->mode |= SYN_BIT_HIGH_RATE; | 527 | priv->mode |= SYN_BIT_HIGH_RATE; |
528 | if (SYN_CAP_EXTENDED(priv->capabilities)) | ||
529 | priv->mode |= SYN_BIT_W_MODE; | ||
534 | 530 | ||
535 | if (synaptics_mode_cmd(psmouse, priv->mode)) | 531 | if (synaptics_mode_cmd(psmouse, priv->mode)) |
536 | return -1; | 532 | return -1; |
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index 75516996db20..316f2c897101 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c | |||
@@ -212,12 +212,17 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
212 | * time before the ACK arrives. | 212 | * time before the ACK arrives. |
213 | */ | 213 | */ |
214 | if (ps2_sendbyte(ps2dev, command & 0xff, | 214 | if (ps2_sendbyte(ps2dev, command & 0xff, |
215 | command == PS2_CMD_RESET_BAT ? 1000 : 200)) | 215 | command == PS2_CMD_RESET_BAT ? 1000 : 200)) { |
216 | goto out; | 216 | serio_pause_rx(ps2dev->serio); |
217 | goto out_reset_flags; | ||
218 | } | ||
217 | 219 | ||
218 | for (i = 0; i < send; i++) | 220 | for (i = 0; i < send; i++) { |
219 | if (ps2_sendbyte(ps2dev, param[i], 200)) | 221 | if (ps2_sendbyte(ps2dev, param[i], 200)) { |
220 | goto out; | 222 | serio_pause_rx(ps2dev->serio); |
223 | goto out_reset_flags; | ||
224 | } | ||
225 | } | ||
221 | 226 | ||
222 | /* | 227 | /* |
223 | * The reset command takes a long time to execute. | 228 | * The reset command takes a long time to execute. |
@@ -234,17 +239,18 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
234 | !(ps2dev->flags & PS2_FLAG_CMD), timeout); | 239 | !(ps2dev->flags & PS2_FLAG_CMD), timeout); |
235 | } | 240 | } |
236 | 241 | ||
242 | serio_pause_rx(ps2dev->serio); | ||
243 | |||
237 | if (param) | 244 | if (param) |
238 | for (i = 0; i < receive; i++) | 245 | for (i = 0; i < receive; i++) |
239 | param[i] = ps2dev->cmdbuf[(receive - 1) - i]; | 246 | param[i] = ps2dev->cmdbuf[(receive - 1) - i]; |
240 | 247 | ||
241 | if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) | 248 | if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) |
242 | goto out; | 249 | goto out_reset_flags; |
243 | 250 | ||
244 | rc = 0; | 251 | rc = 0; |
245 | 252 | ||
246 | out: | 253 | out_reset_flags: |
247 | serio_pause_rx(ps2dev->serio); | ||
248 | ps2dev->flags = 0; | 254 | ps2dev->flags = 0; |
249 | serio_continue_rx(ps2dev->serio); | 255 | serio_continue_rx(ps2dev->serio); |
250 | 256 | ||
diff --git a/drivers/input/serio/parkbd.c b/drivers/input/serio/parkbd.c index 26b45936f9fd..1e8cd6f1fe9e 100644 --- a/drivers/input/serio/parkbd.c +++ b/drivers/input/serio/parkbd.c | |||
@@ -194,6 +194,7 @@ static int __init parkbd_init(void) | |||
194 | parkbd_port = parkbd_allocate_serio(); | 194 | parkbd_port = parkbd_allocate_serio(); |
195 | if (!parkbd_port) { | 195 | if (!parkbd_port) { |
196 | parport_release(parkbd_dev); | 196 | parport_release(parkbd_dev); |
197 | parport_unregister_device(parkbd_dev); | ||
197 | return -ENOMEM; | 198 | return -ENOMEM; |
198 | } | 199 | } |
199 | 200 | ||
diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c index ff0b75813daa..8275267eac25 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c | |||
@@ -94,7 +94,7 @@ struct imx6ul_tsc { | |||
94 | * TSC module need ADC to get the measure value. So | 94 | * TSC module need ADC to get the measure value. So |
95 | * before config TSC, we should initialize ADC module. | 95 | * before config TSC, we should initialize ADC module. |
96 | */ | 96 | */ |
97 | static void imx6ul_adc_init(struct imx6ul_tsc *tsc) | 97 | static int imx6ul_adc_init(struct imx6ul_tsc *tsc) |
98 | { | 98 | { |
99 | int adc_hc = 0; | 99 | int adc_hc = 0; |
100 | int adc_gc; | 100 | int adc_gc; |
@@ -122,17 +122,23 @@ static void imx6ul_adc_init(struct imx6ul_tsc *tsc) | |||
122 | 122 | ||
123 | timeout = wait_for_completion_timeout | 123 | timeout = wait_for_completion_timeout |
124 | (&tsc->completion, ADC_TIMEOUT); | 124 | (&tsc->completion, ADC_TIMEOUT); |
125 | if (timeout == 0) | 125 | if (timeout == 0) { |
126 | dev_err(tsc->dev, "Timeout for adc calibration\n"); | 126 | dev_err(tsc->dev, "Timeout for adc calibration\n"); |
127 | return -ETIMEDOUT; | ||
128 | } | ||
127 | 129 | ||
128 | adc_gs = readl(tsc->adc_regs + REG_ADC_GS); | 130 | adc_gs = readl(tsc->adc_regs + REG_ADC_GS); |
129 | if (adc_gs & ADC_CALF) | 131 | if (adc_gs & ADC_CALF) { |
130 | dev_err(tsc->dev, "ADC calibration failed\n"); | 132 | dev_err(tsc->dev, "ADC calibration failed\n"); |
133 | return -EINVAL; | ||
134 | } | ||
131 | 135 | ||
132 | /* TSC need the ADC work in hardware trigger */ | 136 | /* TSC need the ADC work in hardware trigger */ |
133 | adc_cfg = readl(tsc->adc_regs + REG_ADC_CFG); | 137 | adc_cfg = readl(tsc->adc_regs + REG_ADC_CFG); |
134 | adc_cfg |= ADC_HARDWARE_TRIGGER; | 138 | adc_cfg |= ADC_HARDWARE_TRIGGER; |
135 | writel(adc_cfg, tsc->adc_regs + REG_ADC_CFG); | 139 | writel(adc_cfg, tsc->adc_regs + REG_ADC_CFG); |
140 | |||
141 | return 0; | ||
136 | } | 142 | } |
137 | 143 | ||
138 | /* | 144 | /* |
@@ -188,11 +194,17 @@ static void imx6ul_tsc_set(struct imx6ul_tsc *tsc) | |||
188 | writel(start, tsc->tsc_regs + REG_TSC_FLOW_CONTROL); | 194 | writel(start, tsc->tsc_regs + REG_TSC_FLOW_CONTROL); |
189 | } | 195 | } |
190 | 196 | ||
191 | static void imx6ul_tsc_init(struct imx6ul_tsc *tsc) | 197 | static int imx6ul_tsc_init(struct imx6ul_tsc *tsc) |
192 | { | 198 | { |
193 | imx6ul_adc_init(tsc); | 199 | int err; |
200 | |||
201 | err = imx6ul_adc_init(tsc); | ||
202 | if (err) | ||
203 | return err; | ||
194 | imx6ul_tsc_channel_config(tsc); | 204 | imx6ul_tsc_channel_config(tsc); |
195 | imx6ul_tsc_set(tsc); | 205 | imx6ul_tsc_set(tsc); |
206 | |||
207 | return 0; | ||
196 | } | 208 | } |
197 | 209 | ||
198 | static void imx6ul_tsc_disable(struct imx6ul_tsc *tsc) | 210 | static void imx6ul_tsc_disable(struct imx6ul_tsc *tsc) |
@@ -311,9 +323,7 @@ static int imx6ul_tsc_open(struct input_dev *input_dev) | |||
311 | return err; | 323 | return err; |
312 | } | 324 | } |
313 | 325 | ||
314 | imx6ul_tsc_init(tsc); | 326 | return imx6ul_tsc_init(tsc); |
315 | |||
316 | return 0; | ||
317 | } | 327 | } |
318 | 328 | ||
319 | static void imx6ul_tsc_close(struct input_dev *input_dev) | 329 | static void imx6ul_tsc_close(struct input_dev *input_dev) |
@@ -337,7 +347,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) | |||
337 | int tsc_irq; | 347 | int tsc_irq; |
338 | int adc_irq; | 348 | int adc_irq; |
339 | 349 | ||
340 | tsc = devm_kzalloc(&pdev->dev, sizeof(struct imx6ul_tsc), GFP_KERNEL); | 350 | tsc = devm_kzalloc(&pdev->dev, sizeof(*tsc), GFP_KERNEL); |
341 | if (!tsc) | 351 | if (!tsc) |
342 | return -ENOMEM; | 352 | return -ENOMEM; |
343 | 353 | ||
@@ -345,7 +355,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) | |||
345 | if (!input_dev) | 355 | if (!input_dev) |
346 | return -ENOMEM; | 356 | return -ENOMEM; |
347 | 357 | ||
348 | input_dev->name = "iMX6UL TouchScreen Controller"; | 358 | input_dev->name = "iMX6UL Touchscreen Controller"; |
349 | input_dev->id.bustype = BUS_HOST; | 359 | input_dev->id.bustype = BUS_HOST; |
350 | 360 | ||
351 | input_dev->open = imx6ul_tsc_open; | 361 | input_dev->open = imx6ul_tsc_open; |
@@ -406,7 +416,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) | |||
406 | } | 416 | } |
407 | 417 | ||
408 | adc_irq = platform_get_irq(pdev, 1); | 418 | adc_irq = platform_get_irq(pdev, 1); |
409 | if (adc_irq <= 0) { | 419 | if (adc_irq < 0) { |
410 | dev_err(&pdev->dev, "no adc irq resource?\n"); | 420 | dev_err(&pdev->dev, "no adc irq resource?\n"); |
411 | return adc_irq; | 421 | return adc_irq; |
412 | } | 422 | } |
@@ -491,7 +501,7 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev) | |||
491 | goto out; | 501 | goto out; |
492 | } | 502 | } |
493 | 503 | ||
494 | imx6ul_tsc_init(tsc); | 504 | retval = imx6ul_tsc_init(tsc); |
495 | } | 505 | } |
496 | 506 | ||
497 | out: | 507 | out: |
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 7cce87650fc8..1fafc9f57af6 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c | |||
@@ -394,12 +394,12 @@ static struct mms114_platform_data *mms114_parse_dt(struct device *dev) | |||
394 | if (of_property_read_u32(np, "x-size", &pdata->x_size)) { | 394 | if (of_property_read_u32(np, "x-size", &pdata->x_size)) { |
395 | dev_err(dev, "failed to get x-size property\n"); | 395 | dev_err(dev, "failed to get x-size property\n"); |
396 | return NULL; | 396 | return NULL; |
397 | }; | 397 | } |
398 | 398 | ||
399 | if (of_property_read_u32(np, "y-size", &pdata->y_size)) { | 399 | if (of_property_read_u32(np, "y-size", &pdata->y_size)) { |
400 | dev_err(dev, "failed to get y-size property\n"); | 400 | dev_err(dev, "failed to get y-size property\n"); |
401 | return NULL; | 401 | return NULL; |
402 | }; | 402 | } |
403 | 403 | ||
404 | of_property_read_u32(np, "contact-threshold", | 404 | of_property_read_u32(np, "contact-threshold", |
405 | &pdata->contact_threshold); | 405 | &pdata->contact_threshold); |