aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-19 17:10:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-19 17:10:54 -0400
commitc6cfaf4f86d9d15e5541adb3bb899d0b80f89ec7 (patch)
tree4d6906d1ac94afee030934116d304e9a5bbf311f /drivers/platform/x86
parenta9f8b38a071b468276a243ea3ea5a0636e848cf2 (diff)
parent0898782247ae533d1f4e47a06bc5d4870931b284 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov: - input core allows hardware drivers to specify a [more precise] timestamp (normally taken in top half) to better track velocity of contacts - input_dev instances now support "polling" mode so that drivers could use the same object for polled and interrupt-driven operation. The plan is to convert existing drivers and retire input_polled_dev API - a new driver for the FlySky FS-iA6B RC receiver - a refresh of BU21013 touchpad driver - w90x900 keyboard and touchpad drivers are removed as the platform is gone - assorted fixes * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (45 commits) Input: sidewinder - make array seq static const, makes object smaller Input: reset device timestamp on sync Input: bu21013_ts - switch to using standard touchscreen properties Input: bu21013_ts - switch to using MT-B (slotted) protocol Input: bu21013_ts - fix suspend when wake source Input: bu21013_ts - use interrupt from I2C client Input: bu21013_ts - remove support for platform data Input: bu21013_ts - convert to using managed resources Input: bu21013_ts - remove useless comments Input: bu21013_ts - annotate supend/resume methods as __maybe_unused Input: bu21013_ts - rename some variables Input: bu21013_ts - convert to use GPIO descriptors ARM: ux500: improve BU21013 touchpad bindings Input: i8042 - enable wakeup on a stable struct device Input: soc_button_array - use platform_device_register_resndata() Input: psmouse - drop all unneeded functions from mouse headers Input: add support for polling to input devices Input: wacom_w8001 - allocate additional space for 'phys' Input: cros_ec_keyb - add back missing mask for event_type Input: remove dev_err() usage after platform_get_irq() ...
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/surfacepro3_button.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/platform/x86/surfacepro3_button.c b/drivers/platform/x86/surfacepro3_button.c
index 47c6d000465a..ec515223f654 100644
--- a/drivers/platform/x86/surfacepro3_button.c
+++ b/drivers/platform/x86/surfacepro3_button.c
@@ -20,6 +20,12 @@
20#define SURFACE_BUTTON_OBJ_NAME "VGBI" 20#define SURFACE_BUTTON_OBJ_NAME "VGBI"
21#define SURFACE_BUTTON_DEVICE_NAME "Surface Pro 3/4 Buttons" 21#define SURFACE_BUTTON_DEVICE_NAME "Surface Pro 3/4 Buttons"
22 22
23#define MSHW0040_DSM_REVISION 0x01
24#define MSHW0040_DSM_GET_OMPR 0x02 // get OEM Platform Revision
25static const guid_t MSHW0040_DSM_UUID =
26 GUID_INIT(0x6fd05c69, 0xcde3, 0x49f4, 0x95, 0xed, 0xab, 0x16, 0x65,
27 0x49, 0x80, 0x35);
28
23#define SURFACE_BUTTON_NOTIFY_TABLET_MODE 0xc8 29#define SURFACE_BUTTON_NOTIFY_TABLET_MODE 0xc8
24 30
25#define SURFACE_BUTTON_NOTIFY_PRESS_POWER 0xc6 31#define SURFACE_BUTTON_NOTIFY_PRESS_POWER 0xc6
@@ -142,6 +148,44 @@ static int surface_button_resume(struct device *dev)
142} 148}
143#endif 149#endif
144 150
151/*
152 * Surface Pro 4 and Surface Book 2 / Surface Pro 2017 use the same device
153 * ID (MSHW0040) for the power/volume buttons. Make sure this is the right
154 * device by checking for the _DSM method and OEM Platform Revision.
155 *
156 * Returns true if the driver should bind to this device, i.e. the device is
157 * either MSWH0028 (Pro 3) or MSHW0040 on a Pro 4 or Book 1.
158 */
159static bool surface_button_check_MSHW0040(struct acpi_device *dev)
160{
161 acpi_handle handle = dev->handle;
162 union acpi_object *result;
163 u64 oem_platform_rev = 0; // valid revisions are nonzero
164
165 // get OEM platform revision
166 result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID,
167 MSHW0040_DSM_REVISION,
168 MSHW0040_DSM_GET_OMPR,
169 NULL, ACPI_TYPE_INTEGER);
170
171 /*
172 * If evaluating the _DSM fails, the method is not present. This means
173 * that we have either MSHW0028 or MSHW0040 on Pro 4 or Book 1, so we
174 * should use this driver. We use revision 0 indicating it is
175 * unavailable.
176 */
177
178 if (result) {
179 oem_platform_rev = result->integer.value;
180 ACPI_FREE(result);
181 }
182
183 dev_dbg(&dev->dev, "OEM Platform Revision %llu\n", oem_platform_rev);
184
185 return oem_platform_rev == 0;
186}
187
188
145static int surface_button_add(struct acpi_device *device) 189static int surface_button_add(struct acpi_device *device)
146{ 190{
147 struct surface_button *button; 191 struct surface_button *button;
@@ -154,6 +198,9 @@ static int surface_button_add(struct acpi_device *device)
154 strlen(SURFACE_BUTTON_OBJ_NAME))) 198 strlen(SURFACE_BUTTON_OBJ_NAME)))
155 return -ENODEV; 199 return -ENODEV;
156 200
201 if (!surface_button_check_MSHW0040(device))
202 return -ENODEV;
203
157 button = kzalloc(sizeof(struct surface_button), GFP_KERNEL); 204 button = kzalloc(sizeof(struct surface_button), GFP_KERNEL);
158 if (!button) 205 if (!button)
159 return -ENOMEM; 206 return -ENOMEM;