diff options
Diffstat (limited to 'drivers/input/serio/i8042.c')
-rw-r--r-- | drivers/input/serio/i8042.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 8e63e464d361..5900de3c3f4f 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -698,6 +698,26 @@ static void i8042_timer_func(unsigned long data) | |||
698 | i8042_interrupt(0, NULL, NULL); | 698 | i8042_interrupt(0, NULL, NULL); |
699 | } | 699 | } |
700 | 700 | ||
701 | static int i8042_ctl_test(void) | ||
702 | { | ||
703 | unsigned char param; | ||
704 | |||
705 | if (!i8042_reset) | ||
706 | return 0; | ||
707 | |||
708 | if (i8042_command(¶m, I8042_CMD_CTL_TEST)) { | ||
709 | printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n"); | ||
710 | return -1; | ||
711 | } | ||
712 | |||
713 | if (param != I8042_RET_CTL_TEST) { | ||
714 | printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n", | ||
715 | param, I8042_RET_CTL_TEST); | ||
716 | return -1; | ||
717 | } | ||
718 | |||
719 | return 0; | ||
720 | } | ||
701 | 721 | ||
702 | /* | 722 | /* |
703 | * i8042_controller init initializes the i8042 controller, and, | 723 | * i8042_controller init initializes the i8042 controller, and, |
@@ -719,21 +739,8 @@ static int i8042_controller_init(void) | |||
719 | return -1; | 739 | return -1; |
720 | } | 740 | } |
721 | 741 | ||
722 | if (i8042_reset) { | 742 | if (i8042_ctl_test()) |
723 | 743 | return -1; | |
724 | unsigned char param; | ||
725 | |||
726 | if (i8042_command(¶m, I8042_CMD_CTL_TEST)) { | ||
727 | printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n"); | ||
728 | return -1; | ||
729 | } | ||
730 | |||
731 | if (param != I8042_RET_CTL_TEST) { | ||
732 | printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n", | ||
733 | param, I8042_RET_CTL_TEST); | ||
734 | return -1; | ||
735 | } | ||
736 | } | ||
737 | 744 | ||
738 | /* | 745 | /* |
739 | * Save the CTR for restoral on unload / reboot. | 746 | * Save the CTR for restoral on unload / reboot. |
@@ -802,15 +809,11 @@ static int i8042_controller_init(void) | |||
802 | */ | 809 | */ |
803 | static void i8042_controller_reset(void) | 810 | static void i8042_controller_reset(void) |
804 | { | 811 | { |
805 | unsigned char param; | ||
806 | |||
807 | /* | 812 | /* |
808 | * Reset the controller if requested. | 813 | * Reset the controller if requested. |
809 | */ | 814 | */ |
810 | 815 | ||
811 | if (i8042_reset) | 816 | i8042_ctl_test(); |
812 | if (i8042_command(¶m, I8042_CMD_CTL_TEST)) | ||
813 | printk(KERN_ERR "i8042.c: i8042 controller reset timeout.\n"); | ||
814 | 817 | ||
815 | /* | 818 | /* |
816 | * Disable MUX mode if present. | 819 | * Disable MUX mode if present. |
@@ -922,8 +925,11 @@ static int i8042_resume(struct device *dev, u32 level) | |||
922 | if (level != RESUME_ENABLE) | 925 | if (level != RESUME_ENABLE) |
923 | return 0; | 926 | return 0; |
924 | 927 | ||
925 | if (i8042_controller_init()) { | 928 | if (i8042_ctl_test()) |
926 | printk(KERN_ERR "i8042: resume failed\n"); | 929 | return -1; |
930 | |||
931 | if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { | ||
932 | printk(KERN_ERR "i8042: Can't write CTR\n"); | ||
927 | return -1; | 933 | return -1; |
928 | } | 934 | } |
929 | 935 | ||