lkml.org 
[lkml]   [2021]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] Input: soc_button_array - support AMD variant Surface devices
Date
The power button on the AMD variant of the Surface Laptop uses the
same MSHW0040 device ID as the 5th and later generation of Surface
devices, however they report 0 for their OEM platform revision. As the
_DSM does not exist on the devices requiring special casing, check for
the existence of the _DSM to determine if soc_button_array should be
loaded.

Fixes: c394159310d0 ("Input: soc_button_array - add support for newer surface devices")
Co-developed-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Sachi King <nakato@nakato.io>
---
drivers/input/misc/soc_button_array.c | 33 +++++++--------------------
1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index cb6ec59a045d..4e8944f59def 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -474,8 +474,8 @@ static const struct soc_device_data soc_device_INT33D3 = {
* Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned
* devices use MSHW0040 for power and volume buttons, however the way they
* have to be addressed differs. Make sure that we only load this drivers
- * for the correct devices by checking the OEM Platform Revision provided by
- * the _DSM method.
+ * for the correct devices by checking if the OEM Platform Revision DSM call
+ * exists.
*/
#define MSHW0040_DSM_REVISION 0x01
#define MSHW0040_DSM_GET_OMPR 0x02 // get OEM Platform Revision
@@ -486,31 +486,14 @@ static const guid_t MSHW0040_DSM_UUID =
static int soc_device_check_MSHW0040(struct device *dev)
{
acpi_handle handle = ACPI_HANDLE(dev);
- union acpi_object *result;
- u64 oem_platform_rev = 0; // valid revisions are nonzero
-
- // get OEM platform revision
- result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID,
- MSHW0040_DSM_REVISION,
- MSHW0040_DSM_GET_OMPR, NULL,
- ACPI_TYPE_INTEGER);
-
- if (result) {
- oem_platform_rev = result->integer.value;
- ACPI_FREE(result);
- }
-
- /*
- * If the revision is zero here, the _DSM evaluation has failed. This
- * indicates that we have a Pro 4 or Book 1 and this driver should not
- * be used.
- */
- if (oem_platform_rev == 0)
- return -ENODEV;
+ bool exists;

- dev_dbg(dev, "OEM Platform Revision %llu\n", oem_platform_rev);
+ // check if OEM platform revision DSM call exists
+ exists = acpi_check_dsm(handle, &MSHW0040_DSM_UUID,
+ MSHW0040_DSM_REVISION,
+ BIT(MSHW0040_DSM_GET_OMPR));

- return 0;
+ return exists ? 0 : -ENODEV;
}

/*
--
2.33.0
\
 
 \ /
  Last update: 2021-11-09 09:12    [W:0.070 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site