Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
adt7316.c File Reference
#include <linux/interrupt.h>
#include <linux/gpio.h>
#include <linux/workqueue.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/list.h>
#include <linux/i2c.h>
#include <linux/rtc.h>
#include <linux/module.h>
#include <linux/iio/iio.h>
#include <linux/iio/events.h>
#include <linux/iio/sysfs.h>
#include "adt7316.h"

Go to the source code of this file.

Data Structures

struct  adt7316_chip_info
 
struct  adt7316_limit_regs
 

Macros

#define ADT7316_INT_STAT1   0x0
 
#define ADT7316_INT_STAT2   0x1
 
#define ADT7316_LSB_IN_TEMP_VDD   0x3
 
#define ADT7316_LSB_IN_TEMP_MASK   0x3
 
#define ADT7316_LSB_VDD_MASK   0xC
 
#define ADT7316_LSB_VDD_OFFSET   2
 
#define ADT7316_LSB_EX_TEMP_AIN   0x4
 
#define ADT7316_LSB_EX_TEMP_MASK   0x3
 
#define ADT7516_LSB_AIN_SHIFT   2
 
#define ADT7316_AD_MSB_DATA_BASE   0x6
 
#define ADT7316_AD_MSB_DATA_REGS   3
 
#define ADT7516_AD_MSB_DATA_REGS   6
 
#define ADT7316_MSB_VDD   0x6
 
#define ADT7316_MSB_IN_TEMP   0x7
 
#define ADT7316_MSB_EX_TEMP   0x8
 
#define ADT7516_MSB_AIN1   0x8
 
#define ADT7516_MSB_AIN2   0x9
 
#define ADT7516_MSB_AIN3   0xA
 
#define ADT7516_MSB_AIN4   0xB
 
#define ADT7316_DA_DATA_BASE   0x10
 
#define ADT7316_DA_MSB_DATA_REGS   4
 
#define ADT7316_LSB_DAC_A   0x10
 
#define ADT7316_MSB_DAC_A   0x11
 
#define ADT7316_LSB_DAC_B   0x12
 
#define ADT7316_MSB_DAC_B   0x13
 
#define ADT7316_LSB_DAC_C   0x14
 
#define ADT7316_MSB_DAC_C   0x15
 
#define ADT7316_LSB_DAC_D   0x16
 
#define ADT7316_MSB_DAC_D   0x17
 
#define ADT7316_CONFIG1   0x18
 
#define ADT7316_CONFIG2   0x19
 
#define ADT7316_CONFIG3   0x1A
 
#define ADT7316_LDAC_CONFIG   0x1B
 
#define ADT7316_DAC_CONFIG   0x1C
 
#define ADT7316_INT_MASK1   0x1D
 
#define ADT7316_INT_MASK2   0x1E
 
#define ADT7316_IN_TEMP_OFFSET   0x1F
 
#define ADT7316_EX_TEMP_OFFSET   0x20
 
#define ADT7316_IN_ANALOG_TEMP_OFFSET   0x21
 
#define ADT7316_EX_ANALOG_TEMP_OFFSET   0x22
 
#define ADT7316_VDD_HIGH   0x23
 
#define ADT7316_VDD_LOW   0x24
 
#define ADT7316_IN_TEMP_HIGH   0x25
 
#define ADT7316_IN_TEMP_LOW   0x26
 
#define ADT7316_EX_TEMP_HIGH   0x27
 
#define ADT7316_EX_TEMP_LOW   0x28
 
#define ADT7516_AIN2_HIGH   0x2B
 
#define ADT7516_AIN2_LOW   0x2C
 
#define ADT7516_AIN3_HIGH   0x2D
 
#define ADT7516_AIN3_LOW   0x2E
 
#define ADT7516_AIN4_HIGH   0x2F
 
#define ADT7516_AIN4_LOW   0x30
 
#define ADT7316_DEVICE_ID   0x4D
 
#define ADT7316_MANUFACTURE_ID   0x4E
 
#define ADT7316_DEVICE_REV   0x4F
 
#define ADT7316_SPI_LOCK_STAT   0x7F
 
#define ADT7316_EN   0x1
 
#define ADT7516_SEL_EX_TEMP   0x4
 
#define ADT7516_SEL_AIN1_2_EX_TEMP_MASK   0x6
 
#define ADT7516_SEL_AIN3   0x8
 
#define ADT7316_INT_EN   0x20
 
#define ADT7316_INT_POLARITY   0x40
 
#define ADT7316_PD   0x80
 
#define ADT7316_AD_SINGLE_CH_MASK   0x3
 
