Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
w83795.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/jiffies.h>

Go to the source code of this file.

Data Structures

struct  w83795_data
 

Macros

#define W83795_REG_BANKSEL   0x00
 
#define W83795_REG_VENDORID   0xfd
 
#define W83795_REG_CHIPID   0xfe
 
#define W83795_REG_DEVICEID   0xfb
 
#define W83795_REG_DEVICEID_A   0xff
 
#define W83795_REG_I2C_ADDR   0xfc
 
#define W83795_REG_CONFIG   0x01
 
#define W83795_REG_CONFIG_CONFIG48   0x04
 
#define W83795_REG_CONFIG_START   0x01
 
#define W83795_REG_VOLT_CTRL1   0x02
 
#define W83795_REG_VOLT_CTRL2   0x03
 
#define W83795_REG_TEMP_CTRL1   0x04
 
#define W83795_REG_TEMP_CTRL2   0x05
 
#define W83795_REG_FANIN_CTRL1   0x06
 
#define W83795_REG_FANIN_CTRL2   0x07
 
#define W83795_REG_VMIGB_CTRL   0x08
 
#define TEMP_READ   0
 
#define TEMP_CRIT   1
 
#define TEMP_CRIT_HYST   2
 
#define TEMP_WARN   3
 
#define TEMP_WARN_HYST   4
 
#define IN_READ   0
 
#define IN_MAX   1
 
#define IN_LOW   2
 
#define W83795_REG_VRLSB   0x3C
 
#define IN_LSB_REG(index, type)
 
#define IN_LSB_SHIFT   0
 
#define IN_LSB_IDX   1
 
#define W83795_REG_FAN(index)   (0x2E + (index))
 
#define W83795_REG_FAN_MIN_HL(index)   (0xB6 + (index))
 
#define W83795_REG_FAN_MIN_LSB(index)   (0xC4 + (index) / 2)
 
#define W83795_REG_FAN_MIN_LSB_SHIFT(index)   (((index) & 1) ? 4 : 0)
 
#define W83795_REG_VID_CTRL   0x6A
 
#define W83795_REG_ALARM_CTRL   0x40
 
#define ALARM_CTRL_RTSACS   (1 << 7)
 
#define W83795_REG_ALARM(index)   (0x41 + (index))
 
#define W83795_REG_CLR_CHASSIS   0x4D
 
#define W83795_REG_BEEP(index)   (0x50 + (index))
 
#define W83795_REG_OVT_CFG   0x58
 
#define OVT_CFG_SEL   (1 << 7)
 
#define W83795_REG_FCMS1   0x201
 
#define W83795_REG_FCMS2   0x208
 
#define W83795_REG_TFMR(index)   (0x202 + (index))
 
#define W83795_REG_FOMC   0x20F
 
#define W83795_REG_TSS(index)   (0x209 + (index))
 
#define TSS_MAP_RESERVED   0xff
 
#define PWM_OUTPUT   0
 
#define PWM_FREQ   1
 
#define PWM_START   2
 
#define PWM_NONSTOP   3
 
#define PWM_STOP_TIME   4
 
#define W83795_REG_PWM(index, nr)   (0x210 + (nr) * 8 + (index))
 
#define W83795_REG_FTSH(index)   (0x240 + (index) * 2)
 
#define W83795_REG_FTSL(index)   (0x241 + (index) * 2)
 
#define W83795_REG_TFTS   0x250
 
#define TEMP_PWM_TTTI   0
 
#define TEMP_PWM_CTFS   1
 
#define TEMP_PWM_HCT   2
 
#define TEMP_PWM_HOT   3
 
#define W83795_REG_TTTI(index)   (0x260 + (index))
 
#define W83795_REG_CTFS(index)   (0x268 + (index))
 
#define W83795_REG_HT(index)   (0x270 + (index))
 
#define SF4_TEMP   0
 
#define SF4_PWM   1
 
#define W83795_REG_SF4_TEMP(temp_num, index)   (0x280 + 0x10 * (temp_num) + (index))
 
#define W83795_REG_SF4_PWM(temp_num, index)   (0x288 + 0x10 * (temp_num) + (index))
 
