[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250507190456.3004367-2-mpearson-lenovo@squebb.ca>
Date: Wed, 7 May 2025 15:04:35 -0400
From: Mark Pearson <mpearson-lenovo@...ebb.ca>
To: mpearson-lenovo@...ebb.ca
Cc: hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com,
ikepanhc@...il.com,
W_Armin@....de,
andriy.shevchenko@...ux.intel.com,
linux-kernel@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
ibm-acpi-devel@...ts.sourceforge.net
Subject: [PATCH 2/2] platform/x86: export thinkpad_acpi handles
Add API to be able to get the thinkpad_acpi various handles.
Will use this to start pulling some of the thinkpad_acpi functionality
into separate modules in the future.
Signed-off-by: Mark Pearson <mpearson-lenovo@...ebb.ca>
---
drivers/platform/x86/lenovo/thinkpad_acpi.c | 18 ++++++++++++++++++
include/linux/thinkpad_acpi.h | 17 +++++++++++++++++
2 files changed, 35 insertions(+)
create mode 100644 include/linux/thinkpad_acpi.h
diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c
index 7dd4abf47f61..0eb33b4c99cf 100644
--- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
+++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
@@ -67,6 +67,7 @@
#include <linux/string.h>
#include <linux/string_helpers.h>
#include <linux/sysfs.h>
+#include <linux/thinkpad_acpi.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <linux/units.h>
@@ -606,6 +607,23 @@ TPACPI_HANDLE(hkey, ec, "\\_SB.HKEY", /* 600e/x, 770e, 770x */
* ACPI helpers
*/
+int tp_acpi_get_handle(enum tp_acpi_handle_id handle_id, acpi_handle *handle)
+{
+ switch (handle_id) {
+ case TP_ROOT_HANDLE:
+ *handle = root_handle;
+ return 0;
+ case TP_EC_HANDLE:
+ *handle = ec_handle;
+ return 0;
+ case TP_HKEY_HANDLE:
+ *handle = hkey_handle;
+ return 0;
+ }
+ return -ENODEV;
+}
+EXPORT_SYMBOL_GPL(tp_acpi_get_handle);
+
static int acpi_evalf(acpi_handle handle,
int *res, char *method, char *fmt, ...)
{
diff --git a/include/linux/thinkpad_acpi.h b/include/linux/thinkpad_acpi.h
new file mode 100644
index 000000000000..eb5273464658
--- /dev/null
+++ b/include/linux/thinkpad_acpi.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Thinkpad ACPI driver API
+ */
+
+#ifndef _TP_ACPI_H_
+#define _TP_ACPI_H_
+
+enum tp_acpi_handle_id {
+ TP_ROOT_HANDLE,
+ TP_EC_HANDLE,
+ TP_HKEY_HANDLE,
+};
+
+int tp_acpi_get_handle(enum tp_acpi_handle_id handle_id, acpi_handle *handle);
+
+#endif /* _TP_ACPI_H */
--
2.43.0
Powered by blists - more mailing lists