#define ADT7516_AD_SINGLE_CH_MASK   0x7
 
#define ADT7316_AD_SINGLE_CH_VDD   0
 
#define ADT7316_AD_SINGLE_CH_IN   1
 
#define ADT7316_AD_SINGLE_CH_EX   2
 
#define ADT7516_AD_SINGLE_CH_AIN1   2
 
#define ADT7516_AD_SINGLE_CH_AIN2   3
 
#define ADT7516_AD_SINGLE_CH_AIN3   4
 
#define ADT7516_AD_SINGLE_CH_AIN4   5
 
#define ADT7316_AD_SINGLE_CH_MODE   0x10
 
#define ADT7316_DISABLE_AVERAGING   0x20
 
#define ADT7316_EN_SMBUS_TIMEOUT   0x40
 
#define ADT7316_RESET   0x80
 
#define ADT7316_ADCLK_22_5   0x1
 
#define ADT7316_DA_HIGH_RESOLUTION   0x2
 
#define ADT7316_DA_EN_VIA_DAC_LDCA   0x4
 
#define ADT7516_AIN_IN_VREF   0x10
 
#define ADT7316_EN_IN_TEMP_PROP_DACA   0x20
 
#define ADT7316_EN_EX_TEMP_PROP_DACB   0x40
 
#define ADT7316_DA_2VREF_CH_MASK   0xF
 
#define ADT7316_DA_EN_MODE_MASK   0x30
 
#define ADT7316_DA_EN_MODE_SINGLE   0x00
 
#define ADT7316_DA_EN_MODE_AB_CD   0x10
 
#define ADT7316_DA_EN_MODE_ABCD   0x20
 
#define ADT7316_DA_EN_MODE_LDAC   0x30
 
#define ADT7316_VREF_BYPASS_DAC_AB   0x40
 
#define ADT7316_VREF_BYPASS_DAC_CD   0x80
 
#define ADT7316_LDAC_EN_DA_MASK   0xF
 
#define ADT7316_DAC_IN_VREF   0x10
 
#define ADT7516_DAC_AB_IN_VREF   0x10
 
#define ADT7516_DAC_CD_IN_VREF   0x20
 
#define ADT7516_DAC_IN_VREF_OFFSET   4
 
#define ADT7516_DAC_IN_VREF_MASK   0x30
 
#define ADT7316_INT_MASK2_VDD   0x10
 
#define ADT7316_VALUE_MASK   0xfff
 
#define ADT7316_T_VALUE_SIGN   0x400
 
#define ADT7316_T_VALUE_FLOAT_OFFSET   2
 
#define ADT7316_T_VALUE_FLOAT_MASK   0x2
 
#define ID_ADT7316   0x1
 
#define ID_ADT7317   0x2
 
#define ID_ADT7318   0x3
 
#define ID_ADT7516   0x11
 
#define ID_ADT7517   0x12
 
#define ID_ADT7519   0x14
 
#define ID_FAMILY_MASK   0xF0
 
#define ID_ADT73XX   0x0
 
#define ID_ADT75XX   0x10
 
#define ADT7316_IN_TEMP_HIGH_INT_MASK   0x1
 
#define ADT7316_IN_TEMP_LOW_INT_MASK   0x2
 
#define ADT7316_EX_TEMP_HIGH_INT_MASK   0x4
 
#define ADT7316_EX_TEMP_LOW_INT_MASK   0x8
 
#define ADT7316_EX_TEMP_FAULT_INT_MASK   0x10
 
#define ADT7516_AIN1_INT_MASK   0x4
 
#define ADT7516_AIN2_INT_MASK   0x20
 
#define ADT7516_AIN3_INT_MASK   0x40
 
#define ADT7516_AIN4_INT_MASK   0x80
 
#define ADT7316_VDD_INT_MASK   0x100
 
#define ADT7316_TEMP_INT_MASK   0x1F
 
#define ADT7516_AIN_INT_MASK   0xE0
 
#define ADT7316_TEMP_AIN_INT_MASK   (ADT7316_TEMP_INT_MASK)
 

Functions

int __devinit adt7316_probe (struct device *dev, struct adt7316_bus *bus, const char *name)
 
 EXPORT_SYMBOL (adt7316_probe)
 
int __devexit adt7316_remove (struct device *dev)
 
 EXPORT_SYMBOL (adt7316_remove)
 
 MODULE_AUTHOR ("Sonic Zhang <[email protected]>")
 
 MODULE_DESCRIPTION ("Analog Devices ADT7316/7/8 and ADT7516/7/9 digital"" temperature sensor, ADC and DAC driver")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define ADT7316_AD_MSB_DATA_BASE   0x6

