diff options
Diffstat (limited to 'drivers/input/serio/i8042.c')
-rw-r--r-- | drivers/input/serio/i8042.c | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index c3fdfc1f342a..ec195a36e8f6 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -76,13 +76,6 @@ module_param_named(debug, i8042_debug, bool, 0600); | |||
76 | MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); | 76 | MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | __obsolete_setup("i8042_noaux"); | ||
80 | __obsolete_setup("i8042_nomux"); | ||
81 | __obsolete_setup("i8042_unlock"); | ||
82 | __obsolete_setup("i8042_reset"); | ||
83 | __obsolete_setup("i8042_direct"); | ||
84 | __obsolete_setup("i8042_dumbkbd"); | ||
85 | |||
86 | #include "i8042.h" | 79 | #include "i8042.h" |
87 | 80 | ||
88 | static DEFINE_SPINLOCK(i8042_lock); | 81 | static DEFINE_SPINLOCK(i8042_lock); |
@@ -724,7 +717,7 @@ static int i8042_controller_init(void) | |||
724 | if (~i8042_read_status() & I8042_STR_KEYLOCK) { | 717 | if (~i8042_read_status() & I8042_STR_KEYLOCK) { |
725 | if (i8042_unlock) | 718 | if (i8042_unlock) |
726 | i8042_ctr |= I8042_CTR_IGNKEYLOCK; | 719 | i8042_ctr |= I8042_CTR_IGNKEYLOCK; |
727 | else | 720 | else |
728 | printk(KERN_WARNING "i8042.c: Warning: Keylock active.\n"); | 721 | printk(KERN_WARNING "i8042.c: Warning: Keylock active.\n"); |
729 | } | 722 | } |
730 | spin_unlock_irqrestore(&i8042_lock, flags); | 723 | spin_unlock_irqrestore(&i8042_lock, flags); |
@@ -791,27 +784,6 @@ static void i8042_controller_reset(void) | |||
791 | 784 | ||
792 | 785 | ||
793 | /* | 786 | /* |
794 | * Here we try to reset everything back to a state in which the BIOS will be | ||
795 | * able to talk to the hardware when rebooting. | ||
796 | */ | ||
797 | |||
798 | static void i8042_controller_cleanup(void) | ||
799 | { | ||
800 | int i; | ||
801 | |||
802 | /* | ||
803 | * Reset anything that is connected to the ports. | ||
804 | */ | ||
805 | |||
806 | for (i = 0; i < I8042_NUM_PORTS; i++) | ||
807 | if (i8042_ports[i].serio) | ||
808 | serio_cleanup(i8042_ports[i].serio); | ||
809 | |||
810 | i8042_controller_reset(); | ||
811 | } | ||
812 | |||
813 | |||
814 | /* | ||
815 | * i8042_panic_blink() will flash the keyboard LEDs and is called when | 787 | * i8042_panic_blink() will flash the keyboard LEDs and is called when |
816 | * kernel panics. Flashing LEDs is useful for users running X who may | 788 | * kernel panics. Flashing LEDs is useful for users running X who may |
817 | * not see the console and will help distingushing panics from "real" | 789 | * not see the console and will help distingushing panics from "real" |
@@ -857,13 +829,22 @@ static long i8042_panic_blink(long count) | |||
857 | 829 | ||
858 | #undef DELAY | 830 | #undef DELAY |
859 | 831 | ||
832 | #ifdef CONFIG_PM | ||
860 | /* | 833 | /* |
861 | * Here we try to restore the original BIOS settings | 834 | * Here we try to restore the original BIOS settings. We only want to |
835 | * do that once, when we really suspend, not when we taking memory | ||
836 | * snapshot for swsusp (in this case we'll perform required cleanup | ||
837 | * as part of shutdown process). | ||
862 | */ | 838 | */ |
863 | 839 | ||
864 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) | 840 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) |
865 | { | 841 | { |
866 | i8042_controller_cleanup(); | 842 | if (dev->dev.power.power_state.event != state.event) { |
843 | if (state.event == PM_EVENT_SUSPEND) | ||
844 | i8042_controller_reset(); | ||
845 | |||
846 | dev->dev.power.power_state = state; | ||
847 | } | ||
867 | 848 | ||
868 | return 0; | 849 | return 0; |
869 | } | 850 | } |
@@ -877,6 +858,12 @@ static int i8042_resume(struct platform_device *dev) | |||
877 | { | 858 | { |
878 | int error; | 859 | int error; |
879 | 860 | ||
861 | /* | ||
862 | * Do not bother with restoring state if we haven't suspened yet | ||
863 | */ | ||
864 | if (dev->dev.power.power_state.event == PM_EVENT_ON) | ||
865 | return 0; | ||
866 | |||
880 | error = i8042_controller_check(); | 867 | error = i8042_controller_check(); |
881 | if (error) | 868 | if (error) |
882 | return error; | 869 | return error; |
@@ -886,9 +873,12 @@ static int i8042_resume(struct platform_device *dev) | |||
886 | return error; | 873 | return error; |
887 | 874 | ||
888 | /* | 875 | /* |
889 | * Restore pre-resume CTR value and disable all ports | 876 | * Restore original CTR value and disable all ports |
890 | */ | 877 | */ |
891 | 878 | ||
879 | i8042_ctr = i8042_initial_ctr; | ||
880 | if (i8042_direct) | ||
881 | i8042_ctr &= ~I8042_CTR_XLATE; | ||
892 | i8042_ctr |= I8042_CTR_AUXDIS | I8042_CTR_KBDDIS; | 882 | i8042_ctr |= I8042_CTR_AUXDIS | I8042_CTR_KBDDIS; |
893 | i8042_ctr &= ~(I8042_CTR_AUXINT | I8042_CTR_KBDINT); | 883 | i8042_ctr &= ~(I8042_CTR_AUXINT | I8042_CTR_KBDINT); |
894 | if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { | 884 | if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { |
@@ -909,8 +899,11 @@ static int i8042_resume(struct platform_device *dev) | |||
909 | 899 | ||
910 | i8042_interrupt(0, NULL); | 900 | i8042_interrupt(0, NULL); |
911 | 901 | ||
902 | dev->dev.power.power_state = PMSG_ON; | ||
903 | |||
912 | return 0; | 904 | return 0; |
913 | } | 905 | } |
906 | #endif /* CONFIG_PM */ | ||
914 | 907 | ||
915 | /* | 908 | /* |
916 | * We need to reset the 8042 back to original mode on system shutdown, | 909 | * We need to reset the 8042 back to original mode on system shutdown, |
@@ -919,7 +912,7 @@ static int i8042_resume(struct platform_device *dev) | |||
919 | 912 | ||
920 | static void i8042_shutdown(struct platform_device *dev) | 913 | static void i8042_shutdown(struct platform_device *dev) |
921 | { | 914 | { |
922 | i8042_controller_cleanup(); | 915 | i8042_controller_reset(); |
923 | } | 916 | } |
924 | 917 | ||
925 | static int __devinit i8042_create_kbd_port(void) | 918 | static int __devinit i8042_create_kbd_port(void) |
@@ -1154,9 +1147,11 @@ static struct platform_driver i8042_driver = { | |||
1154 | }, | 1147 | }, |
1155 | .probe = i8042_probe, | 1148 | .probe = i8042_probe, |
1156 | .remove = __devexit_p(i8042_remove), | 1149 | .remove = __devexit_p(i8042_remove), |
1150 | .shutdown = i8042_shutdown, | ||
1151 | #ifdef CONFIG_PM | ||
1157 | .suspend = i8042_suspend, | 1152 | .suspend = i8042_suspend, |
1158 | .resume = i8042_resume, | 1153 | .resume = i8042_resume, |
1159 | .shutdown = i8042_shutdown, | 1154 | #endif |
1160 | }; | 1155 | }; |
1161 | 1156 | ||
1162 | static int __init i8042_init(void) | 1157 | static int __init i8042_init(void) |