aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-20 13:17:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-20 13:17:02 -0400
commit93db6294958f62643a917e44d1abc85440e600cf (patch)
tree33de2c41b0f70d209d64487d1a2bba6d673015ef /drivers/input/serio
parent43813f399c72aa22e01a680559c1cb5274bf2140 (diff)
parenteef3e4cab72eaf5345e3c73b2975c194a714f6cd (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (35 commits) Input: add driver for Synaptics I2C touchpad Input: synaptics - add support for reporting x/y resolution Input: ALPS - handle touchpoints buttons correctly Input: gpio-keys - change timer to workqueue Input: ads7846 - pin change interrupt support Input: add support for touchscreen on W90P910 ARM platform Input: appletouch - improve finger detection Input: wacom - clear Intuos4 wheel data when finger leaves proximity Input: ucb1400 - move static function from header into core Input: add driver for EETI touchpanels Input: ads7846 - more detailed model name in sysfs Input: ads7846 - support swapping x and y axes Input: ati_remote2 - use non-atomic bitops Input: introduce lm8323 keypad driver Input: psmouse - ESD workaround fix for OLPC XO touchpad Input: tsc2007 - make sure platform provides get_pendown_state() Input: uinput - flush all pending ff effects before destroying device Input: simplify name handling for certain input handles Input: serio - do not use deprecated dev.power.power_state Input: wacom - add support for Intuos4 tablets ...
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/i8042.c17
-rw-r--r--drivers/input/serio/serio.c58
2 files changed, 38 insertions, 37 deletions
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 3cffb704e374..f919bf57293c 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -10,6 +10,7 @@
10 * the Free Software Foundation. 10 * the Free Software Foundation.
11 */ 11 */
12 12
13#include <linux/types.h>
13#include <linux/delay.h> 14#include <linux/delay.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -921,6 +922,9 @@ static void i8042_dritek_enable(void)
921#endif 922#endif
922 923
923#ifdef CONFIG_PM 924#ifdef CONFIG_PM
925
926static bool i8042_suspended;
927
924/* 928/*
925 * Here we try to restore the original BIOS settings. We only want to 929 * Here we try to restore the original BIOS settings. We only want to
926 * do that once, when we really suspend, not when we taking memory 930 * do that once, when we really suspend, not when we taking memory
@@ -930,11 +934,9 @@ static void i8042_dritek_enable(void)
930 934
931static int i8042_suspend(struct platform_device *dev, pm_message_t state) 935static int i8042_suspend(struct platform_device *dev, pm_message_t state)
932{ 936{
933 if (dev->dev.power.power_state.event != state.event) { 937 if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) {
934 if (state.event == PM_EVENT_SUSPEND) 938 i8042_controller_reset();
935 i8042_controller_reset(); 939 i8042_suspended = true;
936
937 dev->dev.power.power_state = state;
938 } 940 }
939 941
940 return 0; 942 return 0;
@@ -952,7 +954,7 @@ static int i8042_resume(struct platform_device *dev)
952/* 954/*
953 * Do not bother with restoring state if we haven't suspened yet 955 * Do not bother with restoring state if we haven't suspened yet
954 */ 956 */
955 if (dev->dev.power.power_state.event == PM_EVENT_ON) 957 if (!i8042_suspended)
956 return 0; 958 return 0;
957 959
958 error = i8042_controller_check(); 960 error = i8042_controller_check();
@@ -998,10 +1000,9 @@ static int i8042_resume(struct platform_device *dev)
998 if (i8042_ports[I8042_KBD_PORT_NO].serio) 1000 if (i8042_ports[I8042_KBD_PORT_NO].serio)
999 i8042_enable_kbd_port(); 1001 i8042_enable_kbd_port();
1000 1002
1003 i8042_suspended = false;
1001 i8042_interrupt(0, NULL); 1004 i8042_interrupt(0, NULL);
1002 1005
1003 dev->dev.power.power_state = PMSG_ON;
1004
1005 return 0; 1006 return 0;
1006} 1007}
1007#endif /* CONFIG_PM */ 1008#endif /* CONFIG_PM */
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index bc033250dfcd..fb17573f8f2d 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -41,17 +41,6 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
41MODULE_DESCRIPTION("Serio abstraction core"); 41MODULE_DESCRIPTION("Serio abstraction core");
42MODULE_LICENSE("GPL"); 42MODULE_LICENSE("GPL");
43 43
44EXPORT_SYMBOL(serio_interrupt);
45EXPORT_SYMBOL(__serio_register_port);
46EXPORT_SYMBOL(serio_unregister_port);
47EXPORT_SYMBOL(serio_unregister_child_port);
48EXPORT_SYMBOL(__serio_register_driver);
49EXPORT_SYMBOL(serio_unregister_driver);
50EXPORT_SYMBOL(serio_open);
51EXPORT_SYMBOL(serio_close);
52EXPORT_SYMBOL(serio_rescan);
53EXPORT_SYMBOL(serio_reconnect);
54
55/* 44/*
56 * serio_mutex protects entire serio subsystem and is taken every time 45 * serio_mutex protects entire serio subsystem and is taken every time
57 * serio port or driver registrered or unregistered. 46 * serio port or driver registrered or unregistered.
@@ -506,9 +495,9 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
506 495
507 retval = count; 496 retval = count;
508 if (!strncmp(buf, "manual", count)) { 497 if (!strncmp(buf, "manual", count)) {
509 serio->manual_bind = 1; 498 serio->manual_bind = true;
510 } else if (!strncmp(buf, "auto", count)) { 499 } else if (!strncmp(buf, "auto", count)) {
511 serio->manual_bind = 0; 500 serio->manual_bind = false;
512 } else { 501 } else {
513 retval = -EINVAL; 502 retval = -EINVAL;
514 } 503 }
@@ -581,7 +570,7 @@ static void serio_add_port(struct serio *serio)
581 "serio: device_add() failed for %s (%s), error: %d\n", 570 "serio: device_add() failed for %s (%s), error: %d\n",
582 serio->phys, serio->name, error); 571 serio->phys, serio->name, error);
583 else { 572 else {
584 serio->registered = 1; 573 serio->registered = true;
585 error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); 574 error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
586 if (error) 575 if (error)
587 printk(KERN_ERR 576 printk(KERN_ERR
@@ -617,7 +606,7 @@ static void serio_destroy_port(struct serio *serio)
617 if (serio->registered) { 606 if (serio->registered) {
618 sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); 607 sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
619 device_del(&serio->dev); 608 device_del(&serio->dev);
620 serio->registered = 0; 609 serio->registered = false;
621 } 610 }
622 611
623 list_del_init(&serio->node); 612 list_del_init(&serio->node);
@@ -692,11 +681,13 @@ void serio_rescan(struct serio *serio)
692{ 681{
693 serio_queue_event(serio, NULL, SERIO_RESCAN_PORT); 682 serio_queue_event(serio, NULL, SERIO_RESCAN_PORT);
694} 683}
684EXPORT_SYMBOL(serio_rescan);
695 685
696void serio_reconnect(struct serio *serio) 686void serio_reconnect(struct serio *serio)
697{ 687{
698 serio_queue_event(serio, NULL, SERIO_RECONNECT_CHAIN); 688 serio_queue_event(serio, NULL, SERIO_RECONNECT_CHAIN);
699} 689}
690EXPORT_SYMBOL(serio_reconnect);
700 691
701/* 692/*
702 * Submits register request to kseriod for subsequent execution. 693 * Submits register request to kseriod for subsequent execution.
@@ -707,6 +698,7 @@ void __serio_register_port(struct serio *serio, struct module *owner)
707 serio_init_port(serio); 698 serio_init_port(serio);
708 serio_queue_event(serio, owner, SERIO_REGISTER_PORT); 699 serio_queue_event(serio, owner, SERIO_REGISTER_PORT);
709} 700}
701EXPORT_SYMBOL(__serio_register_port);
710 702
711/* 703/*
712 * Synchronously unregisters serio port. 704 * Synchronously unregisters serio port.
@@ -718,6 +710,7 @@ void serio_unregister_port(struct serio *serio)
718 serio_destroy_port(serio); 710 serio_destroy_port(serio);
719 mutex_unlock(&serio_mutex); 711 mutex_unlock(&serio_mutex);
720} 712}
713EXPORT_SYMBOL(serio_unregister_port);
721 714
722/* 715/*
723 * Safely unregisters child port if one is present. 716 * Safely unregisters child port if one is present.
@@ -731,6 +724,7 @@ void serio_unregister_child_port(struct serio *serio)
731 } 724 }
732 mutex_unlock(&serio_mutex); 725 mutex_unlock(&serio_mutex);
733} 726}
727EXPORT_SYMBOL(serio_unregister_child_port);
734 728
735 729
736/* 730/*
@@ -756,9 +750,9 @@ static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char
756 750
757 retval = count; 751 retval = count;
758 if (!strncmp(buf, "manual", count)) { 752 if (!strncmp(buf, "manual", count)) {
759 serio_drv->manual_bind = 1; 753 serio_drv->manual_bind = true;
760 } else if (!strncmp(buf, "auto", count)) { 754 } else if (!strncmp(buf, "auto", count)) {
761 serio_drv->manual_bind = 0; 755 serio_drv->manual_bind = false;
762 } else { 756 } else {
763 retval = -EINVAL; 757 retval = -EINVAL;
764 } 758 }
@@ -818,7 +812,7 @@ static void serio_attach_driver(struct serio_driver *drv)
818 812
819int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) 813int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name)
820{ 814{
821 int manual_bind = drv->manual_bind; 815 bool manual_bind = drv->manual_bind;
822 int error; 816 int error;
823 817
824 drv->driver.bus = &serio_bus; 818 drv->driver.bus = &serio_bus;
@@ -829,7 +823,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
829 * Temporarily disable automatic binding because probing 823 * Temporarily disable automatic binding because probing
830 * takes long time and we are better off doing it in kseriod 824 * takes long time and we are better off doing it in kseriod
831 */ 825 */
832 drv->manual_bind = 1; 826 drv->manual_bind = true;
833 827
834 error = driver_register(&drv->driver); 828 error = driver_register(&drv->driver);
835 if (error) { 829 if (error) {
@@ -844,7 +838,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
844 * driver to free ports 838 * driver to free ports
845 */ 839 */
846 if (!manual_bind) { 840 if (!manual_bind) {
847 drv->manual_bind = 0; 841 drv->manual_bind = false;
848 error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER); 842 error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER);
849 if (error) { 843 if (error) {
850 driver_unregister(&drv->driver); 844 driver_unregister(&drv->driver);
@@ -854,6 +848,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
854 848
855 return 0; 849 return 0;
856} 850}
851EXPORT_SYMBOL(__serio_register_driver);
857 852
858void serio_unregister_driver(struct serio_driver *drv) 853void serio_unregister_driver(struct serio_driver *drv)
859{ 854{
@@ -861,7 +856,7 @@ void serio_unregister_driver(struct serio_driver *drv)
861 856
862 mutex_lock(&serio_mutex); 857 mutex_lock(&serio_mutex);
863 858
864 drv->manual_bind = 1; /* so serio_find_driver ignores it */ 859 drv->manual_bind = true; /* so serio_find_driver ignores it */
865 serio_remove_pending_events(drv); 860 serio_remove_pending_events(drv);
866 861
867start_over: 862start_over:
@@ -877,6 +872,7 @@ start_over:
877 driver_unregister(&drv->driver); 872 driver_unregister(&drv->driver);
878 mutex_unlock(&serio_mutex); 873 mutex_unlock(&serio_mutex);
879} 874}
875EXPORT_SYMBOL(serio_unregister_driver);
880 876
881static void serio_set_drv(struct serio *serio, struct serio_driver *drv) 877static void serio_set_drv(struct serio *serio, struct serio_driver *drv)
882{ 878{
@@ -937,11 +933,11 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
937#ifdef CONFIG_PM 933#ifdef CONFIG_PM
938static int serio_suspend(struct device *dev, pm_message_t state) 934static int serio_suspend(struct device *dev, pm_message_t state)
939{ 935{
940 if (dev->power.power_state.event != state.event) { 936 struct serio *serio = to_serio_port(dev);
941 if (state.event == PM_EVENT_SUSPEND)
942 serio_cleanup(to_serio_port(dev));
943 937
944 dev->power.power_state = state; 938 if (!serio->suspended && state.event == PM_EVENT_SUSPEND) {
939 serio_cleanup(serio);
940 serio->suspended = true;
945 } 941 }
946 942
947 return 0; 943 return 0;
@@ -949,14 +945,15 @@ static int serio_suspend(struct device *dev, pm_message_t state)
949 945
950static int serio_resume(struct device *dev) 946static int serio_resume(struct device *dev)
951{ 947{
948 struct serio *serio = to_serio_port(dev);
949
952 /* 950 /*
953 * Driver reconnect can take a while, so better let kseriod 951 * Driver reconnect can take a while, so better let kseriod
954 * deal with it. 952 * deal with it.
955 */ 953 */
956 if (dev->power.power_state.event != PM_EVENT_ON) { 954 if (serio->suspended) {
957 dev->power.power_state = PMSG_ON; 955 serio->suspended = false;
958 serio_queue_event(to_serio_port(dev), NULL, 956 serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
959 SERIO_RECONNECT_PORT);
960 } 957 }
961 958
962 return 0; 959 return 0;
@@ -974,6 +971,7 @@ int serio_open(struct serio *serio, struct serio_driver *drv)
974 } 971 }
975 return 0; 972 return 0;
976} 973}
974EXPORT_SYMBOL(serio_open);
977 975
978/* called from serio_driver->connect/disconnect methods under serio_mutex */ 976/* called from serio_driver->connect/disconnect methods under serio_mutex */
979void serio_close(struct serio *serio) 977void serio_close(struct serio *serio)
@@ -983,6 +981,7 @@ void serio_close(struct serio *serio)
983 981
984 serio_set_drv(serio, NULL); 982 serio_set_drv(serio, NULL);
985} 983}
984EXPORT_SYMBOL(serio_close);
986 985
987irqreturn_t serio_interrupt(struct serio *serio, 986irqreturn_t serio_interrupt(struct serio *serio,
988 unsigned char data, unsigned int dfl) 987 unsigned char data, unsigned int dfl)
@@ -1003,6 +1002,7 @@ irqreturn_t serio_interrupt(struct serio *serio,
1003 1002
1004 return ret; 1003 return ret;
1005} 1004}
1005EXPORT_SYMBOL(serio_interrupt);
1006 1006
1007static struct bus_type serio_bus = { 1007static struct bus_type serio_bus = {
1008 .name = "serio", 1008 .name = "serio",