Definition at line 39 of file adt7316.c.

#define ADT7316_AD_MSB_DATA_REGS   3

Definition at line 40 of file adt7316.c.

#define ADT7316_AD_SINGLE_CH_EX   2

Definition at line 105 of file adt7316.c.

#define ADT7316_AD_SINGLE_CH_IN   1

Definition at line 104 of file adt7316.c.

#define ADT7316_AD_SINGLE_CH_MASK   0x3

Definition at line 101 of file adt7316.c.

#define ADT7316_AD_SINGLE_CH_MODE   0x10

Definition at line 110 of file adt7316.c.

#define ADT7316_AD_SINGLE_CH_VDD   0

Definition at line 103 of file adt7316.c.

#define ADT7316_ADCLK_22_5   0x1

Definition at line 118 of file adt7316.c.

#define ADT7316_CONFIG1   0x18

Definition at line 59 of file adt7316.c.

#define ADT7316_CONFIG2   0x19

Definition at line 60 of file adt7316.c.

#define ADT7316_CONFIG3   0x1A

Definition at line 61 of file adt7316.c.

#define ADT7316_DA_2VREF_CH_MASK   0xF

Definition at line 128 of file adt7316.c.

#define ADT7316_DA_DATA_BASE   0x10

Definition at line 49 of file adt7316.c.

#define ADT7316_DA_EN_MODE_AB_CD   0x10

Definition at line 131 of file adt7316.c.

#define ADT7316_DA_EN_MODE_ABCD   0x20

Definition at line 132 of file adt7316.c.

#define ADT7316_DA_EN_MODE_LDAC   0x30

Definition at line 133 of file adt7316.c.

#define ADT7316_DA_EN_MODE_MASK   0x30

Definition at line 129 of file adt7316.c.

#define ADT7316_DA_EN_MODE_SINGLE   0x00

Definition at line 130 of file adt7316.c.

#define ADT7316_DA_EN_VIA_DAC_LDCA   0x4

Definition at line 120 of file adt7316.c.

#define ADT7316_DA_HIGH_RESOLUTION   0x2

Definition at line 119 of file adt7316.c.

#define ADT7316_DA_MSB_DATA_REGS   4

Definition at line 50 of file adt7316.c.

#define ADT7316_DAC_CONFIG   0x1C

Definition at line 63 of file adt7316.c.

#define ADT7316_DAC_IN_VREF   0x10

Definition at line 141 of file adt7316.c.

#define ADT7316_DEVICE_ID   0x4D

Definition at line 82 of file adt7316.c.

#define ADT7316_DEVICE_REV   0x4F

Definition at line 84 of file adt7316.c.

#define ADT7316_DISABLE_AVERAGING   0x20

Definition at line 111 of file adt7316.c.

#define ADT7316_EN   0x1

Definition at line 90 of file adt7316.c.

#define ADT7316_EN_EX_TEMP_PROP_DACB   0x40

Definition at line 123 of file adt7316.c.

#define ADT7316_EN_IN_TEMP_PROP_DACA   0x20

Definition at line 122 of file adt7316.c.

#define ADT7316_EN_SMBUS_TIMEOUT   0x40

Definition at line 112 of file adt7316.c.

#define ADT7316_EX_ANALOG_TEMP_OFFSET   0x22

Definition at line 69 of file adt7316.c.

#define ADT7316_EX_TEMP_FAULT_INT_MASK   0x10

Definition at line 199 of file adt7316.c.

#define ADT7316_EX_TEMP_HIGH   0x27

Definition at line 74 of file adt7316.c.

#define ADT7316_EX_TEMP_HIGH_INT_MASK   0x4

Definition at line 197 of file adt7316.c.

#define ADT7316_EX_TEMP_LOW   0x28

Definition at line 75 of file adt7316.c.

#define ADT7316_EX_TEMP_LOW_INT_MASK   0x8

Definition at line 198 of file adt7316.c.

#define ADT7316_EX_TEMP_OFFSET   0x20

Definition at line 67 of file adt7316.c.

#define ADT7316_IN_ANALOG_TEMP_OFFSET   0x21

Definition at line 68 of file adt7316.c.

#define ADT7316_IN_TEMP_HIGH   0x25

Definition at line 72 of file adt7316.c.

#define ADT7316_IN_TEMP_HIGH_INT_MASK   0x1

Definition at line 195 of file adt7316.c.

#define ADT7316_IN_TEMP_LOW   0x26

Definition at line 73 of file adt7316.c.

#define ADT7316_IN_TEMP_LOW_INT_MASK   0x2

