1 From 106b4e6657e10831f35c32afa26d9c11e6312783 Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Sun, 11 Jan 2009 03:01:06 -0200
4 Subject: ACPI: thinkpad-acpi: handle HKEY thermal and battery alarms
6 Handle some HKEY events that are actually firmware alarms. For
7 now, we do the simple thing: log specific messages to the log and let
8 the thinkpad-specific event pass to userspace.
10 In the future, these events will be migrated to generic notifications
13 These alarms are NOT available on all ThinkPads. E.g. the T43 only
14 issues 0x6011 and 0x6012.
16 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
17 Signed-off-by: Len Brown <len.brown@intel.com>
19 drivers/platform/x86/thinkpad_acpi.c | 63 +++++++++++++++++++++++++++++++--
20 1 files changed, 59 insertions(+), 4 deletions(-)
22 diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
23 index d833ee6..c4e4b64 100644
24 --- a/drivers/platform/x86/thinkpad_acpi.c
25 +++ b/drivers/platform/x86/thinkpad_acpi.c
26 @@ -174,10 +174,12 @@ enum {
29 #define TPACPI_LOG TPACPI_FILE ": "
30 -#define TPACPI_ERR KERN_ERR TPACPI_LOG
31 -#define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG
32 -#define TPACPI_INFO KERN_INFO TPACPI_LOG
33 -#define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG
34 +#define TPACPI_ALERT KERN_ALERT TPACPI_LOG
35 +#define TPACPI_CRIT KERN_CRIT TPACPI_LOG
36 +#define TPACPI_ERR KERN_ERR TPACPI_LOG
37 +#define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG
38 +#define TPACPI_INFO KERN_INFO TPACPI_LOG
39 +#define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG
41 #define TPACPI_DBG_ALL 0xffff
42 #define TPACPI_DBG_INIT 0x0001
43 @@ -2614,6 +2616,15 @@ static bool hotkey_notify_wakeup(const u32 hkey,
44 *ignore_acpi_ev = true;
47 + case 0x2313: /* Battery on critical low level (S3) */
48 + case 0x2413: /* Battery on critical low level (S4) */
50 + "EMERGENCY WAKEUP: battery almost empty\n");
51 + /* how to auto-heal: */
52 + /* 2313: woke up from S3, go to S4/S5 */
53 + /* 2413: woke up from S4, go to S5 */
59 @@ -2659,6 +2670,45 @@ static bool hotkey_notify_usrevent(const u32 hkey,
63 +static bool hotkey_notify_thermal(const u32 hkey,
65 + bool *ignore_acpi_ev)
67 + /* 0x6000-0x6FFF: thermal alarms */
68 + *send_acpi_ev = true;
69 + *ignore_acpi_ev = false;
74 + "THERMAL ALARM: battery is too hot!\n");
75 + /* recommended action: warn user through gui */
79 + "THERMAL EMERGENCY: battery is extremely hot!\n");
80 + /* recommended action: immediate sleep/hibernate */
85 + "a sensor reports something is too hot!\n");
86 + /* recommended action: warn user through gui, that */
87 + /* some internal component is too hot */
91 + "THERMAL EMERGENCY: "
92 + "a sensor reports something is extremely hot!\n");
93 + /* recommended action: immediate sleep/hibernate */
97 + "THERMAL ALERT: unknown thermal alarm received\n");
102 static void hotkey_notify(struct ibm_struct *ibm, u32 event)
105 @@ -2731,6 +2781,11 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
106 known_ev = hotkey_notify_usrevent(hkey, &send_acpi_ev,
110 + /* 0x6000-0x6FFF: thermal alarms */
111 + known_ev = hotkey_notify_thermal(hkey, &send_acpi_ev,
115 /* 0x7000-0x7FFF: misc */
116 if (tp_features.hotkey_wlsw && hkey == 0x7000) {