Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * i8k.c -- Linux driver for accessing the SMM BIOS on Dell laptops. | |
1da177e4 LT |
3 | * |
4 | * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org> | |
5 | * | |
949a9d70 | 6 | * Hwmon integration: |
7c81c60f | 7 | * Copyright (C) 2011 Jean Delvare <jdelvare@suse.de> |
564132d9 | 8 | * Copyright (C) 2013, 2014 Guenter Roeck <linux@roeck-us.net> |
949a9d70 | 9 | * |
1da177e4 LT |
10 | * This program is free software; you can redistribute it and/or modify it |
11 | * under the terms of the GNU General Public License as published by the | |
12 | * Free Software Foundation; either version 2, or (at your option) any | |
13 | * later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, but | |
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | * General Public License for more details. | |
19 | */ | |
20 | ||
60e71aaf GR |
21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
22 | ||
564132d9 | 23 | #include <linux/delay.h> |
1da177e4 LT |
24 | #include <linux/module.h> |
25 | #include <linux/types.h> | |
26 | #include <linux/init.h> | |
27 | #include <linux/proc_fs.h> | |
352f8f8b | 28 | #include <linux/seq_file.h> |
e70c9d5e | 29 | #include <linux/dmi.h> |
7e80d0d0 | 30 | #include <linux/capability.h> |
613655fa | 31 | #include <linux/mutex.h> |
949a9d70 JD |
32 | #include <linux/hwmon.h> |
33 | #include <linux/hwmon-sysfs.h> | |
12186f51 GR |
34 | #include <linux/uaccess.h> |
35 | #include <linux/io.h> | |
f36fdb9f | 36 | #include <linux/sched.h> |
1da177e4 LT |
37 | |
38 | #include <linux/i8k.h> | |
39 | ||
1da177e4 LT |
40 | #define I8K_SMM_FN_STATUS 0x0025 |
41 | #define I8K_SMM_POWER_STATUS 0x0069 | |
42 | #define I8K_SMM_SET_FAN 0x01a3 | |
43 | #define I8K_SMM_GET_FAN 0x00a3 | |
44 | #define I8K_SMM_GET_SPEED 0x02a3 | |
45 | #define I8K_SMM_GET_TEMP 0x10a3 | |
5114b474 | 46 | #define I8K_SMM_GET_TEMP_TYPE 0x11a3 |
7e0fa31d DT |
47 | #define I8K_SMM_GET_DELL_SIG1 0xfea3 |
48 | #define I8K_SMM_GET_DELL_SIG2 0xffa3 | |
1da177e4 LT |
49 | |
50 | #define I8K_FAN_MULT 30 | |
51 | #define I8K_MAX_TEMP 127 | |
52 | ||
53 | #define I8K_FN_NONE 0x00 | |
54 | #define I8K_FN_UP 0x01 | |
55 | #define I8K_FN_DOWN 0x02 | |
56 | #define I8K_FN_MUTE 0x04 | |
57 | #define I8K_FN_MASK 0x07 | |
58 | #define I8K_FN_SHIFT 8 | |
59 | ||
60 | #define I8K_POWER_AC 0x05 | |
61 | #define I8K_POWER_BATTERY 0x01 | |
62 | ||
613655fa | 63 | static DEFINE_MUTEX(i8k_mutex); |
e70c9d5e | 64 | static char bios_version[4]; |
949a9d70 | 65 | static struct device *i8k_hwmon_dev; |
82ba1d3f | 66 | static u32 i8k_hwmon_flags; |
7f69fb03 PR |
67 | static uint i8k_fan_mult; |
68 | static uint i8k_pwm_mult; | |
69 | static uint i8k_fan_max = I8K_FAN_HIGH; | |
82ba1d3f GR |
70 | |
71 | #define I8K_HWMON_HAVE_TEMP1 (1 << 0) | |
d83c39de GR |
72 | #define I8K_HWMON_HAVE_TEMP2 (1 << 1) |
73 | #define I8K_HWMON_HAVE_TEMP3 (1 << 2) | |
74 | #define I8K_HWMON_HAVE_TEMP4 (1 << 3) | |
75 | #define I8K_HWMON_HAVE_FAN1 (1 << 4) | |
76 | #define I8K_HWMON_HAVE_FAN2 (1 << 5) | |
1da177e4 LT |
77 | |
78 | MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); | |
79 | MODULE_DESCRIPTION("Driver for accessing SMM BIOS on Dell laptops"); | |
80 | MODULE_LICENSE("GPL"); | |
81 | ||
90ab5ee9 | 82 | static bool force; |
1da177e4 LT |
83 | module_param(force, bool, 0); |
84 | MODULE_PARM_DESC(force, "Force loading without checking for supported models"); | |
85 | ||
90ab5ee9 | 86 | static bool ignore_dmi; |
e70c9d5e DT |
87 | module_param(ignore_dmi, bool, 0); |
88 | MODULE_PARM_DESC(ignore_dmi, "Continue probing hardware even if DMI data does not match"); | |
89 | ||
90ab5ee9 | 90 | static bool restricted; |
1da177e4 LT |
91 | module_param(restricted, bool, 0); |
92 | MODULE_PARM_DESC(restricted, "Allow fan control if SYS_ADMIN capability set"); | |
93 | ||
90ab5ee9 | 94 | static bool power_status; |
1da177e4 LT |
95 | module_param(power_status, bool, 0600); |
96 | MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); | |
97 | ||
7f69fb03 PR |
98 | static uint fan_mult = I8K_FAN_MULT; |
99 | module_param(fan_mult, uint, 0); | |
4ed99a27 JE |
100 | MODULE_PARM_DESC(fan_mult, "Factor to multiply fan speed with"); |
101 | ||
7f69fb03 PR |
102 | static uint fan_max = I8K_FAN_HIGH; |
103 | module_param(fan_max, uint, 0); | |
81474fc2 GR |
104 | MODULE_PARM_DESC(fan_max, "Maximum configurable fan speed"); |
105 | ||
352f8f8b | 106 | static int i8k_open_fs(struct inode *inode, struct file *file); |
d79b6f4d | 107 | static long i8k_ioctl(struct file *, unsigned int, unsigned long); |
1da177e4 | 108 | |
62322d25 | 109 | static const struct file_operations i8k_fops = { |
1b502217 | 110 | .owner = THIS_MODULE, |
352f8f8b DT |
111 | .open = i8k_open_fs, |
112 | .read = seq_read, | |
113 | .llseek = seq_lseek, | |
114 | .release = single_release, | |
d79b6f4d | 115 | .unlocked_ioctl = i8k_ioctl, |
1da177e4 LT |
116 | }; |
117 | ||
8378b924 | 118 | struct smm_regs { |
dec63ec3 | 119 | unsigned int eax; |
12186f51 GR |
120 | unsigned int ebx __packed; |
121 | unsigned int ecx __packed; | |
122 | unsigned int edx __packed; | |
123 | unsigned int esi __packed; | |
124 | unsigned int edi __packed; | |
8378b924 | 125 | }; |
1da177e4 | 126 | |
1855256c | 127 | static inline const char *i8k_get_dmi_data(int field) |
e70c9d5e | 128 | { |
1855256c | 129 | const char *dmi_data = dmi_get_system_info(field); |
4f005551 DT |
130 | |
131 | return dmi_data && *dmi_data ? dmi_data : "?"; | |
e70c9d5e | 132 | } |
1da177e4 LT |
133 | |
134 | /* | |
135 | * Call the System Management Mode BIOS. Code provided by Jonathan Buzzard. | |
136 | */ | |
8378b924 | 137 | static int i8k_smm(struct smm_regs *regs) |
1da177e4 | 138 | { |
dec63ec3 DT |
139 | int rc; |
140 | int eax = regs->eax; | |
f36fdb9f GR |
141 | cpumask_var_t old_mask; |
142 | ||
143 | /* SMM requires CPU 0 */ | |
144 | if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) | |
145 | return -ENOMEM; | |
146 | cpumask_copy(old_mask, ¤t->cpus_allowed); | |
6d827fbc GR |
147 | rc = set_cpus_allowed_ptr(current, cpumask_of(0)); |
148 | if (rc) | |
149 | goto out; | |
f36fdb9f GR |
150 | if (smp_processor_id() != 0) { |
151 | rc = -EBUSY; | |
152 | goto out; | |
153 | } | |
dec63ec3 | 154 | |
fe04f22f | 155 | #if defined(CONFIG_X86_64) |
22d3243d | 156 | asm volatile("pushq %%rax\n\t" |
fe04f22f BS |
157 | "movl 0(%%rax),%%edx\n\t" |
158 | "pushq %%rdx\n\t" | |
159 | "movl 4(%%rax),%%ebx\n\t" | |
160 | "movl 8(%%rax),%%ecx\n\t" | |
161 | "movl 12(%%rax),%%edx\n\t" | |
162 | "movl 16(%%rax),%%esi\n\t" | |
163 | "movl 20(%%rax),%%edi\n\t" | |
164 | "popq %%rax\n\t" | |
165 | "out %%al,$0xb2\n\t" | |
166 | "out %%al,$0x84\n\t" | |
167 | "xchgq %%rax,(%%rsp)\n\t" | |
168 | "movl %%ebx,4(%%rax)\n\t" | |
169 | "movl %%ecx,8(%%rax)\n\t" | |
170 | "movl %%edx,12(%%rax)\n\t" | |
171 | "movl %%esi,16(%%rax)\n\t" | |
172 | "movl %%edi,20(%%rax)\n\t" | |
173 | "popq %%rdx\n\t" | |
174 | "movl %%edx,0(%%rax)\n\t" | |
bc1f419c LT |
175 | "pushfq\n\t" |
176 | "popq %%rax\n\t" | |
fe04f22f | 177 | "andl $1,%%eax\n" |
12186f51 | 178 | : "=a"(rc) |
fe04f22f BS |
179 | : "a"(regs) |
180 | : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); | |
181 | #else | |
22d3243d | 182 | asm volatile("pushl %%eax\n\t" |
dec63ec3 DT |
183 | "movl 0(%%eax),%%edx\n\t" |
184 | "push %%edx\n\t" | |
185 | "movl 4(%%eax),%%ebx\n\t" | |
186 | "movl 8(%%eax),%%ecx\n\t" | |
187 | "movl 12(%%eax),%%edx\n\t" | |
188 | "movl 16(%%eax),%%esi\n\t" | |
189 | "movl 20(%%eax),%%edi\n\t" | |
190 | "popl %%eax\n\t" | |
191 | "out %%al,$0xb2\n\t" | |
192 | "out %%al,$0x84\n\t" | |
193 | "xchgl %%eax,(%%esp)\n\t" | |
194 | "movl %%ebx,4(%%eax)\n\t" | |
195 | "movl %%ecx,8(%%eax)\n\t" | |
196 | "movl %%edx,12(%%eax)\n\t" | |
197 | "movl %%esi,16(%%eax)\n\t" | |
198 | "movl %%edi,20(%%eax)\n\t" | |
199 | "popl %%edx\n\t" | |
200 | "movl %%edx,0(%%eax)\n\t" | |
201 | "lahf\n\t" | |
202 | "shrl $8,%%eax\n\t" | |
6b4e81db | 203 | "andl $1,%%eax\n" |
12186f51 | 204 | : "=a"(rc) |
dec63ec3 DT |
205 | : "a"(regs) |
206 | : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); | |
fe04f22f | 207 | #endif |
8378b924 | 208 | if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax) |
f36fdb9f | 209 | rc = -EINVAL; |
dec63ec3 | 210 | |
f36fdb9f GR |
211 | out: |
212 | set_cpus_allowed_ptr(current, old_mask); | |
213 | free_cpumask_var(old_mask); | |
214 | return rc; | |
1da177e4 LT |
215 | } |
216 | ||
1da177e4 LT |
217 | /* |
218 | * Read the Fn key status. | |
219 | */ | |
220 | static int i8k_get_fn_status(void) | |
221 | { | |
8378b924 | 222 | struct smm_regs regs = { .eax = I8K_SMM_FN_STATUS, }; |
dec63ec3 DT |
223 | int rc; |
224 | ||
12186f51 GR |
225 | rc = i8k_smm(®s); |
226 | if (rc < 0) | |
dec63ec3 | 227 | return rc; |
dec63ec3 DT |
228 | |
229 | switch ((regs.eax >> I8K_FN_SHIFT) & I8K_FN_MASK) { | |
230 | case I8K_FN_UP: | |
231 | return I8K_VOL_UP; | |
232 | case I8K_FN_DOWN: | |
233 | return I8K_VOL_DOWN; | |
234 | case I8K_FN_MUTE: | |
235 | return I8K_VOL_MUTE; | |
236 | default: | |
237 | return 0; | |
238 | } | |
1da177e4 LT |
239 | } |
240 | ||
241 | /* | |
242 | * Read the power status. | |
243 | */ | |
244 | static int i8k_get_power_status(void) | |
245 | { | |
8378b924 | 246 | struct smm_regs regs = { .eax = I8K_SMM_POWER_STATUS, }; |
dec63ec3 DT |
247 | int rc; |
248 | ||
12186f51 GR |
249 | rc = i8k_smm(®s); |
250 | if (rc < 0) | |
dec63ec3 | 251 | return rc; |
dec63ec3 | 252 | |
8378b924 | 253 | return (regs.eax & 0xff) == I8K_POWER_AC ? I8K_AC : I8K_BATTERY; |
1da177e4 LT |
254 | } |
255 | ||
256 | /* | |
257 | * Read the fan status. | |
258 | */ | |
259 | static int i8k_get_fan_status(int fan) | |
260 | { | |
8378b924 | 261 | struct smm_regs regs = { .eax = I8K_SMM_GET_FAN, }; |
1da177e4 | 262 | |
dec63ec3 | 263 | regs.ebx = fan & 0xff; |
8378b924 | 264 | return i8k_smm(®s) ? : regs.eax & 0xff; |
1da177e4 LT |
265 | } |
266 | ||
267 | /* | |
268 | * Read the fan speed in RPM. | |
269 | */ | |
270 | static int i8k_get_fan_speed(int fan) | |
271 | { | |
8378b924 | 272 | struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, }; |
1da177e4 | 273 | |
dec63ec3 | 274 | regs.ebx = fan & 0xff; |
26d09382 | 275 | return i8k_smm(®s) ? : (regs.eax & 0xffff) * i8k_fan_mult; |
1da177e4 LT |
276 | } |
277 | ||
278 | /* | |
279 | * Set the fan speed (off, low, high). Returns the new fan status. | |
280 | */ | |
281 | static int i8k_set_fan(int fan, int speed) | |
282 | { | |
8378b924 | 283 | struct smm_regs regs = { .eax = I8K_SMM_SET_FAN, }; |
1da177e4 | 284 | |
81474fc2 | 285 | speed = (speed < 0) ? 0 : ((speed > i8k_fan_max) ? i8k_fan_max : speed); |
dec63ec3 | 286 | regs.ebx = (fan & 0xff) | (speed << 8); |
1da177e4 | 287 | |
8378b924 | 288 | return i8k_smm(®s) ? : i8k_get_fan_status(fan); |
1da177e4 LT |
289 | } |
290 | ||
5114b474 PR |
291 | static int i8k_get_temp_type(int sensor) |
292 | { | |
293 | struct smm_regs regs = { .eax = I8K_SMM_GET_TEMP_TYPE, }; | |
294 | ||
295 | regs.ebx = sensor & 0xff; | |
296 | return i8k_smm(®s) ? : regs.eax & 0xff; | |
297 | } | |
298 | ||
1da177e4 LT |
299 | /* |
300 | * Read the cpu temperature. | |
301 | */ | |
564132d9 | 302 | static int _i8k_get_temp(int sensor) |
1da177e4 | 303 | { |
564132d9 GR |
304 | struct smm_regs regs = { |
305 | .eax = I8K_SMM_GET_TEMP, | |
306 | .ebx = sensor & 0xff, | |
307 | }; | |
1da177e4 | 308 | |
564132d9 GR |
309 | return i8k_smm(®s) ? : regs.eax & 0xff; |
310 | } | |
8378b924 | 311 | |
564132d9 GR |
312 | static int i8k_get_temp(int sensor) |
313 | { | |
314 | int temp = _i8k_get_temp(sensor); | |
1da177e4 | 315 | |
dec63ec3 DT |
316 | /* |
317 | * Sometimes the temperature sensor returns 0x99, which is out of range. | |
564132d9 | 318 | * In this case we retry (once) before returning an error. |
dec63ec3 DT |
319 | # 1003655137 00000058 00005a4b |
320 | # 1003655138 00000099 00003a80 <--- 0x99 = 153 degrees | |
321 | # 1003655139 00000054 00005c52 | |
322 | */ | |
564132d9 GR |
323 | if (temp == 0x99) { |
324 | msleep(100); | |
325 | temp = _i8k_get_temp(sensor); | |
dec63ec3 | 326 | } |
564132d9 GR |
327 | /* |
328 | * Return -ENODATA for all invalid temperatures. | |
329 | * | |
330 | * Known instances are the 0x99 value as seen above as well as | |
331 | * 0xc1 (193), which may be returned when trying to read the GPU | |
332 | * temperature if the system supports a GPU and it is currently | |
333 | * turned off. | |
334 | */ | |
723493ca | 335 | if (temp > I8K_MAX_TEMP) |
83d514d7 | 336 | return -ENODATA; |
1da177e4 | 337 | |
dec63ec3 | 338 | return temp; |
1da177e4 LT |
339 | } |
340 | ||
7e0fa31d | 341 | static int i8k_get_dell_signature(int req_fn) |
1da177e4 | 342 | { |
7e0fa31d | 343 | struct smm_regs regs = { .eax = req_fn, }; |
dec63ec3 | 344 | int rc; |
1da177e4 | 345 | |
12186f51 GR |
346 | rc = i8k_smm(®s); |
347 | if (rc < 0) | |
dec63ec3 | 348 | return rc; |
1da177e4 | 349 | |
8378b924 | 350 | return regs.eax == 1145651527 && regs.edx == 1145392204 ? 0 : -1; |
1da177e4 LT |
351 | } |
352 | ||
d79b6f4d FW |
353 | static int |
354 | i8k_ioctl_unlocked(struct file *fp, unsigned int cmd, unsigned long arg) | |
1da177e4 | 355 | { |
e70c9d5e | 356 | int val = 0; |
dec63ec3 DT |
357 | int speed; |
358 | unsigned char buff[16]; | |
359 | int __user *argp = (int __user *)arg; | |
360 | ||
361 | if (!argp) | |
362 | return -EINVAL; | |
363 | ||
364 | switch (cmd) { | |
365 | case I8K_BIOS_VERSION: | |
e551b152 GR |
366 | val = (bios_version[0] << 16) | |
367 | (bios_version[1] << 8) | bios_version[2]; | |
dec63ec3 DT |
368 | break; |
369 | ||
370 | case I8K_MACHINE_ID: | |
371 | memset(buff, 0, 16); | |
12186f51 GR |
372 | strlcpy(buff, i8k_get_dmi_data(DMI_PRODUCT_SERIAL), |
373 | sizeof(buff)); | |
dec63ec3 DT |
374 | break; |
375 | ||
376 | case I8K_FN_STATUS: | |
377 | val = i8k_get_fn_status(); | |
378 | break; | |
379 | ||
380 | case I8K_POWER_STATUS: | |
381 | val = i8k_get_power_status(); | |
382 | break; | |
383 | ||
384 | case I8K_GET_TEMP: | |
7e0fa31d | 385 | val = i8k_get_temp(0); |
dec63ec3 DT |
386 | break; |
387 | ||
388 | case I8K_GET_SPEED: | |
8378b924 | 389 | if (copy_from_user(&val, argp, sizeof(int))) |
dec63ec3 | 390 | return -EFAULT; |
8378b924 | 391 | |
dec63ec3 DT |
392 | val = i8k_get_fan_speed(val); |
393 | break; | |
1da177e4 | 394 | |
dec63ec3 | 395 | case I8K_GET_FAN: |
8378b924 | 396 | if (copy_from_user(&val, argp, sizeof(int))) |
dec63ec3 | 397 | return -EFAULT; |
8378b924 | 398 | |
dec63ec3 DT |
399 | val = i8k_get_fan_status(val); |
400 | break; | |
1da177e4 | 401 | |
dec63ec3 | 402 | case I8K_SET_FAN: |
8378b924 | 403 | if (restricted && !capable(CAP_SYS_ADMIN)) |
dec63ec3 | 404 | return -EPERM; |
8378b924 DT |
405 | |
406 | if (copy_from_user(&val, argp, sizeof(int))) | |
dec63ec3 | 407 | return -EFAULT; |
8378b924 DT |
408 | |
409 | if (copy_from_user(&speed, argp + 1, sizeof(int))) | |
dec63ec3 | 410 | return -EFAULT; |
8378b924 | 411 | |
dec63ec3 DT |
412 | val = i8k_set_fan(val, speed); |
413 | break; | |
1da177e4 | 414 | |
dec63ec3 DT |
415 | default: |
416 | return -EINVAL; | |
1da177e4 | 417 | } |
1da177e4 | 418 | |
8378b924 | 419 | if (val < 0) |
dec63ec3 | 420 | return val; |
1da177e4 | 421 | |
dec63ec3 DT |
422 | switch (cmd) { |
423 | case I8K_BIOS_VERSION: | |
8378b924 | 424 | if (copy_to_user(argp, &val, 4)) |
dec63ec3 | 425 | return -EFAULT; |
8378b924 | 426 | |
dec63ec3 DT |
427 | break; |
428 | case I8K_MACHINE_ID: | |
8378b924 | 429 | if (copy_to_user(argp, buff, 16)) |
dec63ec3 | 430 | return -EFAULT; |
8378b924 | 431 | |
dec63ec3 DT |
432 | break; |
433 | default: | |
8378b924 | 434 | if (copy_to_user(argp, &val, sizeof(int))) |
dec63ec3 | 435 | return -EFAULT; |
8378b924 | 436 | |
dec63ec3 | 437 | break; |
1da177e4 | 438 | } |
1da177e4 | 439 | |
dec63ec3 | 440 | return 0; |
1da177e4 LT |
441 | } |
442 | ||
d79b6f4d FW |
443 | static long i8k_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) |
444 | { | |
445 | long ret; | |
446 | ||
613655fa | 447 | mutex_lock(&i8k_mutex); |
d79b6f4d | 448 | ret = i8k_ioctl_unlocked(fp, cmd, arg); |
613655fa | 449 | mutex_unlock(&i8k_mutex); |
d79b6f4d FW |
450 | |
451 | return ret; | |
452 | } | |
453 | ||
1da177e4 LT |
454 | /* |
455 | * Print the information for /proc/i8k. | |
456 | */ | |
352f8f8b | 457 | static int i8k_proc_show(struct seq_file *seq, void *offset) |
1da177e4 | 458 | { |
352f8f8b | 459 | int fn_key, cpu_temp, ac_power; |
dec63ec3 DT |
460 | int left_fan, right_fan, left_speed, right_speed; |
461 | ||
96de0e25 JE |
462 | cpu_temp = i8k_get_temp(0); /* 11100 µs */ |
463 | left_fan = i8k_get_fan_status(I8K_FAN_LEFT); /* 580 µs */ | |
464 | right_fan = i8k_get_fan_status(I8K_FAN_RIGHT); /* 580 µs */ | |
465 | left_speed = i8k_get_fan_speed(I8K_FAN_LEFT); /* 580 µs */ | |
466 | right_speed = i8k_get_fan_speed(I8K_FAN_RIGHT); /* 580 µs */ | |
467 | fn_key = i8k_get_fn_status(); /* 750 µs */ | |
8378b924 | 468 | if (power_status) |
96de0e25 | 469 | ac_power = i8k_get_power_status(); /* 14700 µs */ |
8378b924 | 470 | else |
dec63ec3 | 471 | ac_power = -1; |
dec63ec3 DT |
472 | |
473 | /* | |
474 | * Info: | |
475 | * | |
476 | * 1) Format version (this will change if format changes) | |
477 | * 2) BIOS version | |
478 | * 3) BIOS machine ID | |
479 | * 4) Cpu temperature | |
480 | * 5) Left fan status | |
481 | * 6) Right fan status | |
482 | * 7) Left fan speed | |
483 | * 8) Right fan speed | |
484 | * 9) AC power | |
485 | * 10) Fn Key status | |
486 | */ | |
352f8f8b DT |
487 | return seq_printf(seq, "%s %s %s %d %d %d %d %d %d %d\n", |
488 | I8K_PROC_FMT, | |
489 | bios_version, | |
4f005551 | 490 | i8k_get_dmi_data(DMI_PRODUCT_SERIAL), |
352f8f8b DT |
491 | cpu_temp, |
492 | left_fan, right_fan, left_speed, right_speed, | |
493 | ac_power, fn_key); | |
1da177e4 LT |
494 | } |
495 | ||
352f8f8b | 496 | static int i8k_open_fs(struct inode *inode, struct file *file) |
1da177e4 | 497 | { |
352f8f8b | 498 | return single_open(file, i8k_proc_show, NULL); |
1da177e4 LT |
499 | } |
500 | ||
949a9d70 JD |
501 | |
502 | /* | |
503 | * Hwmon interface | |
504 | */ | |
505 | ||
5114b474 PR |
506 | static ssize_t i8k_hwmon_show_temp_label(struct device *dev, |
507 | struct device_attribute *devattr, | |
508 | char *buf) | |
509 | { | |
510 | static const char * const labels[] = { | |
511 | "CPU", | |
512 | "GPU", | |
513 | "SODIMM", | |
514 | "Other", | |
515 | "Ambient", | |
516 | "Other", | |
517 | }; | |
518 | int index = to_sensor_dev_attr(devattr)->index; | |
519 | int type; | |
520 | ||
521 | type = i8k_get_temp_type(index); | |
522 | if (type < 0) | |
523 | return type; | |
524 | if (type >= ARRAY_SIZE(labels)) | |
525 | type = ARRAY_SIZE(labels) - 1; | |
526 | return sprintf(buf, "%s\n", labels[type]); | |
527 | } | |
528 | ||
949a9d70 JD |
529 | static ssize_t i8k_hwmon_show_temp(struct device *dev, |
530 | struct device_attribute *devattr, | |
531 | char *buf) | |
532 | { | |
d83c39de GR |
533 | int index = to_sensor_dev_attr(devattr)->index; |
534 | int temp; | |
949a9d70 | 535 | |
d83c39de GR |
536 | temp = i8k_get_temp(index); |
537 | if (temp < 0) | |
538 | return temp; | |
539 | return sprintf(buf, "%d\n", temp * 1000); | |
949a9d70 JD |
540 | } |
541 | ||
542 | static ssize_t i8k_hwmon_show_fan(struct device *dev, | |
543 | struct device_attribute *devattr, | |
544 | char *buf) | |
545 | { | |
546 | int index = to_sensor_dev_attr(devattr)->index; | |
547 | int fan_speed; | |
548 | ||
549 | fan_speed = i8k_get_fan_speed(index); | |
550 | if (fan_speed < 0) | |
551 | return fan_speed; | |
552 | return sprintf(buf, "%d\n", fan_speed); | |
553 | } | |
554 | ||
e7f5f275 GR |
555 | static ssize_t i8k_hwmon_show_pwm(struct device *dev, |
556 | struct device_attribute *devattr, | |
557 | char *buf) | |
558 | { | |
559 | int index = to_sensor_dev_attr(devattr)->index; | |
560 | int status; | |
561 | ||
562 | status = i8k_get_fan_status(index); | |
563 | if (status < 0) | |
564 | return -EIO; | |
81474fc2 | 565 | return sprintf(buf, "%d\n", clamp_val(status * i8k_pwm_mult, 0, 255)); |
e7f5f275 GR |
566 | } |
567 | ||
568 | static ssize_t i8k_hwmon_set_pwm(struct device *dev, | |
569 | struct device_attribute *attr, | |
570 | const char *buf, size_t count) | |
571 | { | |
572 | int index = to_sensor_dev_attr(attr)->index; | |
573 | unsigned long val; | |
574 | int err; | |
575 | ||
576 | err = kstrtoul(buf, 10, &val); | |
577 | if (err) | |
578 | return err; | |
81474fc2 | 579 | val = clamp_val(DIV_ROUND_CLOSEST(val, i8k_pwm_mult), 0, i8k_fan_max); |
e7f5f275 GR |
580 | |
581 | mutex_lock(&i8k_mutex); | |
582 | err = i8k_set_fan(index, val); | |
583 | mutex_unlock(&i8k_mutex); | |
584 | ||
585 | return err < 0 ? -EIO : count; | |
586 | } | |
587 | ||
d83c39de | 588 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 0); |
5114b474 PR |
589 | static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL, |
590 | 0); | |
d83c39de | 591 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 1); |
5114b474 PR |
592 | static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL, |
593 | 1); | |
d83c39de | 594 | static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 2); |
5114b474 PR |
595 | static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL, |
596 | 2); | |
d83c39de | 597 | static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 3); |
5114b474 PR |
598 | static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL, |
599 | 3); | |
949a9d70 JD |
600 | static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, i8k_hwmon_show_fan, NULL, |
601 | I8K_FAN_LEFT); | |
e7f5f275 GR |
602 | static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, i8k_hwmon_show_pwm, |
603 | i8k_hwmon_set_pwm, I8K_FAN_LEFT); | |
949a9d70 JD |
604 | static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, i8k_hwmon_show_fan, NULL, |
605 | I8K_FAN_RIGHT); | |
e7f5f275 GR |
606 | static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, i8k_hwmon_show_pwm, |
607 | i8k_hwmon_set_pwm, I8K_FAN_RIGHT); | |
82ba1d3f GR |
608 | |
609 | static struct attribute *i8k_attrs[] = { | |
d83c39de | 610 | &sensor_dev_attr_temp1_input.dev_attr.attr, /* 0 */ |
5114b474 PR |
611 | &sensor_dev_attr_temp1_label.dev_attr.attr, /* 1 */ |
612 | &sensor_dev_attr_temp2_input.dev_attr.attr, /* 2 */ | |
613 | &sensor_dev_attr_temp2_label.dev_attr.attr, /* 3 */ | |
614 | &sensor_dev_attr_temp3_input.dev_attr.attr, /* 4 */ | |
615 | &sensor_dev_attr_temp3_label.dev_attr.attr, /* 5 */ | |
616 | &sensor_dev_attr_temp4_input.dev_attr.attr, /* 6 */ | |
617 | &sensor_dev_attr_temp4_label.dev_attr.attr, /* 7 */ | |
618 | &sensor_dev_attr_fan1_input.dev_attr.attr, /* 8 */ | |
619 | &sensor_dev_attr_pwm1.dev_attr.attr, /* 9 */ | |
620 | &sensor_dev_attr_fan2_input.dev_attr.attr, /* 10 */ | |
621 | &sensor_dev_attr_pwm2.dev_attr.attr, /* 11 */ | |
82ba1d3f GR |
622 | NULL |
623 | }; | |
949a9d70 | 624 | |
82ba1d3f GR |
625 | static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr, |
626 | int index) | |
949a9d70 | 627 | { |
5114b474 PR |
628 | if (index >= 0 && index <= 1 && |
629 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP1)) | |
82ba1d3f | 630 | return 0; |
5114b474 PR |
631 | if (index >= 2 && index <= 3 && |
632 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP2)) | |
d83c39de | 633 | return 0; |
5114b474 PR |
634 | if (index >= 4 && index <= 5 && |
635 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP3)) | |
d83c39de | 636 | return 0; |
5114b474 PR |
637 | if (index >= 6 && index <= 7 && |
638 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP4)) | |
d83c39de | 639 | return 0; |
5114b474 | 640 | if (index >= 8 && index <= 9 && |
82ba1d3f GR |
641 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN1)) |
642 | return 0; | |
5114b474 | 643 | if (index >= 10 && index <= 11 && |
82ba1d3f GR |
644 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN2)) |
645 | return 0; | |
646 | ||
647 | return attr->mode; | |
949a9d70 JD |
648 | } |
649 | ||
82ba1d3f GR |
650 | static const struct attribute_group i8k_group = { |
651 | .attrs = i8k_attrs, | |
652 | .is_visible = i8k_is_visible, | |
653 | }; | |
654 | __ATTRIBUTE_GROUPS(i8k); | |
655 | ||
949a9d70 JD |
656 | static int __init i8k_init_hwmon(void) |
657 | { | |
658 | int err; | |
659 | ||
82ba1d3f | 660 | i8k_hwmon_flags = 0; |
949a9d70 | 661 | |
672af223 PR |
662 | /* CPU temperature attributes, if temperature type is OK */ |
663 | err = i8k_get_temp_type(0); | |
664 | if (err >= 0) | |
82ba1d3f | 665 | i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP1; |
d83c39de | 666 | /* check for additional temperature sensors */ |
672af223 PR |
667 | err = i8k_get_temp_type(1); |
668 | if (err >= 0) | |
d83c39de | 669 | i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP2; |
672af223 PR |
670 | err = i8k_get_temp_type(2); |
671 | if (err >= 0) | |
d83c39de | 672 | i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP3; |
672af223 PR |
673 | err = i8k_get_temp_type(3); |
674 | if (err >= 0) | |
d83c39de | 675 | i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP4; |
949a9d70 JD |
676 | |
677 | /* Left fan attributes, if left fan is present */ | |
678 | err = i8k_get_fan_status(I8K_FAN_LEFT); | |
82ba1d3f GR |
679 | if (err >= 0) |
680 | i8k_hwmon_flags |= I8K_HWMON_HAVE_FAN1; | |
949a9d70 JD |
681 | |
682 | /* Right fan attributes, if right fan is present */ | |
683 | err = i8k_get_fan_status(I8K_FAN_RIGHT); | |
82ba1d3f GR |
684 | if (err >= 0) |
685 | i8k_hwmon_flags |= I8K_HWMON_HAVE_FAN2; | |
949a9d70 | 686 | |
82ba1d3f GR |
687 | i8k_hwmon_dev = hwmon_device_register_with_groups(NULL, "i8k", NULL, |
688 | i8k_groups); | |
689 | if (IS_ERR(i8k_hwmon_dev)) { | |
690 | err = PTR_ERR(i8k_hwmon_dev); | |
691 | i8k_hwmon_dev = NULL; | |
692 | pr_err("hwmon registration failed (%d)\n", err); | |
693 | return err; | |
694 | } | |
949a9d70 | 695 | return 0; |
949a9d70 JD |
696 | } |
697 | ||
81474fc2 | 698 | struct i8k_config_data { |
7f69fb03 PR |
699 | uint fan_mult; |
700 | uint fan_max; | |
81474fc2 GR |
701 | }; |
702 | ||
703 | enum i8k_configs { | |
7b883446 | 704 | DELL_LATITUDE_D520, |
06c88b0d | 705 | DELL_LATITUDE_E6540, |
7b883446 | 706 | DELL_PRECISION_490, |
81474fc2 | 707 | DELL_STUDIO, |
34ae40f6 | 708 | DELL_XPS, |
81474fc2 GR |
709 | }; |
710 | ||
711 | static const struct i8k_config_data i8k_config_data[] = { | |
7b883446 GR |
712 | [DELL_LATITUDE_D520] = { |
713 | .fan_mult = 1, | |
714 | .fan_max = I8K_FAN_TURBO, | |
715 | }, | |
06c88b0d SH |
716 | [DELL_LATITUDE_E6540] = { |
717 | .fan_mult = 1, | |
718 | .fan_max = I8K_FAN_HIGH, | |
719 | }, | |
7b883446 GR |
720 | [DELL_PRECISION_490] = { |
721 | .fan_mult = 1, | |
722 | .fan_max = I8K_FAN_TURBO, | |
723 | }, | |
81474fc2 GR |
724 | [DELL_STUDIO] = { |
725 | .fan_mult = 1, | |
726 | .fan_max = I8K_FAN_HIGH, | |
727 | }, | |
34ae40f6 | 728 | [DELL_XPS] = { |
81474fc2 GR |
729 | .fan_mult = 1, |
730 | .fan_max = I8K_FAN_HIGH, | |
731 | }, | |
732 | }; | |
733 | ||
12186f51 | 734 | static struct dmi_system_id i8k_dmi_table[] __initdata = { |
e70c9d5e DT |
735 | { |
736 | .ident = "Dell Inspiron", | |
737 | .matches = { | |
738 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer"), | |
739 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron"), | |
740 | }, | |
741 | }, | |
742 | { | |
743 | .ident = "Dell Latitude", | |
744 | .matches = { | |
745 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer"), | |
746 | DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"), | |
747 | }, | |
748 | }, | |
7e0fa31d DT |
749 | { |
750 | .ident = "Dell Inspiron 2", | |
751 | .matches = { | |
752 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
753 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron"), | |
754 | }, | |
755 | }, | |
7b883446 GR |
756 | { |
757 | .ident = "Dell Latitude D520", | |
758 | .matches = { | |
759 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
760 | DMI_MATCH(DMI_PRODUCT_NAME, "Latitude D520"), | |
761 | }, | |
762 | .driver_data = (void *)&i8k_config_data[DELL_LATITUDE_D520], | |
763 | }, | |
0f352239 PR |
764 | { |
765 | .ident = "Dell Latitude E6440", | |
766 | .matches = { | |
767 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
768 | DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6440"), | |
769 | }, | |
770 | .driver_data = (void *)&i8k_config_data[DELL_LATITUDE_E6540], | |
771 | }, | |
06c88b0d SH |
772 | { |
773 | .ident = "Dell Latitude E6540", | |
774 | .matches = { | |
775 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
776 | DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6540"), | |
777 | }, | |
778 | .driver_data = (void *)&i8k_config_data[DELL_LATITUDE_E6540], | |
779 | }, | |
7e0fa31d DT |
780 | { |
781 | .ident = "Dell Latitude 2", | |
782 | .matches = { | |
783 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
784 | DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"), | |
785 | }, | |
786 | }, | |
a9000d03 NW |
787 | { /* UK Inspiron 6400 */ |
788 | .ident = "Dell Inspiron 3", | |
789 | .matches = { | |
790 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
791 | DMI_MATCH(DMI_PRODUCT_NAME, "MM061"), | |
792 | }, | |
793 | }, | |
48103c52 FS |
794 | { |
795 | .ident = "Dell Inspiron 3", | |
796 | .matches = { | |
797 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
798 | DMI_MATCH(DMI_PRODUCT_NAME, "MP061"), | |
799 | }, | |
800 | }, | |
7b883446 GR |
801 | { |
802 | .ident = "Dell Precision 490", | |
803 | .matches = { | |
804 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
805 | DMI_MATCH(DMI_PRODUCT_NAME, | |
806 | "Precision WorkStation 490"), | |
807 | }, | |
808 | .driver_data = (void *)&i8k_config_data[DELL_PRECISION_490], | |
809 | }, | |
7ab21a86 AS |
810 | { |
811 | .ident = "Dell Precision", | |
812 | .matches = { | |
813 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
814 | DMI_MATCH(DMI_PRODUCT_NAME, "Precision"), | |
815 | }, | |
816 | }, | |
bef2a508 FH |
817 | { |
818 | .ident = "Dell Vostro", | |
819 | .matches = { | |
820 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
821 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro"), | |
822 | }, | |
823 | }, | |
9aa5b018 AC |
824 | { |
825 | .ident = "Dell XPS421", | |
826 | .matches = { | |
827 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
828 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"), | |
829 | }, | |
830 | }, | |
ff457bde GR |
831 | { |
832 | .ident = "Dell Studio", | |
833 | .matches = { | |
834 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
835 | DMI_MATCH(DMI_PRODUCT_NAME, "Studio"), | |
836 | }, | |
81474fc2 | 837 | .driver_data = (void *)&i8k_config_data[DELL_STUDIO], |
ff457bde | 838 | }, |
34ae40f6 GR |
839 | { |
840 | .ident = "Dell XPS 13", | |
841 | .matches = { | |
842 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
843 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS13"), | |
844 | }, | |
845 | .driver_data = (void *)&i8k_config_data[DELL_XPS], | |
846 | }, | |
919a0304 GR |
847 | { |
848 | .ident = "Dell XPS M140", | |
849 | .matches = { | |
850 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
851 | DMI_MATCH(DMI_PRODUCT_NAME, "MXC051"), | |
852 | }, | |
34ae40f6 | 853 | .driver_data = (void *)&i8k_config_data[DELL_XPS], |
919a0304 | 854 | }, |
12186f51 | 855 | { } |
e70c9d5e | 856 | }; |
1da177e4 | 857 | |
148b1fda PR |
858 | MODULE_DEVICE_TABLE(dmi, i8k_dmi_table); |
859 | ||
1da177e4 LT |
860 | /* |
861 | * Probe for the presence of a supported laptop. | |
862 | */ | |
863 | static int __init i8k_probe(void) | |
864 | { | |
26d09382 | 865 | const struct dmi_system_id *id; |
dec63ec3 | 866 | |
1da177e4 | 867 | /* |
dec63ec3 | 868 | * Get DMI information |
1da177e4 | 869 | */ |
e70c9d5e DT |
870 | if (!dmi_check_system(i8k_dmi_table)) { |
871 | if (!ignore_dmi && !force) | |
872 | return -ENODEV; | |
873 | ||
60e71aaf GR |
874 | pr_info("not running on a supported Dell system.\n"); |
875 | pr_info("vendor=%s, model=%s, version=%s\n", | |
e70c9d5e DT |
876 | i8k_get_dmi_data(DMI_SYS_VENDOR), |
877 | i8k_get_dmi_data(DMI_PRODUCT_NAME), | |
878 | i8k_get_dmi_data(DMI_BIOS_VERSION)); | |
1da177e4 | 879 | } |
dec63ec3 | 880 | |
12186f51 GR |
881 | strlcpy(bios_version, i8k_get_dmi_data(DMI_BIOS_VERSION), |
882 | sizeof(bios_version)); | |
e70c9d5e | 883 | |
1da177e4 | 884 | /* |
dec63ec3 | 885 | * Get SMM Dell signature |
1da177e4 | 886 | */ |
7e0fa31d DT |
887 | if (i8k_get_dell_signature(I8K_SMM_GET_DELL_SIG1) && |
888 | i8k_get_dell_signature(I8K_SMM_GET_DELL_SIG2)) { | |
60e71aaf | 889 | pr_err("unable to get SMM Dell signature\n"); |
e70c9d5e DT |
890 | if (!force) |
891 | return -ENODEV; | |
1da177e4 | 892 | } |
1da177e4 | 893 | |
26d09382 | 894 | i8k_fan_mult = fan_mult; |
81474fc2 | 895 | i8k_fan_max = fan_max ? : I8K_FAN_HIGH; /* Must not be 0 */ |
26d09382 | 896 | id = dmi_first_match(i8k_dmi_table); |
81474fc2 GR |
897 | if (id && id->driver_data) { |
898 | const struct i8k_config_data *conf = id->driver_data; | |
899 | ||
900 | if (fan_mult == I8K_FAN_MULT && conf->fan_mult) | |
901 | i8k_fan_mult = conf->fan_mult; | |
902 | if (fan_max == I8K_FAN_HIGH && conf->fan_max) | |
903 | i8k_fan_max = conf->fan_max; | |
904 | } | |
905 | i8k_pwm_mult = DIV_ROUND_UP(255, i8k_fan_max); | |
26d09382 | 906 | |
dec63ec3 | 907 | return 0; |
1da177e4 LT |
908 | } |
909 | ||
8378b924 | 910 | static int __init i8k_init(void) |
1da177e4 | 911 | { |
dec63ec3 | 912 | struct proc_dir_entry *proc_i8k; |
949a9d70 | 913 | int err; |
dec63ec3 DT |
914 | |
915 | /* Are we running on an supported laptop? */ | |
e70c9d5e | 916 | if (i8k_probe()) |
dec63ec3 | 917 | return -ENODEV; |
dec63ec3 DT |
918 | |
919 | /* Register the proc entry */ | |
1b502217 | 920 | proc_i8k = proc_create("i8k", 0, NULL, &i8k_fops); |
352f8f8b | 921 | if (!proc_i8k) |
dec63ec3 | 922 | return -ENOENT; |
352f8f8b | 923 | |
949a9d70 JD |
924 | err = i8k_init_hwmon(); |
925 | if (err) | |
926 | goto exit_remove_proc; | |
927 | ||
dec63ec3 | 928 | return 0; |
949a9d70 JD |
929 | |
930 | exit_remove_proc: | |
931 | remove_proc_entry("i8k", NULL); | |
932 | return err; | |
1da177e4 LT |
933 | } |
934 | ||
8378b924 | 935 | static void __exit i8k_exit(void) |
1da177e4 | 936 | { |
82ba1d3f | 937 | hwmon_device_unregister(i8k_hwmon_dev); |
dec63ec3 | 938 | remove_proc_entry("i8k", NULL); |
1da177e4 | 939 | } |
1da177e4 | 940 | |
8378b924 DT |
941 | module_init(i8k_init); |
942 | module_exit(i8k_exit); |