#define W83795_REG_DTSC   0x301
 
#define W83795_REG_DTSE   0x302
 
#define W83795_REG_DTS(index)   (0x26 + (index))
 
#define W83795_REG_PECI_TBASE(index)   (0x320 + (index))
 
#define DTS_CRIT   0
 
#define DTS_CRIT_HYST   1
 
#define DTS_WARN   2
 
#define DTS_WARN_HYST   3
 
#define W83795_REG_DTS_EXT(index)   (0xB2 + (index))
 
#define SETUP_PWM_DEFAULT   0
 
#define SETUP_PWM_UPTIME   1
 
#define SETUP_PWM_DOWNTIME   2
 
#define W83795_REG_SETUP_PWM(index)   (0x20C + (index))
 
#define ALARM_STATUS   0
 
#define BEEP_ENABLE   1
 
#define FAN_INPUT   0
 
#define FAN_MIN   1
 
#define TEMP_PWM_ENABLE   0
 
#define TEMP_PWM_FAN_MAP   1
 
#define FANIN_TARGET   0
 
#define FANIN_TOL   1
 
#define NOT_USED   -1
 
#define SENSOR_ATTR_IN(index)
 
#define SENSOR_ATTR_FAN(index)
 
#define SENSOR_ATTR_PWM(index)
 
#define SENSOR_ATTR_DTS(index)
 
#define SENSOR_ATTR_TEMP(index)
 
#define NUM_PWM_ATTRIBUTES   4
 
#define NUM_TEMP_ATTRIBUTES   8
 

Enumerations

enum  chip_types { w83795g, w83795adg }
 

Functions

 module_param (reset, bool, 0)
 
 MODULE_PARM_DESC (reset,"Set to 1 to reset chip, not recommended")
 
 MODULE_DEVICE_TABLE (i2c, w83795_id)
 
 module_i2c_driver (w83795_driver)
 
 MODULE_AUTHOR ("Wei Song, Jean Delvare <[email protected]>")
 
 MODULE_DESCRIPTION ("W83795G/ADG hardware monitoring driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define ALARM_CTRL_RTSACS   (1 << 7)

Definition at line 171 of file w83795.c.

#define ALARM_STATUS   0

Definition at line 713 of file w83795.c.

#define BEEP_ENABLE   1

Definition at line 714 of file w83795.c.

#define DTS_CRIT   0

Definition at line 226 of file w83795.c.

#define DTS_CRIT_HYST   1

Definition at line 227 of file w83795.c.

#define DTS_WARN   2

Definition at line 228 of file w83795.c.

#define DTS_WARN_HYST   3

Definition at line 229 of file w83795.c.

#define FAN_INPUT   0

Definition at line 787 of file w83795.c.

#define FAN_MIN   1

Definition at line 788 of file w83795.c.

#define FANIN_TARGET   0

Definition at line 1138 of file w83795.c.

#define FANIN_TOL   1

Definition at line 1139 of file w83795.c.

#define IN_LOW   2

Definition at line 90 of file w83795.c.

#define IN_LSB_IDX   1

Definition at line 135 of file w83795.c.

#define IN_LSB_REG (   index,
  type 
)
Value:
(((type) == 1) ? W83795_REG_IN_HL_LSB[(index)] \
: (W83795_REG_IN_HL_LSB[(index)] + 1))

Definition at line 130 of file w83795.c.

#define IN_LSB_SHIFT   0

Definition at line 134 of file w83795.c.

#define IN_MAX   1

Definition at line 89 of file w83795.c.

#define IN_READ   0

Definition at line 88 of file w83795.c.

#define NOT_USED   -1

Definition at line 1618 of file w83795.c.

#define NUM_PWM_ATTRIBUTES   4

Definition at line 1996 of file w83795.c.

#define NUM_TEMP_ATTRIBUTES   8

Definition at line 1997 of file w83795.c.

#define OVT_CFG_SEL   (1 << 7)

Definition at line 177 of file w83795.c.

#define PWM_FREQ   1

Definition at line 196 of file w83795.c.

