Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Philip Rakity and committed by
Dmitry Torokhov
341deefe 550eca7c

+7 -1
+6
drivers/input/touchscreen/tsc2007.c
··· 310 310 ts->get_pendown_state = pdata->get_pendown_state; 311 311 ts->clear_penirq = pdata->clear_penirq; 312 312 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 + 313 319 snprintf(ts->phys, sizeof(ts->phys), 314 320 "%s/input0", dev_name(&client->dev)); 315 321
+1 -1
include/linux/i2c/tsc2007.h
··· 5 5 6 6 struct tsc2007_platform_data { 7 7 u16 model; /* 2007. */ 8 - u16 x_plate_ohms; 8 + u16 x_plate_ohms; /* must be non-zero value */ 9 9 u16 max_rt; /* max. resistance above which samples are ignored */ 10 10 unsigned long poll_delay; /* delay (in ms) after pen-down event 11 11 before polling starts */