aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2010-06-30 17:51:10 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-07-03 16:13:20 -0400
commit963ce8ae6dbc7c8dffb1b117ba14673d40b22dda (patch)
tree97603f28d05852c4609e3ea4161d4d35362a0b05 /drivers/input/touchscreen
parent447b9065b418cbeb6a03ebdcd08629ac26ed8e4a (diff)
Input: ad7879 - report EV_KEY/BTN_TOUCH events
Some input events users such as Android require BTN_TOUCH events. Implement EV_KEY/BTN_TOUCH and make sure that the release event is not erroneous scheduled without a preceding valid touch. Avoid duplicated BTN_TOUCH events, even though input core filters them. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/ad7879.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index fad65969cc72..ba6f0bd1e762 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -146,7 +146,7 @@ static int ad7879_write(struct ad7879 *ts, u8 reg, u16 val)
146 return ts->bops->write(ts->dev, reg, val); 146 return ts->bops->write(ts->dev, reg, val);
147} 147}
148 148
149static void ad7879_report(struct ad7879 *ts) 149static int ad7879_report(struct ad7879 *ts)
150{ 150{
151 struct input_dev *input_dev = ts->input; 151 struct input_dev *input_dev = ts->input;
152 unsigned Rt; 152 unsigned Rt;
@@ -175,11 +175,17 @@ static void ad7879_report(struct ad7879 *ts)
175 Rt /= z1; 175 Rt /= z1;
176 Rt = (Rt + 2047) >> 12; 176 Rt = (Rt + 2047) >> 12;
177 177
178 if (!timer_pending(&ts->timer))
179 input_report_key(input_dev, BTN_TOUCH, 1);
180
178 input_report_abs(input_dev, ABS_X, x); 181 input_report_abs(input_dev, ABS_X, x);
179 input_report_abs(input_dev, ABS_Y, y); 182 input_report_abs(input_dev, ABS_Y, y);
180 input_report_abs(input_dev, ABS_PRESSURE, Rt); 183 input_report_abs(input_dev, ABS_PRESSURE, Rt);
181 input_sync(input_dev); 184 input_sync(input_dev);
185 return 0;
182 } 186 }
187
188 return -EINVAL;
183} 189}
184 190
185static void ad7879_ts_event_release(struct ad7879 *ts) 191static void ad7879_ts_event_release(struct ad7879 *ts)
@@ -187,6 +193,7 @@ static void ad7879_ts_event_release(struct ad7879 *ts)
187 struct input_dev *input_dev = ts->input; 193 struct input_dev *input_dev = ts->input;
188 194
189 input_report_abs(input_dev, ABS_PRESSURE, 0); 195 input_report_abs(input_dev, ABS_PRESSURE, 0);
196 input_report_key(input_dev, BTN_TOUCH, 0);
190 input_sync(input_dev); 197 input_sync(input_dev);
191} 198}
192 199
@@ -202,9 +209,9 @@ static irqreturn_t ad7879_irq(int irq, void *handle)
202 struct ad7879 *ts = handle; 209 struct ad7879 *ts = handle;
203 210
204 ad7879_multi_read(ts, AD7879_REG_XPLUS, AD7879_NR_SENSE, ts->conversion_data); 211 ad7879_multi_read(ts, AD7879_REG_XPLUS, AD7879_NR_SENSE, ts->conversion_data);
205 ad7879_report(ts);
206 212
207 mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT); 213 if (!ad7879_report(ts))
214 mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT);
208 215
209 return IRQ_HANDLED; 216 return IRQ_HANDLED;
210} 217}
@@ -506,6 +513,9 @@ struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq,
506 __set_bit(ABS_Y, input_dev->absbit); 513 __set_bit(ABS_Y, input_dev->absbit);
507 __set_bit(ABS_PRESSURE, input_dev->absbit); 514 __set_bit(ABS_PRESSURE, input_dev->absbit);
508 515
516 __set_bit(EV_KEY, input_dev->evbit);
517 __set_bit(BTN_TOUCH, input_dev->keybit);
518
509 input_set_abs_params(input_dev, ABS_X, 519 input_set_abs_params(input_dev, ABS_X,
510 pdata->x_min ? : 0, 520 pdata->x_min ? : 0,
511 pdata->x_max ? : MAX_12BIT, 521 pdata->x_max ? : MAX_12BIT,