Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
adt7470.c File Reference
#include <linux/module.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>
#include <linux/delay.h>
#include <linux/log2.h>
#include <linux/kthread.h>
#include <linux/slab.h>

Go to the source code of this file.

Data Structures

struct  adt7470_data
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define ADT7470_REG_BASE_ADDR   0x20
 
#define ADT7470_REG_TEMP_BASE_ADDR   0x20
 
#define ADT7470_REG_TEMP_MAX_ADDR   0x29
 
#define ADT7470_REG_FAN_BASE_ADDR   0x2A
 
#define ADT7470_REG_FAN_MAX_ADDR   0x31
 
#define ADT7470_REG_PWM_BASE_ADDR   0x32
 
#define ADT7470_REG_PWM_MAX_ADDR   0x35
 
#define ADT7470_REG_PWM_MAX_BASE_ADDR   0x38
 
#define ADT7470_REG_PWM_MAX_MAX_ADDR   0x3B
 
#define ADT7470_REG_CFG   0x40
 
#define ADT7470_FSPD_MASK   0x04
 
#define ADT7470_REG_ALARM1   0x41
 
#define ADT7470_R1T_ALARM   0x01
 
#define ADT7470_R2T_ALARM   0x02
 
#define ADT7470_R3T_ALARM   0x04
 
#define ADT7470_R4T_ALARM   0x08
 
#define ADT7470_R5T_ALARM   0x10
 
#define ADT7470_R6T_ALARM   0x20
 
#define ADT7470_R7T_ALARM   0x40
 
#define ADT7470_OOL_ALARM   0x80
 
#define ADT7470_REG_ALARM2   0x42
 
#define ADT7470_R8T_ALARM   0x01
 
#define ADT7470_R9T_ALARM   0x02
 
#define ADT7470_R10T_ALARM   0x04
 
#define ADT7470_FAN1_ALARM   0x10
 
#define ADT7470_FAN2_ALARM   0x20
 
#define ADT7470_FAN3_ALARM   0x40
 
#define ADT7470_FAN4_ALARM   0x80
 
#define ADT7470_REG_TEMP_LIMITS_BASE_ADDR   0x44
 
#define ADT7470_REG_TEMP_LIMITS_MAX_ADDR   0x57
 
#define ADT7470_REG_FAN_MIN_BASE_ADDR   0x58
 
#define ADT7470_REG_FAN_MIN_MAX_ADDR   0x5F
 
#define ADT7470_REG_FAN_MAX_BASE_ADDR   0x60
 
#define ADT7470_REG_FAN_MAX_MAX_ADDR   0x67
 
#define ADT7470_REG_PWM_CFG_BASE_ADDR   0x68
 
#define ADT7470_REG_PWM12_CFG   0x68
 
#define ADT7470_PWM2_AUTO_MASK   0x40
 
#define ADT7470_PWM1_AUTO_MASK   0x80
 
#define ADT7470_PWM_AUTO_MASK   0xC0
 
#define ADT7470_REG_PWM34_CFG   0x69
 
#define ADT7470_PWM3_AUTO_MASK   0x40
 
#define ADT7470_PWM4_AUTO_MASK   0x80
 
#define ADT7470_REG_PWM_MIN_BASE_ADDR   0x6A
 
#define ADT7470_REG_PWM_MIN_MAX_ADDR   0x6D
 
#define ADT7470_REG_PWM_TEMP_MIN_BASE_ADDR   0x6E
 
#define ADT7470_REG_PWM_TEMP_MIN_MAX_ADDR   0x71
 
#define ADT7470_REG_ACOUSTICS12   0x75
 
#define ADT7470_REG_ACOUSTICS34   0x76
 
#define ADT7470_REG_DEVICE   0x3D
 
#define ADT7470_REG_VENDOR   0x3E
 
#define ADT7470_REG_REVISION   0x3F
 
#define ADT7470_REG_ALARM1_MASK   0x72
 
#define ADT7470_REG_ALARM2_MASK   0x73
 
#define ADT7470_REG_PWM_AUTO_TEMP_BASE_ADDR   0x7C
 
#define ADT7470_REG_PWM_AUTO_TEMP_MAX_ADDR   0x7D
 
#define ADT7470_REG_MAX_ADDR   0x81
 
#define ADT7470_TEMP_COUNT   10
 
#define ADT7470_TEMP_REG(x)   (ADT7470_REG_TEMP_BASE_ADDR + (x))
 