#define PWM_NONSTOP   3

Definition at line 198 of file w83795.c.

#define PWM_OUTPUT   0

Definition at line 195 of file w83795.c.

#define PWM_START   2

Definition at line 197 of file w83795.c.

#define PWM_STOP_TIME   4

Definition at line 199 of file w83795.c.

#define SENSOR_ATTR_DTS (   index)
Value:
{ \
SENSOR_ATTR_2(temp##index##_type, S_IRUGO , \
show_dts_mode, NULL, NOT_USED, index - 7), \
SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_dts, \
NULL, NOT_USED, index - 7), \
SENSOR_ATTR_2(temp##index##_crit, S_IRUGO | S_IWUSR, show_dts_ext, \
store_dts_ext, DTS_CRIT, NOT_USED), \
SENSOR_ATTR_2(temp##index##_crit_hyst, S_IRUGO | S_IWUSR, \
show_dts_ext, store_dts_ext, DTS_CRIT_HYST, NOT_USED), \
SENSOR_ATTR_2(temp##index##_max, S_IRUGO | S_IWUSR, show_dts_ext, \
store_dts_ext, DTS_WARN, NOT_USED), \
SENSOR_ATTR_2(temp##index##_max_hyst, S_IRUGO | S_IWUSR, \
show_dts_ext, store_dts_ext, DTS_WARN_HYST, NOT_USED), \
SENSOR_ATTR_2(temp##index##_alarm, S_IRUGO, \
show_alarm_beep, NULL, ALARM_STATUS, index + 17), \
SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \
show_alarm_beep, store_beep, BEEP_ENABLE, index + 17) }

Definition at line 1673 of file w83795.c.

#define SENSOR_ATTR_FAN (   index)
Value:
{ \
SENSOR_ATTR_2(fan##index##_input, S_IRUGO, show_fan, \
NULL, FAN_INPUT, index - 1), \
SENSOR_ATTR_2(fan##index##_min, S_IWUSR | S_IRUGO, \
show_fan, store_fan_min, FAN_MIN, index - 1), \
SENSOR_ATTR_2(fan##index##_alarm, S_IRUGO, show_alarm_beep, \
NULL, ALARM_STATUS, index + 31), \
SENSOR_ATTR_2(fan##index##_beep, S_IWUSR | S_IRUGO, \
show_alarm_beep, store_beep, BEEP_ENABLE, index + 31) }

Definition at line 1641 of file w83795.c.

