#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
Go to the source code of this file.
|
#define | LM80_REG_IN_MAX(nr) (0x2a + (nr) * 2) |
|
#define | LM80_REG_IN_MIN(nr) (0x2b + (nr) * 2) |
|
#define | LM80_REG_IN(nr) (0x20 + (nr)) |
|
#define | LM80_REG_FAN1 0x28 |
|
#define | LM80_REG_FAN2 0x29 |
|
#define | LM80_REG_FAN_MIN(nr) (0x3b + (nr)) |
|
#define | LM80_REG_TEMP 0x27 |
|
#define | LM80_REG_TEMP_HOT_MAX 0x38 |
|
#define | LM80_REG_TEMP_HOT_HYST 0x39 |
|
#define | LM80_REG_TEMP_OS_MAX 0x3a |
|
#define | LM80_REG_TEMP_OS_HYST 0x3b |
|
#define | LM80_REG_CONFIG 0x00 |
|
#define | LM80_REG_ALARM1 0x01 |
|
#define | LM80_REG_ALARM2 0x02 |
|
#define | LM80_REG_MASK1 0x03 |
|
#define | LM80_REG_MASK2 0x04 |
|
#define | LM80_REG_FANDIV 0x05 |
|
#define | LM80_REG_RES 0x06 |
|
#define | LM96080_REG_CONV_RATE 0x07 |
|
#define | LM96080_REG_MAN_ID 0x3e |
|
#define | LM96080_REG_DEV_ID 0x3f |
|
#define | IN_TO_REG(val) (SENSORS_LIMIT(((val) + 5) / 10, 0, 255)) |
|
#define | IN_FROM_REG(val) ((val) * 10) |
|
#define | FAN_FROM_REG(val, div) |
|
#define | TEMP_LIMIT_FROM_REG(val) |
|
#define | TEMP_LIMIT_TO_REG(val) |
|
#define | DIV_FROM_REG(val) (1 << (val)) |
|
#define | show_in(suffix, value) |
|
#define | set_in(suffix, value, reg) |
|
#define | show_fan(suffix, value) |
|
#define | show_temp(suffix, value) |
|
#define | set_temp(suffix, value, reg) |
|
|
| MODULE_DEVICE_TABLE (i2c, lm80_id) |
|
| show_in (min, show_in(in_min) |
|
| show_temp (hot_max, temp_hot_max) |
|
| show_temp (hot_hyst, temp_hot_hyst) |
|
| show_temp (os_max, temp_os_max) |
|
| show_temp (os_hyst, temp_os_hyst) |
|
| set_temp (hot_max, temp_hot_max, LM80_REG_TEMP_HOT_MAX) |
|
| set_temp (hot_hyst, temp_hot_hyst, LM80_REG_TEMP_HOT_HYST) |
|
| set_temp (os_max, temp_os_max, LM80_REG_TEMP_OS_MAX) |
|
| set_temp (os_hyst, temp_os_hyst, LM80_REG_TEMP_OS_HYST) |
|
| module_i2c_driver (lm80_driver) |
|
| MODULE_AUTHOR ("Frodo Looijaard <[email protected]> and ""Philip Edelbrock <[email protected]>") |
|
| MODULE_DESCRIPTION ("LM80 driver") |
|
| MODULE_LICENSE ("GPL") |
|
#define DIV_FROM_REG |
( |
|
val | ) |
(1 << (val)) |
#define FAN_FROM_REG |
( |
|
val, |
|
|
|
div |
|
) |
| |
Value:
Definition at line 86 of file lm80.c.
#define IN_FROM_REG |
( |
|
val | ) |
((val) * 10) |
#define IN_TO_REG |
( |
|
val | ) |
(SENSORS_LIMIT(((val) + 5) / 10, 0, 255)) |
#define LM80_REG_ALARM1 0x01 |
#define LM80_REG_ALARM2 0x02 |
#define LM80_REG_CONFIG 0x00 |
#define LM80_REG_FAN1 0x28 |
#define LM80_REG_FAN2 0x29 |
#define LM80_REG_FAN_MIN |
( |
|
nr | ) |
(0x3b + (nr)) |
#define LM80_REG_FANDIV 0x05 |
#define LM80_REG_IN |
( |
|
nr | ) |
(0x20 + (nr)) |
#define LM80_REG_IN_MAX |
( |
|
nr | ) |
(0x2a + (nr) * 2) |
#define LM80_REG_IN_MIN |
( |
|
nr | ) |
(0x2b + (nr) * 2) |
#define LM80_REG_MASK1 0x03 |
#define LM80_REG_MASK2 0x04 |
#define LM80_REG_RES 0x06 |
#define LM80_REG_TEMP 0x27 |
#define LM80_REG_TEMP_HOT_HYST 0x39 |
#define LM80_REG_TEMP_HOT_MAX 0x38 |
#define LM80_REG_TEMP_OS_HYST 0x3b |
#define LM80_REG_TEMP_OS_MAX 0x3a |
#define LM96080_REG_CONV_RATE 0x07 |
#define LM96080_REG_DEV_ID 0x3f |
#define LM96080_REG_MAN_ID 0x3e |
Value:
{ \
int
err = kstrtol(
buf, 10, &val); \
if (err < 0) \
lm80_write_value(client,
reg(nr), data->value[nr]); \
mutex_unlock(&data->update_lock);\
}
Value:
int
err = kstrtol(
buf, 10, &val); \
if (err < 0) \
lm80_write_value(client,
reg, data->value); \
mutex_unlock(&data->update_lock); \
}
Definition at line 330 of file lm80.c.
#define show_fan |
( |
|
suffix, |
|
|
|
value |
|
) |
| |
Value:
{ \
if (IS_ERR(data)) \
return PTR_ERR(data); \
}
#define show_in |
( |
|
suffix, |
|
|
|
value |
|
) |
| |
Value:
{ \
if (IS_ERR(data)) \
return PTR_ERR(data); \
}
Definition at line 175 of file lm80.c.
#define show_temp |
( |
|
suffix, |
|
|
|
value |
|
) |
| |
Value:
if (IS_ERR(data)) \
return PTR_ERR(data); \
}
Definition at line 316 of file lm80.c.
#define TEMP_LIMIT_FROM_REG |
( |
|
val | ) |
|
Value:
(
val) - 0x100 : (
val)) * 1000)
Definition at line 102 of file lm80.c.
#define TEMP_LIMIT_TO_REG |
( |
|
val | ) |
|
Value:SENSORS_LIMIT((
val) < 0 ? \
((
val) - 500) / 1000 : ((
val) + 500) / 1000, 0, 255)
Definition at line 105 of file lm80.c.
MODULE_DESCRIPTION |
( |
"LM80 driver" |
| ) |
|
MODULE_DEVICE_TABLE |
( |
i2c |
, |
|
|
lm80_id |
|
|
) |
| |
module_i2c_driver |
( |
lm80_driver |
| ) |
|
show_in |
( |
min |
, |
|
|
show_in( |
in_min |
|
) |
| |
show_temp |
( |
hot_max |
, |
|
|
temp_hot_max |
|
|
) |
| |
show_temp |
( |
hot_hyst |
, |
|
|
temp_hot_hyst |
|
|
) |
| |
show_temp |
( |
os_max |
, |
|
|
temp_os_max |
|
|
) |
| |
show_temp |
( |
os_hyst |
, |
|
|
temp_os_hyst |
|
|
) |
| |