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

Go to the source code of this file.

Data Structures

struct  adm1031_data
 

Macros

#define ADM1031_REG_FAN_SPEED(nr)   (0x08 + (nr))
 
#define ADM1031_REG_FAN_DIV(nr)   (0x20 + (nr))
 
#define ADM1031_REG_PWM   (0x22)
 
#define ADM1031_REG_FAN_MIN(nr)   (0x10 + (nr))
 
#define ADM1031_REG_FAN_FILTER   (0x23)
 
#define ADM1031_REG_TEMP_OFFSET(nr)   (0x0d + (nr))
 
#define ADM1031_REG_TEMP_MAX(nr)   (0x14 + 4 * (nr))
 
#define ADM1031_REG_TEMP_MIN(nr)   (0x15 + 4 * (nr))
 
#define ADM1031_REG_TEMP_CRIT(nr)   (0x16 + 4 * (nr))
 
#define ADM1031_REG_TEMP(nr)   (0x0a + (nr))
 
#define ADM1031_REG_AUTO_TEMP(nr)   (0x24 + (nr))
 
#define ADM1031_REG_STATUS(nr)   (0x2 + (nr))
 
#define ADM1031_REG_CONF1   0x00
 
#define ADM1031_REG_CONF2   0x01
 
#define ADM1031_REG_EXT_TEMP   0x06
 
#define ADM1031_CONF1_MONITOR_ENABLE   0x01 /* Monitoring enable */
 
#define ADM1031_CONF1_PWM_INVERT   0x08 /* PWM Invert */
 
#define ADM1031_CONF1_AUTO_MODE   0x80 /* Auto FAN */
 
#define ADM1031_CONF2_PWM1_ENABLE   0x01
 
#define ADM1031_CONF2_PWM2_ENABLE   0x02
 
#define ADM1031_CONF2_TACH1_ENABLE   0x04
 
#define ADM1031_CONF2_TACH2_ENABLE   0x08
 
#define ADM1031_CONF2_TEMP_ENABLE(chan)   (0x10 << (chan))
 
#define ADM1031_UPDATE_RATE_MASK   0x1c
 
#define ADM1031_UPDATE_RATE_SHIFT   2
 
#define TEMP_TO_REG(val)
 
#define TEMP_FROM_REG(val)   ((val) * 1000)
 
#define TEMP_FROM_REG_EXT(val, ext)   (TEMP_FROM_REG(val) + (ext) * 125)
 
#define TEMP_OFFSET_TO_REG(val)   (TEMP_TO_REG(val) & 0x8f)
 
#define TEMP_OFFSET_FROM_REG(val)
 
#define FAN_FROM_REG(reg, div)
 
#define FAN_DIV_FROM_REG(reg)   (1<<(((reg)&0xc0)>>6))
 
#define PWM_TO_REG(val)   (SENSORS_LIMIT((val), 0, 255) >> 4)
 
#define PWM_FROM_REG(val)   ((val) << 4)
 
#define FAN_CHAN_FROM_REG(reg)   (((reg) >> 5) & 7)
 
#define FAN_CHAN_TO_REG(val, reg)   (((reg) & 0x1F) | (((val) << 5) & 0xe0))
 
#define AUTO_TEMP_MIN_TO_REG(val, reg)   ((((val) / 500) & 0xf8) | ((reg) & 0x7))
 
#define AUTO_TEMP_RANGE_FROM_REG(reg)   (5000 * (1 << ((reg) & 0x7)))
 
#define AUTO_TEMP_MIN_FROM_REG(reg)   (1000 * ((((reg) >> 3) & 0x1f) << 2))
 
#define AUTO_TEMP_MIN_FROM_REG_DEG(reg)   ((((reg) >> 3) & 0x1f) << 2)
 
#define AUTO_TEMP_OFF_FROM_REG(reg)   (AUTO_TEMP_MIN_FROM_REG(reg) - 5000)
 
#define AUTO_TEMP_MAX_FROM_REG(reg)
 
#define GET_FAN_AUTO_BITFIELD(data, idx)   (*(data)->chan_select_table)[FAN_CHAN_FROM_REG((data)->conf1)][idx % 2]
 
#define auto_temp_reg(offset)
 
#define fan_offset(offset)
 
#define temp_reg(offset)
 

Typedefs

