Input: ALPS - add support for "Rushmore" touchpads
authorKevin Cernekee <cernekee@gmail.com>
Thu, 14 Feb 2013 06:27:08 +0000 (22:27 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 14 Feb 2013 17:18:29 +0000 (09:18 -0800)
Rushmore touchpads are found on Dell E6230/E6430/E6530.  They use the V3
protocol with slightly tweaked init sequences and report formats.

The E7 report is 73 03 0a, and the EC report is 88 08 1d

Credits: Emmanuel Thome reported the MT bitmap changes.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Tested-by: Dave Turvene <dturvene@dahetral.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/mouse/alps.c

index 270b7deefe5bf2d121fdb41a56be6cb666539aae..bf2fa51853e3d7532f032c819eb397ab0fe52591 100644 (file)
@@ -479,6 +479,14 @@ static void alps_decode_pinnacle(struct alps_fields *f, unsigned char *p)
        alps_decode_buttons_v3(f, p);
 }
 
+static void alps_decode_rushmore(struct alps_fields *f, unsigned char *p)
+{
+       alps_decode_pinnacle(f, p);
+
+       f->x_map |= (p[5] & 0x10) << 11;
+       f->y_map |= (p[5] & 0x20) << 6;
+}
+
 static void alps_process_touchpad_packet_v3(struct psmouse *psmouse)
 {
        struct alps_data *priv = psmouse->private;
@@ -1329,6 +1337,40 @@ error:
        return -1;
 }
 
+static int alps_hw_init_rushmore_v3(struct psmouse *psmouse)
+{
+       struct ps2dev *ps2dev = &psmouse->ps2dev;
+       int reg_val, ret = -1;
+
+       if (alps_enter_command_mode(psmouse, NULL) ||
+           alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 ||
+           alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00))
+               goto error;
+
+       reg_val = alps_command_mode_read_reg(psmouse, 0xc2c6);
+       if (reg_val == -1)
+               goto error;
+       if (__alps_command_mode_write_reg(psmouse, reg_val & 0xfd))
+               goto error;
+
+       if (alps_command_mode_write_reg(psmouse, 0xc2c9, 0x64))
+               goto error;
+
+       /* enter absolute mode */
+       reg_val = alps_command_mode_read_reg(psmouse, 0xc2c4);
+       if (reg_val == -1)
+               goto error;
+       if (__alps_command_mode_write_reg(psmouse, reg_val | 0x02))
+               goto error;
+
+       alps_exit_command_mode(psmouse);
+       return ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE);
+
+error:
+       alps_exit_command_mode(psmouse);
+       return ret;
+}
+
 /* Must be in command mode when calling this function */
 static int alps_absolute_mode_v4(struct psmouse *psmouse)
 {
@@ -1510,6 +1552,16 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
                return -EIO;
 
        if (alps_match_table(psmouse, priv, e7, ec) == 0) {
+               return 0;
+       } else if (ec[0] == 0x88 && ec[1] == 0x08) {
+               priv->proto_version = ALPS_PROTO_V3;
+               alps_set_defaults(priv);
+
+               priv->hw_init = alps_hw_init_rushmore_v3;
+               priv->decode_fields = alps_decode_rushmore;
+               priv->x_bits = 16;
+               priv->y_bits = 12;
+
                return 0;
        } else if (ec[0] == 0x88 && ec[1] == 0x07 &&
                   ec[2] >= 0x90 && ec[2] <= 0x9d) {