diff mbox

[10/10] elantech: don't take into account the border size in the calculations

Message ID 4C5F35F1.5070104@tudelft.nl (mailing list archive)
State New, archived
Headers show

Commit Message

Éric Piel Aug. 8, 2010, 10:55 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index ba1c3d8..bf95adf 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -584,22 +584,30 @@  static void elantech_set_input_params(struct psmouse *psmouse)
 			__set_bit(BTN_FORWARD, dev->keybit);
 			__set_bit(BTN_BACK, dev->keybit);
 		}
-		input_set_abs_params(dev, ABS_X, ETP_XMIN_V1, ETP_XMAX_V1, 0, 0);
-		input_set_abs_params(dev, ABS_Y, ETP_YMIN_V1, ETP_YMAX_V1, 0, 0);
+		input_set_abs_params(dev, ABS_X, ETP_XMIN_V1 + ETP_EDGE_FUZZ_V1,
+				     ETP_XMAX_V1 - ETP_EDGE_FUZZ_V1, 0, 0);
+		input_set_abs_params(dev, ABS_Y, ETP_YMIN_V1 + ETP_EDGE_FUZZ_V1,
+				     ETP_YMAX_V1 - ETP_EDGE_FUZZ_V1, 0, 0);
 		break;
 
 	case 2:
 		__set_bit(BTN_TOOL_QUADTAP, dev->keybit);
-		input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0);
-		input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0);
+		input_set_abs_params(dev, ABS_X, ETP_XMIN_V2 + ETP_EDGE_FUZZ_V2,
+				     ETP_XMAX_V2 - ETP_EDGE_FUZZ_V2, 0, 0);
+		input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2 + ETP_EDGE_FUZZ_V2,
+				     ETP_YMAX_V2 - ETP_EDGE_FUZZ_V2, 0, 0);
 		if (etd->reports_pres) {
 			input_set_abs_params(dev, ABS_PRESSURE, ETP_PMIN_V2,
 					     ETP_PMAX_V2, 0, 0);
 			input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2,
 					     ETP_WMAX_V2, 0, 0);
 		}
-		input_set_abs_params(dev, ABS_MT_POSITION_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0);
-		input_set_abs_params(dev, ABS_MT_POSITION_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0);
+		input_set_abs_params(dev, ABS_MT_POSITION_X,
+				     ETP_XMIN_V2 + ETP_EDGE_FUZZ_V2,
+				     ETP_XMAX_V2 - ETP_EDGE_FUZZ_V2, 0, 0);
+		input_set_abs_params(dev, ABS_MT_POSITION_Y,
+				     ETP_YMIN_V2 + ETP_EDGE_FUZZ_V2,
+				     ETP_YMAX_V2 - ETP_EDGE_FUZZ_V2, 0, 0);
 		break;
 	}
 }
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index fa9a6b4..75b0546 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -60,10 +60,10 @@ 
  */
 #define ETP_EDGE_FUZZ_V1		32
 
-#define ETP_XMIN_V1			(  0 + ETP_EDGE_FUZZ_V1)
-#define ETP_XMAX_V1			(576 - ETP_EDGE_FUZZ_V1)
-#define ETP_YMIN_V1			(  0 + ETP_EDGE_FUZZ_V1)
-#define ETP_YMAX_V1			(384 - ETP_EDGE_FUZZ_V1)
+#define ETP_XMIN_V1			0
+#define ETP_XMAX_V1			576
+#define ETP_YMIN_V1			0
+#define ETP_YMAX_V1			384
 
 /*
  * It seems the resolution for hardware version 2 doubled.
@@ -72,10 +72,10 @@ 
  */
 #define ETP_EDGE_FUZZ_V2		8
 
-#define ETP_XMIN_V2			(   0 + ETP_EDGE_FUZZ_V2)
-#define ETP_XMAX_V2			(1152 - ETP_EDGE_FUZZ_V2)
-#define ETP_YMIN_V2			(   0 + ETP_EDGE_FUZZ_V2)
-#define ETP_YMAX_V2			( 768 - ETP_EDGE_FUZZ_V2)
+#define ETP_XMIN_V2			0
+#define ETP_XMAX_V2			1152
+#define ETP_YMIN_V2			0
+#define ETP_YMAX_V2			768
 
 #define ETP_PMIN_V2			0
 #define ETP_PMAX_V2			255
@@ -86,12 +86,10 @@ 
  * For two finger touches the coordinate of each finger gets reported
  * separately but with reduced resolution.
  */
-#define ETP_2FT_FUZZ			4
-
-#define ETP_2FT_XMIN			(  0 + ETP_2FT_FUZZ)
-#define ETP_2FT_XMAX			(288 - ETP_2FT_FUZZ)
-#define ETP_2FT_YMIN			(  0 + ETP_2FT_FUZZ)
-#define ETP_2FT_YMAX			(192 - ETP_2FT_FUZZ)
+#define ETP_2FT_XMIN			0
+#define ETP_2FT_XMAX			288
+#define ETP_2FT_YMIN			0
+#define ETP_2FT_YMAX			192
 
 struct elantech_data {
 	unsigned char reg_10;