summarylogtreecommitdiffstats
path: root/0004-surface-pro4-button.patch
diff options
context:
space:
mode:
Diffstat (limited to '0004-surface-pro4-button.patch')
-rw-r--r--0004-surface-pro4-button.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/0004-surface-pro4-button.patch b/0004-surface-pro4-button.patch
new file mode 100644
index 000000000000..b6aec4362ea2
--- /dev/null
+++ b/0004-surface-pro4-button.patch
@@ -0,0 +1,80 @@
+diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
+index 1089eaa..ea76d67 100644
+--- a/drivers/platform/x86/Kconfig
++++ b/drivers/platform/x86/Kconfig
+@@ -940,8 +940,8 @@ config INTEL_PMC_IPC
+ with other entities in the CPU.
+
+ config SURFACE_PRO3_BUTTON
+- tristate "Power/home/volume buttons driver for Microsoft Surface Pro 3 tablet"
++ tristate "Power/home/volume buttons driver for Microsoft Surface Pro 3/4 tablet"
+ depends on ACPI && INPUT
+ ---help---
+- This driver handles the power/home/volume buttons on the Microsoft Surface Pro 3 tablet.
++ This driver handles the power/home/volume buttons on the Microsoft Surface Pro 3/4 tablet.
+ endif # X86_PLATFORM_DEVICES
+diff --git a/drivers/platform/x86/surfacepro3_button.c b/drivers/platform/x86/surfacepro3_button.c
+index f7dade3..6505c97 100644
+--- a/drivers/platform/x86/surfacepro3_button.c
++++ b/drivers/platform/x86/surfacepro3_button.c
+@@ -1,6 +1,6 @@
+ /*
+ * power/home/volume button support for
+- * Microsoft Surface Pro 3 tablet.
++ * Microsoft Surface Pro 3/4 tablet.
+ *
+ * Copyright (c) 2015 Intel Corporation.
+ * All rights reserved.
+@@ -19,9 +19,12 @@
+ #include <linux/acpi.h>
+ #include <acpi/button.h>
+
+-#define SURFACE_BUTTON_HID "MSHW0028"
++#define SURFACE_PRO3_BUTTON_HID "MSHW0028"
++#define SURFACE_PRO4_BUTTON_HID "MSHW0040"
+ #define SURFACE_BUTTON_OBJ_NAME "VGBI"
+-#define SURFACE_BUTTON_DEVICE_NAME "Surface Pro 3 Buttons"
++#define SURFACE_BUTTON_DEVICE_NAME "Surface Pro 3/4 Buttons"
++
++#define SURFACE_BUTTON_NOTIFY_TABLET_MODE 0xc8
+
+ #define SURFACE_BUTTON_NOTIFY_PRESS_POWER 0xc6
+ #define SURFACE_BUTTON_NOTIFY_RELEASE_POWER 0xc7
+@@ -32,7 +35,7 @@
+ #define SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_UP 0xc0
+ #define SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_UP 0xc1
+
+-#define SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_DOWN 0xc2
++#define SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_DOWN 0xc2
+ #define SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_DOWN 0xc3
+
+ ACPI_MODULE_NAME("surface pro 3 button");
+@@ -54,7 +57,8 @@ MODULE_LICENSE("GPL v2");
+ * acpi_driver.
+ */
+ static const struct acpi_device_id surface_button_device_ids[] = {
+- {SURFACE_BUTTON_HID, 0},
++ {SURFACE_PRO3_BUTTON_HID, 0},
++ {SURFACE_PRO4_BUTTON_HID, 0},
+ {"", 0},
+ };
+ MODULE_DEVICE_TABLE(acpi, surface_button_device_ids);
+@@ -103,13 +107,16 @@ static void surface_button_notify(struct acpi_device *device, u32 event)
+ case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_DOWN:
+ key_code = KEY_VOLUMEDOWN;
+ break;
++ case SURFACE_BUTTON_NOTIFY_TABLET_MODE:
++ dev_warn_once(&device->dev, "Tablet mode is not supported\n");
++ break;
+ default:
+ dev_info_ratelimited(&device->dev,
+- "Unsupported event [0x%x]\n", event);
++ "Unsupported event [0x%x]\n", event);
+ break;
+ }
+ input = button->input;
+- if (KEY_RESERVED == key_code)
++ if (key_code == KEY_RESERVED)
+ return;
+ if (pressed)
+ pm_wakeup_event(&device->dev, 0);