diff options
Diffstat (limited to 'drivers/input/serio')
-rw-r--r-- | drivers/input/serio/Kconfig | 2 | ||||
-rw-r--r-- | drivers/input/serio/ambakmi.c | 2 | ||||
-rw-r--r-- | drivers/input/serio/at32psif.c | 2 | ||||
-rw-r--r-- | drivers/input/serio/hp_sdc_mlc.c | 2 | ||||
-rw-r--r-- | drivers/input/serio/i8042-x86ia64io.h | 71 | ||||
-rw-r--r-- | drivers/input/serio/i8042.c | 242 | ||||
-rw-r--r-- | drivers/input/serio/libps2.c | 15 | ||||
-rw-r--r-- | drivers/input/serio/serio.c | 23 |
8 files changed, 221 insertions, 138 deletions
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index da3c3a5d2689..c4b3fbd1a80f 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig | |||
@@ -192,7 +192,7 @@ config SERIO_RAW | |||
192 | 192 | ||
193 | config SERIO_XILINX_XPS_PS2 | 193 | config SERIO_XILINX_XPS_PS2 |
194 | tristate "Xilinx XPS PS/2 Controller Support" | 194 | tristate "Xilinx XPS PS/2 Controller Support" |
195 | depends on PPC | 195 | depends on PPC || MICROBLAZE |
196 | help | 196 | help |
197 | This driver supports XPS PS/2 IP from the Xilinx EDK on | 197 | This driver supports XPS PS/2 IP from the Xilinx EDK on |
198 | PowerPC platform. | 198 | PowerPC platform. |
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index a28c06d686e1..89b394183a75 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c | |||
@@ -135,7 +135,7 @@ static int amba_kmi_probe(struct amba_device *dev, struct amba_id *id) | |||
135 | io->dev.parent = &dev->dev; | 135 | io->dev.parent = &dev->dev; |
136 | 136 | ||
137 | kmi->io = io; | 137 | kmi->io = io; |
138 | kmi->base = ioremap(dev->res.start, KMI_SIZE); | 138 | kmi->base = ioremap(dev->res.start, resource_size(&dev->res)); |
139 | if (!kmi->base) { | 139 | if (!kmi->base) { |
140 | ret = -ENOMEM; | 140 | ret = -ENOMEM; |
141 | goto out; | 141 | goto out; |
diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c index 41fda8c67b1e..a6fb7a3dcc46 100644 --- a/drivers/input/serio/at32psif.c +++ b/drivers/input/serio/at32psif.c | |||
@@ -231,7 +231,7 @@ static int __init psif_probe(struct platform_device *pdev) | |||
231 | goto out_free_io; | 231 | goto out_free_io; |
232 | } | 232 | } |
233 | 233 | ||
234 | psif->regs = ioremap(regs->start, regs->end - regs->start + 1); | 234 | psif->regs = ioremap(regs->start, resource_size(regs)); |
235 | if (!psif->regs) { | 235 | if (!psif->regs) { |
236 | ret = -ENOMEM; | 236 | ret = -ENOMEM; |
237 | dev_dbg(&pdev->dev, "could not map I/O memory\n"); | 237 | dev_dbg(&pdev->dev, "could not map I/O memory\n"); |
diff --git a/drivers/input/serio/hp_sdc_mlc.c b/drivers/input/serio/hp_sdc_mlc.c index b587e2d576ac..820e51673b26 100644 --- a/drivers/input/serio/hp_sdc_mlc.c +++ b/drivers/input/serio/hp_sdc_mlc.c | |||
@@ -296,7 +296,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc) | |||
296 | priv->tseq[3] = 0; | 296 | priv->tseq[3] = 0; |
297 | if (mlc->opacket & HIL_CTRL_APE) { | 297 | if (mlc->opacket & HIL_CTRL_APE) { |
298 | priv->tseq[3] |= HP_SDC_LPC_APE_IPF; | 298 | priv->tseq[3] |= HP_SDC_LPC_APE_IPF; |
299 | down_trylock(&mlc->csem); | 299 | BUG_ON(down_trylock(&mlc->csem)); |
300 | } | 300 | } |
301 | enqueue: | 301 | enqueue: |
302 | hp_sdc_enqueue_transaction(&priv->trans); | 302 | hp_sdc_enqueue_transaction(&priv->trans); |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index ccbf23ece8e3..a39bc4eb902b 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -457,6 +457,34 @@ static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = { | |||
457 | }, | 457 | }, |
458 | { } | 458 | { } |
459 | }; | 459 | }; |
460 | |||
461 | static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = { | ||
462 | { | ||
463 | .ident = "Portable", | ||
464 | .matches = { | ||
465 | DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */ | ||
466 | }, | ||
467 | }, | ||
468 | { | ||
469 | .ident = "Laptop", | ||
470 | .matches = { | ||
471 | DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */ | ||
472 | }, | ||
473 | }, | ||
474 | { | ||
475 | .ident = "Notebook", | ||
476 | .matches = { | ||
477 | DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */ | ||
478 | }, | ||
479 | }, | ||
480 | { | ||
481 | .ident = "Sub-Notebook", | ||
482 | .matches = { | ||
483 | DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */ | ||
484 | }, | ||
485 | }, | ||
486 | { } | ||
487 | }; | ||
460 | #endif | 488 | #endif |
461 | 489 | ||
462 | /* | 490 | /* |
@@ -530,9 +558,9 @@ static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = { | |||
530 | #ifdef CONFIG_PNP | 558 | #ifdef CONFIG_PNP |
531 | #include <linux/pnp.h> | 559 | #include <linux/pnp.h> |
532 | 560 | ||
533 | static int i8042_pnp_kbd_registered; | 561 | static bool i8042_pnp_kbd_registered; |
534 | static unsigned int i8042_pnp_kbd_devices; | 562 | static unsigned int i8042_pnp_kbd_devices; |
535 | static int i8042_pnp_aux_registered; | 563 | static bool i8042_pnp_aux_registered; |
536 | static unsigned int i8042_pnp_aux_devices; | 564 | static unsigned int i8042_pnp_aux_devices; |
537 | 565 | ||
538 | static int i8042_pnp_command_reg; | 566 | static int i8042_pnp_command_reg; |
@@ -620,12 +648,12 @@ static struct pnp_driver i8042_pnp_aux_driver = { | |||
620 | static void i8042_pnp_exit(void) | 648 | static void i8042_pnp_exit(void) |
621 | { | 649 | { |
622 | if (i8042_pnp_kbd_registered) { | 650 | if (i8042_pnp_kbd_registered) { |
623 | i8042_pnp_kbd_registered = 0; | 651 | i8042_pnp_kbd_registered = false; |
624 | pnp_unregister_driver(&i8042_pnp_kbd_driver); | 652 | pnp_unregister_driver(&i8042_pnp_kbd_driver); |
625 | } | 653 | } |
626 | 654 | ||
627 | if (i8042_pnp_aux_registered) { | 655 | if (i8042_pnp_aux_registered) { |
628 | i8042_pnp_aux_registered = 0; | 656 | i8042_pnp_aux_registered = false; |
629 | pnp_unregister_driver(&i8042_pnp_aux_driver); | 657 | pnp_unregister_driver(&i8042_pnp_aux_driver); |
630 | } | 658 | } |
631 | } | 659 | } |
@@ -633,12 +661,12 @@ static void i8042_pnp_exit(void) | |||
633 | static int __init i8042_pnp_init(void) | 661 | static int __init i8042_pnp_init(void) |
634 | { | 662 | { |
635 | char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; | 663 | char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; |
636 | int pnp_data_busted = 0; | 664 | int pnp_data_busted = false; |
637 | int err; | 665 | int err; |
638 | 666 | ||
639 | #ifdef CONFIG_X86 | 667 | #ifdef CONFIG_X86 |
640 | if (dmi_check_system(i8042_dmi_nopnp_table)) | 668 | if (dmi_check_system(i8042_dmi_nopnp_table)) |
641 | i8042_nopnp = 1; | 669 | i8042_nopnp = true; |
642 | #endif | 670 | #endif |
643 | 671 | ||
644 | if (i8042_nopnp) { | 672 | if (i8042_nopnp) { |
@@ -648,11 +676,11 @@ static int __init i8042_pnp_init(void) | |||
648 | 676 | ||
649 | err = pnp_register_driver(&i8042_pnp_kbd_driver); | 677 | err = pnp_register_driver(&i8042_pnp_kbd_driver); |
650 | if (!err) | 678 | if (!err) |
651 | i8042_pnp_kbd_registered = 1; | 679 | i8042_pnp_kbd_registered = true; |
652 | 680 | ||
653 | err = pnp_register_driver(&i8042_pnp_aux_driver); | 681 | err = pnp_register_driver(&i8042_pnp_aux_driver); |
654 | if (!err) | 682 | if (!err) |
655 | i8042_pnp_aux_registered = 1; | 683 | i8042_pnp_aux_registered = true; |
656 | 684 | ||
657 | if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) { | 685 | if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) { |
658 | i8042_pnp_exit(); | 686 | i8042_pnp_exit(); |
@@ -680,9 +708,9 @@ static int __init i8042_pnp_init(void) | |||
680 | 708 | ||
681 | #if defined(__ia64__) | 709 | #if defined(__ia64__) |
682 | if (!i8042_pnp_kbd_devices) | 710 | if (!i8042_pnp_kbd_devices) |
683 | i8042_nokbd = 1; | 711 | i8042_nokbd = true; |
684 | if (!i8042_pnp_aux_devices) | 712 | if (!i8042_pnp_aux_devices) |
685 | i8042_noaux = 1; | 713 | i8042_noaux = true; |
686 | #endif | 714 | #endif |
687 | 715 | ||
688 | if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) && | 716 | if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) && |
@@ -693,7 +721,7 @@ static int __init i8042_pnp_init(void) | |||
693 | "using default %#x\n", | 721 | "using default %#x\n", |
694 | i8042_pnp_data_reg, i8042_data_reg); | 722 | i8042_pnp_data_reg, i8042_data_reg); |
695 | i8042_pnp_data_reg = i8042_data_reg; | 723 | i8042_pnp_data_reg = i8042_data_reg; |
696 | pnp_data_busted = 1; | 724 | pnp_data_busted = true; |
697 | } | 725 | } |
698 | 726 | ||
699 | if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) && | 727 | if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) && |
@@ -704,7 +732,7 @@ static int __init i8042_pnp_init(void) | |||
704 | "using default %#x\n", | 732 | "using default %#x\n", |
705 | i8042_pnp_command_reg, i8042_command_reg); | 733 | i8042_pnp_command_reg, i8042_command_reg); |
706 | i8042_pnp_command_reg = i8042_command_reg; | 734 | i8042_pnp_command_reg = i8042_command_reg; |
707 | pnp_data_busted = 1; | 735 | pnp_data_busted = true; |
708 | } | 736 | } |
709 | 737 | ||
710 | if (!i8042_nokbd && !i8042_pnp_kbd_irq) { | 738 | if (!i8042_nokbd && !i8042_pnp_kbd_irq) { |
@@ -712,7 +740,7 @@ static int __init i8042_pnp_init(void) | |||
712 | "PNP: PS/2 controller doesn't have KBD irq; " | 740 | "PNP: PS/2 controller doesn't have KBD irq; " |
713 | "using default %d\n", i8042_kbd_irq); | 741 | "using default %d\n", i8042_kbd_irq); |
714 | i8042_pnp_kbd_irq = i8042_kbd_irq; | 742 | i8042_pnp_kbd_irq = i8042_kbd_irq; |
715 | pnp_data_busted = 1; | 743 | pnp_data_busted = true; |
716 | } | 744 | } |
717 | 745 | ||
718 | if (!i8042_noaux && !i8042_pnp_aux_irq) { | 746 | if (!i8042_noaux && !i8042_pnp_aux_irq) { |
@@ -721,7 +749,7 @@ static int __init i8042_pnp_init(void) | |||
721 | "PNP: PS/2 appears to have AUX port disabled, " | 749 | "PNP: PS/2 appears to have AUX port disabled, " |
722 | "if this is incorrect please boot with " | 750 | "if this is incorrect please boot with " |
723 | "i8042.nopnp\n"); | 751 | "i8042.nopnp\n"); |
724 | i8042_noaux = 1; | 752 | i8042_noaux = true; |
725 | } else { | 753 | } else { |
726 | printk(KERN_WARNING | 754 | printk(KERN_WARNING |
727 | "PNP: PS/2 controller doesn't have AUX irq; " | 755 | "PNP: PS/2 controller doesn't have AUX irq; " |
@@ -735,6 +763,11 @@ static int __init i8042_pnp_init(void) | |||
735 | i8042_kbd_irq = i8042_pnp_kbd_irq; | 763 | i8042_kbd_irq = i8042_pnp_kbd_irq; |
736 | i8042_aux_irq = i8042_pnp_aux_irq; | 764 | i8042_aux_irq = i8042_pnp_aux_irq; |
737 | 765 | ||
766 | #ifdef CONFIG_X86 | ||
767 | i8042_bypass_aux_irq_test = !pnp_data_busted && | ||
768 | dmi_check_system(i8042_dmi_laptop_table); | ||
769 | #endif | ||
770 | |||
738 | return 0; | 771 | return 0; |
739 | } | 772 | } |
740 | 773 | ||
@@ -763,21 +796,21 @@ static int __init i8042_platform_init(void) | |||
763 | return retval; | 796 | return retval; |
764 | 797 | ||
765 | #if defined(__ia64__) | 798 | #if defined(__ia64__) |
766 | i8042_reset = 1; | 799 | i8042_reset = true; |
767 | #endif | 800 | #endif |
768 | 801 | ||
769 | #ifdef CONFIG_X86 | 802 | #ifdef CONFIG_X86 |
770 | if (dmi_check_system(i8042_dmi_reset_table)) | 803 | if (dmi_check_system(i8042_dmi_reset_table)) |
771 | i8042_reset = 1; | 804 | i8042_reset = true; |
772 | 805 | ||
773 | if (dmi_check_system(i8042_dmi_noloop_table)) | 806 | if (dmi_check_system(i8042_dmi_noloop_table)) |
774 | i8042_noloop = 1; | 807 | i8042_noloop = true; |
775 | 808 | ||
776 | if (dmi_check_system(i8042_dmi_nomux_table)) | 809 | if (dmi_check_system(i8042_dmi_nomux_table)) |
777 | i8042_nomux = 1; | 810 | i8042_nomux = true; |
778 | 811 | ||
779 | if (dmi_check_system(i8042_dmi_dritek_table)) | 812 | if (dmi_check_system(i8042_dmi_dritek_table)) |
780 | i8042_dritek = 1; | 813 | i8042_dritek = true; |
781 | #endif /* CONFIG_X86 */ | 814 | #endif /* CONFIG_X86 */ |
782 | 815 | ||
783 | return retval; | 816 | return retval; |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 582245c497eb..eb3ff94af58c 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -28,35 +28,35 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); | |||
28 | MODULE_DESCRIPTION("i8042 keyboard and mouse controller driver"); | 28 | MODULE_DESCRIPTION("i8042 keyboard and mouse controller driver"); |
29 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
30 | 30 | ||
31 | static unsigned int i8042_nokbd; | 31 | static bool i8042_nokbd; |
32 | module_param_named(nokbd, i8042_nokbd, bool, 0); | 32 | module_param_named(nokbd, i8042_nokbd, bool, 0); |
33 | MODULE_PARM_DESC(nokbd, "Do not probe or use KBD port."); | 33 | MODULE_PARM_DESC(nokbd, "Do not probe or use KBD port."); |
34 | 34 | ||
35 | static unsigned int i8042_noaux; | 35 | static bool i8042_noaux; |
36 | module_param_named(noaux, i8042_noaux, bool, 0); | 36 | module_param_named(noaux, i8042_noaux, bool, 0); |
37 | MODULE_PARM_DESC(noaux, "Do not probe or use AUX (mouse) port."); | 37 | MODULE_PARM_DESC(noaux, "Do not probe or use AUX (mouse) port."); |
38 | 38 | ||
39 | static unsigned int i8042_nomux; | 39 | static bool i8042_nomux; |
40 | module_param_named(nomux, i8042_nomux, bool, 0); | 40 | module_param_named(nomux, i8042_nomux, bool, 0); |
41 | MODULE_PARM_DESC(nomux, "Do not check whether an active multiplexing conrtoller is present."); | 41 | MODULE_PARM_DESC(nomux, "Do not check whether an active multiplexing conrtoller is present."); |
42 | 42 | ||
43 | static unsigned int i8042_unlock; | 43 | static bool i8042_unlock; |
44 | module_param_named(unlock, i8042_unlock, bool, 0); | 44 | module_param_named(unlock, i8042_unlock, bool, 0); |
45 | MODULE_PARM_DESC(unlock, "Ignore keyboard lock."); | 45 | MODULE_PARM_DESC(unlock, "Ignore keyboard lock."); |
46 | 46 | ||
47 | static unsigned int i8042_reset; | 47 | static bool i8042_reset; |
48 | module_param_named(reset, i8042_reset, bool, 0); | 48 | module_param_named(reset, i8042_reset, bool, 0); |
49 | MODULE_PARM_DESC(reset, "Reset controller during init and cleanup."); | 49 | MODULE_PARM_DESC(reset, "Reset controller during init and cleanup."); |
50 | 50 | ||
51 | static unsigned int i8042_direct; | 51 | static bool i8042_direct; |
52 | module_param_named(direct, i8042_direct, bool, 0); | 52 | module_param_named(direct, i8042_direct, bool, 0); |
53 | MODULE_PARM_DESC(direct, "Put keyboard port into non-translated mode."); | 53 | MODULE_PARM_DESC(direct, "Put keyboard port into non-translated mode."); |
54 | 54 | ||
55 | static unsigned int i8042_dumbkbd; | 55 | static bool i8042_dumbkbd; |
56 | module_param_named(dumbkbd, i8042_dumbkbd, bool, 0); | 56 | module_param_named(dumbkbd, i8042_dumbkbd, bool, 0); |
57 | MODULE_PARM_DESC(dumbkbd, "Pretend that controller can only read data from keyboard"); | 57 | MODULE_PARM_DESC(dumbkbd, "Pretend that controller can only read data from keyboard"); |
58 | 58 | ||
59 | static unsigned int i8042_noloop; | 59 | static bool i8042_noloop; |
60 | module_param_named(noloop, i8042_noloop, bool, 0); | 60 | module_param_named(noloop, i8042_noloop, bool, 0); |
61 | MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port"); | 61 | MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port"); |
62 | 62 | ||
@@ -65,24 +65,26 @@ module_param_named(panicblink, i8042_blink_frequency, uint, 0600); | |||
65 | MODULE_PARM_DESC(panicblink, "Frequency with which keyboard LEDs should blink when kernel panics"); | 65 | MODULE_PARM_DESC(panicblink, "Frequency with which keyboard LEDs should blink when kernel panics"); |
66 | 66 | ||
67 | #ifdef CONFIG_X86 | 67 | #ifdef CONFIG_X86 |
68 | static unsigned int i8042_dritek; | 68 | static bool i8042_dritek; |
69 | module_param_named(dritek, i8042_dritek, bool, 0); | 69 | module_param_named(dritek, i8042_dritek, bool, 0); |
70 | MODULE_PARM_DESC(dritek, "Force enable the Dritek keyboard extension"); | 70 | MODULE_PARM_DESC(dritek, "Force enable the Dritek keyboard extension"); |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #ifdef CONFIG_PNP | 73 | #ifdef CONFIG_PNP |
74 | static int i8042_nopnp; | 74 | static bool i8042_nopnp; |
75 | module_param_named(nopnp, i8042_nopnp, bool, 0); | 75 | module_param_named(nopnp, i8042_nopnp, bool, 0); |
76 | MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings"); | 76 | MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings"); |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #define DEBUG | 79 | #define DEBUG |
80 | #ifdef DEBUG | 80 | #ifdef DEBUG |
81 | static int i8042_debug; | 81 | static bool i8042_debug; |
82 | module_param_named(debug, i8042_debug, bool, 0600); | 82 | module_param_named(debug, i8042_debug, bool, 0600); |
83 | MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); | 83 | MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | static bool i8042_bypass_aux_irq_test; | ||
87 | |||
86 | #include "i8042.h" | 88 | #include "i8042.h" |
87 | 89 | ||
88 | static DEFINE_SPINLOCK(i8042_lock); | 90 | static DEFINE_SPINLOCK(i8042_lock); |
@@ -90,7 +92,7 @@ static DEFINE_SPINLOCK(i8042_lock); | |||
90 | struct i8042_port { | 92 | struct i8042_port { |
91 | struct serio *serio; | 93 | struct serio *serio; |
92 | int irq; | 94 | int irq; |
93 | unsigned char exists; | 95 | bool exists; |
94 | signed char mux; | 96 | signed char mux; |
95 | }; | 97 | }; |
96 | 98 | ||
@@ -103,9 +105,9 @@ static struct i8042_port i8042_ports[I8042_NUM_PORTS]; | |||
103 | 105 | ||
104 | static unsigned char i8042_initial_ctr; | 106 | static unsigned char i8042_initial_ctr; |
105 | static unsigned char i8042_ctr; | 107 | static unsigned char i8042_ctr; |
106 | static unsigned char i8042_mux_present; | 108 | static bool i8042_mux_present; |
107 | static unsigned char i8042_kbd_irq_registered; | 109 | static bool i8042_kbd_irq_registered; |
108 | static unsigned char i8042_aux_irq_registered; | 110 | static bool i8042_aux_irq_registered; |
109 | static unsigned char i8042_suppress_kbd_ack; | 111 | static unsigned char i8042_suppress_kbd_ack; |
110 | static struct platform_device *i8042_platform_device; | 112 | static struct platform_device *i8042_platform_device; |
111 | 113 | ||
@@ -262,6 +264,49 @@ static int i8042_aux_write(struct serio *serio, unsigned char c) | |||
262 | I8042_CMD_MUX_SEND + port->mux); | 264 | I8042_CMD_MUX_SEND + port->mux); |
263 | } | 265 | } |
264 | 266 | ||
267 | |||
268 | /* | ||
269 | * i8042_aux_close attempts to clear AUX or KBD port state by disabling | ||
270 | * and then re-enabling it. | ||
271 | */ | ||
272 | |||
273 | static void i8042_port_close(struct serio *serio) | ||
274 | { | ||
275 | int irq_bit; | ||
276 | int disable_bit; | ||
277 | const char *port_name; | ||
278 | |||
279 | if (serio == i8042_ports[I8042_AUX_PORT_NO].serio) { | ||
280 | irq_bit = I8042_CTR_AUXINT; | ||
281 | disable_bit = I8042_CTR_AUXDIS; | ||
282 | port_name = "AUX"; | ||
283 | } else { | ||
284 | irq_bit = I8042_CTR_KBDINT; | ||
285 | disable_bit = I8042_CTR_KBDDIS; | ||
286 | port_name = "KBD"; | ||
287 | } | ||
288 | |||
289 | i8042_ctr &= ~irq_bit; | ||
290 | if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) | ||
291 | printk(KERN_WARNING | ||
292 | "i8042.c: Can't write CTR while closing %s port.\n", | ||
293 | port_name); | ||
294 | |||
295 | udelay(50); | ||
296 | |||
297 | i8042_ctr &= ~disable_bit; | ||
298 | i8042_ctr |= irq_bit; | ||
299 | if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) | ||
300 | printk(KERN_ERR "i8042.c: Can't reactivate %s port.\n", | ||
301 | port_name); | ||
302 | |||
303 | /* | ||
304 | * See if there is any data appeared while we were messing with | ||
305 | * port state. | ||
306 | */ | ||
307 | i8042_interrupt(0, NULL); | ||
308 | } | ||
309 | |||
265 | /* | 310 | /* |
266 | * i8042_start() is called by serio core when port is about to finish | 311 | * i8042_start() is called by serio core when port is about to finish |
267 | * registering. It will mark port as existing so i8042_interrupt can | 312 | * registering. It will mark port as existing so i8042_interrupt can |
@@ -271,7 +316,7 @@ static int i8042_start(struct serio *serio) | |||
271 | { | 316 | { |
272 | struct i8042_port *port = serio->port_data; | 317 | struct i8042_port *port = serio->port_data; |
273 | 318 | ||
274 | port->exists = 1; | 319 | port->exists = true; |
275 | mb(); | 320 | mb(); |
276 | return 0; | 321 | return 0; |
277 | } | 322 | } |
@@ -285,7 +330,7 @@ static void i8042_stop(struct serio *serio) | |||
285 | { | 330 | { |
286 | struct i8042_port *port = serio->port_data; | 331 | struct i8042_port *port = serio->port_data; |
287 | 332 | ||
288 | port->exists = 0; | 333 | port->exists = false; |
289 | 334 | ||
290 | /* | 335 | /* |
291 | * We synchronize with both AUX and KBD IRQs because there is | 336 | * We synchronize with both AUX and KBD IRQs because there is |
@@ -391,7 +436,7 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id) | |||
391 | } | 436 | } |
392 | 437 | ||
393 | /* | 438 | /* |
394 | * i8042_enable_kbd_port enables keybaord port on chip | 439 | * i8042_enable_kbd_port enables keyboard port on chip |
395 | */ | 440 | */ |
396 | 441 | ||
397 | static int i8042_enable_kbd_port(void) | 442 | static int i8042_enable_kbd_port(void) |
@@ -447,14 +492,15 @@ static int i8042_enable_mux_ports(void) | |||
447 | } | 492 | } |
448 | 493 | ||
449 | /* | 494 | /* |
450 | * i8042_set_mux_mode checks whether the controller has an active | 495 | * i8042_set_mux_mode checks whether the controller has an |
451 | * multiplexor and puts the chip into Multiplexed (1) or Legacy (0) mode. | 496 | * active multiplexor and puts the chip into Multiplexed (true) |
497 | * or Legacy (false) mode. | ||
452 | */ | 498 | */ |
453 | 499 | ||
454 | static int i8042_set_mux_mode(unsigned int mode, unsigned char *mux_version) | 500 | static int i8042_set_mux_mode(bool multiplex, unsigned char *mux_version) |
455 | { | 501 | { |
456 | 502 | ||
457 | unsigned char param; | 503 | unsigned char param, val; |
458 | /* | 504 | /* |
459 | * Get rid of bytes in the queue. | 505 | * Get rid of bytes in the queue. |
460 | */ | 506 | */ |
@@ -466,14 +512,21 @@ static int i8042_set_mux_mode(unsigned int mode, unsigned char *mux_version) | |||
466 | * mouse interface, the last should be version. | 512 | * mouse interface, the last should be version. |
467 | */ | 513 | */ |
468 | 514 | ||
469 | param = 0xf0; | 515 | param = val = 0xf0; |
470 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xf0) | 516 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != val) |
471 | return -1; | 517 | return -1; |
472 | param = mode ? 0x56 : 0xf6; | 518 | param = val = multiplex ? 0x56 : 0xf6; |
473 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != (mode ? 0x56 : 0xf6)) | 519 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != val) |
474 | return -1; | 520 | return -1; |
475 | param = mode ? 0xa4 : 0xa5; | 521 | param = val = multiplex ? 0xa4 : 0xa5; |
476 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == (mode ? 0xa4 : 0xa5)) | 522 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == val) |
523 | return -1; | ||
524 | |||
525 | /* | ||
526 | * Workaround for interference with USB Legacy emulation | ||
527 | * that causes a v10.12 MUX to be found. | ||
528 | */ | ||
529 | if (param == 0xac) | ||
477 | return -1; | 530 | return -1; |
478 | 531 | ||
479 | if (mux_version) | 532 | if (mux_version) |
@@ -488,18 +541,11 @@ static int i8042_set_mux_mode(unsigned int mode, unsigned char *mux_version) | |||
488 | * LCS/Telegraphics. | 541 | * LCS/Telegraphics. |
489 | */ | 542 | */ |
490 | 543 | ||
491 | static int __devinit i8042_check_mux(void) | 544 | static int __init i8042_check_mux(void) |
492 | { | 545 | { |
493 | unsigned char mux_version; | 546 | unsigned char mux_version; |
494 | 547 | ||
495 | if (i8042_set_mux_mode(1, &mux_version)) | 548 | if (i8042_set_mux_mode(true, &mux_version)) |
496 | return -1; | ||
497 | |||
498 | /* | ||
499 | * Workaround for interference with USB Legacy emulation | ||
500 | * that causes a v10.12 MUX to be found. | ||
501 | */ | ||
502 | if (mux_version == 0xAC) | ||
503 | return -1; | 549 | return -1; |
504 | 550 | ||
505 | printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n", | 551 | printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n", |
@@ -516,7 +562,7 @@ static int __devinit i8042_check_mux(void) | |||
516 | return -EIO; | 562 | return -EIO; |
517 | } | 563 | } |
518 | 564 | ||
519 | i8042_mux_present = 1; | 565 | i8042_mux_present = true; |
520 | 566 | ||
521 | return 0; | 567 | return 0; |
522 | } | 568 | } |
@@ -524,10 +570,10 @@ static int __devinit i8042_check_mux(void) | |||
524 | /* | 570 | /* |
525 | * The following is used to test AUX IRQ delivery. | 571 | * The following is used to test AUX IRQ delivery. |
526 | */ | 572 | */ |
527 | static struct completion i8042_aux_irq_delivered __devinitdata; | 573 | static struct completion i8042_aux_irq_delivered __initdata; |
528 | static int i8042_irq_being_tested __devinitdata; | 574 | static bool i8042_irq_being_tested __initdata; |
529 | 575 | ||
530 | static irqreturn_t __devinit i8042_aux_test_irq(int irq, void *dev_id) | 576 | static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id) |
531 | { | 577 | { |
532 | unsigned long flags; | 578 | unsigned long flags; |
533 | unsigned char str, data; | 579 | unsigned char str, data; |
@@ -552,7 +598,7 @@ static irqreturn_t __devinit i8042_aux_test_irq(int irq, void *dev_id) | |||
552 | * verifies success by readinng CTR. Used when testing for presence of AUX | 598 | * verifies success by readinng CTR. Used when testing for presence of AUX |
553 | * port. | 599 | * port. |
554 | */ | 600 | */ |
555 | static int __devinit i8042_toggle_aux(int on) | 601 | static int __init i8042_toggle_aux(bool on) |
556 | { | 602 | { |
557 | unsigned char param; | 603 | unsigned char param; |
558 | int i; | 604 | int i; |
@@ -580,11 +626,11 @@ static int __devinit i8042_toggle_aux(int on) | |||
580 | * the presence of an AUX interface. | 626 | * the presence of an AUX interface. |
581 | */ | 627 | */ |
582 | 628 | ||
583 | static int __devinit i8042_check_aux(void) | 629 | static int __init i8042_check_aux(void) |
584 | { | 630 | { |
585 | int retval = -1; | 631 | int retval = -1; |
586 | int irq_registered = 0; | 632 | bool irq_registered = false; |
587 | int aux_loop_broken = 0; | 633 | bool aux_loop_broken = false; |
588 | unsigned long flags; | 634 | unsigned long flags; |
589 | unsigned char param; | 635 | unsigned char param; |
590 | 636 | ||
@@ -621,19 +667,19 @@ static int __devinit i8042_check_aux(void) | |||
621 | * mark it as broken | 667 | * mark it as broken |
622 | */ | 668 | */ |
623 | if (!retval) | 669 | if (!retval) |
624 | aux_loop_broken = 1; | 670 | aux_loop_broken = true; |
625 | } | 671 | } |
626 | 672 | ||
627 | /* | 673 | /* |
628 | * Bit assignment test - filters out PS/2 i8042's in AT mode | 674 | * Bit assignment test - filters out PS/2 i8042's in AT mode |
629 | */ | 675 | */ |
630 | 676 | ||
631 | if (i8042_toggle_aux(0)) { | 677 | if (i8042_toggle_aux(false)) { |
632 | printk(KERN_WARNING "Failed to disable AUX port, but continuing anyway... Is this a SiS?\n"); | 678 | printk(KERN_WARNING "Failed to disable AUX port, but continuing anyway... Is this a SiS?\n"); |
633 | printk(KERN_WARNING "If AUX port is really absent please use the 'i8042.noaux' option.\n"); | 679 | printk(KERN_WARNING "If AUX port is really absent please use the 'i8042.noaux' option.\n"); |
634 | } | 680 | } |
635 | 681 | ||
636 | if (i8042_toggle_aux(1)) | 682 | if (i8042_toggle_aux(true)) |
637 | return -1; | 683 | return -1; |
638 | 684 | ||
639 | /* | 685 | /* |
@@ -641,7 +687,7 @@ static int __devinit i8042_check_aux(void) | |||
641 | * used it for a PCI card or somethig else. | 687 | * used it for a PCI card or somethig else. |
642 | */ | 688 | */ |
643 | 689 | ||
644 | if (i8042_noloop || aux_loop_broken) { | 690 | if (i8042_noloop || i8042_bypass_aux_irq_test || aux_loop_broken) { |
645 | /* | 691 | /* |
646 | * Without LOOP command we can't test AUX IRQ delivery. Assume the port | 692 | * Without LOOP command we can't test AUX IRQ delivery. Assume the port |
647 | * is working and hope we are right. | 693 | * is working and hope we are right. |
@@ -654,7 +700,7 @@ static int __devinit i8042_check_aux(void) | |||
654 | "i8042", i8042_platform_device)) | 700 | "i8042", i8042_platform_device)) |
655 | goto out; | 701 | goto out; |
656 | 702 | ||
657 | irq_registered = 1; | 703 | irq_registered = true; |
658 | 704 | ||
659 | if (i8042_enable_aux_port()) | 705 | if (i8042_enable_aux_port()) |
660 | goto out; | 706 | goto out; |
@@ -662,7 +708,7 @@ static int __devinit i8042_check_aux(void) | |||
662 | spin_lock_irqsave(&i8042_lock, flags); | 708 | spin_lock_irqsave(&i8042_lock, flags); |
663 | 709 | ||
664 | init_completion(&i8042_aux_irq_delivered); | 710 | init_completion(&i8042_aux_irq_delivered); |
665 | i8042_irq_being_tested = 1; | 711 | i8042_irq_being_tested = true; |
666 | 712 | ||
667 | param = 0xa5; | 713 | param = 0xa5; |
668 | retval = __i8042_command(¶m, I8042_CMD_AUX_LOOP & 0xf0ff); | 714 | retval = __i8042_command(¶m, I8042_CMD_AUX_LOOP & 0xf0ff); |
@@ -799,7 +845,7 @@ static int i8042_controller_init(void) | |||
799 | */ | 845 | */ |
800 | 846 | ||
801 | if (~i8042_ctr & I8042_CTR_XLATE) | 847 | if (~i8042_ctr & I8042_CTR_XLATE) |
802 | i8042_direct = 1; | 848 | i8042_direct = true; |
803 | 849 | ||
804 | /* | 850 | /* |
805 | * Set nontranslated mode for the kbd interface if requested by an option. | 851 | * Set nontranslated mode for the kbd interface if requested by an option. |
@@ -839,12 +885,15 @@ static void i8042_controller_reset(void) | |||
839 | i8042_ctr |= I8042_CTR_KBDDIS | I8042_CTR_AUXDIS; | 885 | i8042_ctr |= I8042_CTR_KBDDIS | I8042_CTR_AUXDIS; |
840 | i8042_ctr &= ~(I8042_CTR_KBDINT | I8042_CTR_AUXINT); | 886 | i8042_ctr &= ~(I8042_CTR_KBDINT | I8042_CTR_AUXINT); |
841 | 887 | ||
888 | if (i8042_command(&i8042_initial_ctr, I8042_CMD_CTL_WCTR)) | ||
889 | printk(KERN_WARNING "i8042.c: Can't write CTR while resetting.\n"); | ||
890 | |||
842 | /* | 891 | /* |
843 | * Disable MUX mode if present. | 892 | * Disable MUX mode if present. |
844 | */ | 893 | */ |
845 | 894 | ||
846 | if (i8042_mux_present) | 895 | if (i8042_mux_present) |
847 | i8042_set_mux_mode(0, NULL); | 896 | i8042_set_mux_mode(false, NULL); |
848 | 897 | ||
849 | /* | 898 | /* |
850 | * Reset the controller if requested. | 899 | * Reset the controller if requested. |
@@ -923,41 +972,27 @@ static void i8042_dritek_enable(void) | |||
923 | 972 | ||
924 | #ifdef CONFIG_PM | 973 | #ifdef CONFIG_PM |
925 | 974 | ||
926 | static bool i8042_suspended; | ||
927 | |||
928 | /* | 975 | /* |
929 | * Here we try to restore the original BIOS settings. We only want to | 976 | * Here we try to restore the original BIOS settings to avoid |
930 | * do that once, when we really suspend, not when we taking memory | 977 | * upsetting it. |
931 | * snapshot for swsusp (in this case we'll perform required cleanup | ||
932 | * as part of shutdown process). | ||
933 | */ | 978 | */ |
934 | 979 | ||
935 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) | 980 | static int i8042_pm_reset(struct device *dev) |
936 | { | 981 | { |
937 | if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) | 982 | i8042_controller_reset(); |
938 | i8042_controller_reset(); | ||
939 | |||
940 | i8042_suspended = state.event == PM_EVENT_SUSPEND || | ||
941 | state.event == PM_EVENT_FREEZE; | ||
942 | 983 | ||
943 | return 0; | 984 | return 0; |
944 | } | 985 | } |
945 | 986 | ||
946 | |||
947 | /* | 987 | /* |
948 | * Here we try to reset everything back to a state in which suspended | 988 | * Here we try to reset everything back to a state we had |
989 | * before suspending. | ||
949 | */ | 990 | */ |
950 | 991 | ||
951 | static int i8042_resume(struct platform_device *dev) | 992 | static int i8042_pm_restore(struct device *dev) |
952 | { | 993 | { |
953 | int error; | 994 | int error; |
954 | 995 | ||
955 | /* | ||
956 | * Do not bother with restoring state if we haven't suspened yet | ||
957 | */ | ||
958 | if (!i8042_suspended) | ||
959 | return 0; | ||
960 | |||
961 | error = i8042_controller_check(); | 996 | error = i8042_controller_check(); |
962 | if (error) | 997 | if (error) |
963 | return error; | 998 | return error; |
@@ -991,7 +1026,7 @@ static int i8042_resume(struct platform_device *dev) | |||
991 | #endif | 1026 | #endif |
992 | 1027 | ||
993 | if (i8042_mux_present) { | 1028 | if (i8042_mux_present) { |
994 | if (i8042_set_mux_mode(1, NULL) || i8042_enable_mux_ports()) | 1029 | if (i8042_set_mux_mode(true, NULL) || i8042_enable_mux_ports()) |
995 | printk(KERN_WARNING | 1030 | printk(KERN_WARNING |
996 | "i8042: failed to resume active multiplexor, " | 1031 | "i8042: failed to resume active multiplexor, " |
997 | "mouse won't work.\n"); | 1032 | "mouse won't work.\n"); |
@@ -1001,11 +1036,18 @@ static int i8042_resume(struct platform_device *dev) | |||
1001 | if (i8042_ports[I8042_KBD_PORT_NO].serio) | 1036 | if (i8042_ports[I8042_KBD_PORT_NO].serio) |
1002 | i8042_enable_kbd_port(); | 1037 | i8042_enable_kbd_port(); |
1003 | 1038 | ||
1004 | i8042_suspended = false; | ||
1005 | i8042_interrupt(0, NULL); | 1039 | i8042_interrupt(0, NULL); |
1006 | 1040 | ||
1007 | return 0; | 1041 | return 0; |
1008 | } | 1042 | } |
1043 | |||
1044 | static const struct dev_pm_ops i8042_pm_ops = { | ||
1045 | .suspend = i8042_pm_reset, | ||
1046 | .resume = i8042_pm_restore, | ||
1047 | .poweroff = i8042_pm_reset, | ||
1048 | .restore = i8042_pm_restore, | ||
1049 | }; | ||
1050 | |||
1009 | #endif /* CONFIG_PM */ | 1051 | #endif /* CONFIG_PM */ |
1010 | 1052 | ||
1011 | /* | 1053 | /* |
@@ -1018,7 +1060,7 @@ static void i8042_shutdown(struct platform_device *dev) | |||
1018 | i8042_controller_reset(); | 1060 | i8042_controller_reset(); |
1019 | } | 1061 | } |
1020 | 1062 | ||
1021 | static int __devinit i8042_create_kbd_port(void) | 1063 | static int __init i8042_create_kbd_port(void) |
1022 | { | 1064 | { |
1023 | struct serio *serio; | 1065 | struct serio *serio; |
1024 | struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; | 1066 | struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; |
@@ -1031,6 +1073,7 @@ static int __devinit i8042_create_kbd_port(void) | |||
1031 | serio->write = i8042_dumbkbd ? NULL : i8042_kbd_write; | 1073 | serio->write = i8042_dumbkbd ? NULL : i8042_kbd_write; |
1032 | serio->start = i8042_start; | 1074 | serio->start = i8042_start; |
1033 | serio->stop = i8042_stop; | 1075 | serio->stop = i8042_stop; |
1076 | serio->close = i8042_port_close; | ||
1034 | serio->port_data = port; | 1077 | serio->port_data = port; |
1035 | serio->dev.parent = &i8042_platform_device->dev; | 1078 | serio->dev.parent = &i8042_platform_device->dev; |
1036 | strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name)); | 1079 | strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name)); |
@@ -1042,7 +1085,7 @@ static int __devinit i8042_create_kbd_port(void) | |||
1042 | return 0; | 1085 | return 0; |
1043 | } | 1086 | } |
1044 | 1087 | ||
1045 | static int __devinit i8042_create_aux_port(int idx) | 1088 | static int __init i8042_create_aux_port(int idx) |
1046 | { | 1089 | { |
1047 | struct serio *serio; | 1090 | struct serio *serio; |
1048 | int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx; | 1091 | int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx; |
@@ -1061,6 +1104,7 @@ static int __devinit i8042_create_aux_port(int idx) | |||
1061 | if (idx < 0) { | 1104 | if (idx < 0) { |
1062 | strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name)); | 1105 | strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name)); |
1063 | strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys)); | 1106 | strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys)); |
1107 | serio->close = i8042_port_close; | ||
1064 | } else { | 1108 | } else { |
1065 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); | 1109 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); |
1066 | snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1); | 1110 | snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1); |
@@ -1073,13 +1117,13 @@ static int __devinit i8042_create_aux_port(int idx) | |||
1073 | return 0; | 1117 | return 0; |
1074 | } | 1118 | } |
1075 | 1119 | ||
1076 | static void __devinit i8042_free_kbd_port(void) | 1120 | static void __init i8042_free_kbd_port(void) |
1077 | { | 1121 | { |
1078 | kfree(i8042_ports[I8042_KBD_PORT_NO].serio); | 1122 | kfree(i8042_ports[I8042_KBD_PORT_NO].serio); |
1079 | i8042_ports[I8042_KBD_PORT_NO].serio = NULL; | 1123 | i8042_ports[I8042_KBD_PORT_NO].serio = NULL; |
1080 | } | 1124 | } |
1081 | 1125 | ||
1082 | static void __devinit i8042_free_aux_ports(void) | 1126 | static void __init i8042_free_aux_ports(void) |
1083 | { | 1127 | { |
1084 | int i; | 1128 | int i; |
1085 | 1129 | ||
@@ -1089,7 +1133,7 @@ static void __devinit i8042_free_aux_ports(void) | |||
1089 | } | 1133 | } |
1090 | } | 1134 | } |
1091 | 1135 | ||
1092 | static void __devinit i8042_register_ports(void) | 1136 | static void __init i8042_register_ports(void) |
1093 | { | 1137 | { |
1094 | int i; | 1138 | int i; |
1095 | 1139 | ||
@@ -1124,10 +1168,10 @@ static void i8042_free_irqs(void) | |||
1124 | if (i8042_kbd_irq_registered) | 1168 | if (i8042_kbd_irq_registered) |
1125 | free_irq(I8042_KBD_IRQ, i8042_platform_device); | 1169 | free_irq(I8042_KBD_IRQ, i8042_platform_device); |
1126 | 1170 | ||
1127 | i8042_aux_irq_registered = i8042_kbd_irq_registered = 0; | 1171 | i8042_aux_irq_registered = i8042_kbd_irq_registered = false; |
1128 | } | 1172 | } |
1129 | 1173 | ||
1130 | static int __devinit i8042_setup_aux(void) | 1174 | static int __init i8042_setup_aux(void) |
1131 | { | 1175 | { |
1132 | int (*aux_enable)(void); | 1176 | int (*aux_enable)(void); |
1133 | int error; | 1177 | int error; |
@@ -1158,7 +1202,7 @@ static int __devinit i8042_setup_aux(void) | |||
1158 | if (aux_enable()) | 1202 | if (aux_enable()) |
1159 | goto err_free_irq; | 1203 | goto err_free_irq; |
1160 | 1204 | ||
1161 | i8042_aux_irq_registered = 1; | 1205 | i8042_aux_irq_registered = true; |
1162 | return 0; | 1206 | return 0; |
1163 | 1207 | ||
1164 | err_free_irq: | 1208 | err_free_irq: |
@@ -1168,7 +1212,7 @@ static int __devinit i8042_setup_aux(void) | |||
1168 | return error; | 1212 | return error; |
1169 | } | 1213 | } |
1170 | 1214 | ||
1171 | static int __devinit i8042_setup_kbd(void) | 1215 | static int __init i8042_setup_kbd(void) |
1172 | { | 1216 | { |
1173 | int error; | 1217 | int error; |
1174 | 1218 | ||
@@ -1185,7 +1229,7 @@ static int __devinit i8042_setup_kbd(void) | |||
1185 | if (error) | 1229 | if (error) |
1186 | goto err_free_irq; | 1230 | goto err_free_irq; |
1187 | 1231 | ||
1188 | i8042_kbd_irq_registered = 1; | 1232 | i8042_kbd_irq_registered = true; |
1189 | return 0; | 1233 | return 0; |
1190 | 1234 | ||
1191 | err_free_irq: | 1235 | err_free_irq: |
@@ -1195,7 +1239,7 @@ static int __devinit i8042_setup_kbd(void) | |||
1195 | return error; | 1239 | return error; |
1196 | } | 1240 | } |
1197 | 1241 | ||
1198 | static int __devinit i8042_probe(struct platform_device *dev) | 1242 | static int __init i8042_probe(struct platform_device *dev) |
1199 | { | 1243 | { |
1200 | int error; | 1244 | int error; |
1201 | 1245 | ||
@@ -1251,14 +1295,12 @@ static struct platform_driver i8042_driver = { | |||
1251 | .driver = { | 1295 | .driver = { |
1252 | .name = "i8042", | 1296 | .name = "i8042", |
1253 | .owner = THIS_MODULE, | 1297 | .owner = THIS_MODULE, |
1298 | #ifdef CONFIG_PM | ||
1299 | .pm = &i8042_pm_ops, | ||
1300 | #endif | ||
1254 | }, | 1301 | }, |
1255 | .probe = i8042_probe, | ||
1256 | .remove = __devexit_p(i8042_remove), | 1302 | .remove = __devexit_p(i8042_remove), |
1257 | .shutdown = i8042_shutdown, | 1303 | .shutdown = i8042_shutdown, |
1258 | #ifdef CONFIG_PM | ||
1259 | .suspend = i8042_suspend, | ||
1260 | .resume = i8042_resume, | ||
1261 | #endif | ||
1262 | }; | 1304 | }; |
1263 | 1305 | ||
1264 | static int __init i8042_init(void) | 1306 | static int __init i8042_init(void) |
@@ -1275,28 +1317,28 @@ static int __init i8042_init(void) | |||
1275 | if (err) | 1317 | if (err) |
1276 | goto err_platform_exit; | 1318 | goto err_platform_exit; |
1277 | 1319 | ||
1278 | err = platform_driver_register(&i8042_driver); | ||
1279 | if (err) | ||
1280 | goto err_platform_exit; | ||
1281 | |||
1282 | i8042_platform_device = platform_device_alloc("i8042", -1); | 1320 | i8042_platform_device = platform_device_alloc("i8042", -1); |
1283 | if (!i8042_platform_device) { | 1321 | if (!i8042_platform_device) { |
1284 | err = -ENOMEM; | 1322 | err = -ENOMEM; |
1285 | goto err_unregister_driver; | 1323 | goto err_platform_exit; |
1286 | } | 1324 | } |
1287 | 1325 | ||
1288 | err = platform_device_add(i8042_platform_device); | 1326 | err = platform_device_add(i8042_platform_device); |
1289 | if (err) | 1327 | if (err) |
1290 | goto err_free_device; | 1328 | goto err_free_device; |
1291 | 1329 | ||
1330 | err = platform_driver_probe(&i8042_driver, i8042_probe); | ||
1331 | if (err) | ||
1332 | goto err_del_device; | ||
1333 | |||
1292 | panic_blink = i8042_panic_blink; | 1334 | panic_blink = i8042_panic_blink; |
1293 | 1335 | ||
1294 | return 0; | 1336 | return 0; |
1295 | 1337 | ||
1338 | err_del_device: | ||
1339 | platform_device_del(i8042_platform_device); | ||
1296 | err_free_device: | 1340 | err_free_device: |
1297 | platform_device_put(i8042_platform_device); | 1341 | platform_device_put(i8042_platform_device); |
1298 | err_unregister_driver: | ||
1299 | platform_driver_unregister(&i8042_driver); | ||
1300 | err_platform_exit: | 1342 | err_platform_exit: |
1301 | i8042_platform_exit(); | 1343 | i8042_platform_exit(); |
1302 | 1344 | ||
@@ -1305,8 +1347,8 @@ static int __init i8042_init(void) | |||
1305 | 1347 | ||
1306 | static void __exit i8042_exit(void) | 1348 | static void __exit i8042_exit(void) |
1307 | { | 1349 | { |
1308 | platform_device_unregister(i8042_platform_device); | ||
1309 | platform_driver_unregister(&i8042_driver); | 1350 | platform_driver_unregister(&i8042_driver); |
1351 | platform_device_unregister(i8042_platform_device); | ||
1310 | i8042_platform_exit(); | 1352 | i8042_platform_exit(); |
1311 | 1353 | ||
1312 | panic_blink = NULL; | 1354 | panic_blink = NULL; |
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index be5bbbb8ae4e..3a95b508bf27 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c | |||
@@ -161,7 +161,7 @@ static int ps2_adjust_timeout(struct ps2dev *ps2dev, int command, int timeout) | |||
161 | * ps2_command() can only be called from a process context | 161 | * ps2_command() can only be called from a process context |
162 | */ | 162 | */ |
163 | 163 | ||
164 | int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | 164 | int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) |
165 | { | 165 | { |
166 | int timeout; | 166 | int timeout; |
167 | int send = (command >> 12) & 0xf; | 167 | int send = (command >> 12) & 0xf; |
@@ -179,8 +179,6 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
179 | return -1; | 179 | return -1; |
180 | } | 180 | } |
181 | 181 | ||
182 | mutex_lock(&ps2dev->cmd_mutex); | ||
183 | |||
184 | serio_pause_rx(ps2dev->serio); | 182 | serio_pause_rx(ps2dev->serio); |
185 | ps2dev->flags = command == PS2_CMD_GETID ? PS2_FLAG_WAITID : 0; | 183 | ps2dev->flags = command == PS2_CMD_GETID ? PS2_FLAG_WAITID : 0; |
186 | ps2dev->cmdcnt = receive; | 184 | ps2dev->cmdcnt = receive; |
@@ -231,7 +229,18 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
231 | ps2dev->flags = 0; | 229 | ps2dev->flags = 0; |
232 | serio_continue_rx(ps2dev->serio); | 230 | serio_continue_rx(ps2dev->serio); |
233 | 231 | ||
232 | return rc; | ||
233 | } | ||
234 | EXPORT_SYMBOL(__ps2_command); | ||
235 | |||
236 | int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | ||
237 | { | ||
238 | int rc; | ||
239 | |||
240 | mutex_lock(&ps2dev->cmd_mutex); | ||
241 | rc = __ps2_command(ps2dev, param, command); | ||
234 | mutex_unlock(&ps2dev->cmd_mutex); | 242 | mutex_unlock(&ps2dev->cmd_mutex); |
243 | |||
235 | return rc; | 244 | return rc; |
236 | } | 245 | } |
237 | EXPORT_SYMBOL(ps2_command); | 246 | EXPORT_SYMBOL(ps2_command); |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index d66f4944f2a0..0236f0d5fd91 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -931,15 +931,11 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
931 | #endif /* CONFIG_HOTPLUG */ | 931 | #endif /* CONFIG_HOTPLUG */ |
932 | 932 | ||
933 | #ifdef CONFIG_PM | 933 | #ifdef CONFIG_PM |
934 | static int serio_suspend(struct device *dev, pm_message_t state) | 934 | static int serio_suspend(struct device *dev) |
935 | { | 935 | { |
936 | struct serio *serio = to_serio_port(dev); | 936 | struct serio *serio = to_serio_port(dev); |
937 | 937 | ||
938 | if (!serio->suspended && state.event == PM_EVENT_SUSPEND) | 938 | serio_cleanup(serio); |
939 | serio_cleanup(serio); | ||
940 | |||
941 | serio->suspended = state.event == PM_EVENT_SUSPEND || | ||
942 | state.event == PM_EVENT_FREEZE; | ||
943 | 939 | ||
944 | return 0; | 940 | return 0; |
945 | } | 941 | } |
@@ -952,13 +948,17 @@ static int serio_resume(struct device *dev) | |||
952 | * Driver reconnect can take a while, so better let kseriod | 948 | * Driver reconnect can take a while, so better let kseriod |
953 | * deal with it. | 949 | * deal with it. |
954 | */ | 950 | */ |
955 | if (serio->suspended) { | 951 | serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT); |
956 | serio->suspended = false; | ||
957 | serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT); | ||
958 | } | ||
959 | 952 | ||
960 | return 0; | 953 | return 0; |
961 | } | 954 | } |
955 | |||
956 | static const struct dev_pm_ops serio_pm_ops = { | ||
957 | .suspend = serio_suspend, | ||
958 | .resume = serio_resume, | ||
959 | .poweroff = serio_suspend, | ||
960 | .restore = serio_resume, | ||
961 | }; | ||
962 | #endif /* CONFIG_PM */ | 962 | #endif /* CONFIG_PM */ |
963 | 963 | ||
964 | /* called from serio_driver->connect/disconnect methods under serio_mutex */ | 964 | /* called from serio_driver->connect/disconnect methods under serio_mutex */ |
@@ -1015,8 +1015,7 @@ static struct bus_type serio_bus = { | |||
1015 | .remove = serio_driver_remove, | 1015 | .remove = serio_driver_remove, |
1016 | .shutdown = serio_shutdown, | 1016 | .shutdown = serio_shutdown, |
1017 | #ifdef CONFIG_PM | 1017 | #ifdef CONFIG_PM |
1018 | .suspend = serio_suspend, | 1018 | .pm = &serio_pm_ops, |
1019 | .resume = serio_resume, | ||
1020 | #endif | 1019 | #endif |
1021 | }; | 1020 | }; |
1022 | 1021 | ||