Title: [9176] branches/2009R1/drivers/input/touchscreen/ad7879.c: input: touchscreen: ad7879: Fix release scheduling on error and implement EV_KEY:BTN_TOUCH reporting
Revision
9176
Author
hennerich
Date
2010-09-29 03:54:28 -0400 (Wed, 29 Sep 2010)

Log Message

input: touchscreen: ad7879: Fix release scheduling on error and implement EV_KEY:BTN_TOUCH reporting

Some input users such as Android or X 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.

Modified Paths

Diff

Modified: branches/2009R1/drivers/input/touchscreen/ad7879.c (9175 => 9176)


--- branches/2009R1/drivers/input/touchscreen/ad7879.c	2010-09-29 03:12:44 UTC (rev 9175)
+++ branches/2009R1/drivers/input/touchscreen/ad7879.c	2010-09-29 07:54:28 UTC (rev 9176)
@@ -160,7 +160,7 @@
 static int ad7879_write(bus_device *, u8, u16);
 static void ad7879_collect(struct ad7879 *);
 
-static void ad7879_report(struct ad7879 *ts)
+static int ad7879_report(struct ad7879 *ts)
 {
 	struct input_dev *input_dev = ts->input;
 	unsigned Rt;
@@ -187,11 +187,17 @@
 		Rt /= z1;
 		Rt = (Rt + 2047) >> 12;
 
+		if (!timer_pending(&ts->timer))
+			input_report_key(input_dev, BTN_TOUCH, 1);
+
 		input_report_abs(input_dev, ABS_X, x);
 		input_report_abs(input_dev, ABS_Y, y);
 		input_report_abs(input_dev, ABS_PRESSURE, Rt);
 		input_sync(input_dev);
+		return 0;
 	}
+
+	return -EINVAL;
 }
 
 static void ad7879_work(struct work_struct *work)
@@ -200,8 +206,8 @@
 
 	/* use keventd context to read the result registers */
 	ad7879_collect(ts);
-	ad7879_report(ts);
-	mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT);
+	if (!ad7879_report(ts))
+		mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT);
 }
 
 static void ad7879_ts_event_release(struct ad7879 *ts)
@@ -209,6 +215,7 @@
 	struct input_dev *input_dev = ts->input;
 
 	input_report_abs(input_dev, ABS_PRESSURE, 0);
+	input_report_key(input_dev, BTN_TOUCH, 0);
 	input_sync(input_dev);
 }
 
@@ -419,6 +426,9 @@
 	__set_bit(ABS_Y, input_dev->absbit);
 	__set_bit(ABS_PRESSURE, input_dev->absbit);
 
+	__set_bit(EV_KEY, input_dev->evbit);
+	__set_bit(BTN_TOUCH, input_dev->keybit);
+
 	input_set_abs_params(input_dev, ABS_X,
 			pdata->x_min ? : 0,
 			pdata->x_max ? : MAX_12BIT,
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to