Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
w83793.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-vid.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/fs.h>
#include <linux/watchdog.h>
#include <linux/miscdevice.h>
#include <linux/uaccess.h>
#include <linux/kref.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/jiffies.h>

Go to the source code of this file.

Data Structures

struct  w83793_data
 

Macros

#define WATCHDOG_TIMEOUT   2 /* 2 minute default timeout */
 
#define W83793_REG_BANKSEL   0x00
 
#define W83793_REG_VENDORID   0x0d
 
#define W83793_REG_CHIPID   0x0e
 
#define W83793_REG_DEVICEID   0x0f
 
#define W83793_REG_CONFIG   0x40
 
#define W83793_REG_MFC   0x58
 
#define W83793_REG_FANIN_CTRL   0x5c
 
#define W83793_REG_FANIN_SEL   0x5d
 
#define W83793_REG_I2C_ADDR   0x0b
 
#define W83793_REG_I2C_SUBADDR   0x0c
 
#define W83793_REG_VID_INA   0x05
 
#define W83793_REG_VID_INB   0x06
 
#define W83793_REG_VID_LATCHA   0x07
 
#define W83793_REG_VID_LATCHB   0x08
 
#define W83793_REG_VID_CTRL   0x59
 
#define W83793_REG_WDT_LOCK   0x01
 
#define W83793_REG_WDT_ENABLE   0x02
 
#define W83793_REG_WDT_STATUS   0x03
 
#define W83793_REG_WDT_TIMEOUT   0x04
 
#define TEMP_READ   0
 
#define TEMP_CRIT   1
 
#define TEMP_CRIT_HYST   2
 
#define TEMP_WARN   3
 
#define TEMP_WARN_HYST   4
 
#define W83793_REG_TEMP_LOW_BITS   0x22
 
#define W83793_REG_BEEP(index)   (0x53 + (index))
 
#define W83793_REG_ALARM(index)   (0x4b + (index))
 
#define W83793_REG_CLR_CHASSIS   0x4a /* SMI MASK4 */
 
#define W83793_REG_IRQ_CTRL   0x50
 
#define W83793_REG_OVT_CTRL   0x51
 
#define W83793_REG_OVT_BEEP   0x52
 
#define IN_READ   0
 
#define IN_MAX   1
 
#define IN_LOW   2
 
#define W83793_REG_FAN(index)   (0x23 + 2 * (index)) /* High byte */
 
#define W83793_REG_FAN_MIN(index)   (0x90 + 2 * (index)) /* High byte */
 
#define W83793_REG_PWM_DEFAULT   0xb2
 
#define W83793_REG_PWM_ENABLE   0x207
 
#define W83793_REG_PWM_UPTIME   0xc3 /* Unit in 0.1 second */
 
#define W83793_REG_PWM_DOWNTIME   0xc4 /* Unit in 0.1 second */
 
#define W83793_REG_TEMP_CRITICAL   0xc5
 
#define PWM_DUTY   0
 
#define PWM_START   1
 
#define PWM_NONSTOP   2
 
#define PWM_STOP_TIME   3
 
#define W83793_REG_PWM(index, nr)
 
#define W83793_REG_TEMP_FAN_MAP(index)   (0x201 + (index))
 
#define W83793_REG_TEMP_TOL(index)   (0x208 + (index))
 
#define W83793_REG_TEMP_CRUISE(index)   (0x210 + (index))
 
#define W83793_REG_PWM_STOP_TIME(index)   (0x228 + (index))
 
#define W83793_REG_SF2_TEMP(index, nr)   (0x230 + ((index) << 4) + (nr))
 
#define W83793_REG_SF2_PWM(index, nr)   (0x238 + ((index) << 4) + (nr))
 
#define ALARM_STATUS   0
 
#define BEEP_ENABLE   1
 
#define FAN_INPUT   0
 
#define FAN_MIN   1
 
#define SETUP_PWM_DEFAULT   0
 
#define SETUP_PWM_UPTIME   1 /* Unit in 0.1s */
 
#define SETUP_PWM_DOWNTIME   2 /* Unit in 0.1s */
 
#define SETUP_TEMP_CRITICAL   3
 
#define TEMP_FAN_MAP   0
 
#define TEMP_PWM_ENABLE   1
 
#define TEMP_CRUISE   2
 
#define TEMP_TOLERANCE   3
 
#define NOT_USED   -1
 
#define SENSOR_ATTR_IN(index)
 
#define SENSOR_ATTR_FAN(index)
 
#define SENSOR_ATTR_PWM(index)
 
#define SENSOR_ATTR_TEMP(index)
 