#define SENSOR_ATTR_IN (   index)
Value:
{ \
SENSOR_ATTR_2(in##index##_input, S_IRUGO, show_in, NULL, \
SENSOR_ATTR_2(in##index##_max, S_IRUGO | S_IWUSR, show_in, \
store_in, IN_MAX, index), \
SENSOR_ATTR_2(in##index##_min, S_IRUGO | S_IWUSR, show_in, \
store_in, IN_LOW, index), \
SENSOR_ATTR_2(in##index##_alarm, S_IRUGO, show_alarm_beep, \
NULL, ALARM_STATUS, index + ((index > 14) ? 1 : 0)), \
SENSOR_ATTR_2(in##index##_beep, S_IWUSR | S_IRUGO, \
show_alarm_beep, store_beep, BEEP_ENABLE, \
index + ((index > 14) ? 1 : 0)) }

Definition at line 1624 of file w83795.c.

#define SENSOR_ATTR_PWM (   index)
Value:
{ \
SENSOR_ATTR_2(pwm##index, S_IWUSR | S_IRUGO, show_pwm, \
store_pwm, PWM_OUTPUT, index - 1), \
SENSOR_ATTR_2(pwm##index##_enable, S_IWUSR | S_IRUGO, \
show_pwm_enable, store_pwm_enable, NOT_USED, index - 1), \
SENSOR_ATTR_2(pwm##index##_mode, S_IRUGO, \
show_pwm_mode, NULL, NOT_USED, index - 1), \
SENSOR_ATTR_2(pwm##index##_freq, S_IWUSR | S_IRUGO, \
show_pwm, store_pwm, PWM_FREQ, index - 1), \
SENSOR_ATTR_2(pwm##index##_nonstop, S_IWUSR | S_IRUGO, \
show_pwm, store_pwm, PWM_NONSTOP, index - 1), \
SENSOR_ATTR_2(pwm##index##_start, S_IWUSR | S_IRUGO, \
show_pwm, store_pwm, PWM_START, index - 1), \
SENSOR_ATTR_2(pwm##index##_stop_time, S_IWUSR | S_IRUGO, \
show_pwm, store_pwm, PWM_STOP_TIME, index - 1), \
SENSOR_ATTR_2(fan##index##_target, S_IWUSR | S_IRUGO, \
show_fanin, store_fanin, FANIN_TARGET, index - 1) }

Definition at line 1651 of file w83795.c.

#define SENSOR_ATTR_TEMP (   index)

Definition at line 1695 of file w83795.c.

#define SETUP_PWM_DEFAULT   0

Definition at line 232 of file w83795.c.

#define SETUP_PWM_DOWNTIME   2

Definition at line 234 of file w83795.c.

#define SETUP_PWM_UPTIME   1

Definition at line 233 of file w83795.c.

#define SF4_PWM   1

Definition at line 215 of file w83795.c.

#define SF4_TEMP   0

Definition at line 214 of file w83795.c.

#define TEMP_CRIT   1

Definition at line 71 of file w83795.c.

#define TEMP_CRIT_HYST   2

Definition at line 72 of file w83795.c.

#define TEMP_PWM_CTFS   1

Definition at line 207 of file w83795.c.

#define TEMP_PWM_ENABLE   0

Definition at line 1072 of file w83795.c.

#define TEMP_PWM_FAN_MAP   1

Definition at line 1073 of file w83795.c.

#define TEMP_PWM_HCT   2

Definition at line 208 of file w83795.c.

#define TEMP_PWM_HOT   3

Definition at line 209 of file w83795.c.

#define TEMP_PWM_TTTI   0

Definition at line 206 of file w83795.c.

#define TEMP_READ   0

Definition at line 70 of file w83795.c.

#define TEMP_WARN   3

Definition at line 73 of file w83795.c.

#define TEMP_WARN_HYST   4

Definition at line 74 of file w83795.c.

#define TSS_MAP_RESERVED   0xff

Definition at line 187 of file w83795.c.

#define W83795_REG_ALARM (   index)    (0x41 + (index))

Definition at line 172 of file w83795.c.

#define W83795_REG_ALARM_CTRL   0x40

Definition at line 170 of file w83795.c.

#define W83795_REG_BANKSEL   0x00

Definition at line 50 of file w83795.c.

#define W83795_REG_BEEP (   index)    (0x50 + (index))

Definition at line 174 of file w83795.c.

#define W83795_REG_CHIPID   0xfe

Definition at line 52 of file w83795.c.

#define W83795_REG_CLR_CHASSIS   0x4D

Definition at line 173 of file w83795.c.

#define W83795_REG_CONFIG   0x01

Definition at line 57 of file w83795.c.

#define W83795_REG_CONFIG_CONFIG48   0x04

Definition at line 58 of file w83795.c.

#define W83795_REG_CONFIG_START   0x01

Definition at line 59 of file w83795.c.

#define W83795_REG_CTFS (   index)    (0x268 + (index))

Definition at line 211 of file w83795.c.

#define W83795_REG_DEVICEID   0xfb

Definition at line 53 of file w83795.c.

#define W83795_REG_DEVICEID_A   0xff

Definition at line 54 of file w83795.c.

#define W83795_REG_DTS (   index)    (0x26 + (index))

Definition at line 223 of file w83795.c.

#define W83795_REG_DTS_EXT (   index)    (0xB2 + (index))

Definition at line 230 of file w83795.c.

#define W83795_REG_DTSC   0x301

Definition at line 221 of file w83795.c.

#define W83795_REG_DTSE   0x302

Definition at line 222 of file w83795.c.

#define W83795_REG_FAN (   index)    (0x2E + (index))

Definition at line 162 of file w83795.c.

#define W83795_REG_FAN_MIN_HL (   index)    (0xB6 + (index))

Definition at line 163 of file w83795.c.

#define W83795_REG_FAN_MIN_LSB (   index)    (0xC4 + (index) / 2)

Definition at line 164 of file w83795.c.

#define W83795_REG_FAN_MIN_LSB_SHIFT (   index)    (((index) & 1) ? 4 : 0)

Definition at line 165 of file w83795.c.

#define W83795_REG_FANIN_CTRL1   0x06

Definition at line 66 of file w83795.c.

#define W83795_REG_FANIN_CTRL2   0x07

Definition at line 67 of file w83795.c.

#define W83795_REG_FCMS1   0x201

Definition at line 180 of file w83795.c.

#define W83795_REG_FCMS2   0x208

Definition at line 181 of file w83795.c.

#define W83795_REG_FOMC   0x20F

Definition at line 183 of file w83795.c.

#define W83795_REG_FTSH (   index)    (0x240 + (index) * 2)

Definition at line 202 of file w83795.c.

#define W83795_REG_FTSL (   index)    (0x241 + (index) * 2)

Definition at line 203 of file w83795.c.

#define W83795_REG_HT (   index)    (0x270 + (index))

Definition at line 212 of file w83795.c.

#define W83795_REG_I2C_ADDR   0xfc

Definition at line 56 of file w83795.c.

#define W83795_REG_OVT_CFG   0x58

Definition at line 176 of file w83795.c.

#define W83795_REG_PECI_TBASE (   index)    (0x320 + (index))

Definition at line 224 of file w83795.c.

#define W83795_REG_PWM (   index,
  nr 
)    (0x210 + (nr) * 8 + (index))

