platform/x86: surfacepro3: Support for wakeup from suspend-to-idle
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 10 Jan 2018 12:26:35 +0000 (13:26 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 11 Jan 2018 17:54:50 +0000 (18:54 +0100)
Modify surface_button_notify() to make it wake up the system from
suspend-to-idle (by reporting "hard" wakeup events while suspended)
and add wakeup initialization to surface_button_add() for wakeup
events reported by this driver to work at all.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=198389
Reported-by: Valentin Manea <valy@mrs.ro>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Valentin Manea <valy@mrs.ro>
drivers/platform/x86/surfacepro3_button.c

index 6505c97705e1486391088baa8728aafd3540403a..1b491690ce07018bffbeaef42a3aee788102e3ac 100644 (file)
@@ -119,7 +119,7 @@ static void surface_button_notify(struct acpi_device *device, u32 event)
        if (key_code == KEY_RESERVED)
                return;
        if (pressed)
-               pm_wakeup_event(&device->dev, 0);
+               pm_wakeup_dev_event(&device->dev, 0, button->suspended);
        if (button->suspended)
                return;
        input_report_key(input, key_code, pressed?1:0);
@@ -185,6 +185,8 @@ static int surface_button_add(struct acpi_device *device)
        error = input_register_device(input);
        if (error)
                goto err_free_input;
+
+       device_init_wakeup(&device->dev, true);
        dev_info(&device->dev,
                        "%s [%s]\n", name, acpi_device_bid(device));
        return 0;