Definition at line 196 of file adt7316.c.

#define ADT7316_IN_TEMP_OFFSET   0x1F

Definition at line 66 of file adt7316.c.

#define ADT7316_INT_EN   0x20

Definition at line 94 of file adt7316.c.

#define ADT7316_INT_MASK1   0x1D

Definition at line 64 of file adt7316.c.

#define ADT7316_INT_MASK2   0x1E

Definition at line 65 of file adt7316.c.

#define ADT7316_INT_MASK2_VDD   0x10

Definition at line 150 of file adt7316.c.

#define ADT7316_INT_POLARITY   0x40

Definition at line 95 of file adt7316.c.

#define ADT7316_INT_STAT1   0x0

Definition at line 30 of file adt7316.c.

#define ADT7316_INT_STAT2   0x1

Definition at line 31 of file adt7316.c.

#define ADT7316_LDAC_CONFIG   0x1B

Definition at line 62 of file adt7316.c.

#define ADT7316_LDAC_EN_DA_MASK   0xF

Definition at line 140 of file adt7316.c.

#define ADT7316_LSB_DAC_A   0x10

Definition at line 51 of file adt7316.c.

#define ADT7316_LSB_DAC_B   0x12

Definition at line 53 of file adt7316.c.

#define ADT7316_LSB_DAC_C   0x14

Definition at line 55 of file adt7316.c.

#define ADT7316_LSB_DAC_D   0x16

Definition at line 57 of file adt7316.c.

#define ADT7316_LSB_EX_TEMP_AIN   0x4

Definition at line 36 of file adt7316.c.

#define ADT7316_LSB_EX_TEMP_MASK   0x3

Definition at line 37 of file adt7316.c.

#define ADT7316_LSB_IN_TEMP_MASK   0x3

Definition at line 33 of file adt7316.c.

#define ADT7316_LSB_IN_TEMP_VDD   0x3

Definition at line 32 of file adt7316.c.

#define ADT7316_LSB_VDD_MASK   0xC

Definition at line 34 of file adt7316.c.

#define ADT7316_LSB_VDD_OFFSET   2

Definition at line 35 of file adt7316.c.

#define ADT7316_MANUFACTURE_ID   0x4E

Definition at line 83 of file adt7316.c.

#define ADT7316_MSB_DAC_A   0x11

Definition at line 52 of file adt7316.c.

#define ADT7316_MSB_DAC_B   0x13

Definition at line 54 of file adt7316.c.

#define ADT7316_MSB_DAC_C   0x15

Definition at line 56 of file adt7316.c.

#define ADT7316_MSB_DAC_D   0x17

Definition at line 58 of file adt7316.c.

#define ADT7316_MSB_EX_TEMP   0x8

Definition at line 44 of file adt7316.c.

#define ADT7316_MSB_IN_TEMP   0x7

Definition at line 43 of file adt7316.c.

#define ADT7316_MSB_VDD   0x6

Definition at line 42 of file adt7316.c.

#define ADT7316_PD   0x80

Definition at line 96 of file adt7316.c.

#define ADT7316_RESET   0x80

Definition at line 113 of file adt7316.c.

#define ADT7316_SPI_LOCK_STAT   0x7F

Definition at line 85 of file adt7316.c.

#define ADT7316_T_VALUE_FLOAT_MASK   0x2

Definition at line 158 of file adt7316.c.

#define ADT7316_T_VALUE_FLOAT_OFFSET   2

Definition at line 157 of file adt7316.c.

#define ADT7316_T_VALUE_SIGN   0x400

Definition at line 156 of file adt7316.c.

#define ADT7316_TEMP_AIN_INT_MASK   (ADT7316_TEMP_INT_MASK)

Definition at line 207 of file adt7316.c.

#define ADT7316_TEMP_INT_MASK   0x1F

Definition at line 205 of file adt7316.c.

#define ADT7316_VALUE_MASK   0xfff

Definition at line 155 of file adt7316.c.

#define ADT7316_VDD_HIGH   0x23

Definition at line 70 of file adt7316.c.

#define ADT7316_VDD_INT_MASK   0x100

Definition at line 204 of file adt7316.c.

#define ADT7316_VDD_LOW   0x24

Definition at line 71 of file adt7316.c.

#define ADT7316_VREF_BYPASS_DAC_AB   0x40

Definition at line 134 of file adt7316.c.

#define ADT7316_VREF_BYPASS_DAC_CD   0x80

Definition at line 135 of file adt7316.c.

#define ADT7516_AD_MSB_DATA_REGS   6

