2 * Elantech Touchpad driver (v6)
4 * Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
10 * Trademarks are the property of their respective owners.
13 #include <linux/delay.h>
14 #include <linux/module.h>
15 #include <linux/input.h>
16 #include <linux/serio.h>
17 #include <linux/libps2.h>
21 #define elantech_debug(format, arg...) \
24 printk(KERN_DEBUG format, ##arg); \
27 static bool force_elantech
;
28 module_param_named(force_elantech
, force_elantech
, bool, 0644);
29 MODULE_PARM_DESC(force_elantech
, "Force the Elantech PS/2 protocol extension to be used, 1 = enabled, 0 = disabled (default).");
32 * Send a Synaptics style sliced query command
34 static int synaptics_send_cmd(struct psmouse
*psmouse
, unsigned char c
,
37 if (psmouse_sliced_command(psmouse
, c
) ||
38 ps2_command(&psmouse
->ps2dev
, param
, PSMOUSE_CMD_GETINFO
)) {
39 pr_err("elantech.c: synaptics_send_cmd query 0x%02x failed.\n", c
);
47 * A retrying version of ps2_command
49 static int elantech_ps2_command(struct psmouse
*psmouse
,
50 unsigned char *param
, int command
)
52 struct ps2dev
*ps2dev
= &psmouse
->ps2dev
;
53 struct elantech_data
*etd
= psmouse
->private;
55 int tries
= ETP_PS2_COMMAND_TRIES
;
58 rc
= ps2_command(ps2dev
, param
, command
);
62 elantech_debug("elantech.c: retrying ps2 command 0x%02x (%d).\n",
64 msleep(ETP_PS2_COMMAND_DELAY
);
68 pr_err("elantech.c: ps2 command 0x%02x failed.\n", command
);
74 * Send an Elantech style special command to read a value from a register
76 static int elantech_read_reg(struct psmouse
*psmouse
, unsigned char reg
,
79 struct elantech_data
*etd
= psmouse
->private;
80 unsigned char param
[3];
83 if (reg
< 0x10 || reg
> 0x26)
86 if (reg
> 0x11 && reg
< 0x20)
89 switch (etd
->hw_version
) {
91 if (psmouse_sliced_command(psmouse
, ETP_REGISTER_READ
) ||
92 psmouse_sliced_command(psmouse
, reg
) ||
93 ps2_command(&psmouse
->ps2dev
, param
, PSMOUSE_CMD_GETINFO
)) {
99 if (elantech_ps2_command(psmouse
, NULL
, ETP_PS2_CUSTOM_COMMAND
) ||
100 elantech_ps2_command(psmouse
, NULL
, ETP_REGISTER_READ
) ||
101 elantech_ps2_command(psmouse
, NULL
, ETP_PS2_CUSTOM_COMMAND
) ||
102 elantech_ps2_command(psmouse
, NULL
, reg
) ||
103 elantech_ps2_command(psmouse
, param
, PSMOUSE_CMD_GETINFO
)) {
110 pr_err("elantech.c: failed to read register 0x%02x.\n", reg
);
118 * Send an Elantech style special command to write a register with a value
120 static int elantech_write_reg(struct psmouse
*psmouse
, unsigned char reg
,
123 struct elantech_data
*etd
= psmouse
->private;
126 if (reg
< 0x10 || reg
> 0x26)
129 if (reg
> 0x11 && reg
< 0x20)
132 switch (etd
->hw_version
) {
134 if (psmouse_sliced_command(psmouse
, ETP_REGISTER_WRITE
) ||
135 psmouse_sliced_command(psmouse
, reg
) ||
136 psmouse_sliced_command(psmouse
, val
) ||
137 ps2_command(&psmouse
->ps2dev
, NULL
, PSMOUSE_CMD_SETSCALE11
)) {
143 if (elantech_ps2_command(psmouse
, NULL
, ETP_PS2_CUSTOM_COMMAND
) ||
144 elantech_ps2_command(psmouse
, NULL
, ETP_REGISTER_WRITE
) ||
145 elantech_ps2_command(psmouse
, NULL
, ETP_PS2_CUSTOM_COMMAND
) ||
146 elantech_ps2_command(psmouse
, NULL
, reg
) ||
147 elantech_ps2_command(psmouse
, NULL
, ETP_PS2_CUSTOM_COMMAND
) ||
148 elantech_ps2_command(psmouse
, NULL
, val
) ||
149 elantech_ps2_command(psmouse
, NULL
, PSMOUSE_CMD_SETSCALE11
)) {
156 pr_err("elantech.c: failed to write register 0x%02x with value 0x%02x.\n",
163 * Dump a complete mouse movement packet to the syslog
165 static void elantech_packet_dump(unsigned char *packet
, int size
)
169 printk(KERN_DEBUG
"elantech.c: PS/2 packet [");
170 for (i
= 0; i
< size
; i
++)
171 printk("%s0x%02x ", (i
) ? ", " : " ", packet
[i
]);
176 * Interpret complete data packets and report absolute mode input events for
177 * hardware version 1. (4 byte packets)
179 static void elantech_report_absolute_v1(struct psmouse
*psmouse
)
181 struct input_dev
*dev
= psmouse
->dev
;
182 struct elantech_data
*etd
= psmouse
->private;
183 unsigned char *packet
= psmouse
->packet
;
186 if (etd
->fw_version
< 0x020000) {
188 * byte 0: D U p1 p2 1 p3 R L
189 * byte 1: f 0 th tw x9 x8 y9 y8
191 fingers
= ((packet
[1] & 0x80) >> 7) +
192 ((packet
[1] & 0x30) >> 4);
195 * byte 0: n1 n0 p2 p1 1 p3 R L
196 * byte 1: 0 0 0 0 x9 x8 y9 y8
198 fingers
= (packet
[0] & 0xc0) >> 6;
201 if (etd
->jumpy_cursor
) {
203 etd
->single_finger_reports
= 0;
204 } else if (etd
->single_finger_reports
< 2) {
205 /* Discard first 2 reports of one finger, bogus */
206 etd
->single_finger_reports
++;
207 elantech_debug("elantech.c: discarding packet\n");
212 input_report_key(dev
, BTN_TOUCH
, fingers
!= 0);
215 * byte 2: x7 x6 x5 x4 x3 x2 x1 x0
216 * byte 3: y7 y6 y5 y4 y3 y2 y1 y0
219 input_report_abs(dev
, ABS_X
,
220 ((packet
[1] & 0x0c) << 6) | packet
[2]);
221 input_report_abs(dev
, ABS_Y
,
222 ETP_YMAX_V1
- (((packet
[1] & 0x03) << 8) | packet
[3]));
225 input_report_key(dev
, BTN_TOOL_FINGER
, fingers
== 1);
226 input_report_key(dev
, BTN_TOOL_DOUBLETAP
, fingers
== 2);
227 input_report_key(dev
, BTN_TOOL_TRIPLETAP
, fingers
== 3);
228 input_report_key(dev
, BTN_LEFT
, packet
[0] & 0x01);
229 input_report_key(dev
, BTN_RIGHT
, packet
[0] & 0x02);
231 if (etd
->fw_version
< 0x020000 &&
232 (etd
->capabilities
& ETP_CAP_HAS_ROCKER
)) {
234 input_report_key(dev
, BTN_FORWARD
, packet
[0] & 0x40);
236 input_report_key(dev
, BTN_BACK
, packet
[0] & 0x80);
243 * Interpret complete data packets and report absolute mode input events for
244 * hardware version 2. (6 byte packets)
246 static void elantech_report_absolute_v2(struct psmouse
*psmouse
)
248 struct input_dev
*dev
= psmouse
->dev
;
249 unsigned char *packet
= psmouse
->packet
;
250 int fingers
, x1
, y1
, x2
, y2
;
252 /* byte 0: n1 n0 . . . . R L */
253 fingers
= (packet
[0] & 0xc0) >> 6;
254 input_report_key(dev
, BTN_TOUCH
, fingers
!= 0);
259 * byte 1: . . . . . x10 x9 x8
260 * byte 2: x7 x6 x5 x4 x4 x2 x1 x0
262 input_report_abs(dev
, ABS_X
,
263 ((packet
[1] & 0x07) << 8) | packet
[2]);
265 * byte 4: . . . . . . y9 y8
266 * byte 5: y7 y6 y5 y4 y3 y2 y1 y0
268 input_report_abs(dev
, ABS_Y
,
269 ETP_YMAX_V2
- (((packet
[4] & 0x03) << 8) | packet
[5]));
274 * The coordinate of each finger is reported separately
275 * with a lower resolution for two finger touches:
276 * byte 0: . . ay8 ax8 . . . .
277 * byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0
279 x1
= ((packet
[0] & 0x10) << 4) | packet
[1];
280 /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */
281 y1
= ETP_2FT_YMAX
- (((packet
[0] & 0x20) << 3) | packet
[2]);
283 * byte 3: . . by8 bx8 . . . .
284 * byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0
286 x2
= ((packet
[3] & 0x10) << 4) | packet
[4];
287 /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */
288 y2
= ETP_2FT_YMAX
- (((packet
[3] & 0x20) << 3) | packet
[5]);
290 * For compatibility with the X Synaptics driver scale up
291 * one coordinate and report as ordinary mouse movent
293 input_report_abs(dev
, ABS_X
, x1
<< 2);
294 input_report_abs(dev
, ABS_Y
, y1
<< 2);
296 * For compatibility with the proprietary X Elantech driver
297 * report both coordinates as hat coordinates
299 input_report_abs(dev
, ABS_HAT0X
, x1
);
300 input_report_abs(dev
, ABS_HAT0Y
, y1
);
301 input_report_abs(dev
, ABS_HAT1X
, x2
);
302 input_report_abs(dev
, ABS_HAT1Y
, y2
);
306 input_report_key(dev
, BTN_TOOL_FINGER
, fingers
== 1);
307 input_report_key(dev
, BTN_TOOL_DOUBLETAP
, fingers
== 2);
308 input_report_key(dev
, BTN_TOOL_TRIPLETAP
, fingers
== 3);
309 input_report_key(dev
, BTN_LEFT
, packet
[0] & 0x01);
310 input_report_key(dev
, BTN_RIGHT
, packet
[0] & 0x02);
315 static int elantech_check_parity_v1(struct psmouse
*psmouse
)
317 struct elantech_data
*etd
= psmouse
->private;
318 unsigned char *packet
= psmouse
->packet
;
319 unsigned char p1
, p2
, p3
;
321 /* Parity bits are placed differently */
322 if (etd
->fw_version
< 0x020000) {
323 /* byte 0: D U p1 p2 1 p3 R L */
324 p1
= (packet
[0] & 0x20) >> 5;
325 p2
= (packet
[0] & 0x10) >> 4;
327 /* byte 0: n1 n0 p2 p1 1 p3 R L */
328 p1
= (packet
[0] & 0x10) >> 4;
329 p2
= (packet
[0] & 0x20) >> 5;
332 p3
= (packet
[0] & 0x04) >> 2;
334 return etd
->parity
[packet
[1]] == p1
&&
335 etd
->parity
[packet
[2]] == p2
&&
336 etd
->parity
[packet
[3]] == p3
;
340 * Process byte stream from mouse and handle complete packets
342 static psmouse_ret_t
elantech_process_byte(struct psmouse
*psmouse
)
344 struct elantech_data
*etd
= psmouse
->private;
346 if (psmouse
->pktcnt
< psmouse
->pktsize
)
347 return PSMOUSE_GOOD_DATA
;
350 elantech_packet_dump(psmouse
->packet
, psmouse
->pktsize
);
352 switch (etd
->hw_version
) {
354 if (etd
->paritycheck
&& !elantech_check_parity_v1(psmouse
))
355 return PSMOUSE_BAD_DATA
;
357 elantech_report_absolute_v1(psmouse
);
361 /* We don't know how to check parity in protocol v2 */
362 elantech_report_absolute_v2(psmouse
);
366 return PSMOUSE_FULL_PACKET
;
370 * Put the touchpad into absolute mode
372 static int elantech_set_absolute_mode(struct psmouse
*psmouse
)
374 struct elantech_data
*etd
= psmouse
->private;
376 int tries
= ETP_READ_BACK_TRIES
;
379 switch (etd
->hw_version
) {
383 if (elantech_write_reg(psmouse
, 0x10, etd
->reg_10
) ||
384 elantech_write_reg(psmouse
, 0x11, etd
->reg_11
)) {
390 /* Windows driver values */
392 etd
->reg_11
= 0x88; /* 0x8a */
393 etd
->reg_21
= 0x60; /* 0x00 */
394 if (elantech_write_reg(psmouse
, 0x10, etd
->reg_10
) ||
395 elantech_write_reg(psmouse
, 0x11, etd
->reg_11
) ||
396 elantech_write_reg(psmouse
, 0x21, etd
->reg_21
)) {
404 * Read back reg 0x10. For hardware version 1 we must make
405 * sure the absolute mode bit is set. For hardware version 2
406 * the touchpad is probably initalising and not ready until
407 * we read back the value we just wrote.
410 rc
= elantech_read_reg(psmouse
, 0x10, &val
);
414 elantech_debug("elantech.c: retrying read (%d).\n",
416 msleep(ETP_READ_BACK_DELAY
);
420 pr_err("elantech.c: failed to read back register 0x10.\n");
421 } else if (etd
->hw_version
== 1 &&
422 !(val
& ETP_R10_ABSOLUTE_MODE
)) {
423 pr_err("elantech.c: touchpad refuses "
424 "to switch to absolute mode.\n");
430 pr_err("elantech.c: failed to initialise registers.\n");
436 * Set the appropriate event bits for the input subsystem
438 static void elantech_set_input_params(struct psmouse
*psmouse
)
440 struct input_dev
*dev
= psmouse
->dev
;
441 struct elantech_data
*etd
= psmouse
->private;
443 __set_bit(EV_KEY
, dev
->evbit
);
444 __set_bit(EV_ABS
, dev
->evbit
);
445 __clear_bit(EV_REL
, dev
->evbit
);
447 __set_bit(BTN_LEFT
, dev
->keybit
);
448 __set_bit(BTN_RIGHT
, dev
->keybit
);
450 __set_bit(BTN_TOUCH
, dev
->keybit
);
451 __set_bit(BTN_TOOL_FINGER
, dev
->keybit
);
452 __set_bit(BTN_TOOL_DOUBLETAP
, dev
->keybit
);
453 __set_bit(BTN_TOOL_TRIPLETAP
, dev
->keybit
);
455 switch (etd
->hw_version
) {
458 if (etd
->fw_version
< 0x020000 &&
459 (etd
->capabilities
& ETP_CAP_HAS_ROCKER
)) {
460 __set_bit(BTN_FORWARD
, dev
->keybit
);
461 __set_bit(BTN_BACK
, dev
->keybit
);
463 input_set_abs_params(dev
, ABS_X
, ETP_XMIN_V1
, ETP_XMAX_V1
, 0, 0);
464 input_set_abs_params(dev
, ABS_Y
, ETP_YMIN_V1
, ETP_YMAX_V1
, 0, 0);
468 input_set_abs_params(dev
, ABS_X
, ETP_XMIN_V2
, ETP_XMAX_V2
, 0, 0);
469 input_set_abs_params(dev
, ABS_Y
, ETP_YMIN_V2
, ETP_YMAX_V2
, 0, 0);
470 input_set_abs_params(dev
, ABS_HAT0X
, ETP_2FT_XMIN
, ETP_2FT_XMAX
, 0, 0);
471 input_set_abs_params(dev
, ABS_HAT0Y
, ETP_2FT_YMIN
, ETP_2FT_YMAX
, 0, 0);
472 input_set_abs_params(dev
, ABS_HAT1X
, ETP_2FT_XMIN
, ETP_2FT_XMAX
, 0, 0);
473 input_set_abs_params(dev
, ABS_HAT1Y
, ETP_2FT_YMIN
, ETP_2FT_YMAX
, 0, 0);
478 struct elantech_attr_data
{
484 * Display a register value by reading a sysfs entry
486 static ssize_t
elantech_show_int_attr(struct psmouse
*psmouse
, void *data
,
489 struct elantech_data
*etd
= psmouse
->private;
490 struct elantech_attr_data
*attr
= data
;
491 unsigned char *reg
= (unsigned char *) etd
+ attr
->field_offset
;
495 rc
= elantech_read_reg(psmouse
, attr
->reg
, reg
);
497 return sprintf(buf
, "0x%02x\n", (attr
->reg
&& rc
) ? -1 : *reg
);
501 * Write a register value by writing a sysfs entry
503 static ssize_t
elantech_set_int_attr(struct psmouse
*psmouse
,
504 void *data
, const char *buf
, size_t count
)
506 struct elantech_data
*etd
= psmouse
->private;
507 struct elantech_attr_data
*attr
= data
;
508 unsigned char *reg
= (unsigned char *) etd
+ attr
->field_offset
;
512 err
= strict_strtoul(buf
, 16, &value
);
519 /* Do we need to preserve some bits for version 2 hardware too? */
520 if (etd
->hw_version
== 1) {
521 if (attr
->reg
== 0x10)
522 /* Force absolute mode always on */
523 value
|= ETP_R10_ABSOLUTE_MODE
;
524 else if (attr
->reg
== 0x11)
525 /* Force 4 byte mode always on */
526 value
|= ETP_R11_4_BYTE_MODE
;
529 if (!attr
->reg
|| elantech_write_reg(psmouse
, attr
->reg
, value
) == 0)
535 #define ELANTECH_INT_ATTR(_name, _register) \
536 static struct elantech_attr_data elantech_attr_##_name = { \
537 .field_offset = offsetof(struct elantech_data, _name), \
540 PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \
541 &elantech_attr_##_name, \
542 elantech_show_int_attr, \
543 elantech_set_int_attr)
545 ELANTECH_INT_ATTR(reg_10
, 0x10);
546 ELANTECH_INT_ATTR(reg_11
, 0x11);
547 ELANTECH_INT_ATTR(reg_20
, 0x20);
548 ELANTECH_INT_ATTR(reg_21
, 0x21);
549 ELANTECH_INT_ATTR(reg_22
, 0x22);
550 ELANTECH_INT_ATTR(reg_23
, 0x23);
551 ELANTECH_INT_ATTR(reg_24
, 0x24);
552 ELANTECH_INT_ATTR(reg_25
, 0x25);
553 ELANTECH_INT_ATTR(reg_26
, 0x26);
554 ELANTECH_INT_ATTR(debug
, 0);
555 ELANTECH_INT_ATTR(paritycheck
, 0);
557 static struct attribute
*elantech_attrs
[] = {
558 &psmouse_attr_reg_10
.dattr
.attr
,
559 &psmouse_attr_reg_11
.dattr
.attr
,
560 &psmouse_attr_reg_20
.dattr
.attr
,
561 &psmouse_attr_reg_21
.dattr
.attr
,
562 &psmouse_attr_reg_22
.dattr
.attr
,
563 &psmouse_attr_reg_23
.dattr
.attr
,
564 &psmouse_attr_reg_24
.dattr
.attr
,
565 &psmouse_attr_reg_25
.dattr
.attr
,
566 &psmouse_attr_reg_26
.dattr
.attr
,
567 &psmouse_attr_debug
.dattr
.attr
,
568 &psmouse_attr_paritycheck
.dattr
.attr
,
572 static struct attribute_group elantech_attr_group
= {
573 .attrs
= elantech_attrs
,
576 static bool elantech_is_signature_valid(const unsigned char *param
)
578 static const unsigned char rates
[] = { 200, 100, 80, 60, 40, 20, 10 };
587 for (i
= 0; i
< ARRAY_SIZE(rates
); i
++)
588 if (param
[2] == rates
[i
])
595 * Use magic knock to detect Elantech touchpad
597 int elantech_detect(struct psmouse
*psmouse
, bool set_properties
)
599 struct ps2dev
*ps2dev
= &psmouse
->ps2dev
;
600 unsigned char param
[3];
602 ps2_command(&psmouse
->ps2dev
, NULL
, PSMOUSE_CMD_RESET_DIS
);
604 if (ps2_command(ps2dev
, NULL
, PSMOUSE_CMD_DISABLE
) ||
605 ps2_command(ps2dev
, NULL
, PSMOUSE_CMD_SETSCALE11
) ||
606 ps2_command(ps2dev
, NULL
, PSMOUSE_CMD_SETSCALE11
) ||
607 ps2_command(ps2dev
, NULL
, PSMOUSE_CMD_SETSCALE11
) ||
608 ps2_command(ps2dev
, param
, PSMOUSE_CMD_GETINFO
)) {
609 pr_debug("elantech.c: sending Elantech magic knock failed.\n");
614 * Report this in case there are Elantech models that use a different
615 * set of magic numbers
617 if (param
[0] != 0x3c || param
[1] != 0x03 || param
[2] != 0xc8) {
618 pr_debug("elantech.c: "
619 "unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
620 param
[0], param
[1], param
[2]);
625 * Query touchpad's firmware version and see if it reports known
626 * value to avoid mis-detection. Logitech mice are known to respond
627 * to Elantech magic knock and there might be more.
629 if (synaptics_send_cmd(psmouse
, ETP_FW_VERSION_QUERY
, param
)) {
630 pr_debug("elantech.c: failed to query firmware version.\n");
634 pr_debug("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
635 param
[0], param
[1], param
[2]);
637 if (!elantech_is_signature_valid(param
)) {
638 if (!force_elantech
) {
639 pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
643 pr_debug("elantech.c: Probably not a real Elantech touchpad. Enabling anyway due to force_elantech.\n");
646 if (set_properties
) {
647 psmouse
->vendor
= "Elantech";
648 psmouse
->name
= "Touchpad";
655 * Clean up sysfs entries when disconnecting
657 static void elantech_disconnect(struct psmouse
*psmouse
)
659 sysfs_remove_group(&psmouse
->ps2dev
.serio
->dev
.kobj
,
660 &elantech_attr_group
);
661 kfree(psmouse
->private);
662 psmouse
->private = NULL
;
666 * Put the touchpad back into absolute mode when reconnecting
668 static int elantech_reconnect(struct psmouse
*psmouse
)
670 if (elantech_detect(psmouse
, 0))
673 if (elantech_set_absolute_mode(psmouse
)) {
674 pr_err("elantech.c: failed to put touchpad back into absolute mode.\n");
682 * Initialize the touchpad and create sysfs entries
684 int elantech_init(struct psmouse
*psmouse
)
686 struct elantech_data
*etd
;
688 unsigned char param
[3];
690 psmouse
->private = etd
= kzalloc(sizeof(struct elantech_data
), GFP_KERNEL
);
695 for (i
= 1; i
< 256; i
++)
696 etd
->parity
[i
] = etd
->parity
[i
& (i
- 1)] ^ 1;
699 * Do the version query again so we can store the result
701 if (synaptics_send_cmd(psmouse
, ETP_FW_VERSION_QUERY
, param
)) {
702 pr_err("elantech.c: failed to query firmware version.\n");
706 etd
->fw_version
= (param
[0] << 16) | (param
[1] << 8) | param
[2];
709 * Assume every version greater than this is new EeePC style
710 * hardware with 6 byte packets
712 if (etd
->fw_version
>= 0x020030) {
714 /* For now show extra debug information */
716 /* Don't know how to do parity checking for version 2 */
717 etd
->paritycheck
= 0;
720 etd
->paritycheck
= 1;
723 pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d.%d\n",
724 etd
->hw_version
, param
[0], param
[1], param
[2]);
726 if (synaptics_send_cmd(psmouse
, ETP_CAPABILITIES_QUERY
, param
)) {
727 pr_err("elantech.c: failed to query capabilities.\n");
730 pr_info("elantech.c: Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n",
731 param
[0], param
[1], param
[2]);
732 etd
->capabilities
= param
[0];
735 * This firmware suffers from misreporting coordinates when
736 * a touch action starts causing the mouse cursor or scrolled page
737 * to jump. Enable a workaround.
739 if (etd
->fw_version
== 0x020022 || etd
->fw_version
== 0x020600) {
740 pr_info("elantech.c: firmware version 2.0.34/2.6.0 detected, "
741 "enabling jumpy cursor workaround\n");
742 etd
->jumpy_cursor
= true;
745 if (elantech_set_absolute_mode(psmouse
)) {
746 pr_err("elantech.c: failed to put touchpad into absolute mode.\n");
750 elantech_set_input_params(psmouse
);
752 error
= sysfs_create_group(&psmouse
->ps2dev
.serio
->dev
.kobj
,
753 &elantech_attr_group
);
755 pr_err("elantech.c: failed to create sysfs attributes, error: %d.\n",
760 psmouse
->protocol_handler
= elantech_process_byte
;
761 psmouse
->disconnect
= elantech_disconnect
;
762 psmouse
->reconnect
= elantech_reconnect
;
763 psmouse
->pktsize
= etd
->hw_version
== 2 ? 6 : 4;