aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/thinkpad_acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/thinkpad_acpi.c')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c63
1 files changed, 59 insertions, 4 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index d833ee689f90..c4e4b641d952 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -174,10 +174,12 @@ enum {
174 174
175/* Debugging */ 175/* Debugging */
176#define TPACPI_LOG TPACPI_FILE ": " 176#define TPACPI_LOG TPACPI_FILE ": "
177#define TPACPI_ERR KERN_ERR TPACPI_LOG 177#define TPACPI_ALERT KERN_ALERT TPACPI_LOG
178#define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG 178#define TPACPI_CRIT KERN_CRIT TPACPI_LOG
179#define TPACPI_INFO KERN_INFO TPACPI_LOG 179#define TPACPI_ERR KERN_ERR TPACPI_LOG
180#define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG 180#define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG
181#define TPACPI_INFO KERN_INFO TPACPI_LOG
182#define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG
181 183
182#define TPACPI_DBG_ALL 0xffff 184#define TPACPI_DBG_ALL 0xffff
183#define TPACPI_DBG_INIT 0x0001 185#define TPACPI_DBG_INIT 0x0001
@@ -2614,6 +2616,15 @@ static bool hotkey_notify_wakeup(const u32 hkey,
2614 *ignore_acpi_ev = true; 2616 *ignore_acpi_ev = true;
2615 break; 2617 break;
2616 2618
2619 case 0x2313: /* Battery on critical low level (S3) */
2620 case 0x2413: /* Battery on critical low level (S4) */
2621 printk(TPACPI_ALERT
2622 "EMERGENCY WAKEUP: battery almost empty\n");
2623 /* how to auto-heal: */
2624 /* 2313: woke up from S3, go to S4/S5 */
2625 /* 2413: woke up from S4, go to S5 */
2626 break;
2627
2617 default: 2628 default:
2618 return false; 2629 return false;
2619 } 2630 }
@@ -2659,6 +2670,45 @@ static bool hotkey_notify_usrevent(const u32 hkey,
2659 } 2670 }
2660} 2671}
2661 2672
2673static bool hotkey_notify_thermal(const u32 hkey,
2674 bool *send_acpi_ev,
2675 bool *ignore_acpi_ev)
2676{
2677 /* 0x6000-0x6FFF: thermal alarms */
2678 *send_acpi_ev = true;
2679 *ignore_acpi_ev = false;
2680
2681 switch (hkey) {
2682 case 0x6011:
2683 printk(TPACPI_CRIT
2684 "THERMAL ALARM: battery is too hot!\n");
2685 /* recommended action: warn user through gui */
2686 return true;
2687 case 0x6012:
2688 printk(TPACPI_ALERT
2689 "THERMAL EMERGENCY: battery is extremely hot!\n");
2690 /* recommended action: immediate sleep/hibernate */
2691 return true;
2692 case 0x6021:
2693 printk(TPACPI_CRIT
2694 "THERMAL ALARM: "
2695 "a sensor reports something is too hot!\n");
2696 /* recommended action: warn user through gui, that */
2697 /* some internal component is too hot */
2698 return true;
2699 case 0x6022:
2700 printk(TPACPI_ALERT
2701 "THERMAL EMERGENCY: "
2702 "a sensor reports something is extremely hot!\n");
2703 /* recommended action: immediate sleep/hibernate */
2704 return true;
2705 default:
2706 printk(TPACPI_ALERT
2707 "THERMAL ALERT: unknown thermal alarm received\n");
2708 return false;
2709 }
2710}
2711
2662static void hotkey_notify(struct ibm_struct *ibm, u32 event) 2712static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2663{ 2713{
2664 u32 hkey; 2714 u32 hkey;
@@ -2731,6 +2781,11 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2731 known_ev = hotkey_notify_usrevent(hkey, &send_acpi_ev, 2781 known_ev = hotkey_notify_usrevent(hkey, &send_acpi_ev,
2732 &ignore_acpi_ev); 2782 &ignore_acpi_ev);
2733 break; 2783 break;
2784 case 6:
2785 /* 0x6000-0x6FFF: thermal alarms */
2786 known_ev = hotkey_notify_thermal(hkey, &send_acpi_ev,
2787 &ignore_acpi_ev);
2788 break;
2734 case 7: 2789 case 7:
2735 /* 0x7000-0x7FFF: misc */ 2790 /* 0x7000-0x7FFF: misc */
2736 if (tp_features.hotkey_wlsw && hkey == 0x7000) { 2791 if (tp_features.hotkey_wlsw && hkey == 0x7000) {