#define ADT7470_TEMP_MIN_REG(x)   (ADT7470_REG_TEMP_LIMITS_BASE_ADDR + ((x) * 2))
 
#define ADT7470_TEMP_MAX_REG(x)
 
#define ADT7470_FAN_COUNT   4
 
#define ADT7470_REG_FAN(x)   (ADT7470_REG_FAN_BASE_ADDR + ((x) * 2))
 
#define ADT7470_REG_FAN_MIN(x)   (ADT7470_REG_FAN_MIN_BASE_ADDR + ((x) * 2))
 
#define ADT7470_REG_FAN_MAX(x)   (ADT7470_REG_FAN_MAX_BASE_ADDR + ((x) * 2))
 
#define ADT7470_PWM_COUNT   4
 
#define ADT7470_REG_PWM(x)   (ADT7470_REG_PWM_BASE_ADDR + (x))
 
#define ADT7470_REG_PWM_MAX(x)   (ADT7470_REG_PWM_MAX_BASE_ADDR + (x))
 
#define ADT7470_REG_PWM_MIN(x)   (ADT7470_REG_PWM_MIN_BASE_ADDR + (x))
 
#define ADT7470_REG_PWM_TMIN(x)   (ADT7470_REG_PWM_TEMP_MIN_BASE_ADDR + (x))
 
#define ADT7470_REG_PWM_CFG(x)   (ADT7470_REG_PWM_CFG_BASE_ADDR + ((x) / 2))
 
#define ADT7470_REG_PWM_AUTO_TEMP(x)
 
#define ALARM2(x)   ((x) << 8)
 
#define ADT7470_VENDOR   0x41
 
#define ADT7470_DEVICE   0x70
 
#define ADT7470_REVISION   0x02
 
#define ADT7470_PWM_ALL_TEMPS   0x3FF
 
#define SENSOR_REFRESH_INTERVAL   (5 * HZ)
 
#define LIMIT_REFRESH_INTERVAL   (60 * HZ)
 
#define TEMP_COLLECTION_TIME   2000
 
#define AUTO_UPDATE_INTERVAL   2000
 
#define FAN_PERIOD_TO_RPM(x)   ((90000 * 60) / (x))
 
#define FAN_RPM_TO_PERIOD   FAN_PERIOD_TO_RPM
 
#define FAN_PERIOD_INVALID   65535
 
#define FAN_DATA_VALID(x)   ((x) && (x) != FAN_PERIOD_INVALID)
 

