Elantech Touchpad Driver
========================
	Copyright (C) 2007 Arjan Opmeer <arjan@opmeer.net>


Configuration of the touchpad is performed by writing register values to the
corresponding sysfs entries found under /sys/bus/serio/drivers/psmouse/serioX


Registers
---------

* reg_10	(Windows driver default value 0x12)

   bit   7   6   5   4   3   2   1   0
         0   C   T   D   L   R   S   E

         E: 1 = enable smart edges in other cases
         S: 1 = enable smart edges only when dragging
         R: 1 = raw mode (needs 4 byte packets, see reg_11)
         L: 1 = enable drag lock (see reg_22)
         D: 1 = disable dynamic resolution
         T: 1 = disable tapping
         C: 1 = enable corner tap

* reg_11	(Windows driver default value 0x8f)

   bit   7   6   5   4   3   2   1   0
         1   0   0   H   V   1   P   N

         N: 1 = bit 4 or 5 of byte 0 is 1 (non null top nibble ?)
         P: 1 = enable native 4 byte packet mode (forced on by driver)
         V: 1 = enable vertical scroll area
         H: 1 = enable horizonal scroll area


* reg_20	(Windows driver default value 0x0a)

         single finger width?

* reg_21	(Windows driver default value 0x60)

         scroll area width (small: 0x40 ... wide: 0xff)

* reg_22	(Windows driver default value 0xff)

         drag lock time out (short: 0x14 ... long: 0xfe; 0xff =never)

* reg_23	(Windows driver default value 0x10)

         tap make timeout?

         Note: the Windows driver does not write this register

* reg_24	(Windows driver default value 0x10)

         tap release timeout?

         Note: the Windows driver does not write this register

* reg_25	(Windows driver default value 0x03)

         smart edge cursor speed (0x02 = slow, 0x03 = medium, 0x04 = fast)

* reg_26	(Windows driver default value 0x00 ?? )

         smart edge activation area width?

         Note: the Windows driver does not write this register
         Note: the Windows driver default value of 0x00 disables smart edges
               when it would get written
         Note: the Windows driver sets bit 0 of the registry value to disable
               tapping when typing, but never actually writes the register.
               Only used as an internal driver flag?



Initially the Elantouch Touchpad is in emulation mode and reports 3 byte
standard PS/2 packets and hence works with a standard mouse driver.
However, it can be configured to talk its native 4 byte mode and a raw 4
byte absolute mode both for which a dedicated driver is needed.


Native 4 byte relative mode packet format
-----------------------------------------

byte 0:
   bit   7   6   5   4   3   2   1   0
         c   c   ?   ?   1   M   R   L

         L, R, M = 1 when Left, Right, Middle mouse button pressed
         c = 1 when corner tap detected

byte 1:
   bit   7   6   5   4   3   2   1   0
        dx7 dx6 dx5 dx4 dx3 dx2 dx1 dx0

         dx7..dx0 = x movement;   positive = right, negative = left
         byte 1 = 0xf0 when corner tap detected

byte 2:
   bit   7   6   5   4   3   2   1   0
        dy7 dy6 dy5 dy4 dy3 dy2 dy1 dy0

         dy7..dy0 = y movement;   positive = up,    negative = down

byte 3:
   bit   7   6   5   4   3   2   1   0
         w   h   0   0  d3  d2  d1  d0

         normally:
            d3..d0 = scroll wheel amount and direction
                     positive = down or left
                     negative = up or right
         when corner tap detected:
            d0 = 1 when top right corner tapped
            d1 = 1 when bottom right corner tapped
            d2 = 1 when bottom left corner tapped
            d3 = 1 when top left corner tapped
         w = 1 when wide finger touch?
         h = 1 when horizontal scroll action


Native 4 byte raw absolute mode packet format
---------------------------------------------

byte 0:
   bit   7   6   5   4   3   2   1   0
         0   0  z2  z1   1  z0   R   L

         L, R = 1 when Left, Right mouse button pressed
         z2..z0 = some touch weigth?

byte 1:
   bit   7   6   5   4   3   2   1   0
         f   0  th  tw  x9  x8  y9  y8

         tw = 1 when two finger touch
         th = 1 when three finger touch
         f  = 1 when finger touch

byte 2:
   bit   7   6   5   4   3   2   1   0
        x7  x6  x5  x4  x3  x2  x1  x0

         x9..x0 = absolute x value (horizontal)

byte 3:
   bit   7   6   5   4   3   2   1   0
        y7  y6  y5  y4  y3  y2  y1  y0

         y9..y0 = absolute y value (vertical)
