summaryrefslogtreecommitdiff
path: root/drivers/input/mouse/hgpk.h
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2010-11-11 22:20:02 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-11-11 22:21:19 -0800
commitc0dc8342656a1425c31dcc505072f2387f0f0c92 (patch)
tree042c9a331a54ad2095688f01dc5602ae96889dbc /drivers/input/mouse/hgpk.h
parentca94ec43540ce5d93fd30a3bf88321b6f11ed51a (diff)
Input: hgpk - rework spew detection
The old implementation of spew detection simply tracked the overall position delta of the cursor over every 100 packets. We found that this causes occasional false positives in spew detection, and also that the conditions of the spewy packets are perhaps more fixed than we once thought. Rework the spew detection to look for packets of specific small delta, and only recalibrating if the overall movement delta stays within expected bounds. Also discard duplicate packets in the advanced mode, which appear to be very common. If we don't, the spew detection kicks in far too early. If we get a large spew of duplicates, request a recalibration straight up. Based on earlier work by Paul Fox. Signed-off-by: Daniel Drake <dsd@laptop.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/hgpk.h')
-rw-r--r--drivers/input/mouse/hgpk.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/input/mouse/hgpk.h b/drivers/input/mouse/hgpk.h
index 01c983bb8465..bccdb26dca49 100644
--- a/drivers/input/mouse/hgpk.h
+++ b/drivers/input/mouse/hgpk.h
@@ -16,6 +16,15 @@ enum hgpk_model_t {
HGPK_MODEL_D = 0x50, /* C1, mass production */
};
+enum hgpk_spew_flag {
+ NO_SPEW,
+ MAYBE_SPEWING,
+ SPEW_DETECTED,
+ RECALIBRATING,
+};
+
+#define SPEW_WATCH_COUNT 42 /* at 12ms/packet, this is 1/2 second */
+
enum hgpk_mode {
HGPK_MODE_MOUSE,
HGPK_MODE_GLIDESENSOR,
@@ -27,10 +36,12 @@ struct hgpk_data {
struct psmouse *psmouse;
enum hgpk_mode mode;
bool powered;
- int count, x_tally, y_tally; /* hardware workaround stuff */
+ enum hgpk_spew_flag spew_flag;
+ int spew_count, x_tally, y_tally; /* spew detection */
unsigned long recalib_window;
struct delayed_work recalib_wq;
int abs_x, abs_y;
+ int dupe_count;
};
#define hgpk_dbg(psmouse, format, arg...) \