Input: tsc2007 - make sure that X plate resistance is specified
authorPhilip Rakity <prakity@marvell.com>
Wed, 12 Oct 2011 03:54:55 +0000 (20:54 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 12 Oct 2011 03:56:41 +0000 (20:56 -0700)
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>
drivers/input/touchscreen/tsc2007.c
include/linux/i2c/tsc2007.h

index 0acca68cc52bd4daa5ba4324f18e2ee1817f1e0d..1f674cb6c55b01747fd6c28bacdfe32467d10744 100644 (file)
@@ -310,6 +310,12 @@ static int __devinit tsc2007_probe(struct i2c_client *client,
        ts->get_pendown_state = pdata->get_pendown_state;
        ts->clear_penirq      = pdata->clear_penirq;
 
+       if (pdata->x_plate_ohms == 0) {
+               dev_err(&client->dev, "x_plate_ohms is not set up in platform data");
+               err = -EINVAL;
+               goto err_free_mem;
+       }
+
        snprintf(ts->phys, sizeof(ts->phys),
                 "%s/input0", dev_name(&client->dev));
 
index 591427a63b062635e991f025222da003915c4911..506a9f7af51e6a5dc4766f62d19dda5279d06e7e 100644 (file)
@@ -5,7 +5,7 @@
 
 struct tsc2007_platform_data {
        u16     model;                          /* 2007. */
-       u16     x_plate_ohms;
+       u16     x_plate_ohms;   /* must be non-zero value */
        u16     max_rt; /* max. resistance above which samples are ignored */
        unsigned long poll_delay; /* delay (in ms) after pen-down event
                                     before polling starts */