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

Go to the source code of this file.

Data Structures

struct  ad5064_chip_info
 
struct  ad5064_state
 

Macros

#define AD5064_MAX_DAC_CHANNELS   8
 
#define AD5064_MAX_VREFS   4
 
#define AD5064_ADDR(x)   ((x) << 20)
 
#define AD5064_CMD(x)   ((x) << 24)
 
#define AD5064_ADDR_DAC(chan)   (chan)
 
#define AD5064_ADDR_ALL_DAC   0xF
 
#define AD5064_CMD_WRITE_INPUT_N   0x0
 
#define AD5064_CMD_UPDATE_DAC_N   0x1
 
#define AD5064_CMD_WRITE_INPUT_N_UPDATE_ALL   0x2
 
#define AD5064_CMD_WRITE_INPUT_N_UPDATE_N   0x3
 
#define AD5064_CMD_POWERDOWN_DAC   0x4
 
#define AD5064_CMD_CLEAR   0x5
 
#define AD5064_CMD_LDAC_MASK   0x6
 
#define AD5064_CMD_RESET   0x7
 
#define AD5064_CMD_CONFIG   0x8
 
#define AD5064_CONFIG_DAISY_CHAIN_ENABLE   BIT(1)
 
#define AD5064_CONFIG_INT_VREF_ENABLE   BIT(0)
 
#define AD5064_LDAC_PWRDN_NONE   0x0
 
#define AD5064_LDAC_PWRDN_1K   0x1
 
#define AD5064_LDAC_PWRDN_100K   0x2
 
#define AD5064_LDAC_PWRDN_3STATE   0x3
 
#define AD5064_CHANNEL(chan, bits)
 
#define DECLARE_AD5064_CHANNELS(name, bits)
 

Typedefs

typedef int(* ad5064_write_func )(struct ad5064_state *st, unsigned int cmd, unsigned int addr, unsigned int val)
 

Enumerations

enum  ad5064_type {
  ID_AD5024, ID_AD5025, ID_AD5044, ID_AD5045,
  ID_AD5064, ID_AD5064_1, ID_AD5065, ID_AD5628_1,
  ID_AD5628_2, ID_AD5648_1, ID_AD5648_2, ID_AD5666_1,
  ID_AD5666_2, ID_AD5668_1, ID_AD5668_2
}
 

Functions

 module_init (ad5064_init)
 
 module_exit (ad5064_exit)
 
 MODULE_AUTHOR ("Lars-Peter Clausen <[email protected]>")
 
 MODULE_DESCRIPTION ("Analog Devices AD5024 and similar multi-channel DACs")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define AD5064_ADDR (   x)    ((x) << 20)

Definition at line 27 of file ad5064.c.

#define AD5064_ADDR_ALL_DAC   0xF

Definition at line 31 of file ad5064.c.

#define AD5064_ADDR_DAC (   chan)    (chan)

Definition at line 30 of file ad5064.c.

#define AD5064_CHANNEL (   chan,
  bits 
)
Value:
{ \
.type = IIO_VOLTAGE, \
.indexed = 1, \
.output = 1, \
.channel = (chan), \
.scan_type = IIO_ST('u', (bits), 16, 20 - (bits)), \
.ext_info = ad5064_ext_info, \
}

Definition at line 295 of file ad5064.c.

#define AD5064_CMD (   x)    ((x) << 24)

Definition at line 28 of file ad5064.c.

#define AD5064_CMD_CLEAR   0x5

Definition at line 38 of file ad5064.c.

#define AD5064_CMD_CONFIG   0x8

Definition at line 41 of file ad5064.c.

#define AD5064_CMD_LDAC_MASK   0x6

Definition at line 39 of file ad5064.c.

#define AD5064_CMD_POWERDOWN_DAC   0x4

Definition at line 37 of file ad5064.c.

#define AD5064_CMD_RESET   0x7

Definition at line 40 of file ad5064.c.

#define AD5064_CMD_UPDATE_DAC_N   0x1

Definition at line 34 of file ad5064.c.

#define AD5064_CMD_WRITE_INPUT_N   0x0

Definition at line 33 of file ad5064.c.

#define AD5064_CMD_WRITE_INPUT_N_UPDATE_ALL   0x2

Definition at line 35 of file ad5064.c.

#define AD5064_CMD_WRITE_INPUT_N_UPDATE_N   0x3

Definition at line 36 of file ad5064.c.

#define AD5064_CONFIG_DAISY_CHAIN_ENABLE   BIT(1)

Definition at line 43 of file ad5064.c.

#define AD5064_CONFIG_INT_VREF_ENABLE   BIT(0)

Definition at line 44 of file ad5064.c.

#define AD5064_LDAC_PWRDN_100K   0x2

Definition at line 48 of file ad5064.c.

#define AD5064_LDAC_PWRDN_1K   0x1

Definition at line 47 of file ad5064.c.

#define AD5064_LDAC_PWRDN_3STATE   0x3

Definition at line 49 of file ad5064.c.

#define AD5064_LDAC_PWRDN_NONE   0x0

Definition at line 46 of file ad5064.c.

#define AD5064_MAX_DAC_CHANNELS   8

Definition at line 24 of file ad5064.c.

#define AD5064_MAX_VREFS   4

Definition at line 25 of file ad5064.c.

#define DECLARE_AD5064_CHANNELS (   name,
  bits 
)
Value:
const struct iio_chan_spec name[] = { \
AD5064_CHANNEL(0, bits), \
AD5064_CHANNEL(1, bits), \
AD5064_CHANNEL(2, bits), \
AD5064_CHANNEL(3, bits), \
AD5064_CHANNEL(4, bits), \
AD5064_CHANNEL(5, bits), \
AD5064_CHANNEL(6, bits), \
AD5064_CHANNEL(7, bits), \
}

Definition at line 307 of file ad5064.c.

Typedef Documentation

typedef int(* ad5064_write_func)(struct ad5064_state *st, unsigned int cmd, unsigned int addr, unsigned int val)

Definition at line 69 of file ad5064.c.

Enumeration Type Documentation

Enumerator:
ID_AD5024 
ID_AD5025 
ID_AD5044 
ID_AD5045 
ID_AD5064 
ID_AD5064_1 
ID_AD5065 
ID_AD5628_1 
ID_AD5628_2 
ID_AD5648_1 
ID_AD5648_2 
ID_AD5666_1 
ID_AD5666_2 
ID_AD5668_1 
ID_AD5668_2 

Definition at line 107 of file ad5064.c.

Function Documentation

MODULE_AUTHOR ( "Lars-Peter Clausen <[email protected]>"  )
MODULE_DESCRIPTION ( "Analog Devices AD5024 and similar multi-channel DACs"  )
module_exit ( ad5064_exit  )
module_init ( ad5064_init  )
MODULE_LICENSE ( "GPL v2 )