Input: synaptics - fuzz position for touchpad with reduced filtering
authorDaniel Kurtz <djkurtz@chromium.org>
Thu, 7 Jul 2011 05:39:14 +0000 (22:39 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 7 Jul 2011 06:01:09 +0000 (23:01 -0700)
Synaptics touchpads indicate via a capability bit when they perform reduced
filtering on position data. In such a case, use a non-zero fuzz value.
Fuzz = 8 was chosen empirically by observing the raw position data
reported by a clickpad indicating it had reduced filtering.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/mouse/synaptics.c
drivers/input/mouse/synaptics.h

index 477d1eaea8b5783d255ef5c25127d3aec8b6fd40..363aedf8131dee26e769421463fecf51ecc5cca4 100644 (file)
@@ -684,23 +684,25 @@ static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse)
 static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
 {
        int i;
+       int fuzz = SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) ?
+                       SYN_REDUCED_FILTER_FUZZ : 0;
 
        __set_bit(INPUT_PROP_POINTER, dev->propbit);
 
        __set_bit(EV_ABS, dev->evbit);
-       input_set_abs_params(dev, ABS_X,
-                            XMIN_NOMINAL, priv->x_max ?: XMAX_NOMINAL, 0, 0);
-       input_set_abs_params(dev, ABS_Y,
-                            YMIN_NOMINAL, priv->y_max ?: YMAX_NOMINAL, 0, 0);
+       input_set_abs_params(dev, ABS_X, XMIN_NOMINAL,
+                            priv->x_max ?: XMAX_NOMINAL, fuzz, 0);
+       input_set_abs_params(dev, ABS_Y, YMIN_NOMINAL,
+                            priv->y_max ?: YMAX_NOMINAL, fuzz, 0);
        input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
 
        if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) {
                __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
                input_mt_init_slots(dev, 2);
                input_set_abs_params(dev, ABS_MT_POSITION_X, XMIN_NOMINAL,
-                                    priv->x_max ?: XMAX_NOMINAL, 0, 0);
+                                    priv->x_max ?: XMAX_NOMINAL, fuzz, 0);
                input_set_abs_params(dev, ABS_MT_POSITION_Y, YMIN_NOMINAL,
-                                    priv->y_max ?: YMAX_NOMINAL, 0, 0);
+                                    priv->y_max ?: YMAX_NOMINAL, fuzz, 0);
 
                input_abs_set_res(dev, ABS_MT_POSITION_X, priv->x_res);
                input_abs_set_res(dev, ABS_MT_POSITION_Y, priv->y_res);
@@ -974,4 +976,3 @@ bool synaptics_supported(void)
 }
 
 #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
-
index 7453938bf5efb4f9c6903316349d9f29f0761ae6..b8025b0ee2bd0ec8f003aaed38342ea6ccb40d26 100644 (file)
@@ -66,9 +66,9 @@
  * 1   0x60    multifinger mode        identifies firmware finger counting
  *                                     (not reporting!) algorithm.
  *                                     Not particularly meaningful
- * 1   0x80    covered pad             W clipped to 14, 15 == pad mostly covered
- * 2   0x01    clickpad bit 1          2-button ClickPad
- * 2   0x02    deluxe LED controls     touchpad support LED commands
+ * 1   0x80    covered pad             W clipped to 14, 15 == pad mostly covered
+ * 2   0x01    clickpad bit 1          2-button ClickPad
+ * 2   0x02    deluxe LED controls     touchpad support LED commands
  *                                     ala multimedia control bar
  * 2   0x04    reduced filtering       firmware does less filtering on
  *                                     position data, driver should watch
@@ -78,6 +78,7 @@
 #define SYN_CAP_CLICKPAD2BTN(ex0c)     ((ex0c) & 0x000100) /* 2-button ClickPad */
 #define SYN_CAP_MAX_DIMENSIONS(ex0c)   ((ex0c) & 0x020000)
 #define SYN_CAP_ADV_GESTURE(ex0c)      ((ex0c) & 0x080000)
+#define SYN_CAP_REDUCED_FILTERING(ex0c)        ((ex0c) & 0x000400)
 
 /* synaptics modes query bits */
 #define SYN_MODE_ABSOLUTE(m)           ((m) & (1 << 7))
 #define SYN_NEWABS_RELAXED             2
 #define SYN_OLDABS                     3
 
+/* amount to fuzz position data when touchpad reports reduced filtering */
+#define SYN_REDUCED_FILTER_FUZZ                8
+
 /*
  * A structure to describe the state of the touchpad hardware (buttons and pad)
  */