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

Go to the source code of this file.

Data Structures

struct  adt7462_data
 

Macros

#define ADT7462_REG_DEVICE   0x3D
 
#define ADT7462_REG_VENDOR   0x3E
 
#define ADT7462_REG_REVISION   0x3F
 
#define ADT7462_REG_MIN_TEMP_BASE_ADDR   0x44
 
#define ADT7462_REG_MIN_TEMP_MAX_ADDR   0x47
 
#define ADT7462_REG_MAX_TEMP_BASE_ADDR   0x48
 
#define ADT7462_REG_MAX_TEMP_MAX_ADDR   0x4B
 
#define ADT7462_REG_TEMP_BASE_ADDR   0x88
 
#define ADT7462_REG_TEMP_MAX_ADDR   0x8F
 
#define ADT7462_REG_FAN_BASE_ADDR   0x98
 
#define ADT7462_REG_FAN_MAX_ADDR   0x9F
 
#define ADT7462_REG_FAN2_BASE_ADDR   0xA2
 
#define ADT7462_REG_FAN2_MAX_ADDR   0xA9
 
#define ADT7462_REG_FAN_ENABLE   0x07
 
#define ADT7462_REG_FAN_MIN_BASE_ADDR   0x78
 
#define ADT7462_REG_FAN_MIN_MAX_ADDR   0x7F
 
#define ADT7462_REG_CFG2   0x02
 
#define ADT7462_FSPD_MASK   0x20
 
#define ADT7462_REG_PWM_BASE_ADDR   0xAA
 
#define ADT7462_REG_PWM_MAX_ADDR   0xAD
 
#define ADT7462_REG_PWM_MIN_BASE_ADDR   0x28
 
#define ADT7462_REG_PWM_MIN_MAX_ADDR   0x2B
 
#define ADT7462_REG_PWM_MAX   0x2C
 
#define ADT7462_REG_PWM_TEMP_MIN_BASE_ADDR   0x5C
 
#define ADT7462_REG_PWM_TEMP_MIN_MAX_ADDR   0x5F
 
#define ADT7462_REG_PWM_TEMP_RANGE_BASE_ADDR   0x60
 
#define ADT7462_REG_PWM_TEMP_RANGE_MAX_ADDR   0x63
 
#define ADT7462_PWM_HYST_MASK   0x0F
 
#define ADT7462_PWM_RANGE_MASK   0xF0
 
#define ADT7462_PWM_RANGE_SHIFT   4
 
#define ADT7462_REG_PWM_CFG_BASE_ADDR   0x21
 
#define ADT7462_REG_PWM_CFG_MAX_ADDR   0x24
 
#define ADT7462_PWM_CHANNEL_MASK   0xE0
 
#define ADT7462_PWM_CHANNEL_SHIFT   5
 
#define ADT7462_REG_PIN_CFG_BASE_ADDR   0x10
 
#define ADT7462_REG_PIN_CFG_MAX_ADDR   0x13
 
#define ADT7462_PIN7_INPUT   0x01 /* cfg0 */
 
#define ADT7462_DIODE3_INPUT   0x20
 
#define ADT7462_DIODE1_INPUT   0x40
 
#define ADT7462_VID_INPUT   0x80
 
#define ADT7462_PIN22_INPUT   0x04 /* cfg1 */
 
#define ADT7462_PIN21_INPUT   0x08
 
#define ADT7462_PIN19_INPUT   0x10
 
#define ADT7462_PIN15_INPUT   0x20
 
#define ADT7462_PIN13_INPUT   0x40
 
#define ADT7462_PIN8_INPUT   0x80
 
#define ADT7462_PIN23_MASK   0x03
 
#define ADT7462_PIN23_SHIFT   0
 
#define ADT7462_PIN26_MASK   0x0C /* cfg2 */
 
#define ADT7462_PIN26_SHIFT   2
 
#define ADT7462_PIN25_MASK   0x30
 
#define ADT7462_PIN25_SHIFT   4
 
#define ADT7462_PIN24_MASK   0xC0
 
#define ADT7462_PIN24_SHIFT   6
 
#define ADT7462_PIN26_VOLT_INPUT   0x08
 
#define ADT7462_PIN25_VOLT_INPUT   0x20
 
#define ADT7462_PIN28_SHIFT   4 /* cfg3 */
 
#define ADT7462_PIN28_VOLT   0x5
 
#define ADT7462_REG_ALARM1   0xB8
 
#define ADT7462_LT_ALARM   0x02
 
#define ADT7462_R1T_ALARM   0x04
 
#define ADT7462_R2T_ALARM   0x08
 
