Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
lm87.c File Reference
#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/hwmon-vid.h>
#include <linux/err.h>
#include <linux/mutex.h>

Go to the source code of this file.

Data Structures

struct  lm87_data
 

Macros

#define LM87_REG_IN(nr)   (0x20 + (nr))
 
#define LM87_REG_IN_MAX(nr)   (0x2B + (nr) * 2)
 
#define LM87_REG_IN_MIN(nr)   (0x2C + (nr) * 2)
 
#define LM87_REG_AIN(nr)   (0x28 + (nr))
 
#define LM87_REG_AIN_MIN(nr)   (0x1A + (nr))
 
#define LM87_REG_AIN_MAX(nr)   (0x3B + (nr))
 
#define LM87_REG_TEMP_HW_INT_LOCK   0x13
 
#define LM87_REG_TEMP_HW_EXT_LOCK   0x14
 
#define LM87_REG_TEMP_HW_INT   0x17
 
#define LM87_REG_TEMP_HW_EXT   0x18
 
#define LM87_REG_FAN(nr)   (0x28 + (nr))
 
#define LM87_REG_FAN_MIN(nr)   (0x3B + (nr))
 
#define LM87_REG_AOUT   0x19
 
#define LM87_REG_CONFIG   0x40
 
#define LM87_REG_CHANNEL_MODE   0x16
 
#define LM87_REG_VID_FAN_DIV   0x47
 
#define LM87_REG_VID4   0x49
 
#define LM87_REG_ALARMS1   0x41
 
#define LM87_REG_ALARMS2   0x42
 
#define LM87_REG_COMPANY_ID   0x3E
 
#define LM87_REG_REVISION   0x3F
 
#define IN_FROM_REG(reg, scale)   (((reg) * (scale) + 96) / 192)
 
#define IN_TO_REG(val, scale)
 
#define TEMP_FROM_REG(reg)   ((reg) * 1000)
 
#define TEMP_TO_REG(val)
 
#define FAN_FROM_REG(reg, div)
 
#define FAN_TO_REG(val, div)
 
#define FAN_DIV_FROM_REG(reg)   (1 << (reg))
 
#define AOUT_FROM_REG(reg)   (((reg) * 98 + 5) / 10)
 
#define AOUT_TO_REG(val)
 
#define CHAN_NO_FAN(nr)   (1 << (nr))
 
#define CHAN_TEMP3   (1 << 2)
 
#define CHAN_VCC_5V   (1 << 3)
 
#define CHAN_NO_VID   (1 << 7)
 
#define set_in(offset)
 
#define set_temp(offset)
 
#define set_fan(offset)
 

Enumerations

enum  chips {
  ad7416, ad7417, ad7418, adm1021,
  adm1023, max1617, max1617a, thmc10,
  lm84, gl523sm, mc1066, adm1025,
  ne1619, adm1030, adm1031, adm9240,
  ds1780, lm81, adt7473, adt7475,
  adt7476, adt7490, amc6821, dme1737,
  sch5027, sch311x, sch5127, f71808e,
  f71808a, f71858fg, f71862fg, f71869,
  f71869a, f71882fg, f71889fg, f71889ed,
  f71889a, f8000, f81865f, f75373,
  f75375, f75387, fscpos, fscher,
  fscscy, fschrc, fschmd, fschds,
  fscsyl, gl518sm_r00, gl518sm_r80, it87,
  it8712, it8716, it8718, it8720,
  it8721, it8728, it8782, it8783,
  lm63, lm64, lm96163, lm78,
  lm79, lm83, lm82, any_chip,
  lm85b, lm85c, adm1027, adt7463,
  adt7468, emc6d100, emc6d102, emc6d103,
  emc6d103s, lm87, adm1024, lm90,
  adm1032, lm99, lm86, max6657,
  max6659, adt7461, max6680, max6646,
  w83l771, max6696, sa56004, g781,
  max1110, max1111, max1112, max1113,
  max16065, max16066, max16067, max16068,
  max16070, max16071, max1668, max1805,
  max1989, mcp3021, mcp3221, adm1075,
  adm1275, adm1276, lm25066, lm5064,
  lm5066, ltc2978, ltc3880, max34440,
  max34441, max34446, ucd9000, ucd90120,
  ucd90124, ucd9090, ucd90910, ucd9200,
  ucd9220, ucd9222, ucd9224, ucd9240,
  ucd9244, ucd9246, ucd9248, zl2004,
  zl2005, zl2006, zl2008, zl2105,
  zl2106, zl6100, zl6105, zl9101,
  zl9117, smm465, smm665, smm665c,
  smm764, smm766, smsc47m1, smsc47m2,
  thmc50, adm1022, tmp401, tmp411,
  tmp421, tmp422, tmp423, w83627hf,
  w83627thf, w83697hf, w83637hf, w83687thf,
  w83781d, w83782d, w83783s, as99127f,
  DC21040 = 0, DC21041 = 1, DC21140 = 2, DC21142 = 3,
  DC21143 = 3, LC82C168, MX98713, MX98715,
  MX98725, AX88140, PNIC2, COMET,
  COMPEX9881, I21145, DM910X, CONEXANT,
  TPS62360, TPS62361, TPS62362, TPS62363,
  sc18is602, sc18is602b, sc18is603, f71808fg,
  f71858fg, f71862fg, f71869, f71882fg,
  f71889fg
}
 

