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

Go to the source code of this file.

Data Structures

struct  ad7746_chip_info
 

Macros

#define AD7746_REG_STATUS   0
 
#define AD7746_REG_CAP_DATA_HIGH   1
 
#define AD7746_REG_CAP_DATA_MID   2
 
#define AD7746_REG_CAP_DATA_LOW   3
 
#define AD7746_REG_VT_DATA_HIGH   4
 
#define AD7746_REG_VT_DATA_MID   5
 
#define AD7746_REG_VT_DATA_LOW   6
 
#define AD7746_REG_CAP_SETUP   7
 
#define AD7746_REG_VT_SETUP   8
 
#define AD7746_REG_EXC_SETUP   9
 
#define AD7746_REG_CFG   10
 
#define AD7746_REG_CAPDACA   11
 
#define AD7746_REG_CAPDACB   12
 
#define AD7746_REG_CAP_OFFH   13
 
#define AD7746_REG_CAP_OFFL   14
 
#define AD7746_REG_CAP_GAINH   15
 
#define AD7746_REG_CAP_GAINL   16
 
#define AD7746_REG_VOLT_GAINH   17
 
#define AD7746_REG_VOLT_GAINL   18
 
#define AD7746_STATUS_EXCERR   (1 << 3)
 
#define AD7746_STATUS_RDY   (1 << 2)
 
#define AD7746_STATUS_RDYVT   (1 << 1)
 
#define AD7746_STATUS_RDYCAP   (1 << 0)
 
#define AD7746_CAPSETUP_CAPEN   (1 << 7)
 
#define AD7746_CAPSETUP_CIN2   (1 << 6) /* AD7746 only */
 
#define AD7746_CAPSETUP_CAPDIFF   (1 << 5)
 
#define AD7746_CAPSETUP_CACHOP   (1 << 0)
 
#define AD7746_VTSETUP_VTEN   (1 << 7)
 
#define AD7746_VTSETUP_VTMD_INT_TEMP   (0 << 5)
 
#define AD7746_VTSETUP_VTMD_EXT_TEMP   (1 << 5)
 
#define AD7746_VTSETUP_VTMD_VDD_MON   (2 << 5)
 
#define AD7746_VTSETUP_VTMD_EXT_VIN   (3 << 5)
 
#define AD7746_VTSETUP_EXTREF   (1 << 4)
 
#define AD7746_VTSETUP_VTSHORT   (1 << 1)
 
#define AD7746_VTSETUP_VTCHOP   (1 << 0)
 
#define AD7746_EXCSETUP_CLKCTRL   (1 << 7)
 
#define AD7746_EXCSETUP_EXCON   (1 << 6)
 
#define AD7746_EXCSETUP_EXCB   (1 << 5)
 
#define AD7746_EXCSETUP_NEXCB   (1 << 4)
 
#define AD7746_EXCSETUP_EXCA   (1 << 3)
 
#define AD7746_EXCSETUP_NEXCA   (1 << 2)
 
#define AD7746_EXCSETUP_EXCLVL(x)   (((x) & 0x3) << 0)
 
#define AD7746_CONF_VTFS(x)   ((x) << 6)
 
#define AD7746_CONF_CAPFS(x)   ((x) << 3)
 
#define AD7746_CONF_MODE_IDLE   (0 << 0)
 
#define AD7746_CONF_MODE_CONT_CONV   (1 << 0)
 
#define AD7746_CONF_MODE_SINGLE_CONV   (2 << 0)
 
#define AD7746_CONF_MODE_PWRDN   (3 << 0)
 
#define AD7746_CONF_MODE_OFFS_CAL   (5 << 0)
 
#define AD7746_CONF_MODE_GAIN_CAL   (6 << 0)
 
#define AD7746_CAPDAC_DACEN   (1 << 7)
 
#define AD7746_CAPDAC_DACP(x)   ((x) & 0x7F)
 

Enumerations

enum  ad7746_chan {
  VIN, VIN_VDD, TEMP_INT, TEMP_EXT,
  CIN1, CIN1_DIFF, CIN2, CIN2_DIFF
}
 

Functions

 MODULE_DEVICE_TABLE (i2c, ad7746_id)
 
 module_i2c_driver (ad7746_driver)
 
 MODULE_AUTHOR ("Michael Hennerich <[email protected]>")
 
 MODULE_DESCRIPTION ("Analog Devices AD7746/5/7 capacitive sensor driver")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define AD7746_CAPDAC_DACEN   (1 << 7)

Definition at line 90 of file ad7746.c.

#define AD7746_CAPDAC_DACP (   x)    ((x) & 0x7F)

Definition at line 91 of file ad7746.c.

#define AD7746_CAPSETUP_CACHOP   (1 << 0)

Definition at line 58 of file ad7746.c.

#define AD7746_CAPSETUP_CAPDIFF   (1 << 5)

Definition at line 57 of file ad7746.c.

#define AD7746_CAPSETUP_CAPEN   (1 << 7)

Definition at line 55 of file ad7746.c.

#define AD7746_CAPSETUP_CIN2   (1 << 6) /* AD7746 only */

Definition at line 56 of file ad7746.c.

#define AD7746_CONF_CAPFS (   x)    ((x) << 3)

Definition at line 81 of file ad7746.c.

#define AD7746_CONF_MODE_CONT_CONV   (1 << 0)

Definition at line 83 of file ad7746.c.

#define AD7746_CONF_MODE_GAIN_CAL   (6 << 0)

