Skip to content

Commit 341deef

Browse files
Philip Rakitydtor
authored andcommitted
Input: tsc2007 - make sure that X plate resistance is specified
Abort driver initialization if X plate resistance was not specified in platform data as it will cause pressure to be always calculated as 0, and making userspace ignore touch coordinates. Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
1 parent 550eca7 commit 341deef

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎drivers/input/touchscreen/tsc2007.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ static int __devinit tsc2007_probe(struct i2c_client *client,
310310
ts->get_pendown_state = pdata->get_pendown_state;
311311
ts->clear_penirq = pdata->clear_penirq;
312312

313+
if (pdata->x_plate_ohms == 0) {
314+
dev_err(&client->dev, "x_plate_ohms is not set up in platform data");
315+
err = -EINVAL;
316+
goto err_free_mem;
317+
}
318+
313319
snprintf(ts->phys, sizeof(ts->phys),
314320
"%s/input0", dev_name(&client->dev));
315321

‎include/linux/i2c/tsc2007.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
struct tsc2007_platform_data {
77
u16 model; /* 2007. */
8-
u16 x_plate_ohms;
8+
u16 x_plate_ohms; /* must be non-zero value */
99
u16 max_rt; /* max. resistance above which samples are ignored */
1010
unsigned long poll_delay; /* delay (in ms) after pen-down event
1111
before polling starts */

0 commit comments

Comments
 (0)