2 w83627hf.c - Part of lm_sensors, Linux kernel modules for hardware
4 Copyright (c) 1998 - 2003 Frodo Looijaard <frodol@dds.nl>,
5 Philip Edelbrock <phil@netroedge.com>,
6 and Mark Studebaker <mdsxyz123@yahoo.com>
7 Ported to 2.6 by Bernhard C. Schrenk <clemy@clemy.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 Supports following chips:
27 Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
28 w83627hf 9 3 2 3 0x20 0x5ca3 no yes(LPC)
29 w83627thf 7 3 3 3 0x90 0x5ca3 no yes(LPC)
30 w83637hf 7 3 3 3 0x80 0x5ca3 no yes(LPC)
31 w83697hf 8 2 2 2 0x60 0x5ca3 no yes(LPC)
33 For other winbond chips, and for i2c support in the above chips,
36 Note: automatic ("cruise") fan control for 697, 637 & 627thf not
40 #include <linux/module.h>
41 #include <linux/init.h>
42 #include <linux/slab.h>
43 #include <linux/i2c.h>
44 #include <linux/i2c-sensor.h>
45 #include <linux/i2c-vid.h>
49 static u16 force_addr;
50 module_param(force_addr, ushort, 0);
51 MODULE_PARM_DESC(force_addr,
52 "Initialize the base address of the sensors");
53 static u8 force_i2c = 0x1f;
54 module_param(force_i2c, byte, 0);
55 MODULE_PARM_DESC(force_i2c,
56 "Initialize the i2c address of the sensors");
58 /* Addresses to scan */
59 static unsigned short normal_i2c[] = { I2C_CLIENT_END };
60 static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
62 /* Insmod parameters */
63 SENSORS_INSMOD_4(w83627hf, w83627thf, w83697hf, w83637hf);
66 module_param(init, bool, 0);
67 MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
69 /* modified from kernel/include/traps.c */
70 #define REG 0x2e /* The register to read/write */
71 #define DEV 0x07 /* Register: Logical device select */
72 #define VAL 0x2f /* The value to read/write */
74 /* logical device numbers for superio_select (below) */
75 #define W83627HF_LD_FDC 0x00
76 #define W83627HF_LD_PRT 0x01
77 #define W83627HF_LD_UART1 0x02
78 #define W83627HF_LD_UART2 0x03
79 #define W83627HF_LD_KBC 0x05
80 #define W83627HF_LD_CIR 0x06 /* w83627hf only */
81 #define W83627HF_LD_GAME 0x07
82 #define W83627HF_LD_MIDI 0x07
83 #define W83627HF_LD_GPIO1 0x07
84 #define W83627HF_LD_GPIO5 0x07 /* w83627thf only */
85 #define W83627HF_LD_GPIO2 0x08
86 #define W83627HF_LD_GPIO3 0x09
87 #define W83627HF_LD_GPIO4 0x09 /* w83627thf only */
88 #define W83627HF_LD_ACPI 0x0a
89 #define W83627HF_LD_HWM 0x0b
91 #define DEVID 0x20 /* Register: Device ID */
93 #define W83627THF_GPIO5_IOSR 0xf3 /* w83627thf only */
94 #define W83627THF_GPIO5_DR 0xf4 /* w83627thf only */
95 #define W83627THF_GPIO5_INVR 0xf5 /* w83627thf only */
98 superio_outb(int reg, int val)
112 superio_select(int ld)
131 #define W627_DEVID 0x52
132 #define W627THF_DEVID 0x82
133 #define W697_DEVID 0x60
134 #define W637_DEVID 0x70
135 #define WINB_ACT_REG 0x30
136 #define WINB_BASE_REG 0x60
137 /* Constants specified below */
139 /* Length of ISA address segment */
140 #define WINB_EXTENT 8
142 /* Where are the ISA address/data registers relative to the base address */
143 #define W83781D_ADDR_REG_OFFSET 5
144 #define W83781D_DATA_REG_OFFSET 6
146 /* The W83781D registers */
147 /* The W83782D registers for nr=7,8 are in bank 5 */
148 #define W83781D_REG_IN_MAX(nr) ((nr < 7) ? (0x2b + (nr) * 2) : \
149 (0x554 + (((nr) - 7) * 2)))
150 #define W83781D_REG_IN_MIN(nr) ((nr < 7) ? (0x2c + (nr) * 2) : \
151 (0x555 + (((nr) - 7) * 2)))
152 #define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \
155 #define W83781D_REG_FAN_MIN(nr) (0x3a + (nr))
156 #define W83781D_REG_FAN(nr) (0x27 + (nr))
158 #define W83781D_REG_TEMP2_CONFIG 0x152
159 #define W83781D_REG_TEMP3_CONFIG 0x252
160 #define W83781D_REG_TEMP(nr) ((nr == 3) ? (0x0250) : \
161 ((nr == 2) ? (0x0150) : \
163 #define W83781D_REG_TEMP_HYST(nr) ((nr == 3) ? (0x253) : \
164 ((nr == 2) ? (0x153) : \
166 #define W83781D_REG_TEMP_OVER(nr) ((nr == 3) ? (0x255) : \
167 ((nr == 2) ? (0x155) : \
170 #define W83781D_REG_BANK 0x4E
172 #define W83781D_REG_CONFIG 0x40
173 #define W83781D_REG_ALARM1 0x41
174 #define W83781D_REG_ALARM2 0x42
175 #define W83781D_REG_ALARM3 0x450
177 #define W83781D_REG_IRQ 0x4C
178 #define W83781D_REG_BEEP_CONFIG 0x4D
179 #define W83781D_REG_BEEP_INTS1 0x56
180 #define W83781D_REG_BEEP_INTS2 0x57
181 #define W83781D_REG_BEEP_INTS3 0x453
183 #define W83781D_REG_VID_FANDIV 0x47
185 #define W83781D_REG_CHIPID 0x49
186 #define W83781D_REG_WCHIPID 0x58
187 #define W83781D_REG_CHIPMAN 0x4F
188 #define W83781D_REG_PIN 0x4B
190 #define W83781D_REG_VBAT 0x5D
192 #define W83627HF_REG_PWM1 0x5A
193 #define W83627HF_REG_PWM2 0x5B
194 #define W83627HF_REG_PWMCLK12 0x5C
196 #define W83627THF_REG_PWM1 0x01 /* 697HF and 637HF too */
197 #define W83627THF_REG_PWM2 0x03 /* 697HF and 637HF too */
198 #define W83627THF_REG_PWM3 0x11 /* 637HF too */
200 #define W83627THF_REG_VRM_OVT_CFG 0x18 /* 637HF too */
202 static const u8 regpwm_627hf[] = { W83627HF_REG_PWM1, W83627HF_REG_PWM2 };
203 static const u8 regpwm[] = { W83627THF_REG_PWM1, W83627THF_REG_PWM2,
204 W83627THF_REG_PWM3 };
205 #define W836X7HF_REG_PWM(type, nr) (((type) == w83627hf) ? \
206 regpwm_627hf[(nr) - 1] : regpwm[(nr) - 1])
208 #define W83781D_REG_I2C_ADDR 0x48
209 #define W83781D_REG_I2C_SUBADDR 0x4A
211 /* Sensor selection */
212 #define W83781D_REG_SCFG1 0x5D
213 static const u8 BIT_SCFG1[] = { 0x02, 0x04, 0x08 };
214 #define W83781D_REG_SCFG2 0x59
215 static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 };
216 #define W83781D_DEFAULT_BETA 3435
218 /* Conversions. Limit checking is only done on the TO_REG
219 variants. Note that you should be a bit careful with which arguments
220 these macros are called: arguments may be evaluated more than once.
221 Fixing this is just not worth it. */
222 #define IN_TO_REG(val) (SENSORS_LIMIT((((val) + 8)/16),0,255))
223 #define IN_FROM_REG(val) ((val) * 16)
225 static inline u8 FAN_TO_REG(long rpm, int div)
229 rpm = SENSORS_LIMIT(rpm, 1, 1000000);
230 return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1,
234 #define TEMP_MIN (-128000)
235 #define TEMP_MAX ( 127000)
237 /* TEMP: 0.001C/bit (-128C to +127C)
238 REG: 1C/bit, two's complement */
239 static u8 TEMP_TO_REG(int temp)
241 int ntemp = SENSORS_LIMIT(temp, TEMP_MIN, TEMP_MAX);
242 ntemp += (ntemp<0 ? -500 : 500);
243 return (u8)(ntemp / 1000);
246 static int TEMP_FROM_REG(u8 reg)
248 return (s8)reg * 1000;
251 #define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==255?0:1350000/((val)*(div)))
253 #define PWM_TO_REG(val) (SENSORS_LIMIT((val),0,255))
255 #define BEEP_MASK_FROM_REG(val) (val)
256 #define BEEP_MASK_TO_REG(val) ((val) & 0xffffff)
257 #define BEEP_ENABLE_TO_REG(val) ((val)?1:0)
258 #define BEEP_ENABLE_FROM_REG(val) ((val)?1:0)
260 #define DIV_FROM_REG(val) (1 << (val))
262 static inline u8 DIV_TO_REG(long val)
265 val = SENSORS_LIMIT(val, 1, 128) >> 1;
266 for (i = 0; i < 6; i++) {
274 /* For each registered chip, we need to keep some data in memory. That
275 data is pointed to by w83627hf_list[NR]->data. The structure itself is
276 dynamically allocated, at the same time when a new client is allocated. */
277 struct w83627hf_data {
278 struct i2c_client client;
279 struct semaphore lock;
282 struct semaphore update_lock;
283 char valid; /* !=0 if following fields are valid */
284 unsigned long last_updated; /* In jiffies */
286 struct i2c_client *lm75; /* for secondary I2C addresses */
287 /* pointer to array of 2 subclients */
289 u8 in[9]; /* Register value */
290 u8 in_max[9]; /* Register value */
291 u8 in_min[9]; /* Register value */
292 u8 fan[3]; /* Register value */
293 u8 fan_min[3]; /* Register value */
295 u8 temp_max; /* Register value */
296 u8 temp_max_hyst; /* Register value */
297 u16 temp_add[2]; /* Register value */
298 u16 temp_max_add[2]; /* Register value */
299 u16 temp_max_hyst_add[2]; /* Register value */
300 u8 fan_div[3]; /* Register encoding, shifted right */
301 u8 vid; /* Register encoding, combined */
302 u32 alarms; /* Register encoding, combined */
303 u32 beep_mask; /* Register encoding, combined */
304 u8 beep_enable; /* Boolean */
305 u8 pwm[3]; /* Register value */
306 u8 pwmenable[3]; /* bool */
307 u16 sens[3]; /* 782D/783S only.
308 1 = pentium diode; 2 = 3904 diode;
309 3000-5000 = thermistor beta.
311 Other Betas unimplemented */
313 u8 vrm_ovt; /* Register value, 627thf & 637hf only */
317 static int w83627hf_attach_adapter(struct i2c_adapter *adapter);
318 static int w83627hf_detect(struct i2c_adapter *adapter, int address,
320 static int w83627hf_detach_client(struct i2c_client *client);
322 static int w83627hf_read_value(struct i2c_client *client, u16 register);
323 static int w83627hf_write_value(struct i2c_client *client, u16 register,
325 static struct w83627hf_data *w83627hf_update_device(struct device *dev);
326 static void w83627hf_init_client(struct i2c_client *client);
328 static struct i2c_driver w83627hf_driver = {
329 .owner = THIS_MODULE,
331 .id = I2C_DRIVERID_W83627HF,
332 .flags = I2C_DF_NOTIFY,
333 .attach_adapter = w83627hf_attach_adapter,
334 .detach_client = w83627hf_detach_client,
337 /* following are the sysfs callback functions */
338 #define show_in_reg(reg) \
339 static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
341 struct w83627hf_data *data = w83627hf_update_device(dev); \
342 return sprintf(buf,"%ld\n", (long)IN_FROM_REG(data->reg[nr])); \
348 #define store_in_reg(REG, reg) \
350 store_in_##reg (struct device *dev, const char *buf, size_t count, int nr) \
352 struct i2c_client *client = to_i2c_client(dev); \
353 struct w83627hf_data *data = i2c_get_clientdata(client); \
356 val = simple_strtoul(buf, NULL, 10); \
357 data->in_##reg[nr] = IN_TO_REG(val); \
358 w83627hf_write_value(client, W83781D_REG_IN_##REG(nr), \
359 data->in_##reg[nr]); \
363 store_in_reg(MIN, min)
364 store_in_reg(MAX, max)
366 #define sysfs_in_offset(offset) \
368 show_regs_in_##offset (struct device *dev, char *buf) \
370 return show_in(dev, buf, offset); \
372 static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_regs_in_##offset, NULL);
374 #define sysfs_in_reg_offset(reg, offset) \
375 static ssize_t show_regs_in_##reg##offset (struct device *dev, char *buf) \
377 return show_in_##reg (dev, buf, offset); \
380 store_regs_in_##reg##offset (struct device *dev, \
381 const char *buf, size_t count) \
383 return store_in_##reg (dev, buf, count, offset); \
385 static DEVICE_ATTR(in##offset##_##reg, S_IRUGO| S_IWUSR, \
386 show_regs_in_##reg##offset, store_regs_in_##reg##offset);
388 #define sysfs_in_offsets(offset) \
389 sysfs_in_offset(offset) \
390 sysfs_in_reg_offset(min, offset) \
391 sysfs_in_reg_offset(max, offset)
402 /* use a different set of functions for in0 */
403 static ssize_t show_in_0(struct w83627hf_data *data, char *buf, u8 reg)
407 if ((data->vrm_ovt & 0x01) &&
408 (w83627thf == data->type || w83637hf == data->type))
410 /* use VRM9 calculation */
411 in0 = (long)((reg * 488 + 70000 + 50) / 100);
413 /* use VRM8 (standard) calculation */
414 in0 = (long)IN_FROM_REG(reg);
416 return sprintf(buf,"%ld\n", in0);
419 static ssize_t show_regs_in_0(struct device *dev, char *buf)
421 struct w83627hf_data *data = w83627hf_update_device(dev);
422 return show_in_0(data, buf, data->in[0]);
425 static ssize_t show_regs_in_min0(struct device *dev, char *buf)
427 struct w83627hf_data *data = w83627hf_update_device(dev);
428 return show_in_0(data, buf, data->in_min[0]);
431 static ssize_t show_regs_in_max0(struct device *dev, char *buf)
433 struct w83627hf_data *data = w83627hf_update_device(dev);
434 return show_in_0(data, buf, data->in_max[0]);
437 static ssize_t store_regs_in_min0(struct device *dev,
438 const char *buf, size_t count)
440 struct i2c_client *client = to_i2c_client(dev);
441 struct w83627hf_data *data = i2c_get_clientdata(client);
444 val = simple_strtoul(buf, NULL, 10);
445 if ((data->vrm_ovt & 0x01) &&
446 (w83627thf == data->type || w83637hf == data->type))
448 /* use VRM9 calculation */
449 data->in_min[0] = (u8)(((val * 100) - 70000 + 244) / 488);
451 /* use VRM8 (standard) calculation */
452 data->in_min[0] = IN_TO_REG(val);
454 w83627hf_write_value(client, W83781D_REG_IN_MIN(0), data->in_min[0]);
458 static ssize_t store_regs_in_max0(struct device *dev,
459 const char *buf, size_t count)
461 struct i2c_client *client = to_i2c_client(dev);
462 struct w83627hf_data *data = i2c_get_clientdata(client);
465 val = simple_strtoul(buf, NULL, 10);
466 if ((data->vrm_ovt & 0x01) &&
467 (w83627thf == data->type || w83637hf == data->type))
469 /* use VRM9 calculation */
470 data->in_max[0] = (u8)(((val * 100) - 70000 + 244) / 488);
472 /* use VRM8 (standard) calculation */
473 data->in_max[0] = IN_TO_REG(val);
475 w83627hf_write_value(client, W83781D_REG_IN_MAX(0), data->in_max[0]);
479 static DEVICE_ATTR(in0_input, S_IRUGO, show_regs_in_0, NULL);
480 static DEVICE_ATTR(in0_min, S_IRUGO | S_IWUSR,
481 show_regs_in_min0, store_regs_in_min0);
482 static DEVICE_ATTR(in0_max, S_IRUGO | S_IWUSR,
483 show_regs_in_max0, store_regs_in_max0);
485 #define device_create_file_in(client, offset) \
487 device_create_file(&client->dev, &dev_attr_in##offset##_input); \
488 device_create_file(&client->dev, &dev_attr_in##offset##_min); \
489 device_create_file(&client->dev, &dev_attr_in##offset##_max); \
492 #define show_fan_reg(reg) \
493 static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
495 struct w83627hf_data *data = w83627hf_update_device(dev); \
496 return sprintf(buf,"%ld\n", \
497 FAN_FROM_REG(data->reg[nr-1], \
498 (long)DIV_FROM_REG(data->fan_div[nr-1]))); \
501 show_fan_reg(fan_min);
504 store_fan_min(struct device *dev, const char *buf, size_t count, int nr)
506 struct i2c_client *client = to_i2c_client(dev);
507 struct w83627hf_data *data = i2c_get_clientdata(client);
510 val = simple_strtoul(buf, NULL, 10);
511 data->fan_min[nr - 1] =
512 FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr - 1]));
513 w83627hf_write_value(client, W83781D_REG_FAN_MIN(nr),
514 data->fan_min[nr - 1]);
519 #define sysfs_fan_offset(offset) \
520 static ssize_t show_regs_fan_##offset (struct device *dev, char *buf) \
522 return show_fan(dev, buf, offset); \
524 static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_regs_fan_##offset, NULL);
526 #define sysfs_fan_min_offset(offset) \
527 static ssize_t show_regs_fan_min##offset (struct device *dev, char *buf) \
529 return show_fan_min(dev, buf, offset); \
532 store_regs_fan_min##offset (struct device *dev, const char *buf, size_t count) \
534 return store_fan_min(dev, buf, count, offset); \
536 static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
537 show_regs_fan_min##offset, store_regs_fan_min##offset);
540 sysfs_fan_min_offset(1);
542 sysfs_fan_min_offset(2);
544 sysfs_fan_min_offset(3);
546 #define device_create_file_fan(client, offset) \
548 device_create_file(&client->dev, &dev_attr_fan##offset##_input); \
549 device_create_file(&client->dev, &dev_attr_fan##offset##_min); \
552 #define show_temp_reg(reg) \
553 static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
555 struct w83627hf_data *data = w83627hf_update_device(dev); \
556 if (nr >= 2) { /* TEMP2 and TEMP3 */ \
557 return sprintf(buf,"%ld\n", \
558 (long)LM75_TEMP_FROM_REG(data->reg##_add[nr-2])); \
559 } else { /* TEMP1 */ \
560 return sprintf(buf,"%ld\n", (long)TEMP_FROM_REG(data->reg)); \
564 show_temp_reg(temp_max);
565 show_temp_reg(temp_max_hyst);
567 #define store_temp_reg(REG, reg) \
569 store_temp_##reg (struct device *dev, const char *buf, size_t count, int nr) \
571 struct i2c_client *client = to_i2c_client(dev); \
572 struct w83627hf_data *data = i2c_get_clientdata(client); \
575 val = simple_strtoul(buf, NULL, 10); \
577 if (nr >= 2) { /* TEMP2 and TEMP3 */ \
578 data->temp_##reg##_add[nr-2] = LM75_TEMP_TO_REG(val); \
579 w83627hf_write_value(client, W83781D_REG_TEMP_##REG(nr), \
580 data->temp_##reg##_add[nr-2]); \
581 } else { /* TEMP1 */ \
582 data->temp_##reg = TEMP_TO_REG(val); \
583 w83627hf_write_value(client, W83781D_REG_TEMP_##REG(nr), \
589 store_temp_reg(OVER, max);
590 store_temp_reg(HYST, max_hyst);
592 #define sysfs_temp_offset(offset) \
594 show_regs_temp_##offset (struct device *dev, char *buf) \
596 return show_temp(dev, buf, offset); \
598 static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_regs_temp_##offset, NULL);
600 #define sysfs_temp_reg_offset(reg, offset) \
601 static ssize_t show_regs_temp_##reg##offset (struct device *dev, char *buf) \
603 return show_temp_##reg (dev, buf, offset); \
606 store_regs_temp_##reg##offset (struct device *dev, \
607 const char *buf, size_t count) \
609 return store_temp_##reg (dev, buf, count, offset); \
611 static DEVICE_ATTR(temp##offset##_##reg, S_IRUGO| S_IWUSR, \
612 show_regs_temp_##reg##offset, store_regs_temp_##reg##offset);
614 #define sysfs_temp_offsets(offset) \
615 sysfs_temp_offset(offset) \
616 sysfs_temp_reg_offset(max, offset) \
617 sysfs_temp_reg_offset(max_hyst, offset)
619 sysfs_temp_offsets(1);
620 sysfs_temp_offsets(2);
621 sysfs_temp_offsets(3);
623 #define device_create_file_temp(client, offset) \
625 device_create_file(&client->dev, &dev_attr_temp##offset##_input); \
626 device_create_file(&client->dev, &dev_attr_temp##offset##_max); \
627 device_create_file(&client->dev, &dev_attr_temp##offset##_max_hyst); \
631 show_vid_reg(struct device *dev, char *buf)
633 struct w83627hf_data *data = w83627hf_update_device(dev);
634 return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm));
636 static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL);
637 #define device_create_file_vid(client) \
638 device_create_file(&client->dev, &dev_attr_cpu0_vid)
641 show_vrm_reg(struct device *dev, char *buf)
643 struct w83627hf_data *data = w83627hf_update_device(dev);
644 return sprintf(buf, "%ld\n", (long) data->vrm);
647 store_vrm_reg(struct device *dev, const char *buf, size_t count)
649 struct i2c_client *client = to_i2c_client(dev);
650 struct w83627hf_data *data = i2c_get_clientdata(client);
653 val = simple_strtoul(buf, NULL, 10);
658 static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg);
659 #define device_create_file_vrm(client) \
660 device_create_file(&client->dev, &dev_attr_vrm)
663 show_alarms_reg(struct device *dev, char *buf)
665 struct w83627hf_data *data = w83627hf_update_device(dev);
666 return sprintf(buf, "%ld\n", (long) data->alarms);
668 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
669 #define device_create_file_alarms(client) \
670 device_create_file(&client->dev, &dev_attr_alarms)
672 #define show_beep_reg(REG, reg) \
673 static ssize_t show_beep_##reg (struct device *dev, char *buf) \
675 struct w83627hf_data *data = w83627hf_update_device(dev); \
676 return sprintf(buf,"%ld\n", \
677 (long)BEEP_##REG##_FROM_REG(data->beep_##reg)); \
679 show_beep_reg(ENABLE, enable)
680 show_beep_reg(MASK, mask)
682 #define BEEP_ENABLE 0 /* Store beep_enable */
683 #define BEEP_MASK 1 /* Store beep_mask */
686 store_beep_reg(struct device *dev, const char *buf, size_t count,
689 struct i2c_client *client = to_i2c_client(dev);
690 struct w83627hf_data *data = i2c_get_clientdata(client);
693 val = simple_strtoul(buf, NULL, 10);
695 if (update_mask == BEEP_MASK) { /* We are storing beep_mask */
696 data->beep_mask = BEEP_MASK_TO_REG(val);
697 w83627hf_write_value(client, W83781D_REG_BEEP_INTS1,
698 data->beep_mask & 0xff);
699 w83627hf_write_value(client, W83781D_REG_BEEP_INTS3,
700 ((data->beep_mask) >> 16) & 0xff);
701 val2 = (data->beep_mask >> 8) & 0x7f;
702 } else { /* We are storing beep_enable */
704 w83627hf_read_value(client, W83781D_REG_BEEP_INTS2) & 0x7f;
705 data->beep_enable = BEEP_ENABLE_TO_REG(val);
708 w83627hf_write_value(client, W83781D_REG_BEEP_INTS2,
709 val2 | data->beep_enable << 7);
714 #define sysfs_beep(REG, reg) \
715 static ssize_t show_regs_beep_##reg (struct device *dev, char *buf) \
717 return show_beep_##reg(dev, buf); \
720 store_regs_beep_##reg (struct device *dev, const char *buf, size_t count) \
722 return store_beep_reg(dev, buf, count, BEEP_##REG); \
724 static DEVICE_ATTR(beep_##reg, S_IRUGO | S_IWUSR, \
725 show_regs_beep_##reg, store_regs_beep_##reg);
727 sysfs_beep(ENABLE, enable);
728 sysfs_beep(MASK, mask);
730 #define device_create_file_beep(client) \
732 device_create_file(&client->dev, &dev_attr_beep_enable); \
733 device_create_file(&client->dev, &dev_attr_beep_mask); \
737 show_fan_div_reg(struct device *dev, char *buf, int nr)
739 struct w83627hf_data *data = w83627hf_update_device(dev);
740 return sprintf(buf, "%ld\n",
741 (long) DIV_FROM_REG(data->fan_div[nr - 1]));
744 /* Note: we save and restore the fan minimum here, because its value is
745 determined in part by the fan divisor. This follows the principle of
746 least suprise; the user doesn't expect the fan minimum to change just
747 because the divisor changed. */
749 store_fan_div_reg(struct device *dev, const char *buf, size_t count, int nr)
751 struct i2c_client *client = to_i2c_client(dev);
752 struct w83627hf_data *data = i2c_get_clientdata(client);
757 min = FAN_FROM_REG(data->fan_min[nr],
758 DIV_FROM_REG(data->fan_div[nr]));
760 data->fan_div[nr] = DIV_TO_REG(simple_strtoul(buf, NULL, 10));
762 reg = (w83627hf_read_value(client, nr==2 ? W83781D_REG_PIN : W83781D_REG_VID_FANDIV)
763 & (nr==0 ? 0xcf : 0x3f))
764 | ((data->fan_div[nr] & 0x03) << (nr==0 ? 4 : 6));
765 w83627hf_write_value(client, nr==2 ? W83781D_REG_PIN : W83781D_REG_VID_FANDIV, reg);
767 reg = (w83627hf_read_value(client, W83781D_REG_VBAT)
769 | ((data->fan_div[nr] & 0x04) << (3 + nr));
770 w83627hf_write_value(client, W83781D_REG_VBAT, reg);
772 /* Restore fan_min */
773 data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
774 w83627hf_write_value(client, W83781D_REG_FAN_MIN(nr+1), data->fan_min[nr]);
779 #define sysfs_fan_div(offset) \
780 static ssize_t show_regs_fan_div_##offset (struct device *dev, char *buf) \
782 return show_fan_div_reg(dev, buf, offset); \
785 store_regs_fan_div_##offset (struct device *dev, \
786 const char *buf, size_t count) \
788 return store_fan_div_reg(dev, buf, count, offset - 1); \
790 static DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
791 show_regs_fan_div_##offset, store_regs_fan_div_##offset);
797 #define device_create_file_fan_div(client, offset) \
799 device_create_file(&client->dev, &dev_attr_fan##offset##_div); \
803 show_pwm_reg(struct device *dev, char *buf, int nr)
805 struct w83627hf_data *data = w83627hf_update_device(dev);
806 return sprintf(buf, "%ld\n", (long) data->pwm[nr - 1]);
810 store_pwm_reg(struct device *dev, const char *buf, size_t count, int nr)
812 struct i2c_client *client = to_i2c_client(dev);
813 struct w83627hf_data *data = i2c_get_clientdata(client);
816 val = simple_strtoul(buf, NULL, 10);
818 if (data->type == w83627thf) {
819 /* bits 0-3 are reserved in 627THF */
820 data->pwm[nr - 1] = PWM_TO_REG(val) & 0xf0;
821 w83627hf_write_value(client,
822 W836X7HF_REG_PWM(data->type, nr),
824 (w83627hf_read_value(client,
825 W836X7HF_REG_PWM(data->type, nr)) & 0x0f));
827 data->pwm[nr - 1] = PWM_TO_REG(val);
828 w83627hf_write_value(client,
829 W836X7HF_REG_PWM(data->type, nr),
836 #define sysfs_pwm(offset) \
837 static ssize_t show_regs_pwm_##offset (struct device *dev, char *buf) \
839 return show_pwm_reg(dev, buf, offset); \
842 store_regs_pwm_##offset (struct device *dev, const char *buf, size_t count) \
844 return store_pwm_reg(dev, buf, count, offset); \
846 static DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \
847 show_regs_pwm_##offset, store_regs_pwm_##offset);
853 #define device_create_file_pwm(client, offset) \
855 device_create_file(&client->dev, &dev_attr_pwm##offset); \
859 show_sensor_reg(struct device *dev, char *buf, int nr)
861 struct w83627hf_data *data = w83627hf_update_device(dev);
862 return sprintf(buf, "%ld\n", (long) data->sens[nr - 1]);
866 store_sensor_reg(struct device *dev, const char *buf, size_t count, int nr)
868 struct i2c_client *client = to_i2c_client(dev);
869 struct w83627hf_data *data = i2c_get_clientdata(client);
872 val = simple_strtoul(buf, NULL, 10);
875 case 1: /* PII/Celeron diode */
876 tmp = w83627hf_read_value(client, W83781D_REG_SCFG1);
877 w83627hf_write_value(client, W83781D_REG_SCFG1,
878 tmp | BIT_SCFG1[nr - 1]);
879 tmp = w83627hf_read_value(client, W83781D_REG_SCFG2);
880 w83627hf_write_value(client, W83781D_REG_SCFG2,
881 tmp | BIT_SCFG2[nr - 1]);
882 data->sens[nr - 1] = val;
885 tmp = w83627hf_read_value(client, W83781D_REG_SCFG1);
886 w83627hf_write_value(client, W83781D_REG_SCFG1,
887 tmp | BIT_SCFG1[nr - 1]);
888 tmp = w83627hf_read_value(client, W83781D_REG_SCFG2);
889 w83627hf_write_value(client, W83781D_REG_SCFG2,
890 tmp & ~BIT_SCFG2[nr - 1]);
891 data->sens[nr - 1] = val;
893 case W83781D_DEFAULT_BETA: /* thermistor */
894 tmp = w83627hf_read_value(client, W83781D_REG_SCFG1);
895 w83627hf_write_value(client, W83781D_REG_SCFG1,
896 tmp & ~BIT_SCFG1[nr - 1]);
897 data->sens[nr - 1] = val;
900 dev_err(&client->dev,
901 "Invalid sensor type %ld; must be 1, 2, or %d\n",
902 (long) val, W83781D_DEFAULT_BETA);
909 #define sysfs_sensor(offset) \
910 static ssize_t show_regs_sensor_##offset (struct device *dev, char *buf) \
912 return show_sensor_reg(dev, buf, offset); \
915 store_regs_sensor_##offset (struct device *dev, const char *buf, size_t count) \
917 return store_sensor_reg(dev, buf, count, offset); \
919 static DEVICE_ATTR(temp##offset##_type, S_IRUGO | S_IWUSR, \
920 show_regs_sensor_##offset, store_regs_sensor_##offset);
926 #define device_create_file_sensor(client, offset) \
928 device_create_file(&client->dev, &dev_attr_temp##offset##_type); \
932 /* This function is called when:
933 * w83627hf_driver is inserted (when this module is loaded), for each
935 * when a new adapter is inserted (and w83627hf_driver is still present) */
936 static int w83627hf_attach_adapter(struct i2c_adapter *adapter)
938 return i2c_detect(adapter, &addr_data, w83627hf_detect);
941 static int w83627hf_find(int *address)
946 val= superio_inb(DEVID);
947 if(val != W627_DEVID &&
948 val != W627THF_DEVID &&
955 superio_select(W83627HF_LD_HWM);
956 val = (superio_inb(WINB_BASE_REG) << 8) |
957 superio_inb(WINB_BASE_REG + 1);
958 *address = val & ~(WINB_EXTENT - 1);
959 if (*address == 0 && force_addr == 0) {
964 *address = force_addr; /* so detect will get called */
970 int w83627hf_detect(struct i2c_adapter *adapter, int address,
974 struct i2c_client *new_client;
975 struct w83627hf_data *data;
977 const char *client_name = "";
979 if (!i2c_is_isa_adapter(adapter)) {
985 address = force_addr & ~(WINB_EXTENT - 1);
987 if (!request_region(address, WINB_EXTENT, "w83627hf")) {
993 printk("w83627hf.o: forcing ISA address 0x%04X\n", address);
995 superio_select(W83627HF_LD_HWM);
996 superio_outb(WINB_BASE_REG, address >> 8);
997 superio_outb(WINB_BASE_REG+1, address & 0xff);
1002 val= superio_inb(DEVID);
1003 if(val == W627_DEVID)
1005 else if(val == W697_DEVID)
1007 else if(val == W627THF_DEVID)
1009 else if(val == W637_DEVID)
1012 dev_info(&adapter->dev,
1013 "Unsupported chip (dev_id=0x%02X).\n", val);
1017 superio_select(W83627HF_LD_HWM);
1018 if((val = 0x01 & superio_inb(WINB_ACT_REG)) == 0)
1019 superio_outb(WINB_ACT_REG, 1);
1022 /* OK. For now, we presume we have a valid client. We now create the
1023 client structure, even though we cannot fill it completely yet.
1024 But it allows us to access w83627hf_{read,write}_value. */
1026 if (!(data = kmalloc(sizeof(struct w83627hf_data), GFP_KERNEL))) {
1030 memset(data, 0, sizeof(struct w83627hf_data));
1032 new_client = &data->client;
1033 i2c_set_clientdata(new_client, data);
1034 new_client->addr = address;
1035 init_MUTEX(&data->lock);
1036 new_client->adapter = adapter;
1037 new_client->driver = &w83627hf_driver;
1038 new_client->flags = 0;
1041 if (kind == w83627hf) {
1042 client_name = "w83627hf";
1043 } else if (kind == w83627thf) {
1044 client_name = "w83627thf";
1045 } else if (kind == w83697hf) {
1046 client_name = "w83697hf";
1047 } else if (kind == w83637hf) {
1048 client_name = "w83637hf";
1051 /* Fill in the remaining client fields and put into the global list */
1052 strlcpy(new_client->name, client_name, I2C_NAME_SIZE);
1055 init_MUTEX(&data->update_lock);
1057 /* Tell the I2C layer a new client has arrived */
1058 if ((err = i2c_attach_client(new_client)))
1063 /* Initialize the chip */
1064 w83627hf_init_client(new_client);
1066 /* A few vars need to be filled upon startup */
1067 data->fan_min[0] = w83627hf_read_value(new_client, W83781D_REG_FAN_MIN(1));
1068 data->fan_min[1] = w83627hf_read_value(new_client, W83781D_REG_FAN_MIN(2));
1069 data->fan_min[2] = w83627hf_read_value(new_client, W83781D_REG_FAN_MIN(3));
1071 /* Register sysfs hooks */
1072 device_create_file_in(new_client, 0);
1073 if (kind != w83697hf)
1074 device_create_file_in(new_client, 1);
1075 device_create_file_in(new_client, 2);
1076 device_create_file_in(new_client, 3);
1077 device_create_file_in(new_client, 4);
1078 if (kind != w83627thf && kind != w83637hf) {
1079 device_create_file_in(new_client, 5);
1080 device_create_file_in(new_client, 6);
1082 device_create_file_in(new_client, 7);
1083 device_create_file_in(new_client, 8);
1085 device_create_file_fan(new_client, 1);
1086 device_create_file_fan(new_client, 2);
1087 if (kind != w83697hf)
1088 device_create_file_fan(new_client, 3);
1090 device_create_file_temp(new_client, 1);
1091 device_create_file_temp(new_client, 2);
1092 if (kind != w83697hf)
1093 device_create_file_temp(new_client, 3);
1095 if (kind != w83697hf)
1096 device_create_file_vid(new_client);
1098 if (kind != w83697hf)
1099 device_create_file_vrm(new_client);
1101 device_create_file_fan_div(new_client, 1);
1102 device_create_file_fan_div(new_client, 2);
1103 if (kind != w83697hf)
1104 device_create_file_fan_div(new_client, 3);
1106 device_create_file_alarms(new_client);
1108 device_create_file_beep(new_client);
1110 device_create_file_pwm(new_client, 1);
1111 device_create_file_pwm(new_client, 2);
1112 if (kind == w83627thf || kind == w83637hf)
1113 device_create_file_pwm(new_client, 3);
1115 device_create_file_sensor(new_client, 1);
1116 device_create_file_sensor(new_client, 2);
1117 if (kind != w83697hf)
1118 device_create_file_sensor(new_client, 3);
1125 release_region(address, WINB_EXTENT);
1130 static int w83627hf_detach_client(struct i2c_client *client)
1134 if ((err = i2c_detach_client(client))) {
1135 dev_err(&client->dev,
1136 "Client deregistration failed, client not detached.\n");
1140 release_region(client->addr, WINB_EXTENT);
1141 kfree(i2c_get_clientdata(client));
1148 ISA access must always be locked explicitly!
1149 We ignore the W83781D BUSY flag at this moment - it could lead to deadlocks,
1150 would slow down the W83781D access and should not be necessary.
1151 There are some ugly typecasts here, but the good news is - they should
1152 nowhere else be necessary! */
1153 static int w83627hf_read_value(struct i2c_client *client, u16 reg)
1155 struct w83627hf_data *data = i2c_get_clientdata(client);
1156 int res, word_sized;
1159 word_sized = (((reg & 0xff00) == 0x100)
1160 || ((reg & 0xff00) == 0x200))
1161 && (((reg & 0x00ff) == 0x50)
1162 || ((reg & 0x00ff) == 0x53)
1163 || ((reg & 0x00ff) == 0x55));
1165 outb_p(W83781D_REG_BANK,
1166 client->addr + W83781D_ADDR_REG_OFFSET);
1168 client->addr + W83781D_DATA_REG_OFFSET);
1170 outb_p(reg & 0xff, client->addr + W83781D_ADDR_REG_OFFSET);
1171 res = inb_p(client->addr + W83781D_DATA_REG_OFFSET);
1173 outb_p((reg & 0xff) + 1,
1174 client->addr + W83781D_ADDR_REG_OFFSET);
1176 (res << 8) + inb_p(client->addr +
1177 W83781D_DATA_REG_OFFSET);
1180 outb_p(W83781D_REG_BANK,
1181 client->addr + W83781D_ADDR_REG_OFFSET);
1182 outb_p(0, client->addr + W83781D_DATA_REG_OFFSET);
1188 static int w83627thf_read_gpio5(struct i2c_client *client)
1190 struct w83627hf_data *data = i2c_get_clientdata(client);
1195 superio_select(W83627HF_LD_GPIO5);
1196 res = superio_inb(W83627THF_GPIO5_DR);
1197 inv = superio_inb(W83627THF_GPIO5_INVR);
1203 static int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value)
1205 struct w83627hf_data *data = i2c_get_clientdata(client);
1209 word_sized = (((reg & 0xff00) == 0x100)
1210 || ((reg & 0xff00) == 0x200))
1211 && (((reg & 0x00ff) == 0x53)
1212 || ((reg & 0x00ff) == 0x55));
1214 outb_p(W83781D_REG_BANK,
1215 client->addr + W83781D_ADDR_REG_OFFSET);
1217 client->addr + W83781D_DATA_REG_OFFSET);
1219 outb_p(reg & 0xff, client->addr + W83781D_ADDR_REG_OFFSET);
1222 client->addr + W83781D_DATA_REG_OFFSET);
1223 outb_p((reg & 0xff) + 1,
1224 client->addr + W83781D_ADDR_REG_OFFSET);
1226 outb_p(value & 0xff,
1227 client->addr + W83781D_DATA_REG_OFFSET);
1229 outb_p(W83781D_REG_BANK,
1230 client->addr + W83781D_ADDR_REG_OFFSET);
1231 outb_p(0, client->addr + W83781D_DATA_REG_OFFSET);
1237 /* Called when we have found a new W83781D. It should set limits, etc. */
1238 static void w83627hf_init_client(struct i2c_client *client)
1240 struct w83627hf_data *data = i2c_get_clientdata(client);
1242 int type = data->type;
1246 /* save this register */
1247 i = w83627hf_read_value(client, W83781D_REG_BEEP_CONFIG);
1248 /* Reset all except Watchdog values and last conversion values
1249 This sets fan-divs to 2, among others */
1250 w83627hf_write_value(client, W83781D_REG_CONFIG, 0x80);
1251 /* Restore the register and disable power-on abnormal beep.
1252 This saves FAN 1/2/3 input/output values set by BIOS. */
1253 w83627hf_write_value(client, W83781D_REG_BEEP_CONFIG, i | 0x80);
1254 /* Disable master beep-enable (reset turns it on).
1255 Individual beeps should be reset to off but for some reason
1256 disabling this bit helps some people not get beeped */
1257 w83627hf_write_value(client, W83781D_REG_BEEP_INTS2, 0);
1260 /* Minimize conflicts with other winbond i2c-only clients... */
1261 /* disable i2c subclients... how to disable main i2c client?? */
1262 /* force i2c address to relatively uncommon address */
1263 w83627hf_write_value(client, W83781D_REG_I2C_SUBADDR, 0x89);
1264 w83627hf_write_value(client, W83781D_REG_I2C_ADDR, force_i2c);
1266 /* Read VID only once */
1267 if (w83627hf == data->type || w83637hf == data->type) {
1268 int lo = w83627hf_read_value(client, W83781D_REG_VID_FANDIV);
1269 int hi = w83627hf_read_value(client, W83781D_REG_CHIPID);
1270 data->vid = (lo & 0x0f) | ((hi & 0x01) << 4);
1271 } else if (w83627thf == data->type) {
1272 data->vid = w83627thf_read_gpio5(client) & 0x1f;
1275 /* Read VRM & OVT Config only once */
1276 if (w83627thf == data->type || w83637hf == data->type) {
1278 w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG);
1279 data->vrm = (data->vrm_ovt & 0x01) ? 90 : 82;
1281 /* Convert VID to voltage based on default VRM */
1282 data->vrm = i2c_which_vrm();
1285 tmp = w83627hf_read_value(client, W83781D_REG_SCFG1);
1286 for (i = 1; i <= 3; i++) {
1287 if (!(tmp & BIT_SCFG1[i - 1])) {
1288 data->sens[i - 1] = W83781D_DEFAULT_BETA;
1290 if (w83627hf_read_value
1292 W83781D_REG_SCFG2) & BIT_SCFG2[i - 1])
1293 data->sens[i - 1] = 1;
1295 data->sens[i - 1] = 2;
1297 if ((type == w83697hf) && (i == 2))
1301 data->pwmenable[0] = 1;
1302 data->pwmenable[1] = 1;
1303 data->pwmenable[2] = 1;
1306 if (type == w83627hf) {
1307 /* enable PWM2 control (can't hurt since PWM reg
1308 should have been reset to 0xff) */
1309 w83627hf_write_value(client, W83627HF_REG_PWMCLK12,
1312 /* enable comparator mode for temp2 and temp3 so
1313 alarm indication will work correctly */
1314 i = w83627hf_read_value(client, W83781D_REG_IRQ);
1316 w83627hf_write_value(client, W83781D_REG_IRQ,
1320 /* Start monitoring */
1321 w83627hf_write_value(client, W83781D_REG_CONFIG,
1322 (w83627hf_read_value(client,
1323 W83781D_REG_CONFIG) & 0xf7)
1327 static struct w83627hf_data *w83627hf_update_device(struct device *dev)
1329 struct i2c_client *client = to_i2c_client(dev);
1330 struct w83627hf_data *data = i2c_get_clientdata(client);
1333 down(&data->update_lock);
1335 if ((jiffies - data->last_updated > HZ + HZ / 2) ||
1336 (jiffies < data->last_updated) || !data->valid) {
1337 for (i = 0; i <= 8; i++) {
1338 /* skip missing sensors */
1339 if (((data->type == w83697hf) && (i == 1)) ||
1340 ((data->type == w83627thf || data->type == w83637hf)
1341 && (i == 4 || i == 5)))
1344 w83627hf_read_value(client, W83781D_REG_IN(i));
1346 w83627hf_read_value(client,
1347 W83781D_REG_IN_MIN(i));
1349 w83627hf_read_value(client,
1350 W83781D_REG_IN_MAX(i));
1352 for (i = 1; i <= 3; i++) {
1354 w83627hf_read_value(client, W83781D_REG_FAN(i));
1355 data->fan_min[i - 1] =
1356 w83627hf_read_value(client,
1357 W83781D_REG_FAN_MIN(i));
1359 for (i = 1; i <= 3; i++) {
1360 u8 tmp = w83627hf_read_value(client,
1361 W836X7HF_REG_PWM(data->type, i));
1362 /* bits 0-3 are reserved in 627THF */
1363 if (data->type == w83627thf)
1365 data->pwm[i - 1] = tmp;
1367 (data->type == w83627hf || data->type == w83697hf))
1371 data->temp = w83627hf_read_value(client, W83781D_REG_TEMP(1));
1373 w83627hf_read_value(client, W83781D_REG_TEMP_OVER(1));
1374 data->temp_max_hyst =
1375 w83627hf_read_value(client, W83781D_REG_TEMP_HYST(1));
1377 w83627hf_read_value(client, W83781D_REG_TEMP(2));
1378 data->temp_max_add[0] =
1379 w83627hf_read_value(client, W83781D_REG_TEMP_OVER(2));
1380 data->temp_max_hyst_add[0] =
1381 w83627hf_read_value(client, W83781D_REG_TEMP_HYST(2));
1382 if (data->type != w83697hf) {
1384 w83627hf_read_value(client, W83781D_REG_TEMP(3));
1385 data->temp_max_add[1] =
1386 w83627hf_read_value(client, W83781D_REG_TEMP_OVER(3));
1387 data->temp_max_hyst_add[1] =
1388 w83627hf_read_value(client, W83781D_REG_TEMP_HYST(3));
1391 i = w83627hf_read_value(client, W83781D_REG_VID_FANDIV);
1392 data->fan_div[0] = (i >> 4) & 0x03;
1393 data->fan_div[1] = (i >> 6) & 0x03;
1394 if (data->type != w83697hf) {
1395 data->fan_div[2] = (w83627hf_read_value(client,
1396 W83781D_REG_PIN) >> 6) & 0x03;
1398 i = w83627hf_read_value(client, W83781D_REG_VBAT);
1399 data->fan_div[0] |= (i >> 3) & 0x04;
1400 data->fan_div[1] |= (i >> 4) & 0x04;
1401 if (data->type != w83697hf)
1402 data->fan_div[2] |= (i >> 5) & 0x04;
1404 w83627hf_read_value(client, W83781D_REG_ALARM1) |
1405 (w83627hf_read_value(client, W83781D_REG_ALARM2) << 8) |
1406 (w83627hf_read_value(client, W83781D_REG_ALARM3) << 16);
1407 i = w83627hf_read_value(client, W83781D_REG_BEEP_INTS2);
1408 data->beep_enable = i >> 7;
1409 data->beep_mask = ((i & 0x7f) << 8) |
1410 w83627hf_read_value(client, W83781D_REG_BEEP_INTS1) |
1411 w83627hf_read_value(client, W83781D_REG_BEEP_INTS3) << 16;
1412 data->last_updated = jiffies;
1416 up(&data->update_lock);
1421 static int __init sensors_w83627hf_init(void)
1425 if (w83627hf_find(&addr)) {
1428 normal_isa[0] = addr;
1430 return i2c_add_driver(&w83627hf_driver);
1433 static void __exit sensors_w83627hf_exit(void)
1435 i2c_del_driver(&w83627hf_driver);
1438 MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
1439 "Philip Edelbrock <phil@netroedge.com>, "
1440 "and Mark Studebaker <mdsxyz123@yahoo.com>");
1441 MODULE_DESCRIPTION("W83627HF driver");
1442 MODULE_LICENSE("GPL");
1444 module_init(sensors_w83627hf_init);
1445 module_exit(sensors_w83627hf_exit);