Definition at line 200 of file w83795.c.

#define W83795_REG_SETUP_PWM (   index)    (0x20C + (index))

Definition at line 235 of file w83795.c.

#define W83795_REG_SF4_PWM (   temp_num,
  index 
)    (0x288 + 0x10 * (temp_num) + (index))

Definition at line 218 of file w83795.c.

#define W83795_REG_SF4_TEMP (   temp_num,
  index 
)    (0x280 + 0x10 * (temp_num) + (index))

Definition at line 216 of file w83795.c.

#define W83795_REG_TEMP_CTRL1   0x04

Definition at line 64 of file w83795.c.

#define W83795_REG_TEMP_CTRL2   0x05

Definition at line 65 of file w83795.c.

#define W83795_REG_TFMR (   index)    (0x202 + (index))

Definition at line 182 of file w83795.c.

#define W83795_REG_TFTS   0x250

Definition at line 204 of file w83795.c.

#define W83795_REG_TSS (   index)    (0x209 + (index))

Definition at line 185 of file w83795.c.

#define W83795_REG_TTTI (   index)    (0x260 + (index))

Definition at line 210 of file w83795.c.

#define W83795_REG_VENDORID   0xfd

Definition at line 51 of file w83795.c.

#define W83795_REG_VID_CTRL   0x6A

Definition at line 168 of file w83795.c.

#define W83795_REG_VMIGB_CTRL   0x08

Definition at line 68 of file w83795.c.

#define W83795_REG_VOLT_CTRL1   0x02

Definition at line 62 of file w83795.c.

#define W83795_REG_VOLT_CTRL2   0x03

Definition at line 63 of file w83795.c.

#define W83795_REG_VRLSB   0x3C

Definition at line 115 of file w83795.c.

Enumeration Type Documentation

enum chip_types
Enumerator:
w83795g 
w83795adg 

Definition at line 333 of file w83795.c.

Function Documentation

MODULE_AUTHOR ( "Wei  Song,
Jean Delvare< khali @linux-fr.org >"   
)
MODULE_DESCRIPTION ( "W83795G/ADG hardware monitoring driver )
MODULE_DEVICE_TABLE ( i2c  ,
w83795_id   
)
module_i2c_driver ( w83795_driver  )
MODULE_LICENSE ( "GPL"  )
module_param ( reset  ,
bool  ,
 
)
MODULE_PARM_DESC ( reset  ,
"Set to 1 to reset  chip,
not recommended"   
)