diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2009-12-08 20:36:28 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-09 15:45:30 -0500 |
commit | 9ebd9e833648745fa5ac6998b9e0153ccd3ba839 (patch) | |
tree | a535aca51fd978662be594b899be7919ca87348f | |
parent | b09c72259e88cec3d602aef987a3209297f3a9c2 (diff) |
thinkpad-acpi: log temperatures on termal alarm (v2)
Log temperatures on any of the EC thermal alarms. It could be
useful to help tracking down what is happening...
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 4b96a961b7e..b3e256b2cf1 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -3546,49 +3546,57 @@ static bool hotkey_notify_usrevent(const u32 hkey, | |||
3546 | } | 3546 | } |
3547 | } | 3547 | } |
3548 | 3548 | ||
3549 | static void thermal_dump_all_sensors(void); | ||
3550 | |||
3549 | static bool hotkey_notify_thermal(const u32 hkey, | 3551 | static bool hotkey_notify_thermal(const u32 hkey, |
3550 | bool *send_acpi_ev, | 3552 | bool *send_acpi_ev, |
3551 | bool *ignore_acpi_ev) | 3553 | bool *ignore_acpi_ev) |
3552 | { | 3554 | { |
3555 | bool known = true; | ||
3556 | |||
3553 | /* 0x6000-0x6FFF: thermal alarms */ | 3557 | /* 0x6000-0x6FFF: thermal alarms */ |
3554 | *send_acpi_ev = true; | 3558 | *send_acpi_ev = true; |
3555 | *ignore_acpi_ev = false; | 3559 | *ignore_acpi_ev = false; |
3556 | 3560 | ||
3557 | switch (hkey) { | 3561 | switch (hkey) { |
3562 | case TP_HKEY_EV_THM_TABLE_CHANGED: | ||
3563 | printk(TPACPI_INFO | ||
3564 | "EC reports that Thermal Table has changed\n"); | ||
3565 | /* recommended action: do nothing, we don't have | ||
3566 | * Lenovo ATM information */ | ||
3567 | return true; | ||
3558 | case TP_HKEY_EV_ALARM_BAT_HOT: | 3568 | case TP_HKEY_EV_ALARM_BAT_HOT: |
3559 | printk(TPACPI_CRIT | 3569 | printk(TPACPI_CRIT |
3560 | "THERMAL ALARM: battery is too hot!\n"); | 3570 | "THERMAL ALARM: battery is too hot!\n"); |
3561 | /* recommended action: warn user through gui */ | 3571 | /* recommended action: warn user through gui */ |
3562 | return true; | 3572 | break; |
3563 | case TP_HKEY_EV_ALARM_BAT_XHOT: | 3573 | case TP_HKEY_EV_ALARM_BAT_XHOT: |
3564 | printk(TPACPI_ALERT | 3574 | printk(TPACPI_ALERT |
3565 | "THERMAL EMERGENCY: battery is extremely hot!\n"); | 3575 | "THERMAL EMERGENCY: battery is extremely hot!\n"); |
3566 | /* recommended action: immediate sleep/hibernate */ | 3576 | /* recommended action: immediate sleep/hibernate */ |
3567 | return true; | 3577 | break; |
3568 | case TP_HKEY_EV_ALARM_SENSOR_HOT: | 3578 | case TP_HKEY_EV_ALARM_SENSOR_HOT: |
3569 | printk(TPACPI_CRIT | 3579 | printk(TPACPI_CRIT |
3570 | "THERMAL ALARM: " | 3580 | "THERMAL ALARM: " |
3571 | "a sensor reports something is too hot!\n"); | 3581 | "a sensor reports something is too hot!\n"); |
3572 | /* recommended action: warn user through gui, that */ | 3582 | /* recommended action: warn user through gui, that */ |
3573 | /* some internal component is too hot */ | 3583 | /* some internal component is too hot */ |
3574 | return true; | 3584 | break; |
3575 | case TP_HKEY_EV_ALARM_SENSOR_XHOT: | 3585 | case TP_HKEY_EV_ALARM_SENSOR_XHOT: |
3576 | printk(TPACPI_ALERT | 3586 | printk(TPACPI_ALERT |
3577 | "THERMAL EMERGENCY: " | 3587 | "THERMAL EMERGENCY: " |
3578 | "a sensor reports something is extremely hot!\n"); | 3588 | "a sensor reports something is extremely hot!\n"); |
3579 | /* recommended action: immediate sleep/hibernate */ | 3589 | /* recommended action: immediate sleep/hibernate */ |
3580 | return true; | 3590 | break; |
3581 | case TP_HKEY_EV_THM_TABLE_CHANGED: | ||
3582 | printk(TPACPI_INFO | ||
3583 | "EC reports that Thermal Table has changed\n"); | ||
3584 | /* recommended action: do nothing, we don't have | ||
3585 | * Lenovo ATM information */ | ||
3586 | return true; | ||
3587 | default: | 3591 | default: |
3588 | printk(TPACPI_ALERT | 3592 | printk(TPACPI_ALERT |
3589 | "THERMAL ALERT: unknown thermal alarm received\n"); | 3593 | "THERMAL ALERT: unknown thermal alarm received\n"); |
3590 | return false; | 3594 | known = false; |
3591 | } | 3595 | } |
3596 | |||
3597 | thermal_dump_all_sensors(); | ||
3598 | |||
3599 | return known; | ||
3592 | } | 3600 | } |
3593 | 3601 | ||
3594 | static void hotkey_notify(struct ibm_struct *ibm, u32 event) | 3602 | static void hotkey_notify(struct ibm_struct *ibm, u32 event) |
@@ -5462,8 +5470,11 @@ enum { /* TPACPI_THERMAL_TPEC_* */ | |||
5462 | TP_EC_THERMAL_TMP0 = 0x78, /* ACPI EC regs TMP 0..7 */ | 5470 | TP_EC_THERMAL_TMP0 = 0x78, /* ACPI EC regs TMP 0..7 */ |
5463 | TP_EC_THERMAL_TMP8 = 0xC0, /* ACPI EC regs TMP 8..15 */ | 5471 | TP_EC_THERMAL_TMP8 = 0xC0, /* ACPI EC regs TMP 8..15 */ |
5464 | TP_EC_THERMAL_TMP_NA = -128, /* ACPI EC sensor not available */ | 5472 | TP_EC_THERMAL_TMP_NA = -128, /* ACPI EC sensor not available */ |
5473 | |||
5474 | TPACPI_THERMAL_SENSOR_NA = -128000, /* Sensor not available */ | ||
5465 | }; | 5475 | }; |
5466 | 5476 | ||
5477 | |||
5467 | #define TPACPI_MAX_THERMAL_SENSORS 16 /* Max thermal sensors supported */ | 5478 | #define TPACPI_MAX_THERMAL_SENSORS 16 /* Max thermal sensors supported */ |
5468 | struct ibm_thermal_sensors_struct { | 5479 | struct ibm_thermal_sensors_struct { |
5469 | s32 temp[TPACPI_MAX_THERMAL_SENSORS]; | 5480 | s32 temp[TPACPI_MAX_THERMAL_SENSORS]; |
@@ -5553,6 +5564,28 @@ static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s) | |||
5553 | return n; | 5564 | return n; |
5554 | } | 5565 | } |
5555 | 5566 | ||
5567 | static void thermal_dump_all_sensors(void) | ||
5568 | { | ||
5569 | int n, i; | ||
5570 | struct ibm_thermal_sensors_struct t; | ||
5571 | |||
5572 | n = thermal_get_sensors(&t); | ||
5573 | if (n <= 0) | ||
5574 | return; | ||
5575 | |||
5576 | printk(TPACPI_NOTICE | ||
5577 | "temperatures (Celsius):"); | ||
5578 | |||
5579 | for (i = 0; i < n; i++) { | ||
5580 | if (t.temp[i] != TPACPI_THERMAL_SENSOR_NA) | ||
5581 | printk(KERN_CONT " %d", (int)(t.temp[i] / 1000)); | ||
5582 | else | ||
5583 | printk(KERN_CONT " N/A"); | ||
5584 | } | ||
5585 | |||
5586 | printk(KERN_CONT "\n"); | ||
5587 | } | ||
5588 | |||
5556 | /* sysfs temp##_input -------------------------------------------------- */ | 5589 | /* sysfs temp##_input -------------------------------------------------- */ |
5557 | 5590 | ||
5558 | static ssize_t thermal_temp_input_show(struct device *dev, | 5591 | static ssize_t thermal_temp_input_show(struct device *dev, |
@@ -5568,7 +5601,7 @@ static ssize_t thermal_temp_input_show(struct device *dev, | |||
5568 | res = thermal_get_sensor(idx, &value); | 5601 | res = thermal_get_sensor(idx, &value); |
5569 | if (res) | 5602 | if (res) |
5570 | return res; | 5603 | return res; |
5571 | if (value == TP_EC_THERMAL_TMP_NA * 1000) | 5604 | if (value == TPACPI_THERMAL_SENSOR_NA) |
5572 | return -ENXIO; | 5605 | return -ENXIO; |
5573 | 5606 | ||
5574 | return snprintf(buf, PAGE_SIZE, "%d\n", value); | 5607 | return snprintf(buf, PAGE_SIZE, "%d\n", value); |