Functions

 set_in (0)
 
 set_in (1)
 
 set_in (2)
 
 set_in (3)
 
 set_in (4)
 
 set_in (5)
 
 set_in (6)
 
 set_in (7)
 
 set_temp (1)
 
 set_temp (2)
 
 set_temp (3)
 
 set_fan (1)
 
 set_fan (2)
 
 MODULE_DEVICE_TABLE (i2c, lm87_id)
 
 module_i2c_driver (lm87_driver)
 
 MODULE_AUTHOR ("Jean Delvare <[email protected]> and others")
 
 MODULE_DESCRIPTION ("LM87 driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define AOUT_FROM_REG (   reg)    (((reg) * 98 + 5) / 10)

Definition at line 141 of file lm87.c.

#define AOUT_TO_REG (   val)
Value:
((val) <= 0 ? 0 : \
(val) >= 2500 ? 255 : \
((val) * 10 + 49) / 98)

Definition at line 142 of file lm87.c.

#define CHAN_NO_FAN (   nr)    (1 << (nr))

Definition at line 147 of file lm87.c.

#define CHAN_NO_VID   (1 << 7)

Definition at line 150 of file lm87.c.

#define CHAN_TEMP3   (1 << 2)

Definition at line 148 of file lm87.c.

#define CHAN_VCC_5V   (1 << 3)

Definition at line 149 of file lm87.c.

#define FAN_DIV_FROM_REG (   reg)    (1 << (reg))

Definition at line 138 of file lm87.c.

#define FAN_FROM_REG (   reg,
  div 
)
Value:
((reg) == 255 || (reg) == 0 ? 0 : \
(1350000 + (reg)*(div) / 2) / ((reg) * (div)))

Definition at line 133 of file lm87.c.

#define FAN_TO_REG (   val,
  div 
)
Value:
((val) * (div) * 255 <= 1350000 ? 255 : \
(1350000 + (val)*(div) / 2) / ((val) * (div)))

Definition at line 135 of file lm87.c.

#define IN_FROM_REG (   reg,
  scale 
)    (((reg) * (scale) + 96) / 192)

Definition at line 122 of file lm87.c.

#define IN_TO_REG (   val,
  scale 
)
Value:
((val) <= 0 ? 0 : \
(val) * 192 >= (scale) * 255 ? 255 : \
((val) * 192 + (scale) / 2) / (scale))

Definition at line 123 of file lm87.c.

#define LM87_REG_AIN (   nr)    (0x28 + (nr))

Definition at line 88 of file lm87.c.

#define LM87_REG_AIN_MAX (   nr)    (0x3B + (nr))

Definition at line 90 of file lm87.c.

#define LM87_REG_AIN_MIN (   nr)    (0x1A + (nr))

Definition at line 89 of file lm87.c.

#define LM87_REG_ALARMS1   0x41

Definition at line 111 of file lm87.c.

#define LM87_REG_ALARMS2   0x42

Definition at line 112 of file lm87.c.

#define LM87_REG_AOUT   0x19

Definition at line 104 of file lm87.c.

#define LM87_REG_CHANNEL_MODE   0x16

Definition at line 107 of file lm87.c.

#define LM87_REG_COMPANY_ID   0x3E

Definition at line 114 of file lm87.c.

#define LM87_REG_CONFIG   0x40

Definition at line 106 of file lm87.c.

#define LM87_REG_FAN (   nr)    (0x28 + (nr))

Definition at line 102 of file lm87.c.

#define LM87_REG_FAN_MIN (   nr)    (0x3B + (nr))

Definition at line 103 of file lm87.c.

#define LM87_REG_IN (   nr)    (0x20 + (nr))

Definition at line 84 of file lm87.c.

#define LM87_REG_IN_MAX (   nr)    (0x2B + (nr) * 2)

Definition at line 85 of file lm87.c.

#define LM87_REG_IN_MIN (   nr)    (0x2C + (nr) * 2)

Definition at line 86 of file lm87.c.

#define LM87_REG_REVISION   0x3F

Definition at line 115 of file lm87.c.

#define LM87_REG_TEMP_HW_EXT   0x18

Definition at line 99 of file lm87.c.

#define LM87_REG_TEMP_HW_EXT_LOCK   0x14

Definition at line 97 of file lm87.c.

#define LM87_REG_TEMP_HW_INT   0x17

Definition at line 98 of file lm87.c.

#define LM87_REG_TEMP_HW_INT_LOCK   0x13

