Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: i8042 - fix AUX port detection with some chips

The i8042 driver fails detection of the AUX port with some chips,
because they apparently do not change the I8042_CTR_AUXDIS bit
immediately. This is known to affect at least HP500/HP510 notebooks,
consequently the built-in touchpad will not work. The patch will simply
reread the value until it gets the expected value or a retry limit is
hit, without touching other workaround code in the same area.

Signed-off-by: Roland Scheidegger <sroland@tungstengraphics.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

authored by

Roland Scheidegger and committed by
Dmitry Torokhov
d2ada559 334d0dd8

+29 -6
+29 -6
drivers/input/serio/i8042.c
··· 526 526 return IRQ_HANDLED; 527 527 } 528 528 529 + /* 530 + * i8042_toggle_aux - enables or disables AUX port on i8042 via command and 531 + * verifies success by readinng CTR. Used when testing for presence of AUX 532 + * port. 533 + */ 534 + static int __devinit i8042_toggle_aux(int on) 535 + { 536 + unsigned char param; 537 + int i; 538 + 539 + if (i8042_command(&param, 540 + on ? I8042_CMD_AUX_ENABLE : I8042_CMD_AUX_DISABLE)) 541 + return -1; 542 + 543 + /* some chips need some time to set the I8042_CTR_AUXDIS bit */ 544 + for (i = 0; i < 100; i++) { 545 + udelay(50); 546 + 547 + if (i8042_command(&param, I8042_CMD_CTL_RCTR)) 548 + return -1; 549 + 550 + if (!(param & I8042_CTR_AUXDIS) == on) 551 + return 0; 552 + } 553 + 554 + return -1; 555 + } 529 556 530 557 /* 531 558 * i8042_check_aux() applies as much paranoia as it can at detecting ··· 607 580 * Bit assignment test - filters out PS/2 i8042's in AT mode 608 581 */ 609 582 610 - if (i8042_command(&param, I8042_CMD_AUX_DISABLE)) 611 - return -1; 612 - if (i8042_command(&param, I8042_CMD_CTL_RCTR) || (~param & I8042_CTR_AUXDIS)) { 583 + if (i8042_toggle_aux(0)) { 613 584 printk(KERN_WARNING "Failed to disable AUX port, but continuing anyway... Is this a SiS?\n"); 614 585 printk(KERN_WARNING "If AUX port is really absent please use the 'i8042.noaux' option.\n"); 615 586 } 616 587 617 - if (i8042_command(&param, I8042_CMD_AUX_ENABLE)) 618 - return -1; 619 - if (i8042_command(&param, I8042_CMD_CTL_RCTR) || (param & I8042_CTR_AUXDIS)) 588 + if (i8042_toggle_aux(1)) 620 589 return -1; 621 590 622 591 /*