2 * adt7475 - Thermal sensor driver for the ADT7475 chip and derivatives
3 * Copyright (C) 2007-2008, Advanced Micro Devices, Inc.
4 * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
5 * Copyright (C) 2008 Hans de Goede <hdegoede@redhat.com>
7 * Derived from the lm83 driver by Jean Delvare
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/slab.h>
17 #include <linux/i2c.h>
18 #include <linux/hwmon.h>
19 #include <linux/hwmon-sysfs.h>
20 #include <linux/err.h>
22 /* Indexes for the sysfs hooks */
33 /* These are unique identifiers for the sysfs functions - unlike the
34 numbers above, these are not also indexes into an array
40 /* 7475 Common Registers */
42 #define REG_VOLTAGE_BASE 0x21
43 #define REG_TEMP_BASE 0x25
44 #define REG_TACH_BASE 0x28
45 #define REG_PWM_BASE 0x30
46 #define REG_PWM_MAX_BASE 0x38
48 #define REG_DEVID 0x3D
49 #define REG_VENDID 0x3E
51 #define REG_STATUS1 0x41
52 #define REG_STATUS2 0x42
54 #define REG_VOLTAGE_MIN_BASE 0x46
55 #define REG_VOLTAGE_MAX_BASE 0x47
57 #define REG_TEMP_MIN_BASE 0x4E
58 #define REG_TEMP_MAX_BASE 0x4F
60 #define REG_TACH_MIN_BASE 0x54
62 #define REG_PWM_CONFIG_BASE 0x5C
64 #define REG_TEMP_TRANGE_BASE 0x5F
66 #define REG_PWM_MIN_BASE 0x64
68 #define REG_TEMP_TMIN_BASE 0x67
69 #define REG_TEMP_THERM_BASE 0x6A
71 #define REG_REMOTE1_HYSTERSIS 0x6D
72 #define REG_REMOTE2_HYSTERSIS 0x6E
74 #define REG_TEMP_OFFSET_BASE 0x70
76 #define REG_EXTEND1 0x76
77 #define REG_EXTEND2 0x77
78 #define REG_CONFIG5 0x7C
80 #define CONFIG5_TWOSCOMP 0x01
81 #define CONFIG5_TEMPOFFSET 0x02
83 /* ADT7475 Settings */
85 #define ADT7475_VOLTAGE_COUNT 2
86 #define ADT7475_TEMP_COUNT 3
87 #define ADT7475_TACH_COUNT 4
88 #define ADT7475_PWM_COUNT 3
90 /* Macro to read the registers */
92 #define adt7475_read(reg) i2c_smbus_read_byte_data(client, (reg))
94 /* Macros to easily index the registers */
96 #define TACH_REG(idx) (REG_TACH_BASE + ((idx) * 2))
97 #define TACH_MIN_REG(idx) (REG_TACH_MIN_BASE + ((idx) * 2))
99 #define PWM_REG(idx) (REG_PWM_BASE + (idx))
100 #define PWM_MAX_REG(idx) (REG_PWM_MAX_BASE + (idx))
101 #define PWM_MIN_REG(idx) (REG_PWM_MIN_BASE + (idx))
102 #define PWM_CONFIG_REG(idx) (REG_PWM_CONFIG_BASE + (idx))
104 #define VOLTAGE_REG(idx) (REG_VOLTAGE_BASE + (idx))
105 #define VOLTAGE_MIN_REG(idx) (REG_VOLTAGE_MIN_BASE + ((idx) * 2))
106 #define VOLTAGE_MAX_REG(idx) (REG_VOLTAGE_MAX_BASE + ((idx) * 2))
108 #define TEMP_REG(idx) (REG_TEMP_BASE + (idx))
109 #define TEMP_MIN_REG(idx) (REG_TEMP_MIN_BASE + ((idx) * 2))
110 #define TEMP_MAX_REG(idx) (REG_TEMP_MAX_BASE + ((idx) * 2))
111 #define TEMP_TMIN_REG(idx) (REG_TEMP_TMIN_BASE + (idx))
112 #define TEMP_THERM_REG(idx) (REG_TEMP_THERM_BASE + (idx))
113 #define TEMP_OFFSET_REG(idx) (REG_TEMP_OFFSET_BASE + (idx))
114 #define TEMP_TRANGE_REG(idx) (REG_TEMP_TRANGE_BASE + (idx))
116 static unsigned short normal_i2c
[] = { 0x2e, I2C_CLIENT_END
};
118 I2C_CLIENT_INSMOD_1(adt7475
);
120 static const struct i2c_device_id adt7475_id
[] = {
121 { "adt7475", adt7475
},
124 MODULE_DEVICE_TABLE(i2c
, adt7475_id
);
126 struct adt7475_data
{
127 struct device
*hwmon_dev
;
130 unsigned long measure_updated
;
131 unsigned long limits_updated
;
145 static struct i2c_driver adt7475_driver
;
146 static struct adt7475_data
*adt7475_update_device(struct device
*dev
);
147 static void adt7475_read_hystersis(struct i2c_client
*client
);
148 static void adt7475_read_pwm(struct i2c_client
*client
, int index
);
150 /* Given a temp value, convert it to register value */
152 static inline u16
temp2reg(struct adt7475_data
*data
, long val
)
156 if (!(data
->config5
& CONFIG5_TWOSCOMP
)) {
157 val
= SENSORS_LIMIT(val
, -64000, 191000);
158 ret
= (val
+ 64500) / 1000;
160 val
= SENSORS_LIMIT(val
, -128000, 127000);
162 ret
= (256500 + val
) / 1000;
164 ret
= (val
+ 500) / 1000;
170 /* Given a register value, convert it to a real temp value */
172 static inline int reg2temp(struct adt7475_data
*data
, u16 reg
)
174 if (data
->config5
& CONFIG5_TWOSCOMP
) {
176 return (reg
- 1024) * 250;
180 return (reg
- 256) * 250;
183 static inline int tach2rpm(u16 tach
)
185 if (tach
== 0 || tach
== 0xFFFF)
188 return (90000 * 60) / tach
;
191 static inline u16
rpm2tach(unsigned long rpm
)
196 return SENSORS_LIMIT((90000 * 60) / rpm
, 1, 0xFFFF);
199 static inline int reg2vcc(u16 reg
)
201 return (4296 * reg
) / 1000;
204 static inline int reg2vccp(u16 reg
)
206 return (2929 * reg
) / 1000;
209 static inline u16
vcc2reg(long vcc
)
211 vcc
= SENSORS_LIMIT(vcc
, 0, 4396);
212 return (vcc
* 1000) / 4296;
215 static inline u16
vccp2reg(long vcc
)
217 vcc
= SENSORS_LIMIT(vcc
, 0, 2998);
218 return (vcc
* 1000) / 2929;
221 static u16
adt7475_read_word(struct i2c_client
*client
, int reg
)
225 val
= i2c_smbus_read_byte_data(client
, reg
);
226 val
|= (i2c_smbus_read_byte_data(client
, reg
+ 1) << 8);
231 static void adt7475_write_word(struct i2c_client
*client
, int reg
, u16 val
)
233 i2c_smbus_write_byte_data(client
, reg
+ 1, val
>> 8);
234 i2c_smbus_write_byte_data(client
, reg
, val
& 0xFF);
237 /* Find the nearest value in a table - used for pwm frequency and
239 static int find_nearest(long val
, const int *array
, int size
)
246 if (val
> array
[size
- 1])
249 for (i
= 0; i
< size
- 1; i
++) {
252 if (val
> array
[i
+ 1])
256 b
= array
[i
+ 1] - val
;
258 return (a
<= b
) ? i
: i
+ 1;
264 static ssize_t
show_voltage(struct device
*dev
, struct device_attribute
*attr
,
267 struct adt7475_data
*data
= adt7475_update_device(dev
);
268 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
273 return sprintf(buf
, "%d\n",
274 (data
->alarms
>> (sattr
->index
+ 1)) & 1);
276 val
= data
->voltage
[sattr
->nr
][sattr
->index
];
277 return sprintf(buf
, "%d\n",
279 0 ? reg2vccp(val
) : reg2vcc(val
));
283 static ssize_t
set_voltage(struct device
*dev
, struct device_attribute
*attr
,
284 const char *buf
, size_t count
)
287 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
288 struct i2c_client
*client
= to_i2c_client(dev
);
289 struct adt7475_data
*data
= i2c_get_clientdata(client
);
293 if (strict_strtol(buf
, 10, &val
))
296 mutex_lock(&data
->lock
);
298 data
->voltage
[sattr
->nr
][sattr
->index
] =
299 sattr
->index
? vcc2reg(val
) : vccp2reg(val
);
301 if (sattr
->nr
== MIN
)
302 reg
= VOLTAGE_MIN_REG(sattr
->index
);
304 reg
= VOLTAGE_MAX_REG(sattr
->index
);
306 i2c_smbus_write_byte_data(client
, reg
,
307 data
->voltage
[sattr
->nr
][sattr
->index
] >> 2);
308 mutex_unlock(&data
->lock
);
313 static ssize_t
show_temp(struct device
*dev
, struct device_attribute
*attr
,
316 struct adt7475_data
*data
= adt7475_update_device(dev
);
317 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
322 mutex_lock(&data
->lock
);
323 out
= data
->temp
[sattr
->nr
][sattr
->index
];
324 if (sattr
->index
!= 1)
325 out
= (out
>> 4) & 0xF;
328 /* Show the value as an absolute number tied to
330 out
= reg2temp(data
, data
->temp
[THERM
][sattr
->index
]) -
332 mutex_unlock(&data
->lock
);
336 /* Offset is always 2's complement, regardless of the
337 * setting in CONFIG5 */
338 mutex_lock(&data
->lock
);
339 out
= (s8
)data
->temp
[sattr
->nr
][sattr
->index
];
340 if (data
->config5
& CONFIG5_TEMPOFFSET
)
344 mutex_unlock(&data
->lock
);
348 out
= (data
->alarms
>> (sattr
->index
+ 4)) & 1;
352 /* Note - only for remote1 and remote2 */
353 out
= !!(data
->alarms
& (sattr
->index
? 0x8000 : 0x4000));
357 /* All other temp values are in the configured format */
358 out
= reg2temp(data
, data
->temp
[sattr
->nr
][sattr
->index
]);
361 return sprintf(buf
, "%d\n", out
);
364 static ssize_t
set_temp(struct device
*dev
, struct device_attribute
*attr
,
365 const char *buf
, size_t count
)
367 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
368 struct i2c_client
*client
= to_i2c_client(dev
);
369 struct adt7475_data
*data
= i2c_get_clientdata(client
);
370 unsigned char reg
= 0;
375 if (strict_strtol(buf
, 10, &val
))
378 mutex_lock(&data
->lock
);
380 /* We need the config register in all cases for temp <-> reg conv. */
381 data
->config5
= adt7475_read(REG_CONFIG5
);
385 if (data
->config5
& CONFIG5_TEMPOFFSET
) {
386 val
= SENSORS_LIMIT(val
, -63000, 127000);
387 out
= data
->temp
[OFFSET
][sattr
->index
] = val
/ 1000;
389 val
= SENSORS_LIMIT(val
, -63000, 64000);
390 out
= data
->temp
[OFFSET
][sattr
->index
] = val
/ 500;
395 /* The value will be given as an absolute value, turn it
396 into an offset based on THERM */
398 /* Read fresh THERM and HYSTERSIS values from the chip */
399 data
->temp
[THERM
][sattr
->index
] =
400 adt7475_read(TEMP_THERM_REG(sattr
->index
)) << 2;
401 adt7475_read_hystersis(client
);
403 temp
= reg2temp(data
, data
->temp
[THERM
][sattr
->index
]);
404 val
= SENSORS_LIMIT(val
, temp
- 15000, temp
);
405 val
= (temp
- val
) / 1000;
407 if (sattr
->index
!= 1) {
408 data
->temp
[HYSTERSIS
][sattr
->index
] &= 0xF0;
409 data
->temp
[HYSTERSIS
][sattr
->index
] |= (val
& 0xF) << 4;
411 data
->temp
[HYSTERSIS
][sattr
->index
] &= 0x0F;
412 data
->temp
[HYSTERSIS
][sattr
->index
] |= (val
& 0xF);
415 out
= data
->temp
[HYSTERSIS
][sattr
->index
];
419 data
->temp
[sattr
->nr
][sattr
->index
] = temp2reg(data
, val
);
421 /* We maintain an extra 2 digits of precision for simplicity
422 * - shift those back off before writing the value */
423 out
= (u8
) (data
->temp
[sattr
->nr
][sattr
->index
] >> 2);
428 reg
= TEMP_MIN_REG(sattr
->index
);
431 reg
= TEMP_MAX_REG(sattr
->index
);
434 reg
= TEMP_OFFSET_REG(sattr
->index
);
437 reg
= TEMP_TMIN_REG(sattr
->index
);
440 reg
= TEMP_THERM_REG(sattr
->index
);
443 if (sattr
->index
!= 2)
444 reg
= REG_REMOTE1_HYSTERSIS
;
446 reg
= REG_REMOTE2_HYSTERSIS
;
451 i2c_smbus_write_byte_data(client
, reg
, out
);
453 mutex_unlock(&data
->lock
);
457 /* Table of autorange values - the user will write the value in millidegrees,
458 and we'll convert it */
459 static const int autorange_table
[] = {
460 2000, 2500, 3330, 4000, 5000, 6670, 8000,
461 10000, 13330, 16000, 20000, 26670, 32000, 40000,
465 static ssize_t
show_point2(struct device
*dev
, struct device_attribute
*attr
,
468 struct adt7475_data
*data
= adt7475_update_device(dev
);
469 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
472 mutex_lock(&data
->lock
);
473 out
= (data
->range
[sattr
->index
] >> 4) & 0x0F;
474 val
= reg2temp(data
, data
->temp
[AUTOMIN
][sattr
->index
]);
475 mutex_unlock(&data
->lock
);
477 return sprintf(buf
, "%d\n", val
+ autorange_table
[out
]);
480 static ssize_t
set_point2(struct device
*dev
, struct device_attribute
*attr
,
481 const char *buf
, size_t count
)
483 struct i2c_client
*client
= to_i2c_client(dev
);
484 struct adt7475_data
*data
= i2c_get_clientdata(client
);
485 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
489 if (strict_strtol(buf
, 10, &val
))
492 mutex_lock(&data
->lock
);
494 /* Get a fresh copy of the needed registers */
495 data
->config5
= adt7475_read(REG_CONFIG5
);
496 data
->temp
[AUTOMIN
][sattr
->index
] =
497 adt7475_read(TEMP_TMIN_REG(sattr
->index
)) << 2;
498 data
->range
[sattr
->index
] =
499 adt7475_read(TEMP_TRANGE_REG(sattr
->index
));
501 /* The user will write an absolute value, so subtract the start point
502 to figure the range */
503 temp
= reg2temp(data
, data
->temp
[AUTOMIN
][sattr
->index
]);
504 val
= SENSORS_LIMIT(val
, temp
+ autorange_table
[0],
505 temp
+ autorange_table
[ARRAY_SIZE(autorange_table
) - 1]);
508 /* Find the nearest table entry to what the user wrote */
509 val
= find_nearest(val
, autorange_table
, ARRAY_SIZE(autorange_table
));
511 data
->range
[sattr
->index
] &= ~0xF0;
512 data
->range
[sattr
->index
] |= val
<< 4;
514 i2c_smbus_write_byte_data(client
, TEMP_TRANGE_REG(sattr
->index
),
515 data
->range
[sattr
->index
]);
517 mutex_unlock(&data
->lock
);
521 static ssize_t
show_tach(struct device
*dev
, struct device_attribute
*attr
,
524 struct adt7475_data
*data
= adt7475_update_device(dev
);
525 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
528 if (sattr
->nr
== ALARM
)
529 out
= (data
->alarms
>> (sattr
->index
+ 10)) & 1;
531 out
= tach2rpm(data
->tach
[sattr
->nr
][sattr
->index
]);
533 return sprintf(buf
, "%d\n", out
);
536 static ssize_t
set_tach(struct device
*dev
, struct device_attribute
*attr
,
537 const char *buf
, size_t count
)
540 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
541 struct i2c_client
*client
= to_i2c_client(dev
);
542 struct adt7475_data
*data
= i2c_get_clientdata(client
);
545 if (strict_strtoul(buf
, 10, &val
))
548 mutex_lock(&data
->lock
);
550 data
->tach
[MIN
][sattr
->index
] = rpm2tach(val
);
552 adt7475_write_word(client
, TACH_MIN_REG(sattr
->index
),
553 data
->tach
[MIN
][sattr
->index
]);
555 mutex_unlock(&data
->lock
);
559 static ssize_t
show_pwm(struct device
*dev
, struct device_attribute
*attr
,
562 struct adt7475_data
*data
= adt7475_update_device(dev
);
563 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
565 return sprintf(buf
, "%d\n", data
->pwm
[sattr
->nr
][sattr
->index
]);
568 static ssize_t
show_pwmchan(struct device
*dev
, struct device_attribute
*attr
,
571 struct adt7475_data
*data
= adt7475_update_device(dev
);
572 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
574 return sprintf(buf
, "%d\n", data
->pwmchan
[sattr
->index
]);
577 static ssize_t
show_pwmctrl(struct device
*dev
, struct device_attribute
*attr
,
580 struct adt7475_data
*data
= adt7475_update_device(dev
);
581 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
583 return sprintf(buf
, "%d\n", data
->pwmctl
[sattr
->index
]);
586 static ssize_t
set_pwm(struct device
*dev
, struct device_attribute
*attr
,
587 const char *buf
, size_t count
)
590 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
591 struct i2c_client
*client
= to_i2c_client(dev
);
592 struct adt7475_data
*data
= i2c_get_clientdata(client
);
593 unsigned char reg
= 0;
596 if (strict_strtol(buf
, 10, &val
))
599 mutex_lock(&data
->lock
);
603 /* Get a fresh value for CONTROL */
604 data
->pwm
[CONTROL
][sattr
->index
] =
605 adt7475_read(PWM_CONFIG_REG(sattr
->index
));
607 /* If we are not in manual mode, then we shouldn't allow
608 * the user to set the pwm speed */
609 if (((data
->pwm
[CONTROL
][sattr
->index
] >> 5) & 7) != 7) {
610 mutex_unlock(&data
->lock
);
614 reg
= PWM_REG(sattr
->index
);
618 reg
= PWM_MIN_REG(sattr
->index
);
622 reg
= PWM_MAX_REG(sattr
->index
);
626 data
->pwm
[sattr
->nr
][sattr
->index
] = SENSORS_LIMIT(val
, 0, 0xFF);
627 i2c_smbus_write_byte_data(client
, reg
,
628 data
->pwm
[sattr
->nr
][sattr
->index
]);
630 mutex_unlock(&data
->lock
);
635 /* Called by set_pwmctrl and set_pwmchan */
637 static int hw_set_pwm(struct i2c_client
*client
, int index
,
638 unsigned int pwmctl
, unsigned int pwmchan
)
640 struct adt7475_data
*data
= i2c_get_clientdata(client
);
645 val
= 0x03; /* Run at full speed */
648 val
= 0x07; /* Manual mode */
653 /* Remote1 controls PWM */
657 /* local controls PWM */
661 /* remote2 controls PWM */
665 /* local/remote2 control PWM */
669 /* All three control PWM */
680 data
->pwmctl
[index
] = pwmctl
;
681 data
->pwmchan
[index
] = pwmchan
;
683 data
->pwm
[CONTROL
][index
] &= ~0xE0;
684 data
->pwm
[CONTROL
][index
] |= (val
& 7) << 5;
686 i2c_smbus_write_byte_data(client
, PWM_CONFIG_REG(index
),
687 data
->pwm
[CONTROL
][index
]);
692 static ssize_t
set_pwmchan(struct device
*dev
, struct device_attribute
*attr
,
693 const char *buf
, size_t count
)
695 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
696 struct i2c_client
*client
= to_i2c_client(dev
);
697 struct adt7475_data
*data
= i2c_get_clientdata(client
);
701 if (strict_strtol(buf
, 10, &val
))
704 mutex_lock(&data
->lock
);
705 /* Read Modify Write PWM values */
706 adt7475_read_pwm(client
, sattr
->index
);
707 r
= hw_set_pwm(client
, sattr
->index
, data
->pwmctl
[sattr
->index
], val
);
710 mutex_unlock(&data
->lock
);
715 static ssize_t
set_pwmctrl(struct device
*dev
, struct device_attribute
*attr
,
716 const char *buf
, size_t count
)
718 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
719 struct i2c_client
*client
= to_i2c_client(dev
);
720 struct adt7475_data
*data
= i2c_get_clientdata(client
);
724 if (strict_strtol(buf
, 10, &val
))
727 mutex_lock(&data
->lock
);
728 /* Read Modify Write PWM values */
729 adt7475_read_pwm(client
, sattr
->index
);
730 r
= hw_set_pwm(client
, sattr
->index
, val
, data
->pwmchan
[sattr
->index
]);
733 mutex_unlock(&data
->lock
);
738 /* List of frequencies for the PWM */
739 static const int pwmfreq_table
[] = {
740 11, 14, 22, 29, 35, 44, 58, 88
743 static ssize_t
show_pwmfreq(struct device
*dev
, struct device_attribute
*attr
,
746 struct adt7475_data
*data
= adt7475_update_device(dev
);
747 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
749 return sprintf(buf
, "%d\n",
750 pwmfreq_table
[data
->range
[sattr
->index
] & 7]);
753 static ssize_t
set_pwmfreq(struct device
*dev
, struct device_attribute
*attr
,
754 const char *buf
, size_t count
)
756 struct sensor_device_attribute_2
*sattr
= to_sensor_dev_attr_2(attr
);
757 struct i2c_client
*client
= to_i2c_client(dev
);
758 struct adt7475_data
*data
= i2c_get_clientdata(client
);
762 if (strict_strtol(buf
, 10, &val
))
765 out
= find_nearest(val
, pwmfreq_table
, ARRAY_SIZE(pwmfreq_table
));
767 mutex_lock(&data
->lock
);
769 data
->range
[sattr
->index
] =
770 adt7475_read(TEMP_TRANGE_REG(sattr
->index
));
771 data
->range
[sattr
->index
] &= ~7;
772 data
->range
[sattr
->index
] |= out
;
774 i2c_smbus_write_byte_data(client
, TEMP_TRANGE_REG(sattr
->index
),
775 data
->range
[sattr
->index
]);
777 mutex_unlock(&data
->lock
);
781 static SENSOR_DEVICE_ATTR_2(in1_input
, S_IRUGO
, show_voltage
, NULL
, INPUT
, 0);
782 static SENSOR_DEVICE_ATTR_2(in1_max
, S_IRUGO
| S_IWUSR
, show_voltage
,
783 set_voltage
, MAX
, 0);
784 static SENSOR_DEVICE_ATTR_2(in1_min
, S_IRUGO
| S_IWUSR
, show_voltage
,
785 set_voltage
, MIN
, 0);
786 static SENSOR_DEVICE_ATTR_2(in1_alarm
, S_IRUGO
, show_voltage
, NULL
, ALARM
, 0);
787 static SENSOR_DEVICE_ATTR_2(in2_input
, S_IRUGO
, show_voltage
, NULL
, INPUT
, 1);
788 static SENSOR_DEVICE_ATTR_2(in2_max
, S_IRUGO
| S_IWUSR
, show_voltage
,
789 set_voltage
, MAX
, 1);
790 static SENSOR_DEVICE_ATTR_2(in2_min
, S_IRUGO
| S_IWUSR
, show_voltage
,
791 set_voltage
, MIN
, 1);
792 static SENSOR_DEVICE_ATTR_2(in2_alarm
, S_IRUGO
, show_voltage
, NULL
, ALARM
, 1);
793 static SENSOR_DEVICE_ATTR_2(temp1_input
, S_IRUGO
, show_temp
, NULL
, INPUT
, 0);
794 static SENSOR_DEVICE_ATTR_2(temp1_alarm
, S_IRUGO
, show_temp
, NULL
, ALARM
, 0);
795 static SENSOR_DEVICE_ATTR_2(temp1_fault
, S_IRUGO
, show_temp
, NULL
, FAULT
, 0);
796 static SENSOR_DEVICE_ATTR_2(temp1_max
, S_IRUGO
| S_IWUSR
, show_temp
, set_temp
,
798 static SENSOR_DEVICE_ATTR_2(temp1_min
, S_IRUGO
| S_IWUSR
, show_temp
, set_temp
,
800 static SENSOR_DEVICE_ATTR_2(temp1_offset
, S_IRUGO
| S_IWUSR
, show_temp
,
801 set_temp
, OFFSET
, 0);
802 static SENSOR_DEVICE_ATTR_2(temp1_auto_point1_temp
, S_IRUGO
| S_IWUSR
,
803 show_temp
, set_temp
, AUTOMIN
, 0);
804 static SENSOR_DEVICE_ATTR_2(temp1_auto_point2_temp
, S_IRUGO
| S_IWUSR
,
805 show_point2
, set_point2
, 0, 0);
806 static SENSOR_DEVICE_ATTR_2(temp1_crit
, S_IRUGO
| S_IWUSR
, show_temp
, set_temp
,
808 static SENSOR_DEVICE_ATTR_2(temp1_crit_hyst
, S_IRUGO
| S_IWUSR
, show_temp
,
809 set_temp
, HYSTERSIS
, 0);
810 static SENSOR_DEVICE_ATTR_2(temp2_input
, S_IRUGO
, show_temp
, NULL
, INPUT
, 1);
811 static SENSOR_DEVICE_ATTR_2(temp2_alarm
, S_IRUGO
, show_temp
, NULL
, ALARM
, 1);
812 static SENSOR_DEVICE_ATTR_2(temp2_max
, S_IRUGO
| S_IWUSR
, show_temp
, set_temp
,
814 static SENSOR_DEVICE_ATTR_2(temp2_min
, S_IRUGO
| S_IWUSR
, show_temp
, set_temp
,
816 static SENSOR_DEVICE_ATTR_2(temp2_offset
, S_IRUGO
| S_IWUSR
, show_temp
,
817 set_temp
, OFFSET
, 1);
818 static SENSOR_DEVICE_ATTR_2(temp2_auto_point1_temp
, S_IRUGO
| S_IWUSR
,
819 show_temp
, set_temp
, AUTOMIN
, 1);
820 static SENSOR_DEVICE_ATTR_2(temp2_auto_point2_temp
, S_IRUGO
| S_IWUSR
,
821 show_point2
, set_point2
, 0, 1);
822 static SENSOR_DEVICE_ATTR_2(temp2_crit
, S_IRUGO
| S_IWUSR
, show_temp
, set_temp
,
824 static SENSOR_DEVICE_ATTR_2(temp2_crit_hyst
, S_IRUGO
| S_IWUSR
, show_temp
,
825 set_temp
, HYSTERSIS
, 1);
826 static SENSOR_DEVICE_ATTR_2(temp3_input
, S_IRUGO
, show_temp
, NULL
, INPUT
, 2);
827 static SENSOR_DEVICE_ATTR_2(temp3_alarm
, S_IRUGO
, show_temp
, NULL
, ALARM
, 2);
828 static SENSOR_DEVICE_ATTR_2(temp3_fault
, S_IRUGO
, show_temp
, NULL
, FAULT
, 2);
829 static SENSOR_DEVICE_ATTR_2(temp3_max
, S_IRUGO
| S_IWUSR
, show_temp
, set_temp
,
831 static SENSOR_DEVICE_ATTR_2(temp3_min
, S_IRUGO
| S_IWUSR
, show_temp
, set_temp
,
833 static SENSOR_DEVICE_ATTR_2(temp3_offset
, S_IRUGO
| S_IWUSR
, show_temp
,
834 set_temp
, OFFSET
, 2);
835 static SENSOR_DEVICE_ATTR_2(temp3_auto_point1_temp
, S_IRUGO
| S_IWUSR
,
836 show_temp
, set_temp
, AUTOMIN
, 2);
837 static SENSOR_DEVICE_ATTR_2(temp3_auto_point2_temp
, S_IRUGO
| S_IWUSR
,
838 show_point2
, set_point2
, 0, 2);
839 static SENSOR_DEVICE_ATTR_2(temp3_crit
, S_IRUGO
| S_IWUSR
, show_temp
, set_temp
,
841 static SENSOR_DEVICE_ATTR_2(temp3_crit_hyst
, S_IRUGO
| S_IWUSR
, show_temp
,
842 set_temp
, HYSTERSIS
, 2);
843 static SENSOR_DEVICE_ATTR_2(fan1_input
, S_IRUGO
, show_tach
, NULL
, INPUT
, 0);
844 static SENSOR_DEVICE_ATTR_2(fan1_min
, S_IRUGO
| S_IWUSR
, show_tach
, set_tach
,
846 static SENSOR_DEVICE_ATTR_2(fan1_alarm
, S_IRUGO
, show_tach
, NULL
, ALARM
, 0);
847 static SENSOR_DEVICE_ATTR_2(fan2_input
, S_IRUGO
, show_tach
, NULL
, INPUT
, 1);
848 static SENSOR_DEVICE_ATTR_2(fan2_min
, S_IRUGO
| S_IWUSR
, show_tach
, set_tach
,
850 static SENSOR_DEVICE_ATTR_2(fan2_alarm
, S_IRUGO
, show_tach
, NULL
, ALARM
, 1);
851 static SENSOR_DEVICE_ATTR_2(fan3_input
, S_IRUGO
, show_tach
, NULL
, INPUT
, 2);
852 static SENSOR_DEVICE_ATTR_2(fan3_min
, S_IRUGO
| S_IWUSR
, show_tach
, set_tach
,
854 static SENSOR_DEVICE_ATTR_2(fan3_alarm
, S_IRUGO
, show_tach
, NULL
, ALARM
, 2);
855 static SENSOR_DEVICE_ATTR_2(fan4_input
, S_IRUGO
, show_tach
, NULL
, INPUT
, 3);
856 static SENSOR_DEVICE_ATTR_2(fan4_min
, S_IRUGO
| S_IWUSR
, show_tach
, set_tach
,
858 static SENSOR_DEVICE_ATTR_2(fan4_alarm
, S_IRUGO
, show_tach
, NULL
, ALARM
, 3);
859 static SENSOR_DEVICE_ATTR_2(pwm1
, S_IRUGO
| S_IWUSR
, show_pwm
, set_pwm
, INPUT
,
861 static SENSOR_DEVICE_ATTR_2(pwm1_freq
, S_IRUGO
| S_IWUSR
, show_pwmfreq
,
862 set_pwmfreq
, INPUT
, 0);
863 static SENSOR_DEVICE_ATTR_2(pwm1_enable
, S_IRUGO
| S_IWUSR
, show_pwmctrl
,
864 set_pwmctrl
, INPUT
, 0);
865 static SENSOR_DEVICE_ATTR_2(pwm1_auto_channels_temp
, S_IRUGO
| S_IWUSR
,
866 show_pwmchan
, set_pwmchan
, INPUT
, 0);
867 static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_pwm
, S_IRUGO
| S_IWUSR
, show_pwm
,
869 static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_pwm
, S_IRUGO
| S_IWUSR
, show_pwm
,
871 static SENSOR_DEVICE_ATTR_2(pwm2
, S_IRUGO
| S_IWUSR
, show_pwm
, set_pwm
, INPUT
,
873 static SENSOR_DEVICE_ATTR_2(pwm2_freq
, S_IRUGO
| S_IWUSR
, show_pwmfreq
,
874 set_pwmfreq
, INPUT
, 1);
875 static SENSOR_DEVICE_ATTR_2(pwm2_enable
, S_IRUGO
| S_IWUSR
, show_pwmctrl
,
876 set_pwmctrl
, INPUT
, 1);
877 static SENSOR_DEVICE_ATTR_2(pwm2_auto_channels_temp
, S_IRUGO
| S_IWUSR
,
878 show_pwmchan
, set_pwmchan
, INPUT
, 1);
879 static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_pwm
, S_IRUGO
| S_IWUSR
, show_pwm
,
881 static SENSOR_DEVICE_ATTR_2(pwm2_auto_point2_pwm
, S_IRUGO
| S_IWUSR
, show_pwm
,
883 static SENSOR_DEVICE_ATTR_2(pwm3
, S_IRUGO
| S_IWUSR
, show_pwm
, set_pwm
, INPUT
,
885 static SENSOR_DEVICE_ATTR_2(pwm3_freq
, S_IRUGO
| S_IWUSR
, show_pwmfreq
,
886 set_pwmfreq
, INPUT
, 2);
887 static SENSOR_DEVICE_ATTR_2(pwm3_enable
, S_IRUGO
| S_IWUSR
, show_pwmctrl
,
888 set_pwmctrl
, INPUT
, 2);
889 static SENSOR_DEVICE_ATTR_2(pwm3_auto_channels_temp
, S_IRUGO
| S_IWUSR
,
890 show_pwmchan
, set_pwmchan
, INPUT
, 2);
891 static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_pwm
, S_IRUGO
| S_IWUSR
, show_pwm
,
893 static SENSOR_DEVICE_ATTR_2(pwm3_auto_point2_pwm
, S_IRUGO
| S_IWUSR
, show_pwm
,
896 static struct attribute
*adt7475_attrs
[] = {
897 &sensor_dev_attr_in1_input
.dev_attr
.attr
,
898 &sensor_dev_attr_in1_max
.dev_attr
.attr
,
899 &sensor_dev_attr_in1_min
.dev_attr
.attr
,
900 &sensor_dev_attr_in1_alarm
.dev_attr
.attr
,
901 &sensor_dev_attr_in2_input
.dev_attr
.attr
,
902 &sensor_dev_attr_in2_max
.dev_attr
.attr
,
903 &sensor_dev_attr_in2_min
.dev_attr
.attr
,
904 &sensor_dev_attr_in2_alarm
.dev_attr
.attr
,
905 &sensor_dev_attr_temp1_input
.dev_attr
.attr
,
906 &sensor_dev_attr_temp1_alarm
.dev_attr
.attr
,
907 &sensor_dev_attr_temp1_fault
.dev_attr
.attr
,
908 &sensor_dev_attr_temp1_max
.dev_attr
.attr
,
909 &sensor_dev_attr_temp1_min
.dev_attr
.attr
,
910 &sensor_dev_attr_temp1_offset
.dev_attr
.attr
,
911 &sensor_dev_attr_temp1_auto_point1_temp
.dev_attr
.attr
,
912 &sensor_dev_attr_temp1_auto_point2_temp
.dev_attr
.attr
,
913 &sensor_dev_attr_temp1_crit
.dev_attr
.attr
,
914 &sensor_dev_attr_temp1_crit_hyst
.dev_attr
.attr
,
915 &sensor_dev_attr_temp2_input
.dev_attr
.attr
,
916 &sensor_dev_attr_temp2_alarm
.dev_attr
.attr
,
917 &sensor_dev_attr_temp2_max
.dev_attr
.attr
,
918 &sensor_dev_attr_temp2_min
.dev_attr
.attr
,
919 &sensor_dev_attr_temp2_offset
.dev_attr
.attr
,
920 &sensor_dev_attr_temp2_auto_point1_temp
.dev_attr
.attr
,
921 &sensor_dev_attr_temp2_auto_point2_temp
.dev_attr
.attr
,
922 &sensor_dev_attr_temp2_crit
.dev_attr
.attr
,
923 &sensor_dev_attr_temp2_crit_hyst
.dev_attr
.attr
,
924 &sensor_dev_attr_temp3_input
.dev_attr
.attr
,
925 &sensor_dev_attr_temp3_fault
.dev_attr
.attr
,
926 &sensor_dev_attr_temp3_alarm
.dev_attr
.attr
,
927 &sensor_dev_attr_temp3_max
.dev_attr
.attr
,
928 &sensor_dev_attr_temp3_min
.dev_attr
.attr
,
929 &sensor_dev_attr_temp3_offset
.dev_attr
.attr
,
930 &sensor_dev_attr_temp3_auto_point1_temp
.dev_attr
.attr
,
931 &sensor_dev_attr_temp3_auto_point2_temp
.dev_attr
.attr
,
932 &sensor_dev_attr_temp3_crit
.dev_attr
.attr
,
933 &sensor_dev_attr_temp3_crit_hyst
.dev_attr
.attr
,
934 &sensor_dev_attr_fan1_input
.dev_attr
.attr
,
935 &sensor_dev_attr_fan1_min
.dev_attr
.attr
,
936 &sensor_dev_attr_fan1_alarm
.dev_attr
.attr
,
937 &sensor_dev_attr_fan2_input
.dev_attr
.attr
,
938 &sensor_dev_attr_fan2_min
.dev_attr
.attr
,
939 &sensor_dev_attr_fan2_alarm
.dev_attr
.attr
,
940 &sensor_dev_attr_fan3_input
.dev_attr
.attr
,
941 &sensor_dev_attr_fan3_min
.dev_attr
.attr
,
942 &sensor_dev_attr_fan3_alarm
.dev_attr
.attr
,
943 &sensor_dev_attr_fan4_input
.dev_attr
.attr
,
944 &sensor_dev_attr_fan4_min
.dev_attr
.attr
,
945 &sensor_dev_attr_fan4_alarm
.dev_attr
.attr
,
946 &sensor_dev_attr_pwm1
.dev_attr
.attr
,
947 &sensor_dev_attr_pwm1_freq
.dev_attr
.attr
,
948 &sensor_dev_attr_pwm1_enable
.dev_attr
.attr
,
949 &sensor_dev_attr_pwm1_auto_channels_temp
.dev_attr
.attr
,
950 &sensor_dev_attr_pwm1_auto_point1_pwm
.dev_attr
.attr
,
951 &sensor_dev_attr_pwm1_auto_point2_pwm
.dev_attr
.attr
,
952 &sensor_dev_attr_pwm2
.dev_attr
.attr
,
953 &sensor_dev_attr_pwm2_freq
.dev_attr
.attr
,
954 &sensor_dev_attr_pwm2_enable
.dev_attr
.attr
,
955 &sensor_dev_attr_pwm2_auto_channels_temp
.dev_attr
.attr
,
956 &sensor_dev_attr_pwm2_auto_point1_pwm
.dev_attr
.attr
,
957 &sensor_dev_attr_pwm2_auto_point2_pwm
.dev_attr
.attr
,
958 &sensor_dev_attr_pwm3
.dev_attr
.attr
,
959 &sensor_dev_attr_pwm3_freq
.dev_attr
.attr
,
960 &sensor_dev_attr_pwm3_enable
.dev_attr
.attr
,
961 &sensor_dev_attr_pwm3_auto_channels_temp
.dev_attr
.attr
,
962 &sensor_dev_attr_pwm3_auto_point1_pwm
.dev_attr
.attr
,
963 &sensor_dev_attr_pwm3_auto_point2_pwm
.dev_attr
.attr
,
967 struct attribute_group adt7475_attr_group
= { .attrs
= adt7475_attrs
};
969 static int adt7475_detect(struct i2c_client
*client
, int kind
,
970 struct i2c_board_info
*info
)
972 struct i2c_adapter
*adapter
= client
->adapter
;
974 if (!i2c_check_functionality(adapter
, I2C_FUNC_SMBUS_BYTE_DATA
))
978 if (adt7475_read(REG_VENDID
) != 0x41 ||
979 adt7475_read(REG_DEVID
) != 0x75) {
980 dev_err(&adapter
->dev
,
981 "Couldn't detect a adt7475 part at 0x%02x\n",
982 (unsigned int)client
->addr
);
987 strlcpy(info
->type
, adt7475_id
[0].name
, I2C_NAME_SIZE
);
992 static int adt7475_probe(struct i2c_client
*client
,
993 const struct i2c_device_id
*id
)
995 struct adt7475_data
*data
;
998 data
= kzalloc(sizeof(*data
), GFP_KERNEL
);
1002 mutex_init(&data
->lock
);
1003 i2c_set_clientdata(client
, data
);
1005 /* Call adt7475_read_pwm for all pwm's as this will reprogram any
1006 pwm's which are disabled to manual mode with 0% duty cycle */
1007 for (i
= 0; i
< ADT7475_PWM_COUNT
; i
++)
1008 adt7475_read_pwm(client
, i
);
1010 ret
= sysfs_create_group(&client
->dev
.kobj
, &adt7475_attr_group
);
1014 data
->hwmon_dev
= hwmon_device_register(&client
->dev
);
1015 if (IS_ERR(data
->hwmon_dev
)) {
1016 ret
= PTR_ERR(data
->hwmon_dev
);
1023 sysfs_remove_group(&client
->dev
.kobj
, &adt7475_attr_group
);
1029 static int adt7475_remove(struct i2c_client
*client
)
1031 struct adt7475_data
*data
= i2c_get_clientdata(client
);
1033 hwmon_device_unregister(data
->hwmon_dev
);
1034 sysfs_remove_group(&client
->dev
.kobj
, &adt7475_attr_group
);
1040 static struct i2c_driver adt7475_driver
= {
1041 .class = I2C_CLASS_HWMON
,
1045 .probe
= adt7475_probe
,
1046 .remove
= adt7475_remove
,
1047 .id_table
= adt7475_id
,
1048 .detect
= adt7475_detect
,
1049 .address_data
= &addr_data
,
1052 static void adt7475_read_hystersis(struct i2c_client
*client
)
1054 struct adt7475_data
*data
= i2c_get_clientdata(client
);
1056 data
->temp
[HYSTERSIS
][0] = (u16
) adt7475_read(REG_REMOTE1_HYSTERSIS
);
1057 data
->temp
[HYSTERSIS
][1] = data
->temp
[HYSTERSIS
][0];
1058 data
->temp
[HYSTERSIS
][2] = (u16
) adt7475_read(REG_REMOTE2_HYSTERSIS
);
1061 static void adt7475_read_pwm(struct i2c_client
*client
, int index
)
1063 struct adt7475_data
*data
= i2c_get_clientdata(client
);
1066 data
->pwm
[CONTROL
][index
] = adt7475_read(PWM_CONFIG_REG(index
));
1068 /* Figure out the internal value for pwmctrl and pwmchan
1069 based on the current settings */
1070 v
= (data
->pwm
[CONTROL
][index
] >> 5) & 7;
1073 data
->pwmctl
[index
] = 0;
1075 data
->pwmctl
[index
] = 1;
1077 /* The fan is disabled - we don't want to
1078 support that, so change to manual mode and
1079 set the duty cycle to 0 instead
1081 data
->pwm
[INPUT
][index
] = 0;
1082 data
->pwm
[CONTROL
][index
] &= ~0xE0;
1083 data
->pwm
[CONTROL
][index
] |= (7 << 5);
1085 i2c_smbus_write_byte_data(client
, PWM_CONFIG_REG(index
),
1086 data
->pwm
[INPUT
][index
]);
1088 i2c_smbus_write_byte_data(client
, PWM_CONFIG_REG(index
),
1089 data
->pwm
[CONTROL
][index
]);
1091 data
->pwmctl
[index
] = 1;
1093 data
->pwmctl
[index
] = 2;
1097 data
->pwmchan
[index
] = 1;
1100 data
->pwmchan
[index
] = 2;
1103 data
->pwmchan
[index
] = 4;
1106 data
->pwmchan
[index
] = 6;
1109 data
->pwmchan
[index
] = 7;
1115 static struct adt7475_data
*adt7475_update_device(struct device
*dev
)
1117 struct i2c_client
*client
= to_i2c_client(dev
);
1118 struct adt7475_data
*data
= i2c_get_clientdata(client
);
1122 mutex_lock(&data
->lock
);
1124 /* Measurement values update every 2 seconds */
1125 if (time_after(jiffies
, data
->measure_updated
+ HZ
* 2) ||
1127 data
->alarms
= adt7475_read(REG_STATUS2
) << 8;
1128 data
->alarms
|= adt7475_read(REG_STATUS1
);
1130 ext
= adt7475_read(REG_EXTEND1
);
1131 for (i
= 0; i
< ADT7475_VOLTAGE_COUNT
; i
++)
1132 data
->voltage
[INPUT
][i
] =
1133 (adt7475_read(VOLTAGE_REG(i
)) << 2) |
1134 ((ext
>> ((i
+ 1) * 2)) & 3);
1136 ext
= adt7475_read(REG_EXTEND2
);
1137 for (i
= 0; i
< ADT7475_TEMP_COUNT
; i
++)
1138 data
->temp
[INPUT
][i
] =
1139 (adt7475_read(TEMP_REG(i
)) << 2) |
1140 ((ext
>> ((i
+ 1) * 2)) & 3);
1142 for (i
= 0; i
< ADT7475_TACH_COUNT
; i
++)
1143 data
->tach
[INPUT
][i
] =
1144 adt7475_read_word(client
, TACH_REG(i
));
1146 /* Updated by hw when in auto mode */
1147 for (i
= 0; i
< ADT7475_PWM_COUNT
; i
++)
1148 data
->pwm
[INPUT
][i
] = adt7475_read(PWM_REG(i
));
1150 data
->measure_updated
= jiffies
;
1153 /* Limits and settings, should never change update every 60 seconds */
1154 if (time_after(jiffies
, data
->limits_updated
+ HZ
* 60) ||
1156 data
->config5
= adt7475_read(REG_CONFIG5
);
1158 for (i
= 0; i
< ADT7475_VOLTAGE_COUNT
; i
++) {
1159 /* Adjust values so they match the input precision */
1160 data
->voltage
[MIN
][i
] =
1161 adt7475_read(VOLTAGE_MIN_REG(i
)) << 2;
1162 data
->voltage
[MAX
][i
] =
1163 adt7475_read(VOLTAGE_MAX_REG(i
)) << 2;
1166 for (i
= 0; i
< ADT7475_TEMP_COUNT
; i
++) {
1167 /* Adjust values so they match the input precision */
1168 data
->temp
[MIN
][i
] =
1169 adt7475_read(TEMP_MIN_REG(i
)) << 2;
1170 data
->temp
[MAX
][i
] =
1171 adt7475_read(TEMP_MAX_REG(i
)) << 2;
1172 data
->temp
[AUTOMIN
][i
] =
1173 adt7475_read(TEMP_TMIN_REG(i
)) << 2;
1174 data
->temp
[THERM
][i
] =
1175 adt7475_read(TEMP_THERM_REG(i
)) << 2;
1176 data
->temp
[OFFSET
][i
] =
1177 adt7475_read(TEMP_OFFSET_REG(i
));
1179 adt7475_read_hystersis(client
);
1181 for (i
= 0; i
< ADT7475_TACH_COUNT
; i
++)
1182 data
->tach
[MIN
][i
] =
1183 adt7475_read_word(client
, TACH_MIN_REG(i
));
1185 for (i
= 0; i
< ADT7475_PWM_COUNT
; i
++) {
1186 data
->pwm
[MAX
][i
] = adt7475_read(PWM_MAX_REG(i
));
1187 data
->pwm
[MIN
][i
] = adt7475_read(PWM_MIN_REG(i
));
1188 /* Set the channel and control information */
1189 adt7475_read_pwm(client
, i
);
1192 data
->range
[0] = adt7475_read(TEMP_TRANGE_REG(0));
1193 data
->range
[1] = adt7475_read(TEMP_TRANGE_REG(1));
1194 data
->range
[2] = adt7475_read(TEMP_TRANGE_REG(2));
1196 data
->limits_updated
= jiffies
;
1200 mutex_unlock(&data
->lock
);
1205 static int __init
sensors_adt7475_init(void)
1207 return i2c_add_driver(&adt7475_driver
);
1210 static void __exit
sensors_adt7475_exit(void)
1212 i2c_del_driver(&adt7475_driver
);
1215 MODULE_AUTHOR("Advanced Micro Devices, Inc");
1216 MODULE_DESCRIPTION("adt7475 driver");
1217 MODULE_LICENSE("GPL");
1219 module_init(sensors_adt7475_init
);
1220 module_exit(sensors_adt7475_exit
);