Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197551
b: refs/heads/master
c: 437e470
h: refs/heads/master
i:
  197549: 69960b7
  197547: 6a49f2d
  197543: f47e5ed
  197535: bdf0d6a
v: v3
  • Loading branch information
Henrique de Moraes Holschuh committed May 16, 2010
1 parent 8c6e553 commit a589431
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 38e11cdec90f1dd7355db4aed8a1857258e99485
refs/heads/master: 437e470c4ca818c97426afa3a67fbd7e34cffe00
53 changes: 41 additions & 12 deletions trunk/drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ enum {

/* ACPI HIDs */
#define TPACPI_ACPI_HKEY_HID "IBM0068"
#define TPACPI_ACPI_EC_HID "PNP0C09"

/* Input IDs */
#define TPACPI_HKEY_INPUT_PRODUCT 0x5054 /* "TP" */
Expand Down Expand Up @@ -511,23 +512,14 @@ static inline bool __pure __init tpacpi_is_ibm(void)
*/

static acpi_handle root_handle;
static acpi_handle ec_handle;

#define TPACPI_HANDLE(object, parent, paths...) \
static acpi_handle object##_handle; \
static acpi_handle *object##_parent = &parent##_handle; \
static char *object##_path; \
static char *object##_paths[] = { paths }

TPACPI_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC0", /* 240, 240x */
"\\_SB.PCI.ISA.EC", /* 570 */
"\\_SB.PCI0.ISA0.EC0", /* 600e/x, 770e, 770x */
"\\_SB.PCI0.ISA.EC", /* A21e, A2xm/p, T20-22, X20-21 */
"\\_SB.PCI0.AD4S.EC0", /* i1400, R30 */
"\\_SB.PCI0.ICH3.EC0", /* R31 */
"\\_SB.PCI0.LPC0.EC", /* X100e and a few others */
"\\_SB.PCI0.LPC.EC", /* all others */
);

TPACPI_HANDLE(ecrd, ec, "ECRD"); /* 570 */
TPACPI_HANDLE(ecwr, ec, "ECWR"); /* 570 */

Expand Down Expand Up @@ -708,6 +700,43 @@ static void drv_acpi_handle_init(char *name,
*handle = NULL;
}

static acpi_status __init tpacpi_acpi_handle_locate_callback(acpi_handle handle,
u32 level, void *context, void **return_value)
{
*(acpi_handle *)return_value = handle;

return AE_CTRL_TERMINATE;
}

static void __init tpacpi_acpi_handle_locate(const char *name,
const char *hid,
acpi_handle *handle)
{
acpi_status status;
acpi_handle device_found;

BUG_ON(!name || !hid || !handle);
vdbg_printk(TPACPI_DBG_INIT,
"trying to locate ACPI handle for %s, using HID %s\n",
name, hid);

memset(&device_found, 0, sizeof(device_found));
status = acpi_get_devices(hid, tpacpi_acpi_handle_locate_callback,
(void *)name, &device_found);

*handle = NULL;

if (ACPI_SUCCESS(status)) {
*handle = device_found;
dbg_printk(TPACPI_DBG_INIT,
"Found ACPI handle for %s\n", name);
} else {
vdbg_printk(TPACPI_DBG_INIT,
"Could not locate an ACPI handle for %s: %s\n",
name, acpi_format_exception(status));
}
}

static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data)
{
struct ibm_struct *ibm = data;
Expand Down Expand Up @@ -8752,8 +8781,8 @@ static int __init probe_for_thinkpad(void)
(thinkpad_id.ec_model != 0) ||
tpacpi_is_fw_known();

/* ec is required because many other handles are relative to it */
TPACPI_ACPIHANDLE_INIT(ec);
/* The EC handler is required */
tpacpi_acpi_handle_locate("ec", TPACPI_ACPI_EC_HID, &ec_handle);
if (!ec_handle) {
if (is_thinkpad)
printk(TPACPI_ERR
Expand Down

0 comments on commit a589431

Please sign in to comment.