Definition at line 87 of file ad7746.c.

#define AD7746_CONF_MODE_IDLE   (0 << 0)

Definition at line 82 of file ad7746.c.

#define AD7746_CONF_MODE_OFFS_CAL   (5 << 0)

Definition at line 86 of file ad7746.c.

#define AD7746_CONF_MODE_PWRDN   (3 << 0)

Definition at line 85 of file ad7746.c.

#define AD7746_CONF_MODE_SINGLE_CONV   (2 << 0)

Definition at line 84 of file ad7746.c.

#define AD7746_CONF_VTFS (   x)    ((x) << 6)

Definition at line 80 of file ad7746.c.

#define AD7746_EXCSETUP_CLKCTRL   (1 << 7)

Definition at line 71 of file ad7746.c.

#define AD7746_EXCSETUP_EXCA   (1 << 3)

Definition at line 75 of file ad7746.c.

#define AD7746_EXCSETUP_EXCB   (1 << 5)

Definition at line 73 of file ad7746.c.

#define AD7746_EXCSETUP_EXCLVL (   x)    (((x) & 0x3) << 0)

Definition at line 77 of file ad7746.c.

#define AD7746_EXCSETUP_EXCON   (1 << 6)

Definition at line 72 of file ad7746.c.

#define AD7746_EXCSETUP_NEXCA   (1 << 2)

Definition at line 76 of file ad7746.c.

#define AD7746_EXCSETUP_NEXCB   (1 << 4)

Definition at line 74 of file ad7746.c.

#define AD7746_REG_CAP_DATA_HIGH   1

Definition at line 29 of file ad7746.c.

#define AD7746_REG_CAP_DATA_LOW   3

Definition at line 31 of file ad7746.c.

#define AD7746_REG_CAP_DATA_MID   2

Definition at line 30 of file ad7746.c.

#define AD7746_REG_CAP_GAINH   15

Definition at line 43 of file ad7746.c.

#define AD7746_REG_CAP_GAINL   16

Definition at line 44 of file ad7746.c.

#define AD7746_REG_CAP_OFFH   13

Definition at line 41 of file ad7746.c.

#define AD7746_REG_CAP_OFFL   14

Definition at line 42 of file ad7746.c.

#define AD7746_REG_CAP_SETUP   7

Definition at line 35 of file ad7746.c.

#define AD7746_REG_CAPDACA   11

Definition at line 39 of file ad7746.c.

#define AD7746_REG_CAPDACB   12

Definition at line 40 of file ad7746.c.

#define AD7746_REG_CFG   10

Definition at line 38 of file ad7746.c.

#define AD7746_REG_EXC_SETUP   9

Definition at line 37 of file ad7746.c.

#define AD7746_REG_STATUS   0

Definition at line 28 of file ad7746.c.

#define AD7746_REG_VOLT_GAINH   17

Definition at line 45 of file ad7746.c.

#define AD7746_REG_VOLT_GAINL   18

Definition at line 46 of file ad7746.c.

#define AD7746_REG_VT_DATA_HIGH   4

Definition at line 32 of file ad7746.c.

#define AD7746_REG_VT_DATA_LOW   6

Definition at line 34 of file ad7746.c.

#define AD7746_REG_VT_DATA_MID   5

Definition at line 33 of file ad7746.c.

#define AD7746_REG_VT_SETUP   8

Definition at line 36 of file ad7746.c.

#define AD7746_STATUS_EXCERR   (1 << 3)

Definition at line 49 of file ad7746.c.

#define AD7746_STATUS_RDY   (1 << 2)

Definition at line 50 of file ad7746.c.

#define AD7746_STATUS_RDYCAP   (1 << 0)

Definition at line 52 of file ad7746.c.

#define AD7746_STATUS_RDYVT   (1 << 1)

Definition at line 51 of file ad7746.c.

#define AD7746_VTSETUP_EXTREF   (1 << 4)

Definition at line 66 of file ad7746.c.

#define AD7746_VTSETUP_VTCHOP   (1 << 0)

Definition at line 68 of file ad7746.c.

#define AD7746_VTSETUP_VTEN   (1 << 7)

Definition at line 61 of file ad7746.c.

#define AD7746_VTSETUP_VTMD_EXT_TEMP   (1 << 5)

Definition at line 63 of file ad7746.c.

#define AD7746_VTSETUP_VTMD_EXT_VIN   (3 << 5)

Definition at line 65 of file ad7746.c.

#define AD7746_VTSETUP_VTMD_INT_TEMP   (0 << 5)

Definition at line 62 of file ad7746.c.

#define AD7746_VTSETUP_VTMD_VDD_MON   (2 << 5)

Definition at line 64 of file ad7746.c.

#define AD7746_VTSETUP_VTSHORT   (1 << 1)

Definition at line 67 of file ad7746.c.

Enumeration Type Documentation

Enumerator:
VIN 
VIN_VDD 
TEMP_INT 
TEMP_EXT 
CIN1 
CIN1_DIFF 
CIN2 
CIN2_DIFF 

Definition at line 110 of file ad7746.c.

Function Documentation

MODULE_AUTHOR ( "Michael Hennerich <[email protected]>"  )
MODULE_DESCRIPTION ( "Analog Devices AD7746/5/7 capacitive sensor driver )
MODULE_DEVICE_TABLE ( i2c  ,
ad7746_id   
)
module_i2c_driver ( ad7746_driver  )
MODULE_LICENSE ( "GPL v2 )