Functions

 MODULE_DEVICE_TABLE (i2c, adt7470_id)
 
 module_i2c_driver (adt7470_driver)
 
 MODULE_AUTHOR ("Darrick J. Wong <[email protected]>")
 
 MODULE_DESCRIPTION ("ADT7470 driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define ADT7470_DEVICE   0x70

Definition at line 120 of file adt7470.c.

#define ADT7470_FAN1_ALARM   0x10

Definition at line 64 of file adt7470.c.

#define ADT7470_FAN2_ALARM   0x20

Definition at line 65 of file adt7470.c.

#define ADT7470_FAN3_ALARM   0x40

Definition at line 66 of file adt7470.c.

#define ADT7470_FAN4_ALARM   0x80

Definition at line 67 of file adt7470.c.

#define ADT7470_FAN_COUNT   4

Definition at line 103 of file adt7470.c.

#define ADT7470_FSPD_MASK   0x04

Definition at line 50 of file adt7470.c.

#define ADT7470_OOL_ALARM   0x80

Definition at line 59 of file adt7470.c.

#define ADT7470_PWM1_AUTO_MASK   0x80

Definition at line 77 of file adt7470.c.

#define ADT7470_PWM2_AUTO_MASK   0x40

Definition at line 76 of file adt7470.c.

#define ADT7470_PWM3_AUTO_MASK   0x40

Definition at line 80 of file adt7470.c.

#define ADT7470_PWM4_AUTO_MASK   0x80

Definition at line 81 of file adt7470.c.

#define ADT7470_PWM_ALL_TEMPS   0x3FF

Definition at line 125 of file adt7470.c.

#define ADT7470_PWM_AUTO_MASK   0xC0

Definition at line 78 of file adt7470.c.

#define ADT7470_PWM_COUNT   4

Definition at line 108 of file adt7470.c.

#define ADT7470_R10T_ALARM   0x04

Definition at line 63 of file adt7470.c.

#define ADT7470_R1T_ALARM   0x01

Definition at line 52 of file adt7470.c.

#define ADT7470_R2T_ALARM   0x02

Definition at line 53 of file adt7470.c.

#define ADT7470_R3T_ALARM   0x04

Definition at line 54 of file adt7470.c.

#define ADT7470_R4T_ALARM   0x08

Definition at line 55 of file adt7470.c.

#define ADT7470_R5T_ALARM   0x10

Definition at line 56 of file adt7470.c.

#define ADT7470_R6T_ALARM   0x20

Definition at line 57 of file adt7470.c.

#define ADT7470_R7T_ALARM   0x40

Definition at line 58 of file adt7470.c.

#define ADT7470_R8T_ALARM   0x01

Definition at line 61 of file adt7470.c.

#define ADT7470_R9T_ALARM   0x02

Definition at line 62 of file adt7470.c.

#define ADT7470_REG_ACOUSTICS12   0x75

Definition at line 86 of file adt7470.c.

#define ADT7470_REG_ACOUSTICS34   0x76

Definition at line 87 of file adt7470.c.

#define ADT7470_REG_ALARM1   0x41

Definition at line 51 of file adt7470.c.

#define ADT7470_REG_ALARM1_MASK   0x72

Definition at line 91 of file adt7470.c.

#define ADT7470_REG_ALARM2   0x42

Definition at line 60 of file adt7470.c.

#define ADT7470_REG_ALARM2_MASK   0x73

Definition at line 92 of file adt7470.c.

#define ADT7470_REG_BASE_ADDR   0x20

Definition at line 40 of file adt7470.c.

#define ADT7470_REG_CFG   0x40

Definition at line 49 of file adt7470.c.

#define ADT7470_REG_DEVICE   0x3D

Definition at line 88 of file adt7470.c.

#define ADT7470_REG_FAN (   x)    (ADT7470_REG_FAN_BASE_ADDR + ((x) * 2))

Definition at line 104 of file adt7470.c.

#define ADT7470_REG_FAN_BASE_ADDR   0x2A

Definition at line 43 of file adt7470.c.

#define ADT7470_REG_FAN_MAX (   x)    (ADT7470_REG_FAN_MAX_BASE_ADDR + ((x) * 2))

Definition at line 106 of file adt7470.c.

#define ADT7470_REG_FAN_MAX_ADDR   0x31

Definition at line 44 of file adt7470.c.

#define ADT7470_REG_FAN_MAX_BASE_ADDR   0x60

Definition at line 72 of file adt7470.c.

#define ADT7470_REG_FAN_MAX_MAX_ADDR   0x67

Definition at line 73 of file adt7470.c.

#define ADT7470_REG_FAN_MIN (   x)    (ADT7470_REG_FAN_MIN_BASE_ADDR + ((x) * 2))

Definition at line 105 of file adt7470.c.

#define ADT7470_REG_FAN_MIN_BASE_ADDR   0x58

Definition at line 70 of file adt7470.c.

#define ADT7470_REG_FAN_MIN_MAX_ADDR   0x5F

Definition at line 71 of file adt7470.c.

#define ADT7470_REG_MAX_ADDR   0x81

Definition at line 95 of file adt7470.c.

#define ADT7470_REG_PWM (   x)    (ADT7470_REG_PWM_BASE_ADDR + (x))

Definition at line 109 of file adt7470.c.

#define ADT7470_REG_PWM12_CFG   0x68

Definition at line 75 of file adt7470.c.

#define ADT7470_REG_PWM34_CFG   0x69

Definition at line 79 of file adt7470.c.

#define ADT7470_REG_PWM_AUTO_TEMP (   x)
Value:

Definition at line 114 of file adt7470.c.

#define ADT7470_REG_PWM_AUTO_TEMP_BASE_ADDR   0x7C

Definition at line 93 of file adt7470.c.

#define ADT7470_REG_PWM_AUTO_TEMP_MAX_ADDR   0x7D

Definition at line 94 of file adt7470.c.

#define ADT7470_REG_PWM_BASE_ADDR   0x32

Definition at line 45 of file adt7470.c.

#define ADT7470_REG_PWM_CFG (   x)    (ADT7470_REG_PWM_CFG_BASE_ADDR + ((x) / 2))

Definition at line 113 of file adt7470.c.

#define ADT7470_REG_PWM_CFG_BASE_ADDR   0x68

Definition at line 74 of file adt7470.c.

#define ADT7470_REG_PWM_MAX (   x)    (ADT7470_REG_PWM_MAX_BASE_ADDR + (x))

Definition at line 110 of file adt7470.c.

#define ADT7470_REG_PWM_MAX_ADDR   0x35

Definition at line 46 of file adt7470.c.

#define ADT7470_REG_PWM_MAX_BASE_ADDR   0x38

Definition at line 47 of file adt7470.c.

#define ADT7470_REG_PWM_MAX_MAX_ADDR   0x3B

Definition at line 48 of file adt7470.c.

#define ADT7470_REG_PWM_MIN (   x)    (ADT7470_REG_PWM_MIN_BASE_ADDR + (x))

Definition at line 111 of file adt7470.c.

#define ADT7470_REG_PWM_MIN_BASE_ADDR   0x6A

Definition at line 82 of file adt7470.c.

#define ADT7470_REG_PWM_MIN_MAX_ADDR   0x6D

Definition at line 83 of file adt7470.c.

#define ADT7470_REG_PWM_TEMP_MIN_BASE_ADDR   0x6E

Definition at line 84 of file adt7470.c.

#define ADT7470_REG_PWM_TEMP_MIN_MAX_ADDR   0x71

Definition at line 85 of file adt7470.c.

#define ADT7470_REG_PWM_TMIN (   x)    (ADT7470_REG_PWM_TEMP_MIN_BASE_ADDR + (x))

Definition at line 112 of file adt7470.c.

#define ADT7470_REG_REVISION   0x3F

Definition at line 90 of file adt7470.c.

#define ADT7470_REG_TEMP_BASE_ADDR   0x20

Definition at line 41 of file adt7470.c.

#define ADT7470_REG_TEMP_LIMITS_BASE_ADDR   0x44

Definition at line 68 of file adt7470.c.

#define ADT7470_REG_TEMP_LIMITS_MAX_ADDR   0x57

Definition at line 69 of file adt7470.c.

#define ADT7470_REG_TEMP_MAX_ADDR   0x29

Definition at line 42 of file adt7470.c.

#define ADT7470_REG_VENDOR   0x3E

Definition at line 89 of file adt7470.c.

#define ADT7470_REVISION   0x02

Definition at line 122 of file adt7470.c.

#define ADT7470_TEMP_COUNT   10

Definition at line 97 of file adt7470.c.

#define ADT7470_TEMP_MAX_REG (   x)
Value:

Definition at line 100 of file adt7470.c.

#define ADT7470_TEMP_MIN_REG (   x)    (ADT7470_REG_TEMP_LIMITS_BASE_ADDR + ((x) * 2))

Definition at line 99 of file adt7470.c.

#define ADT7470_TEMP_REG (   x)    (ADT7470_REG_TEMP_BASE_ADDR + (x))

Definition at line 98 of file adt7470.c.

#define ADT7470_VENDOR   0x41

Definition at line 119 of file adt7470.c.

#define ALARM2 (   x)    ((x) << 8)

Definition at line 117 of file adt7470.c.

#define AUTO_UPDATE_INTERVAL   2000

Definition at line 137 of file adt7470.c.

#define FAN_DATA_VALID (   x)    ((x) && (x) != FAN_PERIOD_INVALID)

Definition at line 143 of file adt7470.c.

#define FAN_PERIOD_INVALID   65535

Definition at line 142 of file adt7470.c.

#define FAN_PERIOD_TO_RPM (   x)    ((90000 * 60) / (x))

Definition at line 140 of file adt7470.c.

#define FAN_RPM_TO_PERIOD   FAN_PERIOD_TO_RPM

Definition at line 141 of file adt7470.c.

#define LIMIT_REFRESH_INTERVAL   (60 * HZ)

Definition at line 131 of file adt7470.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 22 of file adt7470.c.

#define SENSOR_REFRESH_INTERVAL   (5 * HZ)

Definition at line 128 of file adt7470.c.

#define TEMP_COLLECTION_TIME   2000

Definition at line 134 of file adt7470.c.

Function Documentation

MODULE_AUTHOR ( "Darrick J. Wong <[email protected]>"  )
MODULE_DESCRIPTION ( "ADT7470 driver )
MODULE_DEVICE_TABLE ( i2c  ,
adt7470_id   
)
module_i2c_driver ( adt7470_driver  )
MODULE_LICENSE ( "GPL"  )