diff options
author | Philip Rakity <prakity@marvell.com> | 2011-10-11 23:54:55 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-10-11 23:56:41 -0400 |
commit | 341deefe8f4584b09564193cb46d8cf386f491a5 (patch) | |
tree | 6610d3c3c0306e3b1a8e82552f5e426818ff5a57 | |
parent | 550eca7cafa1c6e2c077afb2211a364a982d8645 (diff) |
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>
-rw-r--r-- | drivers/input/touchscreen/tsc2007.c | 6 | ||||
-rw-r--r-- | include/linux/i2c/tsc2007.h | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 0acca68cc52b..1f674cb6c55b 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c | |||
@@ -310,6 +310,12 @@ static int __devinit tsc2007_probe(struct i2c_client *client, | |||
310 | ts->get_pendown_state = pdata->get_pendown_state; | 310 | ts->get_pendown_state = pdata->get_pendown_state; |
311 | ts->clear_penirq = pdata->clear_penirq; | 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 | snprintf(ts->phys, sizeof(ts->phys), | 319 | snprintf(ts->phys, sizeof(ts->phys), |
314 | "%s/input0", dev_name(&client->dev)); | 320 | "%s/input0", dev_name(&client->dev)); |
315 | 321 | ||
diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h index 591427a63b06..506a9f7af51e 100644 --- a/include/linux/i2c/tsc2007.h +++ b/include/linux/i2c/tsc2007.h | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | struct tsc2007_platform_data { | 6 | struct tsc2007_platform_data { |
7 | u16 model; /* 2007. */ | 7 | u16 model; /* 2007. */ |
8 | u16 x_plate_ohms; | 8 | u16 x_plate_ohms; /* must be non-zero value */ |
9 | u16 max_rt; /* max. resistance above which samples are ignored */ | 9 | u16 max_rt; /* max. resistance above which samples are ignored */ |
10 | unsigned long poll_delay; /* delay (in ms) after pen-down event | 10 | unsigned long poll_delay; /* delay (in ms) after pen-down event |
11 | before polling starts */ | 11 | before polling starts */ |