Functions

 module_param_array (force_subclients, short, NULL, 0)
 
 MODULE_PARM_DESC (force_subclients,"List of subclient addresses: ""{bus, clientaddr, subclientaddr1, subclientaddr2}")
 
 module_param (reset, bool, 0)
 
 MODULE_PARM_DESC (reset,"Set to 1 to reset chip, not recommended")
 
 module_param (timeout, int, 0)
 
 MODULE_PARM_DESC (timeout,"Watchdog timeout in minutes. 2<= timeout <=255 (default="__MODULE_STRING(WATCHDOG_TIMEOUT)")")
 
 module_param (nowayout, bool, 0)
 
 MODULE_PARM_DESC (nowayout,"Watchdog cannot be stopped once started (default="__MODULE_STRING(WATCHDOG_NOWAYOUT)")")
 
 MODULE_DEVICE_TABLE (i2c, w83793_id)
 
 module_i2c_driver (w83793_driver)
 
 MODULE_AUTHOR ("Yuan Mu, Sven Anders")
 
 MODULE_DESCRIPTION ("w83793 driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define ALARM_STATUS   0

Definition at line 360 of file w83793.c.

#define BEEP_ENABLE   1

Definition at line 361 of file w83793.c.

#define FAN_INPUT   0

Definition at line 472 of file w83793.c.

#define FAN_MIN   1

Definition at line 473 of file w83793.c.

#define IN_LOW   2

Definition at line 139 of file w83793.c.

#define IN_MAX   1

Definition at line 138 of file w83793.c.

#define IN_READ   0

Definition at line 137 of file w83793.c.

#define NOT_USED   -1

Definition at line 1024 of file w83793.c.

#define PWM_DUTY   0

Definition at line 168 of file w83793.c.

#define PWM_NONSTOP   2

Definition at line 170 of file w83793.c.

#define PWM_START   1

Definition at line 169 of file w83793.c.

#define PWM_STOP_TIME   3

Definition at line 171 of file w83793.c.

#define SENSOR_ATTR_FAN (   index)
Value:
SENSOR_ATTR_2(fan##index##_alarm, S_IRUGO, show_alarm_beep, \
NULL, ALARM_STATUS, index + 17), \
SENSOR_ATTR_2(fan##index##_beep, S_IWUSR | S_IRUGO, \
show_alarm_beep, store_beep, BEEP_ENABLE, index + 17), \
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)

Definition at line 1039 of file w83793.c.

#define SENSOR_ATTR_IN (   index)
Value:
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 > 2) ? 1 : 0)), \
SENSOR_ATTR_2(in##index##_beep, S_IWUSR | S_IRUGO, \
show_alarm_beep, store_beep, BEEP_ENABLE, \
index + ((index > 2) ? 1 : 0))

Definition at line 1026 of file w83793.c.

#define SENSOR_ATTR_PWM (   index)
Value:
store_pwm, PWM_DUTY, 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)

Definition at line 1049 of file w83793.c.

#define SENSOR_ATTR_TEMP (   index)

Definition at line 1059 of file w83793.c.

#define SETUP_PWM_DEFAULT   0

Definition at line 697 of file w83793.c.

#define SETUP_PWM_DOWNTIME   2 /* Unit in 0.1s */

Definition at line 699 of file w83793.c.

#define SETUP_PWM_UPTIME   1 /* Unit in 0.1s */

Definition at line 698 of file w83793.c.

#define SETUP_TEMP_CRITICAL   3

Definition at line 700 of file w83793.c.

#define TEMP_CRIT   1

Definition at line 110 of file w83793.c.

#define TEMP_CRIT_HYST   2

Definition at line 111 of file w83793.c.

#define TEMP_CRUISE   2

Definition at line 796 of file w83793.c.

#define TEMP_FAN_MAP   0

Definition at line 794 of file w83793.c.

#define TEMP_PWM_ENABLE   1

Definition at line 795 of file w83793.c.

#define TEMP_READ   0

Definition at line 109 of file w83793.c.

#define TEMP_TOLERANCE   3

Definition at line 797 of file w83793.c.

#define TEMP_WARN   3

Definition at line 112 of file w83793.c.

#define TEMP_WARN_HYST   4

Definition at line 113 of file w83793.c.

#define W83793_REG_ALARM (   index)    (0x4b + (index))

Definition at line 130 of file w83793.c.

#define W83793_REG_BANKSEL   0x00

Definition at line 85 of file w83793.c.

#define W83793_REG_BEEP (   index)    (0x53 + (index))

Definition at line 129 of file w83793.c.

#define W83793_REG_CHIPID   0x0e

Definition at line 87 of file w83793.c.

#define W83793_REG_CLR_CHASSIS   0x4a /* SMI MASK4 */

Definition at line 132 of file w83793.c.

#define W83793_REG_CONFIG   0x40

Definition at line 90 of file w83793.c.

#define W83793_REG_DEVICEID   0x0f

Definition at line 88 of file w83793.c.

#define W83793_REG_FAN (   index)    (0x23 + 2 * (index)) /* High byte */

Definition at line 159 of file w83793.c.

#define W83793_REG_FAN_MIN (   index)    (0x90 + 2 * (index)) /* High byte */

Definition at line 160 of file w83793.c.