#define ADT7462_R3T_ALARM   0x10
 
#define ADT7462_REG_ALARM2   0xBB
 
#define ADT7462_V0_ALARM   0x01
 
#define ADT7462_V1_ALARM   0x02
 
#define ADT7462_V2_ALARM   0x04
 
#define ADT7462_V3_ALARM   0x08
 
#define ADT7462_V4_ALARM   0x10
 
#define ADT7462_V5_ALARM   0x20
 
#define ADT7462_V6_ALARM   0x40
 
#define ADT7462_V7_ALARM   0x80
 
#define ADT7462_REG_ALARM3   0xBC
 
#define ADT7462_V8_ALARM   0x08
 
#define ADT7462_V9_ALARM   0x10
 
#define ADT7462_V10_ALARM   0x20
 
#define ADT7462_V11_ALARM   0x40
 
#define ADT7462_V12_ALARM   0x80
 
#define ADT7462_REG_ALARM4   0xBD
 
#define ADT7462_F0_ALARM   0x01
 
#define ADT7462_F1_ALARM   0x02
 
#define ADT7462_F2_ALARM   0x04
 
#define ADT7462_F3_ALARM   0x08
 
#define ADT7462_F4_ALARM   0x10
 
#define ADT7462_F5_ALARM   0x20
 
#define ADT7462_F6_ALARM   0x40
 
#define ADT7462_F7_ALARM   0x80
 
#define ADT7462_ALARM1   0x0000
 
#define ADT7462_ALARM2   0x0100
 
#define ADT7462_ALARM3   0x0200
 
#define ADT7462_ALARM4   0x0300
 
#define ADT7462_ALARM_REG_SHIFT   8
 
#define ADT7462_ALARM_FLAG_MASK   0x0F
 
#define ADT7462_TEMP_COUNT   4
 
#define ADT7462_TEMP_REG(x)   (ADT7462_REG_TEMP_BASE_ADDR + ((x) * 2))
 
#define ADT7462_TEMP_MIN_REG(x)   (ADT7462_REG_MIN_TEMP_BASE_ADDR + (x))
 
#define ADT7462_TEMP_MAX_REG(x)   (ADT7462_REG_MAX_TEMP_BASE_ADDR + (x))
 
#define TEMP_FRAC_OFFSET   6
 
#define ADT7462_FAN_COUNT   8
 
#define ADT7462_REG_FAN_MIN(x)   (ADT7462_REG_FAN_MIN_BASE_ADDR + (x))
 
#define ADT7462_PWM_COUNT   4
 
#define ADT7462_REG_PWM(x)   (ADT7462_REG_PWM_BASE_ADDR + (x))
 
#define ADT7462_REG_PWM_MIN(x)   (ADT7462_REG_PWM_MIN_BASE_ADDR + (x))
 
#define ADT7462_REG_PWM_TMIN(x)   (ADT7462_REG_PWM_TEMP_MIN_BASE_ADDR + (x))
 
#define ADT7462_REG_PWM_TRANGE(x)   (ADT7462_REG_PWM_TEMP_RANGE_BASE_ADDR + (x))
 
#define ADT7462_PIN_CFG_REG_COUNT   4
 
#define ADT7462_REG_PIN_CFG(x)   (ADT7462_REG_PIN_CFG_BASE_ADDR + (x))
 
#define ADT7462_REG_PWM_CFG(x)   (ADT7462_REG_PWM_CFG_BASE_ADDR + (x))
 
#define ADT7462_ALARM_REG_COUNT   4
 
#define ADT7462_VOLT_COUNT   13
 
#define ADT7462_VENDOR   0x41
 
#define ADT7462_DEVICE   0x62
 
#define ADT7462_REVISION   0x04
 
#define SENSOR_REFRESH_INTERVAL   (2 * HZ)
 
#define LIMIT_REFRESH_INTERVAL   (60 * HZ)
 
#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)
 
#define MASK_AND_SHIFT(value, prefix)   (((value) & prefix##_MASK) >> prefix##_SHIFT)
 
#define NUM_TRANGE_VALUES   16
 