Definition at line 41 of file adt7316.c.

#define ADT7516_AD_SINGLE_CH_AIN1   2

Definition at line 106 of file adt7316.c.

#define ADT7516_AD_SINGLE_CH_AIN2   3

Definition at line 107 of file adt7316.c.

#define ADT7516_AD_SINGLE_CH_AIN3   4

Definition at line 108 of file adt7316.c.

#define ADT7516_AD_SINGLE_CH_AIN4   5

Definition at line 109 of file adt7316.c.

#define ADT7516_AD_SINGLE_CH_MASK   0x7

Definition at line 102 of file adt7316.c.

#define ADT7516_AIN1_INT_MASK   0x4

Definition at line 200 of file adt7316.c.

#define ADT7516_AIN2_HIGH   0x2B

Definition at line 76 of file adt7316.c.

#define ADT7516_AIN2_INT_MASK   0x20

Definition at line 201 of file adt7316.c.

#define ADT7516_AIN2_LOW   0x2C

Definition at line 77 of file adt7316.c.

#define ADT7516_AIN3_HIGH   0x2D

Definition at line 78 of file adt7316.c.

#define ADT7516_AIN3_INT_MASK   0x40

Definition at line 202 of file adt7316.c.

#define ADT7516_AIN3_LOW   0x2E

Definition at line 79 of file adt7316.c.

#define ADT7516_AIN4_HIGH   0x2F

Definition at line 80 of file adt7316.c.

#define ADT7516_AIN4_INT_MASK   0x80

Definition at line 203 of file adt7316.c.

#define ADT7516_AIN4_LOW   0x30

Definition at line 81 of file adt7316.c.

#define ADT7516_AIN_IN_VREF   0x10

Definition at line 121 of file adt7316.c.

#define ADT7516_AIN_INT_MASK   0xE0

Definition at line 206 of file adt7316.c.

#define ADT7516_DAC_AB_IN_VREF   0x10

Definition at line 142 of file adt7316.c.

#define ADT7516_DAC_CD_IN_VREF   0x20

Definition at line 143 of file adt7316.c.

#define ADT7516_DAC_IN_VREF_MASK   0x30

Definition at line 145 of file adt7316.c.

#define ADT7516_DAC_IN_VREF_OFFSET   4

Definition at line 144 of file adt7316.c.

#define ADT7516_LSB_AIN_SHIFT   2

Definition at line 38 of file adt7316.c.

#define ADT7516_MSB_AIN1   0x8

Definition at line 45 of file adt7316.c.

#define ADT7516_MSB_AIN2   0x9

Definition at line 46 of file adt7316.c.

#define ADT7516_MSB_AIN3   0xA

Definition at line 47 of file adt7316.c.

#define ADT7516_MSB_AIN4   0xB

Definition at line 48 of file adt7316.c.

#define ADT7516_SEL_AIN1_2_EX_TEMP_MASK   0x6

Definition at line 92 of file adt7316.c.

#define ADT7516_SEL_AIN3   0x8

Definition at line 93 of file adt7316.c.

#define ADT7516_SEL_EX_TEMP   0x4

Definition at line 91 of file adt7316.c.

#define ID_ADT7316   0x1

Definition at line 163 of file adt7316.c.

#define ID_ADT7317   0x2

Definition at line 164 of file adt7316.c.

#define ID_ADT7318   0x3

Definition at line 165 of file adt7316.c.

#define ID_ADT73XX   0x0

Definition at line 171 of file adt7316.c.

#define ID_ADT7516   0x11

Definition at line 166 of file adt7316.c.

#define ID_ADT7517   0x12

Definition at line 167 of file adt7316.c.

#define ID_ADT7519   0x14

Definition at line 168 of file adt7316.c.

#define ID_ADT75XX   0x10

Definition at line 172 of file adt7316.c.

#define ID_FAMILY_MASK   0xF0

Definition at line 170 of file adt7316.c.

Function Documentation

int __devinit adt7316_probe ( struct device dev,
struct adt7316_bus bus,
const char name 
)

Definition at line 2128 of file adt7316.c.

int __devexit adt7316_remove ( struct device dev)

Definition at line 2219 of file adt7316.c.

EXPORT_SYMBOL ( adt7316_probe  )
EXPORT_SYMBOL ( adt7316_remove  )
MODULE_AUTHOR ( "Sonic Zhang <[email protected]>"  )
MODULE_DESCRIPTION ( "Analog Devices ADT7316/7/8 and ADT7516/7/9 digital"" temperature  sensor,
ADC and DAC driver  
)
MODULE_LICENSE ( "GPL v2 )