Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
ad5791.c File Reference
#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/regulator/consumer.h>
#include <linux/module.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/dac/ad5791.h>

Go to the source code of this file.

Data Structures

struct  ad5791_chip_info
 
struct  ad5791_state
 

Macros

#define AD5791_RES_MASK(x)   ((1 << (x)) - 1)
 
#define AD5791_DAC_MASK   AD5791_RES_MASK(20)
 
#define AD5791_DAC_MSB   (1 << 19)
 
#define AD5791_CMD_READ   (1 << 23)
 
#define AD5791_CMD_WRITE   (0 << 23)
 
#define AD5791_ADDR(addr)   ((addr) << 20)
 
#define AD5791_ADDR_NOOP   0
 
#define AD5791_ADDR_DAC0   1
 
#define AD5791_ADDR_CTRL   2
 
#define AD5791_ADDR_CLRCODE   3
 
#define AD5791_ADDR_SW_CTRL   4
 
#define AD5791_CTRL_RBUF   (1 << 1)
 
#define AD5791_CTRL_OPGND   (1 << 2)
 
#define AD5791_CTRL_DACTRI   (1 << 3)
 
#define AD5791_CTRL_BIN2SC   (1 << 4)
 
#define AD5791_CTRL_SDODIS   (1 << 5)
 
#define AD5761_CTRL_LINCOMP(x)   ((x) << 6)
 
#define AD5791_LINCOMP_0_10   0
 
#define AD5791_LINCOMP_10_12   1
 
#define AD5791_LINCOMP_12_16   2
 
#define AD5791_LINCOMP_16_19   3
 
#define AD5791_LINCOMP_19_20   12
 
#define AD5780_LINCOMP_0_10   0
 
#define AD5780_LINCOMP_10_20   12
 
#define AD5791_SWCTRL_LDAC   (1 << 0)
 
#define AD5791_SWCTRL_CLR   (1 << 1)
 
#define AD5791_SWCTRL_RESET   (1 << 2)
 
#define AD5791_DAC_PWRDN_6K   0
 
#define AD5791_DAC_PWRDN_3STATE   1
 
#define AD5791_CHAN(bits, shift)
 

Enumerations

enum  ad5791_supported_device_ids { ID_AD5760, ID_AD5780, ID_AD5781, ID_AD5791 }
 

Functions

 MODULE_DEVICE_TABLE (spi, ad5791_id)
 
 module_spi_driver (ad5791_driver)
 
 MODULE_AUTHOR ("Michael Hennerich <[email protected]>")
 
 MODULE_DESCRIPTION ("Analog Devices AD5760/AD5780/AD5781/AD5790/AD5791 DAC")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define AD5761_CTRL_LINCOMP (   x)    ((x) << 6)

Definition at line 45 of file ad5791.c.

#define AD5780_LINCOMP_0_10   0

Definition at line 53 of file ad5791.c.

#define AD5780_LINCOMP_10_20   12

Definition at line 54 of file ad5791.c.

#define AD5791_ADDR (   addr)    ((addr) << 20)

Definition at line 30 of file ad5791.c.

#define AD5791_ADDR_CLRCODE   3

Definition at line 36 of file ad5791.c.

#define AD5791_ADDR_CTRL   2

Definition at line 35 of file ad5791.c.

#define AD5791_ADDR_DAC0   1

Definition at line 34 of file ad5791.c.

#define AD5791_ADDR_NOOP   0

Definition at line 33 of file ad5791.c.

#define AD5791_ADDR_SW_CTRL   4

Definition at line 37 of file ad5791.c.

#define AD5791_CHAN (   bits,
  shift 
)
Value:
{ \
.type = IIO_VOLTAGE, \
.output = 1, \
.indexed = 1, \
.address = AD5791_ADDR_DAC0, \
.channel = 0, \
IIO_CHAN_INFO_SCALE_SHARED_BIT | \
IIO_CHAN_INFO_OFFSET_SHARED_BIT, \
.scan_type = IIO_ST('u', bits, 24, shift), \
.ext_info = ad5791_ext_info, \
}

Definition at line 303 of file ad5791.c.

#define AD5791_CMD_READ   (1 << 23)

Definition at line 28 of file ad5791.c.

#define AD5791_CMD_WRITE   (0 << 23)

Definition at line 29 of file ad5791.c.

#define AD5791_CTRL_BIN2SC   (1 << 4)

Definition at line 43 of file ad5791.c.

#define AD5791_CTRL_DACTRI   (1 << 3)

Definition at line 42 of file ad5791.c.

#define AD5791_CTRL_OPGND   (1 << 2)

Definition at line 41 of file ad5791.c.

#define AD5791_CTRL_RBUF   (1 << 1)

Definition at line 40 of file ad5791.c.

#define AD5791_CTRL_SDODIS   (1 << 5)

Definition at line 44 of file ad5791.c.

#define AD5791_DAC_MASK   AD5791_RES_MASK(20)

Definition at line 25 of file ad5791.c.

#define AD5791_DAC_MSB   (1 << 19)

Definition at line 26 of file ad5791.c.

#define AD5791_DAC_PWRDN_3STATE   1

Definition at line 62 of file ad5791.c.

#define AD5791_DAC_PWRDN_6K   0

Definition at line 61 of file ad5791.c.

#define AD5791_LINCOMP_0_10   0

Definition at line 47 of file ad5791.c.

#define AD5791_LINCOMP_10_12   1

Definition at line 48 of file ad5791.c.

#define AD5791_LINCOMP_12_16   2

Definition at line 49 of file ad5791.c.

#define AD5791_LINCOMP_16_19   3

Definition at line 50 of file ad5791.c.

#define AD5791_LINCOMP_19_20   12

Definition at line 51 of file ad5791.c.

#define AD5791_RES_MASK (   x)    ((1 << (x)) - 1)

Definition at line 24 of file ad5791.c.

#define AD5791_SWCTRL_CLR   (1 << 1)

Definition at line 58 of file ad5791.c.

#define AD5791_SWCTRL_LDAC   (1 << 0)

Definition at line 57 of file ad5791.c.

#define AD5791_SWCTRL_RESET   (1 << 2)

Definition at line 59 of file ad5791.c.

Enumeration Type Documentation

ad5791_supported_device_ids:

Enumerator:
ID_AD5760 
ID_AD5780 
ID_AD5781 
ID_AD5791 

Definition at line 100 of file ad5791.c.

Function Documentation

MODULE_AUTHOR ( "Michael Hennerich <[email protected]>"  )
MODULE_DESCRIPTION ( "Analog Devices AD5760/AD5780/AD5781/AD5790/AD5791 DAC )
MODULE_DEVICE_TABLE ( spi  ,
ad5791_id   
)
MODULE_LICENSE ( "GPL v2 )
module_spi_driver ( ad5791_driver  )