Functions

 MODULE_DEVICE_TABLE (i2c, adt7462_id)
 
 module_i2c_driver (adt7462_driver)
 
 MODULE_AUTHOR ("Darrick J. Wong <[email protected]>")
 
 MODULE_DESCRIPTION ("ADT7462 driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define ADT7462_ALARM1   0x0000

Definition at line 129 of file adt7462.c.

#define ADT7462_ALARM2   0x0100

Definition at line 130 of file adt7462.c.

#define ADT7462_ALARM3   0x0200

Definition at line 131 of file adt7462.c.

#define ADT7462_ALARM4   0x0300

Definition at line 132 of file adt7462.c.

#define ADT7462_ALARM_FLAG_MASK   0x0F

Definition at line 134 of file adt7462.c.

#define ADT7462_ALARM_REG_COUNT   4

Definition at line 157 of file adt7462.c.

#define ADT7462_ALARM_REG_SHIFT   8

Definition at line 133 of file adt7462.c.

#define ADT7462_DEVICE   0x62

Definition at line 185 of file adt7462.c.

#define ADT7462_DIODE1_INPUT   0x40

Definition at line 79 of file adt7462.c.

#define ADT7462_DIODE3_INPUT   0x20

Definition at line 78 of file adt7462.c.

#define ADT7462_F0_ALARM   0x01

Definition at line 121 of file adt7462.c.

#define ADT7462_F1_ALARM   0x02

Definition at line 122 of file adt7462.c.

#define ADT7462_F2_ALARM   0x04

Definition at line 123 of file adt7462.c.

#define ADT7462_F3_ALARM   0x08

Definition at line 124 of file adt7462.c.

#define ADT7462_F4_ALARM   0x10

Definition at line 125 of file adt7462.c.

#define ADT7462_F5_ALARM   0x20

Definition at line 126 of file adt7462.c.

#define ADT7462_F6_ALARM   0x40

Definition at line 127 of file adt7462.c.

#define ADT7462_F7_ALARM   0x80

Definition at line 128 of file adt7462.c.

#define ADT7462_FAN_COUNT   8

Definition at line 142 of file adt7462.c.

#define ADT7462_FSPD_MASK   0x20

Definition at line 56 of file adt7462.c.

#define ADT7462_LT_ALARM   0x02

Definition at line 101 of file adt7462.c.

#define ADT7462_PIN13_INPUT   0x40

Definition at line 85 of file adt7462.c.

#define ADT7462_PIN15_INPUT   0x20

Definition at line 84 of file adt7462.c.

#define ADT7462_PIN19_INPUT   0x10

Definition at line 83 of file adt7462.c.

#define ADT7462_PIN21_INPUT   0x08

Definition at line 82 of file adt7462.c.

#define ADT7462_PIN22_INPUT   0x04 /* cfg1 */

Definition at line 81 of file adt7462.c.

#define ADT7462_PIN23_MASK   0x03

Definition at line 87 of file adt7462.c.

#define ADT7462_PIN23_SHIFT   0

Definition at line 88 of file adt7462.c.

#define ADT7462_PIN24_MASK   0xC0

Definition at line 93 of file adt7462.c.

#define ADT7462_PIN24_SHIFT   6

Definition at line 94 of file adt7462.c.

#define ADT7462_PIN25_MASK   0x30

Definition at line 91 of file adt7462.c.

#define ADT7462_PIN25_SHIFT   4

Definition at line 92 of file adt7462.c.

#define ADT7462_PIN25_VOLT_INPUT   0x20

Definition at line 96 of file adt7462.c.

#define ADT7462_PIN26_MASK   0x0C /* cfg2 */

Definition at line 89 of file adt7462.c.

#define ADT7462_PIN26_SHIFT   2

Definition at line 90 of file adt7462.c.

#define ADT7462_PIN26_VOLT_INPUT   0x08

Definition at line 95 of file adt7462.c.

#define ADT7462_PIN28_SHIFT   4 /* cfg3 */

Definition at line 97 of file adt7462.c.

#define ADT7462_PIN28_VOLT   0x5

Definition at line 98 of file adt7462.c.

#define ADT7462_PIN7_INPUT   0x01 /* cfg0 */

Definition at line 77 of file adt7462.c.

#define ADT7462_PIN8_INPUT   0x80

Definition at line 86 of file adt7462.c.

#define ADT7462_PIN_CFG_REG_COUNT   4

Definition at line 153 of file adt7462.c.

#define ADT7462_PWM_CHANNEL_MASK   0xE0

Definition at line 72 of file adt7462.c.

#define ADT7462_PWM_CHANNEL_SHIFT   5

Definition at line 73 of file adt7462.c.

#define ADT7462_PWM_COUNT   4

Definition at line 145 of file adt7462.c.

#define ADT7462_PWM_HYST_MASK   0x0F

Definition at line 67 of file adt7462.c.

#define ADT7462_PWM_RANGE_MASK   0xF0

Definition at line 68 of file adt7462.c.

#define ADT7462_PWM_RANGE_SHIFT   4

Definition at line 69 of file adt7462.c.

#define ADT7462_R1T_ALARM   0x04

Definition at line 102 of file adt7462.c.

#define ADT7462_R2T_ALARM   0x08

Definition at line 103 of file adt7462.c.

#define ADT7462_R3T_ALARM   0x10

Definition at line 104 of file adt7462.c.

#define ADT7462_REG_ALARM1   0xB8

Definition at line 100 of file adt7462.c.

#define ADT7462_REG_ALARM2   0xBB

Definition at line 105 of file adt7462.c.

#define ADT7462_REG_ALARM3   0xBC

Definition at line 114 of file adt7462.c.

#define ADT7462_REG_ALARM4   0xBD

Definition at line 120 of file adt7462.c.

#define ADT7462_REG_CFG2   0x02

Definition at line 55 of file adt7462.c.

#define ADT7462_REG_DEVICE   0x3D

Definition at line 36 of file adt7462.c.

#define ADT7462_REG_FAN2_BASE_ADDR   0xA2

Definition at line 49 of file adt7462.c.

#define ADT7462_REG_FAN2_MAX_ADDR   0xA9

Definition at line 50 of file adt7462.c.

#define ADT7462_REG_FAN_BASE_ADDR   0x98

Definition at line 47 of file adt7462.c.

#define ADT7462_REG_FAN_ENABLE   0x07

Definition at line 51 of file adt7462.c.

#define ADT7462_REG_FAN_MAX_ADDR   0x9F

Definition at line 48 of file adt7462.c.

#define ADT7462_REG_FAN_MIN (   x)    (ADT7462_REG_FAN_MIN_BASE_ADDR + (x))

Definition at line 143 of file adt7462.c.

#define ADT7462_REG_FAN_MIN_BASE_ADDR   0x78

Definition at line 52 of file adt7462.c.

#define ADT7462_REG_FAN_MIN_MAX_ADDR   0x7F

Definition at line 53 of file adt7462.c.

#define ADT7462_REG_MAX_TEMP_BASE_ADDR   0x48

Definition at line 42 of file adt7462.c.

#define ADT7462_REG_MAX_TEMP_MAX_ADDR   0x4B

Definition at line 43 of file adt7462.c.

#define ADT7462_REG_MIN_TEMP_BASE_ADDR   0x44

Definition at line 40 of file adt7462.c.

#define ADT7462_REG_MIN_TEMP_MAX_ADDR   0x47

Definition at line 41 of file adt7462.c.

#define ADT7462_REG_PIN_CFG (   x)    (ADT7462_REG_PIN_CFG_BASE_ADDR + (x))

Definition at line 154 of file adt7462.c.

#define ADT7462_REG_PIN_CFG_BASE_ADDR   0x10

Definition at line 75 of file adt7462.c.

#define ADT7462_REG_PIN_CFG_MAX_ADDR   0x13

Definition at line 76 of file adt7462.c.

#define ADT7462_REG_PWM (   x)    (ADT7462_REG_PWM_BASE_ADDR + (x))

Definition at line 146 of file adt7462.c.

#define ADT7462_REG_PWM_BASE_ADDR   0xAA

Definition at line 58 of file adt7462.c.

#define ADT7462_REG_PWM_CFG (   x)    (ADT7462_REG_PWM_CFG_BASE_ADDR + (x))

Definition at line 155 of file adt7462.c.

#define ADT7462_REG_PWM_CFG_BASE_ADDR   0x21

Definition at line 70 of file adt7462.c.

#define ADT7462_REG_PWM_CFG_MAX_ADDR   0x24

Definition at line 71 of file adt7462.c.

#define ADT7462_REG_PWM_MAX   0x2C

Definition at line 62 of file adt7462.c.

#define ADT7462_REG_PWM_MAX_ADDR   0xAD

Definition at line 59 of file adt7462.c.

#define ADT7462_REG_PWM_MIN (   x)    (ADT7462_REG_PWM_MIN_BASE_ADDR + (x))

Definition at line 147 of file adt7462.c.

#define ADT7462_REG_PWM_MIN_BASE_ADDR   0x28

Definition at line 60 of file adt7462.c.

#define ADT7462_REG_PWM_MIN_MAX_ADDR   0x2B

Definition at line 61 of file adt7462.c.

#define ADT7462_REG_PWM_TEMP_MIN_BASE_ADDR   0x5C

Definition at line 63 of file adt7462.c.

#define ADT7462_REG_PWM_TEMP_MIN_MAX_ADDR   0x5F

Definition at line 64 of file adt7462.c.

#define ADT7462_REG_PWM_TEMP_RANGE_BASE_ADDR   0x60

Definition at line 65 of file adt7462.c.

#define ADT7462_REG_PWM_TEMP_RANGE_MAX_ADDR   0x63

Definition at line 66 of file adt7462.c.

#define ADT7462_REG_PWM_TMIN (   x)    (ADT7462_REG_PWM_TEMP_MIN_BASE_ADDR + (x))

Definition at line 148 of file adt7462.c.

#define ADT7462_REG_PWM_TRANGE (   x)    (ADT7462_REG_PWM_TEMP_RANGE_BASE_ADDR + (x))

Definition at line 150 of file adt7462.c.

#define ADT7462_REG_REVISION   0x3F

Definition at line 38 of file adt7462.c.

#define ADT7462_REG_TEMP_BASE_ADDR   0x88

Definition at line 44 of file adt7462.c.

#define ADT7462_REG_TEMP_MAX_ADDR   0x8F

Definition at line 45 of file adt7462.c.

#define ADT7462_REG_VENDOR   0x3E

Definition at line 37 of file adt7462.c.

#define ADT7462_REVISION   0x04

Definition at line 187 of file adt7462.c.

#define ADT7462_TEMP_COUNT   4

Definition at line 136 of file adt7462.c.

#define ADT7462_TEMP_MAX_REG (   x)    (ADT7462_REG_MAX_TEMP_BASE_ADDR + (x))

Definition at line 139 of file adt7462.c.

#define ADT7462_TEMP_MIN_REG (   x)    (ADT7462_REG_MIN_TEMP_BASE_ADDR + (x))

Definition at line 138 of file adt7462.c.

#define ADT7462_TEMP_REG (   x)    (ADT7462_REG_TEMP_BASE_ADDR + ((x) * 2))

Definition at line 137 of file adt7462.c.

#define ADT7462_V0_ALARM   0x01

Definition at line 106 of file adt7462.c.

#define ADT7462_V10_ALARM   0x20

Definition at line 117 of file adt7462.c.

#define ADT7462_V11_ALARM   0x40

Definition at line 118 of file adt7462.c.

#define ADT7462_V12_ALARM   0x80

Definition at line 119 of file adt7462.c.

#define ADT7462_V1_ALARM   0x02

Definition at line 107 of file adt7462.c.

#define ADT7462_V2_ALARM   0x04

Definition at line 108 of file adt7462.c.

#define ADT7462_V3_ALARM   0x08

Definition at line 109 of file adt7462.c.

#define ADT7462_V4_ALARM   0x10

Definition at line 110 of file adt7462.c.

#define ADT7462_V5_ALARM   0x20

Definition at line 111 of file adt7462.c.

#define ADT7462_V6_ALARM   0x40

Definition at line 112 of file adt7462.c.

#define ADT7462_V7_ALARM   0x80

Definition at line 113 of file adt7462.c.

#define ADT7462_V8_ALARM   0x08

Definition at line 115 of file adt7462.c.

#define ADT7462_V9_ALARM   0x10

Definition at line 116 of file adt7462.c.

#define ADT7462_VENDOR   0x41

Definition at line 184 of file adt7462.c.

#define ADT7462_VID_INPUT   0x80

Definition at line 80 of file adt7462.c.

#define ADT7462_VOLT_COUNT   13

Definition at line 182 of file adt7462.c.

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

Definition at line 199 of file adt7462.c.

#define FAN_PERIOD_INVALID   65535

Definition at line 198 of file adt7462.c.

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

Definition at line 196 of file adt7462.c.

#define FAN_RPM_TO_PERIOD   FAN_PERIOD_TO_RPM

Definition at line 197 of file adt7462.c.

#define LIMIT_REFRESH_INTERVAL   (60 * HZ)

Definition at line 193 of file adt7462.c.

#define MASK_AND_SHIFT (   value,
  prefix 
)    (((value) & prefix##_MASK) >> prefix##_SHIFT)

Definition at line 201 of file adt7462.c.

#define NUM_TRANGE_VALUES   16

Definition at line 675 of file adt7462.c.

#define SENSOR_REFRESH_INTERVAL   (2 * HZ)

Definition at line 190 of file adt7462.c.

#define TEMP_FRAC_OFFSET   6

Definition at line 140 of file adt7462.c.

Function Documentation

MODULE_AUTHOR ( "Darrick J. Wong <[email protected]>"  )
MODULE_DESCRIPTION ( "ADT7462 driver )
MODULE_DEVICE_TABLE ( i2c  ,
adt7462_id   
)
module_i2c_driver ( adt7462_driver  )
MODULE_LICENSE ( "GPL"  )