* the Free Software Foundation.
*/
+#include <linux/dmi.h>
+#include <linux/slab.h>
#include <linux/input.h>
#include <linux/serio.h>
#include <linux/libps2.h>
/* Dell Latitude E5500, E6400, E6500, Precision M4400 */
{ { 0x62, 0x02, 0x14 }, 0xcf, 0xcf,
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
+ /* Dell Precision 4500 */
+ { { 0x73, 0x02, 0x64 }, 0x80, 0x80, 0 },
{ { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */
{ { 0x52, 0x01, 0x14 }, 0xff, 0xff,
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */
* on a dualpoint, etc.
*/
+static const struct dmi_system_id dell_quirk_table[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_CHASSIS_TYPE, "8"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_CHASSIS_TYPE, "9"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "ZHAOYANG E47"),
+ },
+ },
+ { }
+};
+
+int alps_model_quirk_enabled;
+static void dell_e2_model_init(void *data);
+
+ /* Magic Sequence to enable Intellimouse Mode on Dell E2 Touchpads*/
+
+static int dell_e2_setup_intellimouse_mode(void *data)
+{
+ struct psmouse *psmouse = (struct psmouse *)(data);
+ struct ps2dev *ps2dev = &psmouse->ps2dev;
+ unsigned char param[] = {0, 0, 0};
+
+ if (!dmi_check_system(dell_quirk_table))
+ return -1;
+
+ if (ps2_command(ps2dev, param, 0x00f5) ||
+ ps2_command(ps2dev, param, 0x00ea) ||
+ ps2_command(ps2dev, param, 0x00ec) ||
+ ps2_command(ps2dev, param, 0x00ec) ||
+ ps2_command(ps2dev, param, 0x00ec) ||
+ ps2_command(ps2dev, param, 0x03e9))
+ return -1;
+
+ dbg("alps:dell_e2_setup: param[0]: %x,"
+ "param[1]: %x, param[2]: %x\n", param[0],
+ param[1], param[2]);
+ /* Check for supported model to continue */
+
+ if (!((param[0] == 0x88) && (param[1] == 0x07)
+ && ((param[2] == 0x9D) || (param[2] == 0x9B))))
+ return -1;
+
+ if (ps2_command(ps2dev, NULL, 0x00ec) ||
+ ps2_command(ps2dev, NULL, 0x00f0) ||
+ ps2_command(ps2dev, NULL, 0x00f0) ||
+ ps2_command(ps2dev, NULL, 0x00f0) ||
+ ps2_command(ps2dev, NULL, 0x00f3) ||
+ ps2_command(ps2dev, NULL, 0x0028) ||
+ ps2_command(ps2dev, NULL, 0x00f0) ||
+ ps2_command(ps2dev, NULL, 0x00f6) ||
+ ps2_command(ps2dev, NULL, 0x00ea) ||
+ ps2_command(ps2dev, NULL, 0x00f4))
+ return -1;
+
+ return 0;
+}
+
+static const struct alps_model_quirk alps_model_init_quirk_tbl[] = {
+
+ { {0x73, 0x02, 0x64}, dell_e2_setup_intellimouse_mode, dell_e2_model_init }
+};
+
+static int alps_model_hw_init_quirk(struct psmouse *psmouse,
+ const struct alps_model_info *model)
+{
+ int rc = 1;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(alps_model_init_quirk_tbl); i++) {
+ if (!memcmp(model->signature,
+ alps_model_init_quirk_tbl[i].signature,
+ sizeof(alps_model_init_quirk_tbl[i].signature))) {
+ rc = alps_model_init_quirk_tbl[i].alps_model_quirk_hw_init(psmouse);
+ alps_model_quirk_enabled = i + 1;
+ break;
+ }
+ }
+
+ return rc;
+}
+
static bool alps_is_valid_first_byte(const struct alps_model_info *model,
unsigned char data)
{
struct input_dev *dev1, struct input_dev *dev2,
int left, int right, int middle)
{
- struct alps_data *priv = psmouse->private;
- const struct alps_model_info *model = priv->i;
+ struct input_dev *dev;
- if (model->flags & ALPS_PS2_INTERLEAVED) {
- struct input_dev *dev;
-
- /*
- * If shared button has already been reported on the
- * other device (dev2) then this event should be also
- * sent through that device.
- */
- dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1;
- input_report_key(dev, BTN_LEFT, left);
+ /*
+ * If shared button has already been reported on the
+ * other device (dev2) then this event should be also
+ * sent through that device.
+ */
+ dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1;
+ input_report_key(dev, BTN_LEFT, left);
- dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1;
- input_report_key(dev, BTN_RIGHT, right);
+ dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1;
+ input_report_key(dev, BTN_RIGHT, right);
- dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1;
- input_report_key(dev, BTN_MIDDLE, middle);
+ dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1;
+ input_report_key(dev, BTN_MIDDLE, middle);
- /*
- * Sync the _other_ device now, we'll do the first
- * device later once we report the rest of the events.
- */
- input_sync(dev2);
- } else {
- /*
- * For devices with non-interleaved packets we know what
- * device buttons belong to so we can simply report them.
- */
- input_report_key(dev1, BTN_LEFT, left);
- input_report_key(dev1, BTN_RIGHT, right);
- input_report_key(dev1, BTN_MIDDLE, middle);
- }
+ /*
+ * Sync the _other_ device now, we'll do the first
+ * device later once we report the rest of the events.
+ */
+ input_sync(dev2);
}
static void alps_process_packet(struct psmouse *psmouse)
struct alps_data *priv = psmouse->private;
const struct alps_model_info *model = priv->i;
+ if (alps_model_hw_init_quirk(psmouse, model)) {
+ alps_model_quirk_enabled = 0;
+ }
+
if ((model->flags & ALPS_PASS) &&
alps_passthrough_mode(psmouse, true)) {
return -1;
psmouse_reset(psmouse);
del_timer_sync(&priv->timer);
- input_unregister_device(priv->dev2);
+ if (!alps_model_quirk_enabled)
+ input_unregister_device(priv->dev2);
kfree(priv);
}
+static void dell_e2_model_init(void *data)
+{
+ struct psmouse *psmouse = (struct psmouse *)(data);
+ struct input_dev *dev = psmouse->dev;
+
+ __set_bit(BTN_MIDDLE, dev->keybit);
+ __set_bit(REL_WHEEL, dev->relbit);
+
+ psmouse->pktsize = 4;
+ psmouse->type = PSMOUSE_IMPS;
+ psmouse->disconnect = alps_disconnect;
+ psmouse->reconnect = alps_reconnect;
+
+}
+
int alps_init(struct psmouse *psmouse)
{
struct alps_data *priv;
if (alps_hw_init(psmouse))
goto init_fail;
+ if (alps_model_quirk_enabled) {
+ printk(KERN_WARNING "alps.c: Enabled hardware quirk, falling back to psmouse-core\n");
+ alps_model_init_quirk_tbl[alps_model_quirk_enabled-1].alps_model_quirk_init(psmouse);
+ return 0;
+ }
+
/*
* Undo part of setup done for us by psmouse core since touchpad
* is not a relative device.