Add patches accepted for 2.6.30-rc1
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / releases / upstream / 2.6.30-rc1 / 0013-thinkpad-acpi-enhanced-debugging-messages-for-the-f.patch
blob2942d72791d1ef0fcc5400ef824a83d1f8a40695
1 From 74a60c0f828016456fc635feae388ffd12bb3bb9 Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Sat, 4 Apr 2009 04:25:52 +0000
4 Subject: thinkpad-acpi: enhanced debugging messages for the fan subdriver
6 Enhance debugging messages for the fan subdriver.
8 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
9 Signed-off-by: Len Brown <len.brown@intel.com>
10 ---
11 Documentation/laptops/thinkpad-acpi.txt | 1 +
12 drivers/platform/x86/thinkpad_acpi.c | 46 +++++++++++++++++++++++++++---
13 2 files changed, 42 insertions(+), 5 deletions(-)
15 diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
16 index abbbe78..25ed43d 100644
17 --- a/Documentation/laptops/thinkpad-acpi.txt
18 +++ b/Documentation/laptops/thinkpad-acpi.txt
19 @@ -1497,6 +1497,7 @@ to enable more than one output class, just add their values.
20 0x0004 RF Transmitter control (RFKILL)
21 (bluetooth, WWAN, UWB...)
22 0x0008 HKEY event interface, hotkeys
23 + 0x0010 Fan control
25 There is also a kernel build option to enable more debugging
26 information, which may be necessary to debug driver problems.
27 diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
28 index 0a4796a..4eec770 100644
29 --- a/drivers/platform/x86/thinkpad_acpi.c
30 +++ b/drivers/platform/x86/thinkpad_acpi.c
31 @@ -191,6 +191,7 @@ enum {
32 #define TPACPI_DBG_EXIT 0x0002
33 #define TPACPI_DBG_RFKILL 0x0004
34 #define TPACPI_DBG_HKEY 0x0008
35 +#define TPACPI_DBG_FAN 0x0010
37 #define onoff(status, bit) ((status) & (1 << (bit)) ? "on" : "off")
38 #define enabled(status, bit) ((status) & (1 << (bit)) ? "enabled" : "disabled")
39 @@ -6271,6 +6272,9 @@ static int fan_set_level(int level)
40 default:
41 return -ENXIO;
44 + vdbg_printk(TPACPI_DBG_FAN,
45 + "fan control: set fan control register to 0x%02x\n", level);
46 return 0;
49 @@ -6348,6 +6352,11 @@ static int fan_set_enable(void)
52 mutex_unlock(&fan_mutex);
54 + if (!rc)
55 + vdbg_printk(TPACPI_DBG_FAN,
56 + "fan control: set fan control register to 0x%02x\n",
57 + s);
58 return rc;
61 @@ -6384,6 +6393,9 @@ static int fan_set_disable(void)
62 rc = -ENXIO;
65 + if (!rc)
66 + vdbg_printk(TPACPI_DBG_FAN,
67 + "fan control: set fan control register to 0\n");
69 mutex_unlock(&fan_mutex);
70 return rc;
71 @@ -6512,6 +6524,9 @@ static ssize_t fan_pwm1_enable_store(struct device *dev,
72 if (parse_strtoul(buf, 2, &t))
73 return -EINVAL;
75 + tpacpi_disclose_usertask("hwmon pwm1_enable",
76 + "set fan mode to %lu\n", t);
78 switch (t) {
79 case 0:
80 level = TP_EC_FAN_FULLSPEED;
81 @@ -6577,6 +6592,9 @@ static ssize_t fan_pwm1_store(struct device *dev,
82 if (parse_strtoul(buf, 255, &s))
83 return -EINVAL;
85 + tpacpi_disclose_usertask("hwmon pwm1",
86 + "set fan speed to %lu\n", s);
88 /* scale down from 0-255 to 0-7 */
89 newlevel = (s >> 5) & 0x07;
91 @@ -6643,6 +6661,8 @@ static ssize_t fan_fan_watchdog_store(struct device_driver *drv,
92 fan_watchdog_maxinterval = t;
93 fan_watchdog_reset();
95 + tpacpi_disclose_usertask("fan_watchdog", "set to %lu\n", t);
97 return count;
100 @@ -6664,7 +6684,8 @@ static int __init fan_init(struct ibm_init_struct *iibm)
102 int rc;
104 - vdbg_printk(TPACPI_DBG_INIT, "initializing fan subdriver\n");
105 + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN,
106 + "initializing fan subdriver\n");
108 mutex_init(&fan_mutex);
109 fan_status_access_mode = TPACPI_FAN_NONE;
110 @@ -6723,7 +6744,8 @@ static int __init fan_init(struct ibm_init_struct *iibm)
114 - vdbg_printk(TPACPI_DBG_INIT, "fan is %s, modes %d, %d\n",
115 + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN,
116 + "fan is %s, modes %d, %d\n",
117 str_supported(fan_status_access_mode != TPACPI_FAN_NONE ||
118 fan_control_access_mode != TPACPI_FAN_WR_NONE),
119 fan_status_access_mode, fan_control_access_mode);
120 @@ -6732,7 +6754,7 @@ static int __init fan_init(struct ibm_init_struct *iibm)
121 if (!fan_control_allowed) {
122 fan_control_access_mode = TPACPI_FAN_WR_NONE;
123 fan_control_commands = 0;
124 - dbg_printk(TPACPI_DBG_INIT,
125 + dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_FAN,
126 "fan control features disabled by parameter\n");
129 @@ -6761,7 +6783,7 @@ static int __init fan_init(struct ibm_init_struct *iibm)
131 static void fan_exit(void)
133 - vdbg_printk(TPACPI_DBG_EXIT,
134 + vdbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_FAN,
135 "cancelling any pending fan watchdog tasks\n");
137 /* FIXME: can we really do this unconditionally? */
138 @@ -6942,6 +6964,9 @@ static int fan_write_cmd_level(const char *cmd, int *rc)
139 if (*rc == -ENXIO)
140 printk(TPACPI_ERR "level command accepted for unsupported "
141 "access mode %d", fan_control_access_mode);
142 + else if (!*rc)
143 + tpacpi_disclose_usertask("procfs fan",
144 + "set level to %d\n", level);
146 return 1;
148 @@ -6955,6 +6980,8 @@ static int fan_write_cmd_enable(const char *cmd, int *rc)
149 if (*rc == -ENXIO)
150 printk(TPACPI_ERR "enable command accepted for unsupported "
151 "access mode %d", fan_control_access_mode);
152 + else if (!*rc)
153 + tpacpi_disclose_usertask("procfs fan", "enable\n");
155 return 1;
157 @@ -6968,6 +6995,8 @@ static int fan_write_cmd_disable(const char *cmd, int *rc)
158 if (*rc == -ENXIO)
159 printk(TPACPI_ERR "disable command accepted for unsupported "
160 "access mode %d", fan_control_access_mode);
161 + else if (!*rc)
162 + tpacpi_disclose_usertask("procfs fan", "disable\n");
164 return 1;
166 @@ -6986,6 +7015,9 @@ static int fan_write_cmd_speed(const char *cmd, int *rc)
167 if (*rc == -ENXIO)
168 printk(TPACPI_ERR "speed command accepted for unsupported "
169 "access mode %d", fan_control_access_mode);
170 + else if (!*rc)
171 + tpacpi_disclose_usertask("procfs fan",
172 + "set speed to %d\n", speed);
174 return 1;
176 @@ -6999,8 +7031,12 @@ static int fan_write_cmd_watchdog(const char *cmd, int *rc)
178 if (interval < 0 || interval > 120)
179 *rc = -EINVAL;
180 - else
181 + else {
182 fan_watchdog_maxinterval = interval;
183 + tpacpi_disclose_usertask("procfs fan",
184 + "set watchdog timer to %d\n",
185 + interval);
188 return 1;
191 1.6.2.1