Guest

Untitled

By: a guest on Jan 19th, 2012  |  syntax: Diff  |  size: 4.47 KB  |  hits: 47  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
  2. index 99d5876..0963a0d 100644
  3. --- a/drivers/input/mouse/alps.c
  4. +++ b/drivers/input/mouse/alps.c
  5. @@ -63,6 +63,8 @@ static const struct alps_model_info alps_model_data[] = {
  6.         /* Dell Latitude E5500, E6400, E6500, Precision M4400 */
  7.         { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf,
  8.                 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
  9. +       /* Dell Precision 4500 */
  10. +       { { 0x73, 0x02, 0x64 }, 0x80, 0x80, 0 },
  11.         { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS },          /* Dell Vostro 1400 */
  12.         { { 0x52, 0x01, 0x14 }, 0xff, 0xff,
  13.                 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },      /* Toshiba Tecra A11-11L */
  14. @@ -111,6 +113,77 @@ static const struct alps_model_info alps_model_data[] = {
  15.   * on a dualpoint, etc.
  16.   */
  17.  
  18. +
  19. +/* Magic Sequence to enable Intellimouse Mode on Dell E2 Touchpads*/
  20. +
  21. +static int dell_e2_setup_intellimouse_mode(void *data)
  22. +{
  23. +       struct psmouse *psmouse = (struct psmouse *)(data);
  24. +       struct ps2dev *ps2dev = &psmouse->ps2dev;
  25. +       struct input_dev *dev = psmouse->dev;
  26. +       unsigned char param[] = {0, 0, 0};
  27. +
  28. +       if (ps2_command(ps2dev, param, 0x00f5) ||
  29. +               ps2_command(ps2dev, param, 0x00ea) ||
  30. +               ps2_command(ps2dev, param, 0x00ec) ||
  31. +               ps2_command(ps2dev, param, 0x00ec) ||
  32. +               ps2_command(ps2dev, param, 0x00ec) ||
  33. +               ps2_command(ps2dev, param, 0x03e9))
  34. +                       return -1;
  35. +
  36. +       dbg("alps:dell_e2_setup: param[0]: %x,"
  37. +               "param[1]: %x, param[2]: %x\n", param[0],
  38. +                                       param[1], param[2]);
  39. +/* Check for supported model to continue */
  40. +
  41. +       if (!((param[0] == 0x88) && (param[1] == 0x07)
  42. +               && ((param[2] == 0x9D) || (param[2] == 0x9B))))
  43. +               return -1;
  44. +
  45. +       if (ps2_command(ps2dev, NULL, 0x00ec) ||
  46. +               ps2_command(ps2dev, NULL, 0x00f0) ||
  47. +               ps2_command(ps2dev, NULL, 0x00f0) ||
  48. +               ps2_command(ps2dev, NULL, 0x00f0) ||
  49. +               ps2_command(ps2dev, NULL, 0x00f3) ||
  50. +               ps2_command(ps2dev, NULL, 0x0028) ||
  51. +               ps2_command(ps2dev, NULL, 0x00f0) ||
  52. +               ps2_command(ps2dev, NULL, 0x00f6) ||
  53. +               ps2_command(ps2dev, NULL, 0x00ea) ||
  54. +               ps2_command(ps2dev, NULL, 0x00f4))
  55. +                       return -1;
  56. +
  57. +       __set_bit(BTN_MIDDLE, dev->keybit);
  58. +       __set_bit(REL_WHEEL, dev->relbit);
  59. +
  60. +       psmouse->pktsize = 4;
  61. +       psmouse->type = PSMOUSE_IMPS;
  62. +
  63. +       return 0;
  64. +}
  65. +
  66. +static const struct alps_model_quirk alps_model_init_quirk_tbl[] = {
  67. +
  68. +       { {0x73, 0x02, 0x64}, dell_e2_setup_intellimouse_mode }
  69. +};
  70. +
  71. +static int alps_model_init_quirk(struct psmouse *psmouse,
  72. +                                       const struct alps_model_info *model)
  73. +{
  74. +       int rc = 1;
  75. +       int i;
  76. +
  77. +       for (i = 0; i < ARRAY_SIZE(alps_model_init_quirk_tbl); i++) {
  78. +               if (!memcmp(model->signature,
  79. +                       alps_model_init_quirk_tbl[i].signature,
  80. +                           sizeof(alps_model_init_quirk_tbl[i].signature))) {
  81. +                               rc = alps_model_init_quirk_tbl[i].callback(psmouse);
  82. +                               break;
  83. +               }
  84. +       }
  85. +
  86. +       return rc;
  87. +}
  88. +
  89.  static bool alps_is_valid_first_byte(const struct alps_model_info *model,
  90.                                      unsigned char data)
  91.  {
  92. @@ -677,6 +750,14 @@ int alps_init(struct psmouse *psmouse)
  93.         if (alps_hw_init(psmouse))
  94.                 goto init_fail;
  95.  
  96. +       if (!alps_model_init_quirk(psmouse, model)) {
  97. +               printk(KERN_WARNING "alps.c: Enabled hardware quirk, falling back to psmouse-core\n");
  98. +               input_free_device(dev2);
  99. +               kfree(priv);
  100. +               psmouse->private = NULL;
  101. +               return 0;
  102. +       }
  103. +
  104.         /*
  105.          * Undo part of setup done for us by psmouse core since touchpad
  106.          * is not a relative device.
  107. diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
  108. index 904ed8b..c54c5ea 100644
  109. --- a/drivers/input/mouse/alps.h
  110. +++ b/drivers/input/mouse/alps.h
  111. @@ -26,6 +26,11 @@ struct alps_data {
  112.         struct timer_list timer;
  113.  };
  114.  
  115. +struct alps_model_quirk {
  116. +unsigned char signature[3];
  117. +int (*callback)(void *data);
  118. +};
  119. +
  120.  #ifdef CONFIG_MOUSE_PS2_ALPS
  121.  int alps_detect(struct psmouse *psmouse, bool set_properties);
  122.  int alps_init(struct psmouse *psmouse);
  123. diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
  124. index 979c502..3657de8 100644
  125. --- a/drivers/input/mouse/psmouse-base.c
  126. +++ b/drivers/input/mouse/psmouse-base.c
  127. @@ -659,7 +659,8 @@ static int psmouse_extensions(struct psmouse *psmouse,
  128.                 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
  129.                 if (alps_detect(psmouse, set_properties) == 0) {
  130.                         if (!set_properties || alps_init(psmouse) == 0)
  131. -                               return PSMOUSE_ALPS;
  132. +/* If ALPS model quirk was applied, don't change the settings */
  133. +                               return psmouse->type ? psmouse->type : PSMOUSE_ALPS;
  134.  /*
  135.   * Init failed, try basic relative protocols
  136.   */
  137. --
  138. 1.7.0.4