diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2009-04-04 00:25:52 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-04 03:14:53 -0400 |
commit | 74a60c0f828016456fc635feae388ffd12bb3bb9 (patch) | |
tree | fe801c68171a2a69564a16e59c307fc2745db082 /drivers | |
parent | 56e2c200945dafafb86169762eb1e88aed0ce69e (diff) |
thinkpad-acpi: enhanced debugging messages for the fan subdriver
Enhance debugging messages for the fan subdriver.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 0a4796a246ea..4eec77032a71 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -191,6 +191,7 @@ enum { | |||
191 | #define TPACPI_DBG_EXIT 0x0002 | 191 | #define TPACPI_DBG_EXIT 0x0002 |
192 | #define TPACPI_DBG_RFKILL 0x0004 | 192 | #define TPACPI_DBG_RFKILL 0x0004 |
193 | #define TPACPI_DBG_HKEY 0x0008 | 193 | #define TPACPI_DBG_HKEY 0x0008 |
194 | #define TPACPI_DBG_FAN 0x0010 | ||
194 | 195 | ||
195 | #define onoff(status, bit) ((status) & (1 << (bit)) ? "on" : "off") | 196 | #define onoff(status, bit) ((status) & (1 << (bit)) ? "on" : "off") |
196 | #define enabled(status, bit) ((status) & (1 << (bit)) ? "enabled" : "disabled") | 197 | #define enabled(status, bit) ((status) & (1 << (bit)) ? "enabled" : "disabled") |
@@ -6271,6 +6272,9 @@ static int fan_set_level(int level) | |||
6271 | default: | 6272 | default: |
6272 | return -ENXIO; | 6273 | return -ENXIO; |
6273 | } | 6274 | } |
6275 | |||
6276 | vdbg_printk(TPACPI_DBG_FAN, | ||
6277 | "fan control: set fan control register to 0x%02x\n", level); | ||
6274 | return 0; | 6278 | return 0; |
6275 | } | 6279 | } |
6276 | 6280 | ||
@@ -6348,6 +6352,11 @@ static int fan_set_enable(void) | |||
6348 | } | 6352 | } |
6349 | 6353 | ||
6350 | mutex_unlock(&fan_mutex); | 6354 | mutex_unlock(&fan_mutex); |
6355 | |||
6356 | if (!rc) | ||
6357 | vdbg_printk(TPACPI_DBG_FAN, | ||
6358 | "fan control: set fan control register to 0x%02x\n", | ||
6359 | s); | ||
6351 | return rc; | 6360 | return rc; |
6352 | } | 6361 | } |
6353 | 6362 | ||
@@ -6384,6 +6393,9 @@ static int fan_set_disable(void) | |||
6384 | rc = -ENXIO; | 6393 | rc = -ENXIO; |
6385 | } | 6394 | } |
6386 | 6395 | ||
6396 | if (!rc) | ||
6397 | vdbg_printk(TPACPI_DBG_FAN, | ||
6398 | "fan control: set fan control register to 0\n"); | ||
6387 | 6399 | ||
6388 | mutex_unlock(&fan_mutex); | 6400 | mutex_unlock(&fan_mutex); |
6389 | return rc; | 6401 | return rc; |
@@ -6512,6 +6524,9 @@ static ssize_t fan_pwm1_enable_store(struct device *dev, | |||
6512 | if (parse_strtoul(buf, 2, &t)) | 6524 | if (parse_strtoul(buf, 2, &t)) |
6513 | return -EINVAL; | 6525 | return -EINVAL; |
6514 | 6526 | ||
6527 | tpacpi_disclose_usertask("hwmon pwm1_enable", | ||
6528 | "set fan mode to %lu\n", t); | ||
6529 | |||
6515 | switch (t) { | 6530 | switch (t) { |
6516 | case 0: | 6531 | case 0: |
6517 | level = TP_EC_FAN_FULLSPEED; | 6532 | level = TP_EC_FAN_FULLSPEED; |
@@ -6577,6 +6592,9 @@ static ssize_t fan_pwm1_store(struct device *dev, | |||
6577 | if (parse_strtoul(buf, 255, &s)) | 6592 | if (parse_strtoul(buf, 255, &s)) |
6578 | return -EINVAL; | 6593 | return -EINVAL; |
6579 | 6594 | ||
6595 | tpacpi_disclose_usertask("hwmon pwm1", | ||
6596 | "set fan speed to %lu\n", s); | ||
6597 | |||
6580 | /* scale down from 0-255 to 0-7 */ | 6598 | /* scale down from 0-255 to 0-7 */ |
6581 | newlevel = (s >> 5) & 0x07; | 6599 | newlevel = (s >> 5) & 0x07; |
6582 | 6600 | ||
@@ -6643,6 +6661,8 @@ static ssize_t fan_fan_watchdog_store(struct device_driver *drv, | |||
6643 | fan_watchdog_maxinterval = t; | 6661 | fan_watchdog_maxinterval = t; |
6644 | fan_watchdog_reset(); | 6662 | fan_watchdog_reset(); |
6645 | 6663 | ||
6664 | tpacpi_disclose_usertask("fan_watchdog", "set to %lu\n", t); | ||
6665 | |||
6646 | return count; | 6666 | return count; |
6647 | } | 6667 | } |
6648 | 6668 | ||
@@ -6664,7 +6684,8 @@ static int __init fan_init(struct ibm_init_struct *iibm) | |||
6664 | { | 6684 | { |
6665 | int rc; | 6685 | int rc; |
6666 | 6686 | ||
6667 | vdbg_printk(TPACPI_DBG_INIT, "initializing fan subdriver\n"); | 6687 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN, |
6688 | "initializing fan subdriver\n"); | ||
6668 | 6689 | ||
6669 | mutex_init(&fan_mutex); | 6690 | mutex_init(&fan_mutex); |
6670 | fan_status_access_mode = TPACPI_FAN_NONE; | 6691 | fan_status_access_mode = TPACPI_FAN_NONE; |
@@ -6723,7 +6744,8 @@ static int __init fan_init(struct ibm_init_struct *iibm) | |||
6723 | } | 6744 | } |
6724 | } | 6745 | } |
6725 | 6746 | ||
6726 | vdbg_printk(TPACPI_DBG_INIT, "fan is %s, modes %d, %d\n", | 6747 | vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN, |
6748 | "fan is %s, modes %d, %d\n", | ||
6727 | str_supported(fan_status_access_mode != TPACPI_FAN_NONE || | 6749 | str_supported(fan_status_access_mode != TPACPI_FAN_NONE || |
6728 | fan_control_access_mode != TPACPI_FAN_WR_NONE), | 6750 | fan_control_access_mode != TPACPI_FAN_WR_NONE), |
6729 | fan_status_access_mode, fan_control_access_mode); | 6751 | fan_status_access_mode, fan_control_access_mode); |
@@ -6732,7 +6754,7 @@ static int __init fan_init(struct ibm_init_struct *iibm) | |||
6732 | if (!fan_control_allowed) { | 6754 | if (!fan_control_allowed) { |
6733 | fan_control_access_mode = TPACPI_FAN_WR_NONE; | 6755 | fan_control_access_mode = TPACPI_FAN_WR_NONE; |
6734 | fan_control_commands = 0; | 6756 | fan_control_commands = 0; |
6735 | dbg_printk(TPACPI_DBG_INIT, | 6757 | dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN, |
6736 | "fan control features disabled by parameter\n"); | 6758 | "fan control features disabled by parameter\n"); |
6737 | } | 6759 | } |
6738 | 6760 | ||
@@ -6761,7 +6783,7 @@ static int __init fan_init(struct ibm_init_struct *iibm) | |||
6761 | 6783 | ||
6762 | static void fan_exit(void) | 6784 | static void fan_exit(void) |
6763 | { | 6785 | { |
6764 | vdbg_printk(TPACPI_DBG_EXIT, | 6786 | vdbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_FAN, |
6765 | "cancelling any pending fan watchdog tasks\n"); | 6787 | "cancelling any pending fan watchdog tasks\n"); |
6766 | 6788 | ||
6767 | /* FIXME: can we really do this unconditionally? */ | 6789 | /* FIXME: can we really do this unconditionally? */ |
@@ -6942,6 +6964,9 @@ static int fan_write_cmd_level(const char *cmd, int *rc) | |||
6942 | if (*rc == -ENXIO) | 6964 | if (*rc == -ENXIO) |
6943 | printk(TPACPI_ERR "level command accepted for unsupported " | 6965 | printk(TPACPI_ERR "level command accepted for unsupported " |
6944 | "access mode %d", fan_control_access_mode); | 6966 | "access mode %d", fan_control_access_mode); |
6967 | else if (!*rc) | ||
6968 | tpacpi_disclose_usertask("procfs fan", | ||
6969 | "set level to %d\n", level); | ||
6945 | 6970 | ||
6946 | return 1; | 6971 | return 1; |
6947 | } | 6972 | } |
@@ -6955,6 +6980,8 @@ static int fan_write_cmd_enable(const char *cmd, int *rc) | |||
6955 | if (*rc == -ENXIO) | 6980 | if (*rc == -ENXIO) |
6956 | printk(TPACPI_ERR "enable command accepted for unsupported " | 6981 | printk(TPACPI_ERR "enable command accepted for unsupported " |
6957 | "access mode %d", fan_control_access_mode); | 6982 | "access mode %d", fan_control_access_mode); |
6983 | else if (!*rc) | ||
6984 | tpacpi_disclose_usertask("procfs fan", "enable\n"); | ||
6958 | 6985 | ||
6959 | return 1; | 6986 | return 1; |
6960 | } | 6987 | } |
@@ -6968,6 +6995,8 @@ static int fan_write_cmd_disable(const char *cmd, int *rc) | |||
6968 | if (*rc == -ENXIO) | 6995 | if (*rc == -ENXIO) |
6969 | printk(TPACPI_ERR "disable command accepted for unsupported " | 6996 | printk(TPACPI_ERR "disable command accepted for unsupported " |
6970 | "access mode %d", fan_control_access_mode); | 6997 | "access mode %d", fan_control_access_mode); |
6998 | else if (!*rc) | ||
6999 | tpacpi_disclose_usertask("procfs fan", "disable\n"); | ||
6971 | 7000 | ||
6972 | return 1; | 7001 | return 1; |
6973 | } | 7002 | } |
@@ -6986,6 +7015,9 @@ static int fan_write_cmd_speed(const char *cmd, int *rc) | |||
6986 | if (*rc == -ENXIO) | 7015 | if (*rc == -ENXIO) |
6987 | printk(TPACPI_ERR "speed command accepted for unsupported " | 7016 | printk(TPACPI_ERR "speed command accepted for unsupported " |
6988 | "access mode %d", fan_control_access_mode); | 7017 | "access mode %d", fan_control_access_mode); |
7018 | else if (!*rc) | ||
7019 | tpacpi_disclose_usertask("procfs fan", | ||
7020 | "set speed to %d\n", speed); | ||
6989 | 7021 | ||
6990 | return 1; | 7022 | return 1; |
6991 | } | 7023 | } |
@@ -6999,8 +7031,12 @@ static int fan_write_cmd_watchdog(const char *cmd, int *rc) | |||
6999 | 7031 | ||
7000 | if (interval < 0 || interval > 120) | 7032 | if (interval < 0 || interval > 120) |
7001 | *rc = -EINVAL; | 7033 | *rc = -EINVAL; |
7002 | else | 7034 | else { |
7003 | fan_watchdog_maxinterval = interval; | 7035 | fan_watchdog_maxinterval = interval; |
7036 | tpacpi_disclose_usertask("procfs fan", | ||
7037 | "set watchdog timer to %d\n", | ||
7038 | interval); | ||
7039 | } | ||
7004 | 7040 | ||
7005 | return 1; | 7041 | return 1; |
7006 | } | 7042 | } |