aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2010-05-16 18:45:43 -0400
committerHenrique de Moraes Holschuh <hmh@hmh.eng.br>2010-05-16 18:45:43 -0400
commit437e470c4ca818c97426afa3a67fbd7e34cffe00 (patch)
tree771a16de2854ae31f6fe5ae544f32f7106367480 /drivers/platform
parent38e11cdec90f1dd7355db4aed8a1857258e99485 (diff)
thinkpad-acpi: detect EC node using its HID (v2)
Use the EC HID (PNP0C09) to locate its main node, instead of a static list. Suggested-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c53
1 files changed, 41 insertions, 12 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index b03cb3e04582..877a7802e830 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -129,6 +129,7 @@ enum {
129 129
130/* ACPI HIDs */ 130/* ACPI HIDs */
131#define TPACPI_ACPI_HKEY_HID "IBM0068" 131#define TPACPI_ACPI_HKEY_HID "IBM0068"
132#define TPACPI_ACPI_EC_HID "PNP0C09"
132 133
133/* Input IDs */ 134/* Input IDs */
134#define TPACPI_HKEY_INPUT_PRODUCT 0x5054 /* "TP" */ 135#define TPACPI_HKEY_INPUT_PRODUCT 0x5054 /* "TP" */
@@ -511,6 +512,7 @@ static inline bool __pure __init tpacpi_is_ibm(void)
511 */ 512 */
512 513
513static acpi_handle root_handle; 514static acpi_handle root_handle;
515static acpi_handle ec_handle;
514 516
515#define TPACPI_HANDLE(object, parent, paths...) \ 517#define TPACPI_HANDLE(object, parent, paths...) \
516 static acpi_handle object##_handle; \ 518 static acpi_handle object##_handle; \
@@ -518,16 +520,6 @@ static acpi_handle root_handle;
518 static char *object##_path; \ 520 static char *object##_path; \
519 static char *object##_paths[] = { paths } 521 static char *object##_paths[] = { paths }
520 522
521TPACPI_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC0", /* 240, 240x */
522 "\\_SB.PCI.ISA.EC", /* 570 */
523 "\\_SB.PCI0.ISA0.EC0", /* 600e/x, 770e, 770x */
524 "\\_SB.PCI0.ISA.EC", /* A21e, A2xm/p, T20-22, X20-21 */
525 "\\_SB.PCI0.AD4S.EC0", /* i1400, R30 */
526 "\\_SB.PCI0.ICH3.EC0", /* R31 */
527 "\\_SB.PCI0.LPC0.EC", /* X100e and a few others */
528 "\\_SB.PCI0.LPC.EC", /* all others */
529 );
530
531TPACPI_HANDLE(ecrd, ec, "ECRD"); /* 570 */ 523TPACPI_HANDLE(ecrd, ec, "ECRD"); /* 570 */
532TPACPI_HANDLE(ecwr, ec, "ECWR"); /* 570 */ 524TPACPI_HANDLE(ecwr, ec, "ECWR"); /* 570 */
533 525
@@ -708,6 +700,43 @@ static void drv_acpi_handle_init(char *name,
708 *handle = NULL; 700 *handle = NULL;
709} 701}
710 702
703static acpi_status __init tpacpi_acpi_handle_locate_callback(acpi_handle handle,
704 u32 level, void *context, void **return_value)
705{
706 *(acpi_handle *)return_value = handle;
707
708 return AE_CTRL_TERMINATE;
709}
710
711static void __init tpacpi_acpi_handle_locate(const char *name,
712 const char *hid,
713 acpi_handle *handle)
714{
715 acpi_status status;
716 acpi_handle device_found;
717
718 BUG_ON(!name || !hid || !handle);
719 vdbg_printk(TPACPI_DBG_INIT,
720 "trying to locate ACPI handle for %s, using HID %s\n",
721 name, hid);
722
723 memset(&device_found, 0, sizeof(device_found));
724 status = acpi_get_devices(hid, tpacpi_acpi_handle_locate_callback,
725 (void *)name, &device_found);
726
727 *handle = NULL;
728
729 if (ACPI_SUCCESS(status)) {
730 *handle = device_found;
731 dbg_printk(TPACPI_DBG_INIT,
732 "Found ACPI handle for %s\n", name);
733 } else {
734 vdbg_printk(TPACPI_DBG_INIT,
735 "Could not locate an ACPI handle for %s: %s\n",
736 name, acpi_format_exception(status));
737 }
738}
739
711static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data) 740static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data)
712{ 741{
713 struct ibm_struct *ibm = data; 742 struct ibm_struct *ibm = data;
@@ -8752,8 +8781,8 @@ static int __init probe_for_thinkpad(void)
8752 (thinkpad_id.ec_model != 0) || 8781 (thinkpad_id.ec_model != 0) ||
8753 tpacpi_is_fw_known(); 8782 tpacpi_is_fw_known();
8754 8783
8755 /* ec is required because many other handles are relative to it */ 8784 /* The EC handler is required */
8756 TPACPI_ACPIHANDLE_INIT(ec); 8785 tpacpi_acpi_handle_locate("ec", TPACPI_ACPI_EC_HID, &ec_handle);
8757 if (!ec_handle) { 8786 if (!ec_handle) {
8758 if (is_thinkpad) 8787 if (is_thinkpad)
8759 printk(TPACPI_ERR 8788 printk(TPACPI_ERR