aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-19 16:31:34 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-19 16:31:34 -0500
commitd43a338e395371733a80ec473b40baac5f74d768 (patch)
treed4c01b62865bed1af2463d7a4eb4cb25ca46c66e /drivers/input/serio
parentcb4aaf46c0283dd79ab2e8b8b165c0bf13ab6194 (diff)
parent62b529a7b9c11880a8820494a25db0e2ecdf3bed (diff)
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input: Input: remove obsolete setup parameters from input drivers Input: HIL - fix improper call to release_region() Input: hid-lgff - treat devices as joysticks unless told otherwise Input: HID - add support for Logitech Formula Force EX Input: gpio-keys - switch to common GPIO API Input: do not lock device when showing name, phys and uniq Input: i8042 - let serio bus suspend ports Input: psmouse - properly reset mouse on shutdown/suspend
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/i8042.c63
-rw-r--r--drivers/input/serio/serio.c36
2 files changed, 64 insertions, 35 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);
76MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); 76MODULE_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
88static DEFINE_SPINLOCK(i8042_lock); 81static 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
798static 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
864static int i8042_suspend(struct platform_device *dev, pm_message_t state) 840static 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
920static void i8042_shutdown(struct platform_device *dev) 913static void i8042_shutdown(struct platform_device *dev)
921{ 914{
922 i8042_controller_cleanup(); 915 i8042_controller_reset();
923} 916}
924 917
925static int __devinit i8042_create_kbd_port(void) 918static 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
1162static int __init i8042_init(void) 1157static int __init i8042_init(void)
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 17c8c63cbe1a..a15e531ec755 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -778,6 +778,19 @@ static int serio_driver_remove(struct device *dev)
778 return 0; 778 return 0;
779} 779}
780 780
781static void serio_cleanup(struct serio *serio)
782{
783 if (serio->drv && serio->drv->cleanup)
784 serio->drv->cleanup(serio);
785}
786
787static void serio_shutdown(struct device *dev)
788{
789 struct serio *serio = to_serio_port(dev);
790
791 serio_cleanup(serio);
792}
793
781static void serio_attach_driver(struct serio_driver *drv) 794static void serio_attach_driver(struct serio_driver *drv)
782{ 795{
783 int error; 796 int error;
@@ -910,11 +923,25 @@ static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buf
910 923
911#endif /* CONFIG_HOTPLUG */ 924#endif /* CONFIG_HOTPLUG */
912 925
926#ifdef CONFIG_PM
927static int serio_suspend(struct device *dev, pm_message_t state)
928{
929 if (dev->power.power_state.event != state.event) {
930 if (state.event == PM_EVENT_SUSPEND)
931 serio_cleanup(to_serio_port(dev));
932
933 dev->power.power_state = state;
934 }
935
936 return 0;
937}
938
913static int serio_resume(struct device *dev) 939static int serio_resume(struct device *dev)
914{ 940{
915 struct serio *serio = to_serio_port(dev); 941 struct serio *serio = to_serio_port(dev);
916 942
917 if (serio_reconnect_driver(serio)) { 943 if (dev->power.power_state.event != PM_EVENT_ON &&
944 serio_reconnect_driver(serio)) {
918 /* 945 /*
919 * Driver re-probing can take a while, so better let kseriod 946 * Driver re-probing can take a while, so better let kseriod
920 * deal with it. 947 * deal with it.
@@ -922,8 +949,11 @@ static int serio_resume(struct device *dev)
922 serio_rescan(serio); 949 serio_rescan(serio);
923 } 950 }
924 951
952 dev->power.power_state = PMSG_ON;
953
925 return 0; 954 return 0;
926} 955}
956#endif /* CONFIG_PM */
927 957
928/* called from serio_driver->connect/disconnect methods under serio_mutex */ 958/* called from serio_driver->connect/disconnect methods under serio_mutex */
929int serio_open(struct serio *serio, struct serio_driver *drv) 959int serio_open(struct serio *serio, struct serio_driver *drv)
@@ -974,7 +1004,11 @@ static struct bus_type serio_bus = {
974 .uevent = serio_uevent, 1004 .uevent = serio_uevent,
975 .probe = serio_driver_probe, 1005 .probe = serio_driver_probe,
976 .remove = serio_driver_remove, 1006 .remove = serio_driver_remove,
1007 .shutdown = serio_shutdown,
1008#ifdef CONFIG_PM
1009 .suspend = serio_suspend,
977 .resume = serio_resume, 1010 .resume = serio_resume,
1011#endif
978}; 1012};
979 1013
980static int __init serio_init(void) 1014static int __init serio_init(void)