diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index b695094290ab..20ff2bed3917 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -432,6 +432,20 @@ static int i8042_start(struct serio *serio) { struct i8042_port *port = serio->port_data; + device_set_wakeup_capable(&serio->dev, true); + + /* + * On platforms using suspend-to-idle, allow the keyboard to + * wake up the system from sleep by enabling keyboard wakeups + * by default. This is consistent with keyboard wakeup + * behavior on many platforms using suspend-to-RAM (ACPI S3) + * by default. + */ + if (pm_suspend_default_s2idle() && + serio == i8042_ports[I8042_KBD_PORT_NO].serio) { + device_set_wakeup_enable(&serio->dev, true); + } + spin_lock_irq(&i8042_lock); port->exists = true; spin_unlock_irq(&i8042_lock); @@ -1397,17 +1411,6 @@ static void __init i8042_register_ports(void) (unsigned long) I8042_COMMAND_REG, i8042_ports[i].irq); serio_register_port(serio); - device_set_wakeup_capable(&serio->dev, true); - - /* - * On platforms using suspend-to-idle, allow the keyboard to - * wake up the system from sleep by enabling keyboard wakeups - * by default. This is consistent with keyboard wakeup - * behavior on many platforms using suspend-to-RAM (ACPI S3) - * by default. - */ - if (pm_suspend_default_s2idle() && i == I8042_KBD_PORT_NO) - device_set_wakeup_enable(&serio->dev, true); } }