Definition at line 96 of file lm87.c.

#define LM87_REG_VID4   0x49

Definition at line 109 of file lm87.c.

#define LM87_REG_VID_FAN_DIV   0x47

Definition at line 108 of file lm87.c.

#define set_fan (   offset)
Value:
static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
show_fan_input, NULL, offset - 1); \
show_fan_min, set_fan_min, offset - 1); \
show_fan_div, set_fan_div, offset - 1)

Definition at line 578 of file lm87.c.

#define set_in (   offset)
Value:
static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \
show_in_input, NULL, offset); \
show_in_min, set_in_min, offset); \
show_in_max, set_in_max, offset)

Definition at line 351 of file lm87.c.

#define set_temp (   offset)
Value:
show_temp_input, NULL, offset - 1); \
show_temp_high, set_temp_high, offset - 1); \
show_temp_low, set_temp_low, offset - 1)

Definition at line 436 of file lm87.c.

#define TEMP_FROM_REG (   reg)    ((reg) * 1000)

Definition at line 127 of file lm87.c.

#define TEMP_TO_REG (   val)
Value:
((val) <= -127500 ? -128 : \
(val) >= 126500 ? 127 : \
(((val) < 0 ? (val) - 500 : \
(val) + 500) / 1000))

Definition at line 128 of file lm87.c.

Enumeration Type Documentation

enum chips
Enumerator:
ad7416 
ad7417 
ad7418 
adm1021 
adm1023 
max1617 
max1617a 
thmc10 
lm84 
gl523sm 
mc1066 
adm1025 
ne1619 
adm1030 
adm1031 
adm9240 
ds1780 
lm81 
adt7473 
adt7475 
adt7476 
adt7490 
amc6821 
dme1737 
sch5027 
sch311x 
sch5127 
f71808e 
f71808a 
f71858fg 
f71862fg 
f71869 
f71869a 
f71882fg 
f71889fg 
f71889ed 
f71889a 
f8000 
f81865f 
f75373 
f75375 
f75387 
fscpos 
fscher 
fscscy 
fschrc 
fschmd 
fschds 
fscsyl 
gl518sm_r00 
gl518sm_r80 
it87 
it8712 
it8716 
it8718 
it8720 
it8721 
it8728 
it8782 
it8783 
lm63 
lm64 
lm96163 
lm78 
lm79 
lm83 
lm82 
any_chip 
lm85b 
lm85c 
adm1027 
adt7463 
adt7468 
emc6d100 
emc6d102 
emc6d103 
emc6d103s 
lm87 
adm1024 
lm90 
adm1032 
lm99 
lm86 
max6657 
max6659 
adt7461 
max6680 
max6646 
w83l771 
max6696 
sa56004 
g781 
max1110 
max1111 
max1112 
max1113 
max16065 
max16066 
max16067 
max16068 
max16070 
max16071 
max1668 
max1805 
max1989 
mcp3021 
mcp3221 
adm1075 
adm1275 
adm1276 
lm25066 
lm5064 
lm5066 
ltc2978 
ltc3880 
max34440 
max34441 
max34446 
ucd9000 
ucd90120 
ucd90124 
ucd9090 
ucd90910 
ucd9200 
ucd9220 
ucd9222 
ucd9224 
ucd9240 
ucd9244 
ucd9246 
ucd9248 
zl2004 
zl2005 
zl2006 
zl2008 
zl2105 
zl2106 
zl6100 
zl6105 
zl9101 
zl9117 
smm465 
smm665 
smm665c 
smm764 
smm766 
smsc47m1 
smsc47m2 
thmc50 
adm1022 
tmp401 
tmp411 
tmp421 
tmp422 
tmp423 
w83627hf 
w83627thf 
w83697hf 
w83637hf 
w83687thf 
w83781d 
w83782d 
w83783s 
as99127f 
DC21040 
DC21041 
DC21140 
DC21142 
DC21143 
LC82C168 
MX98713 
MX98715 
MX98725 
AX88140 
PNIC2 
COMET 
COMPEX9881 
I21145 
DM910X 
CONEXANT 
TPS62360 
TPS62361 
TPS62362 
TPS62363 
sc18is602 
sc18is602b 
sc18is603 
f71808fg 
f71858fg 
f71862fg 
f71869 
f71882fg 
f71889fg 

Definition at line 77 of file lm87.c.

Function Documentation

MODULE_AUTHOR ( "Jean Delvare <[email protected]> and others"  )
MODULE_DESCRIPTION ( "LM87 driver )
MODULE_DEVICE_TABLE ( i2c  ,
lm87_id   
)
module_i2c_driver ( lm87_driver  )
MODULE_LICENSE ( "GPL"  )
set_fan ( )
set_fan ( )
set_in ( )
set_in ( )
set_in ( )
set_in ( )
set_in ( )
set_in ( )
set_in ( )
set_in ( )
set_temp ( )
set_temp ( )
set_temp ( )