typedef u8 auto_chan_table_t [8][2]
 

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

 MODULE_DEVICE_TABLE (i2c, adm1031_id)
 
 auto_temp_reg (1)
 
 auto_temp_reg (2)
 
 auto_temp_reg (3)
 
 fan_offset (1)
 
 fan_offset (2)
 
 temp_reg (1)
 
 temp_reg (2)
 
 temp_reg (3)
 
 module_i2c_driver (adm1031_driver)
 
 MODULE_AUTHOR ("Alexandre d'Alton <[email protected]>")
 
 MODULE_DESCRIPTION ("ADM1031/ADM1030 driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define ADM1031_CONF1_AUTO_MODE   0x80 /* Auto FAN */

Definition at line 57 of file adm1031.c.

#define ADM1031_CONF1_MONITOR_ENABLE   0x01 /* Monitoring enable */

Definition at line 55 of file adm1031.c.

#define ADM1031_CONF1_PWM_INVERT   0x08 /* PWM Invert */

Definition at line 56 of file adm1031.c.

#define ADM1031_CONF2_PWM1_ENABLE   0x01

Definition at line 59 of file adm1031.c.

#define ADM1031_CONF2_PWM2_ENABLE   0x02

Definition at line 60 of file adm1031.c.

#define ADM1031_CONF2_TACH1_ENABLE   0x04

Definition at line 61 of file adm1031.c.

#define ADM1031_CONF2_TACH2_ENABLE   0x08

Definition at line 62 of file adm1031.c.

#define ADM1031_CONF2_TEMP_ENABLE (   chan)    (0x10 << (chan))

Definition at line 63 of file adm1031.c.

#define ADM1031_REG_AUTO_TEMP (   nr)    (0x24 + (nr))

Definition at line 47 of file adm1031.c.

#define ADM1031_REG_CONF1   0x00

Definition at line 51 of file adm1031.c.

#define ADM1031_REG_CONF2   0x01

Definition at line 52 of file adm1031.c.

#define ADM1031_REG_EXT_TEMP   0x06

Definition at line 53 of file adm1031.c.

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

Definition at line 36 of file adm1031.c.

#define ADM1031_REG_FAN_FILTER   (0x23)

Definition at line 39 of file adm1031.c.

#define ADM1031_REG_FAN_MIN (   nr)    (0x10 + (nr))

Definition at line 38 of file adm1031.c.

#define ADM1031_REG_FAN_SPEED (   nr)    (0x08 + (nr))

Definition at line 35 of file adm1031.c.

#define ADM1031_REG_PWM   (0x22)

Definition at line 37 of file adm1031.c.

#define ADM1031_REG_STATUS (   nr)    (0x2 + (nr))

Definition at line 49 of file adm1031.c.

#define ADM1031_REG_TEMP (   nr)    (0x0a + (nr))

Definition at line 46 of file adm1031.c.

#define ADM1031_REG_TEMP_CRIT (   nr)    (0x16 + 4 * (nr))

Definition at line 44 of file adm1031.c.

#define ADM1031_REG_TEMP_MAX (   nr)    (0x14 + 4 * (nr))

Definition at line 42 of file adm1031.c.

#define ADM1031_REG_TEMP_MIN (   nr)    (0x15 + 4 * (nr))

Definition at line 43 of file adm1031.c.

#define ADM1031_REG_TEMP_OFFSET (   nr)    (0x0d + (nr))

Definition at line 41 of file adm1031.c.

#define ADM1031_UPDATE_RATE_MASK   0x1c

Definition at line 65 of file adm1031.c.

#define ADM1031_UPDATE_RATE_SHIFT   2

Definition at line 66 of file adm1031.c.

#define AUTO_TEMP_MAX_FROM_REG (   reg)
Value:
AUTO_TEMP_MIN_FROM_REG(reg))

Definition at line 188 of file adm1031.c.

#define AUTO_TEMP_MIN_FROM_REG (   reg)    (1000 * ((((reg) >> 3) & 0x1f) << 2))

Definition at line 181 of file adm1031.c.

#define AUTO_TEMP_MIN_FROM_REG_DEG (   reg)    ((((reg) >> 3) & 0x1f) << 2)

Definition at line 183 of file adm1031.c.

