1 From 49a13cd6a2acd284ee106eaea7eeea8f2cc6796a Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Fri, 24 Nov 2006 11:47:13 -0200
4 Subject: [PATCH 16/28] ACPI: ibm-acpi: store embedded controller firmware version for matching
6 This patch changes the ThinkPad Embedded Controller DMI matching
7 code to store the firmware version of the EC for later usage, e.g.
10 It also prints the firmware version when starting up.
12 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
14 drivers/acpi/ibm_acpi.c | 23 ++++++++++++++++++-----
15 1 files changed, 18 insertions(+), 5 deletions(-)
17 diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
18 index 4001ad1..3c091c4 100644
19 --- a/drivers/acpi/ibm_acpi.c
20 +++ b/drivers/acpi/ibm_acpi.c
22 #include <linux/module.h>
23 #include <linux/init.h>
24 #include <linux/types.h>
25 +#include <linux/string.h>
26 #include <linux/proc_fs.h>
27 #include <linux/backlight.h>
28 #include <asm/uaccess.h>
29 @@ -361,7 +362,7 @@ enum { /* Fan control constants */
33 -static int ibm_thinkpad_ec_found;
34 +static char* ibm_thinkpad_ec_found = NULL;
38 @@ -2540,11 +2541,15 @@ static void acpi_ibm_exit(void)
41 remove_proc_entry(IBM_DIR, acpi_root_dir);
43 + if (ibm_thinkpad_ec_found)
44 + kfree(ibm_thinkpad_ec_found);
47 -static int __init check_dmi_for_ec(void)
48 +static char* __init check_dmi_for_ec(void)
50 struct dmi_device *dev = NULL;
51 + char ec_fw_string[18];
54 * ThinkPad T23 or newer, A31 or newer, R50e or newer,
55 @@ -2554,10 +2559,15 @@ static int __init check_dmi_for_ec(void)
56 * See http://thinkwiki.org/wiki/List_of_DMI_IDs
58 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
59 - if (strstr(dev->name, "IBM ThinkPad Embedded Controller"))
61 + if (sscanf(dev->name,
62 + "IBM ThinkPad Embedded Controller -[%17c",
63 + ec_fw_string) == 1) {
64 + ec_fw_string[sizeof(ec_fw_string) - 1] = 0;
65 + ec_fw_string[strcspn(ec_fw_string, " ]")] = 0;
66 + return kstrdup(ec_fw_string, GFP_KERNEL);
73 static int __init acpi_ibm_init(void)
74 @@ -2581,6 +2591,9 @@ static int __init acpi_ibm_init(void)
76 /* Models with newer firmware report the EC in DMI */
77 ibm_thinkpad_ec_found = check_dmi_for_ec();
78 + if (ibm_thinkpad_ec_found)
79 + printk(IBM_INFO "ThinkPad EC firmware %s\n",
80 + ibm_thinkpad_ec_found);
82 /* these handles are not required */