#define W83793_REG_FANIN_CTRL   0x5c

Definition at line 92 of file w83793.c.

#define W83793_REG_FANIN_SEL   0x5d

Definition at line 93 of file w83793.c.

#define W83793_REG_I2C_ADDR   0x0b

Definition at line 94 of file w83793.c.

#define W83793_REG_I2C_SUBADDR   0x0c

Definition at line 95 of file w83793.c.

#define W83793_REG_IRQ_CTRL   0x50

Definition at line 133 of file w83793.c.

#define W83793_REG_MFC   0x58

Definition at line 91 of file w83793.c.

#define W83793_REG_OVT_BEEP   0x52

Definition at line 135 of file w83793.c.

#define W83793_REG_OVT_CTRL   0x51

Definition at line 134 of file w83793.c.

#define W83793_REG_PWM (   index,
  nr 
)
Value:
(((nr) == 0 ? 0xb3 : \
(nr) == 1 ? 0x220 : 0x218) + (index))

Definition at line 172 of file w83793.c.

#define W83793_REG_PWM_DEFAULT   0xb2

Definition at line 162 of file w83793.c.

#define W83793_REG_PWM_DOWNTIME   0xc4 /* Unit in 0.1 second */

Definition at line 165 of file w83793.c.

#define W83793_REG_PWM_ENABLE   0x207

Definition at line 163 of file w83793.c.

#define W83793_REG_PWM_STOP_TIME (   index)    (0x228 + (index))

Definition at line 179 of file w83793.c.

#define W83793_REG_PWM_UPTIME   0xc3 /* Unit in 0.1 second */

Definition at line 164 of file w83793.c.

#define W83793_REG_SF2_PWM (   index,
  nr 
)    (0x238 + ((index) << 4) + (nr))

Definition at line 181 of file w83793.c.

#define W83793_REG_SF2_TEMP (   index,
  nr 
)    (0x230 + ((index) << 4) + (nr))

Definition at line 180 of file w83793.c.

#define W83793_REG_TEMP_CRITICAL   0xc5

Definition at line 166 of file w83793.c.

#define W83793_REG_TEMP_CRUISE (   index)    (0x210 + (index))

Definition at line 178 of file w83793.c.

#define W83793_REG_TEMP_FAN_MAP (   index)    (0x201 + (index))

Definition at line 176 of file w83793.c.

#define W83793_REG_TEMP_LOW_BITS   0x22

Definition at line 127 of file w83793.c.

#define W83793_REG_TEMP_TOL (   index)    (0x208 + (index))

Definition at line 177 of file w83793.c.

#define W83793_REG_VENDORID   0x0d

Definition at line 86 of file w83793.c.

#define W83793_REG_VID_CTRL   0x59

Definition at line 100 of file w83793.c.

#define W83793_REG_VID_INA   0x05

Definition at line 96 of file w83793.c.

#define W83793_REG_VID_INB   0x06

Definition at line 97 of file w83793.c.

#define W83793_REG_VID_LATCHA   0x07

Definition at line 98 of file w83793.c.

#define W83793_REG_VID_LATCHB   0x08

Definition at line 99 of file w83793.c.

#define W83793_REG_WDT_ENABLE   0x02

Definition at line 103 of file w83793.c.

#define W83793_REG_WDT_LOCK   0x01

Definition at line 102 of file w83793.c.

#define W83793_REG_WDT_STATUS   0x03

Definition at line 104 of file w83793.c.

#define W83793_REG_WDT_TIMEOUT   0x04

Definition at line 105 of file w83793.c.

#define WATCHDOG_TIMEOUT   2 /* 2 minute default timeout */

Definition at line 52 of file w83793.c.

Function Documentation

MODULE_AUTHOR ( "Yuan  Mu,
Sven Anders"   
)
MODULE_DESCRIPTION ( "w83793 driver )
MODULE_DEVICE_TABLE ( i2c  ,
w83793_id   
)
module_i2c_driver ( w83793_driver  )
MODULE_LICENSE ( "GPL"  )
module_param ( reset  ,
bool  ,
 
)
module_param ( timeout  ,
int  ,
 
)
module_param ( nowayout  ,
bool  ,
 
)
module_param_array ( force_subclients  ,
short  ,
NULL  ,
 
)
MODULE_PARM_DESC ( force_subclients  ,
"List of subclient addresses: ""{bus, clientaddr, subclientaddr1, subclientaddr2}"   
)
MODULE_PARM_DESC ( reset  ,
"Set to 1 to reset  chip,
not recommended"   
)
MODULE_PARM_DESC ( timeout  ,
"Watchdog timeout in minutes. 2<= timeout <=255 (default="__MODULE_STRING(WATCHDOG_TIMEOUT)")"   
)
MODULE_PARM_DESC ( nowayout  ,
"Watchdog cannot be stopped once started (default="__MODULE_STRING(WATCHDOG_NOWAYOUT)")"   
)