#define AUTO_TEMP_MIN_TO_REG (   val,
  reg 
)    ((((val) / 500) & 0xf8) | ((reg) & 0x7))

Definition at line 178 of file adm1031.c.

#define AUTO_TEMP_OFF_FROM_REG (   reg)    (AUTO_TEMP_MIN_FROM_REG(reg) - 5000)

Definition at line 185 of file adm1031.c.

#define AUTO_TEMP_RANGE_FROM_REG (   reg)    (5000 * (1 << ((reg) & 0x7)))

Definition at line 180 of file adm1031.c.

#define auto_temp_reg (   offset)
Value:
static SENSOR_DEVICE_ATTR(auto_temp##offset##_off, S_IRUGO, \
show_auto_temp_off, NULL, offset - 1); \
static SENSOR_DEVICE_ATTR(auto_temp##offset##_min, S_IRUGO | S_IWUSR, \
show_auto_temp_min, set_auto_temp_min, offset - 1); \
static SENSOR_DEVICE_ATTR(auto_temp##offset##_max, S_IRUGO | S_IWUSR, \
show_auto_temp_max, set_auto_temp_max, offset - 1)

Definition at line 406 of file adm1031.c.

#define FAN_CHAN_FROM_REG (   reg)    (((reg) >> 5) & 7)

Definition at line 174 of file adm1031.c.

#define FAN_CHAN_TO_REG (   val,
  reg 
)    (((reg) & 0x1F) | (((val) << 5) & 0xe0))

Definition at line 175 of file adm1031.c.

#define FAN_DIV_FROM_REG (   reg)    (1<<(((reg)&0xc0)>>6))

Definition at line 169 of file adm1031.c.

#define FAN_FROM_REG (   reg,
  div 
)
Value:
((reg) ? \
(11250 * 60) / ((reg) * (div)) : 0)

Definition at line 159 of file adm1031.c.

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

Definition at line 611 of file adm1031.c.

#define GET_FAN_AUTO_BITFIELD (   data,
  idx 
)    (*(data)->chan_select_table)[FAN_CHAN_FROM_REG((data)->conf1)][idx % 2]

Definition at line 206 of file adm1031.c.

#define PWM_FROM_REG (   val)    ((val) << 4)

Definition at line 172 of file adm1031.c.

#define PWM_TO_REG (   val)    (SENSORS_LIMIT((val), 0, 255) >> 4)

Definition at line 171 of file adm1031.c.

#define TEMP_FROM_REG (   val)    ((val) * 1000)

Definition at line 151 of file adm1031.c.

#define TEMP_FROM_REG_EXT (   val,
  ext 
)    (TEMP_FROM_REG(val) + (ext) * 125)

Definition at line 153 of file adm1031.c.

#define TEMP_OFFSET_FROM_REG (   val)
Value:
TEMP_FROM_REG((val) < 0 ? \
(val) | 0x70 : (val))

Definition at line 156 of file adm1031.c.

#define TEMP_OFFSET_TO_REG (   val)    (TEMP_TO_REG(val) & 0x8f)

Definition at line 155 of file adm1031.c.

#define temp_reg (   offset)
Value:
show_temp, NULL, offset - 1); \
show_temp_offset, set_temp_offset, offset - 1); \
show_temp_min, set_temp_min, offset - 1); \
show_temp_max, set_temp_max, offset - 1); \
show_temp_crit, set_temp_crit, offset - 1)

Definition at line 750 of file adm1031.c.

#define TEMP_TO_REG (   val)
Value:
(((val) < 0 ? ((val - 500) / 1000) : \
((val + 500) / 1000)))

Definition at line 148 of file adm1031.c.

Typedef Documentation

typedef u8 auto_chan_table_t[8][2]

Definition at line 73 of file adm1031.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 71 of file adm1031.c.

Function Documentation

auto_temp_reg ( )
auto_temp_reg ( )
auto_temp_reg ( )
fan_offset ( )
fan_offset ( )
MODULE_AUTHOR ( "Alexandre d'Alton <[email protected]>"  )
MODULE_DESCRIPTION ( "ADM1031/ADM1030 driver )
MODULE_DEVICE_TABLE ( i2c  ,
adm1031_id   
)
module_i2c_driver ( adm1031_driver  )
MODULE_LICENSE ( "GPL"  )
temp_reg ( )
temp_reg ( )
temp_reg ( )