X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=drivers%2Finput%2Fserio%2Fi8042.c;h=ec195a36e8f66ea9f170698d5b6dbb34f6140649;hb=2874b391bd78a5b8cb84be67297a345fbdec4ac8;hp=c3fdfc1f342a2fdd38b35e1294adc77ca0d44d9e;hpb=59b8175c771040afcd4ad67022b0cc80c216b866;p=pandora-kernel.git 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); MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); #endif -__obsolete_setup("i8042_noaux"); -__obsolete_setup("i8042_nomux"); -__obsolete_setup("i8042_unlock"); -__obsolete_setup("i8042_reset"); -__obsolete_setup("i8042_direct"); -__obsolete_setup("i8042_dumbkbd"); - #include "i8042.h" static DEFINE_SPINLOCK(i8042_lock); @@ -724,7 +717,7 @@ static int i8042_controller_init(void) if (~i8042_read_status() & I8042_STR_KEYLOCK) { if (i8042_unlock) i8042_ctr |= I8042_CTR_IGNKEYLOCK; - else + else printk(KERN_WARNING "i8042.c: Warning: Keylock active.\n"); } spin_unlock_irqrestore(&i8042_lock, flags); @@ -790,27 +783,6 @@ static void i8042_controller_reset(void) } -/* - * Here we try to reset everything back to a state in which the BIOS will be - * able to talk to the hardware when rebooting. - */ - -static void i8042_controller_cleanup(void) -{ - int i; - -/* - * Reset anything that is connected to the ports. - */ - - for (i = 0; i < I8042_NUM_PORTS; i++) - if (i8042_ports[i].serio) - serio_cleanup(i8042_ports[i].serio); - - i8042_controller_reset(); -} - - /* * i8042_panic_blink() will flash the keyboard LEDs and is called when * kernel panics. Flashing LEDs is useful for users running X who may @@ -857,13 +829,22 @@ static long i8042_panic_blink(long count) #undef DELAY +#ifdef CONFIG_PM /* - * Here we try to restore the original BIOS settings + * Here we try to restore the original BIOS settings. We only want to + * do that once, when we really suspend, not when we taking memory + * snapshot for swsusp (in this case we'll perform required cleanup + * as part of shutdown process). */ static int i8042_suspend(struct platform_device *dev, pm_message_t state) { - i8042_controller_cleanup(); + if (dev->dev.power.power_state.event != state.event) { + if (state.event == PM_EVENT_SUSPEND) + i8042_controller_reset(); + + dev->dev.power.power_state = state; + } return 0; } @@ -877,6 +858,12 @@ static int i8042_resume(struct platform_device *dev) { int error; +/* + * Do not bother with restoring state if we haven't suspened yet + */ + if (dev->dev.power.power_state.event == PM_EVENT_ON) + return 0; + error = i8042_controller_check(); if (error) return error; @@ -886,9 +873,12 @@ static int i8042_resume(struct platform_device *dev) return error; /* - * Restore pre-resume CTR value and disable all ports + * Restore original CTR value and disable all ports */ + i8042_ctr = i8042_initial_ctr; + if (i8042_direct) + i8042_ctr &= ~I8042_CTR_XLATE; i8042_ctr |= I8042_CTR_AUXDIS | I8042_CTR_KBDDIS; i8042_ctr &= ~(I8042_CTR_AUXINT | I8042_CTR_KBDINT); if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { @@ -909,8 +899,11 @@ static int i8042_resume(struct platform_device *dev) i8042_interrupt(0, NULL); + dev->dev.power.power_state = PMSG_ON; + return 0; } +#endif /* CONFIG_PM */ /* * 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) static void i8042_shutdown(struct platform_device *dev) { - i8042_controller_cleanup(); + i8042_controller_reset(); } static int __devinit i8042_create_kbd_port(void) @@ -1154,9 +1147,11 @@ static struct platform_driver i8042_driver = { }, .probe = i8042_probe, .remove = __devexit_p(i8042_remove), + .shutdown = i8042_shutdown, +#ifdef CONFIG_PM .suspend = i8042_suspend, .resume = i8042_resume, - .shutdown = i8042_shutdown, +#endif }; static int __init i8042_init(void)