From: Mark Pearson <mpearson-lenovo@squebb.ca>
To: mpearson-lenovo@squebb.ca
Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com,
ikepanhc@gmail.com, W_Armin@gmx.de,
andriy.shevchenko@linux.intel.com, linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org,
ibm-acpi-devel@lists.sourceforge.net
Subject: [PATCH 2/2] platform/x86: export thinkpad_acpi handles
Date: Wed, 7 May 2025 15:04:35 -0400 [thread overview]
Message-ID: <20250507190456.3004367-2-mpearson-lenovo@squebb.ca> (raw)
In-Reply-To: <20250507190456.3004367-1-mpearson-lenovo@squebb.ca>
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@squebb.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
next prev parent reply other threads:[~2025-05-07 19:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 19:04 [PATCH 1/2] platform/x86: Move Lenovo files into lenovo subdir Mark Pearson
2025-05-07 19:04 ` Mark Pearson [this message]
2025-05-08 14:03 ` [PATCH 2/2] platform/x86: export thinkpad_acpi handles Ilpo Järvinen
2025-05-08 14:28 ` Mark Pearson
2025-05-08 14:32 ` Andy Shevchenko
2025-05-08 15:02 ` Mark Pearson
2025-05-08 14:31 ` Andy Shevchenko
2025-05-08 15:01 ` Mark Pearson
2025-05-08 14:01 ` [PATCH 1/2] platform/x86: Move Lenovo files into lenovo subdir Ilpo Järvinen
2025-05-08 14:23 ` Mark Pearson
2025-05-08 14:27 ` Ilpo Järvinen
2025-05-08 14:29 ` Mark Pearson
2025-05-08 14:29 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250507190456.3004367-2-mpearson-lenovo@squebb.ca \
--to=mpearson-lenovo@squebb.ca \
--cc=W_Armin@gmx.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ikepanhc@gmail.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®