diff options
Diffstat (limited to 'drivers/input/touchscreen/tsc2007.c')
-rw-r--r-- | drivers/input/touchscreen/tsc2007.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 80467f262331..fadc11545b1e 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c | |||
@@ -27,9 +27,6 @@ | |||
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | #include <linux/i2c/tsc2007.h> | 28 | #include <linux/i2c/tsc2007.h> |
29 | 29 | ||
30 | #define TS_POLL_DELAY 1 /* ms delay between samples */ | ||
31 | #define TS_POLL_PERIOD 1 /* ms delay between samples */ | ||
32 | |||
33 | #define TSC2007_MEASURE_TEMP0 (0x0 << 4) | 30 | #define TSC2007_MEASURE_TEMP0 (0x0 << 4) |
34 | #define TSC2007_MEASURE_AUX (0x2 << 4) | 31 | #define TSC2007_MEASURE_AUX (0x2 << 4) |
35 | #define TSC2007_MEASURE_TEMP1 (0x4 << 4) | 32 | #define TSC2007_MEASURE_TEMP1 (0x4 << 4) |
@@ -75,6 +72,9 @@ struct tsc2007 { | |||
75 | 72 | ||
76 | u16 model; | 73 | u16 model; |
77 | u16 x_plate_ohms; | 74 | u16 x_plate_ohms; |
75 | u16 max_rt; | ||
76 | unsigned long poll_delay; | ||
77 | unsigned long poll_period; | ||
78 | 78 | ||
79 | bool pendown; | 79 | bool pendown; |
80 | int irq; | 80 | int irq; |
@@ -156,6 +156,7 @@ static void tsc2007_work(struct work_struct *work) | |||
156 | { | 156 | { |
157 | struct tsc2007 *ts = | 157 | struct tsc2007 *ts = |
158 | container_of(to_delayed_work(work), struct tsc2007, work); | 158 | container_of(to_delayed_work(work), struct tsc2007, work); |
159 | bool debounced = false; | ||
159 | struct ts_event tc; | 160 | struct ts_event tc; |
160 | u32 rt; | 161 | u32 rt; |
161 | 162 | ||
@@ -184,13 +185,14 @@ static void tsc2007_work(struct work_struct *work) | |||
184 | tsc2007_read_values(ts, &tc); | 185 | tsc2007_read_values(ts, &tc); |
185 | 186 | ||
186 | rt = tsc2007_calculate_pressure(ts, &tc); | 187 | rt = tsc2007_calculate_pressure(ts, &tc); |
187 | if (rt > MAX_12BIT) { | 188 | if (rt > ts->max_rt) { |
188 | /* | 189 | /* |
189 | * Sample found inconsistent by debouncing or pressure is | 190 | * Sample found inconsistent by debouncing or pressure is |
190 | * beyond the maximum. Don't report it to user space, | 191 | * beyond the maximum. Don't report it to user space, |
191 | * repeat at least once more the measurement. | 192 | * repeat at least once more the measurement. |
192 | */ | 193 | */ |
193 | dev_dbg(&ts->client->dev, "ignored pressure %d\n", rt); | 194 | dev_dbg(&ts->client->dev, "ignored pressure %d\n", rt); |
195 | debounced = true; | ||
194 | goto out; | 196 | goto out; |
195 | 197 | ||
196 | } | 198 | } |
@@ -225,9 +227,9 @@ static void tsc2007_work(struct work_struct *work) | |||
225 | } | 227 | } |
226 | 228 | ||
227 | out: | 229 | out: |
228 | if (ts->pendown) | 230 | if (ts->pendown || debounced) |
229 | schedule_delayed_work(&ts->work, | 231 | schedule_delayed_work(&ts->work, |
230 | msecs_to_jiffies(TS_POLL_PERIOD)); | 232 | msecs_to_jiffies(ts->poll_period)); |
231 | else | 233 | else |
232 | enable_irq(ts->irq); | 234 | enable_irq(ts->irq); |
233 | } | 235 | } |
@@ -239,7 +241,7 @@ static irqreturn_t tsc2007_irq(int irq, void *handle) | |||
239 | if (!ts->get_pendown_state || likely(ts->get_pendown_state())) { | 241 | if (!ts->get_pendown_state || likely(ts->get_pendown_state())) { |
240 | disable_irq_nosync(ts->irq); | 242 | disable_irq_nosync(ts->irq); |
241 | schedule_delayed_work(&ts->work, | 243 | schedule_delayed_work(&ts->work, |
242 | msecs_to_jiffies(TS_POLL_DELAY)); | 244 | msecs_to_jiffies(ts->poll_delay)); |
243 | } | 245 | } |
244 | 246 | ||
245 | if (ts->clear_penirq) | 247 | if (ts->clear_penirq) |
@@ -292,6 +294,9 @@ static int __devinit tsc2007_probe(struct i2c_client *client, | |||
292 | 294 | ||
293 | ts->model = pdata->model; | 295 | ts->model = pdata->model; |
294 | ts->x_plate_ohms = pdata->x_plate_ohms; | 296 | ts->x_plate_ohms = pdata->x_plate_ohms; |
297 | ts->max_rt = pdata->max_rt ? : MAX_12BIT; | ||
298 | ts->poll_delay = pdata->poll_delay ? : 1; | ||
299 | ts->poll_period = pdata->poll_period ? : 1; | ||
295 | ts->get_pendown_state = pdata->get_pendown_state; | 300 | ts->get_pendown_state = pdata->get_pendown_state; |
296 | ts->clear_penirq = pdata->clear_penirq; | 301 | ts->clear_penirq = pdata->clear_penirq; |
297 | 302 | ||
@@ -305,9 +310,10 @@ static int __devinit tsc2007_probe(struct i2c_client *client, | |||
305 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 310 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
306 | input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | 311 | input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); |
307 | 312 | ||
308 | input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0); | 313 | input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, pdata->fuzzx, 0); |
309 | input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0); | 314 | input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, pdata->fuzzy, 0); |
310 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, 0, 0); | 315 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, |
316 | pdata->fuzzz, 0); | ||
311 | 317 | ||
312 | if (pdata->init_platform_hw) | 318 | if (pdata->init_platform_hw) |
313 | pdata->init_platform_hw(); | 319 | pdata->init_platform_hw(); |