Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
ad_sigma_delta.c File Reference
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/adc/ad_sigma_delta.h>
#include <asm/unaligned.h>

Go to the source code of this file.

Macros

#define AD_SD_COMM_CHAN_MASK   0x3
 
#define AD_SD_REG_COMM   0x00
 
#define AD_SD_REG_DATA   0x03
 

Functions

void ad_sd_set_comm (struct ad_sigma_delta *sigma_delta, uint8_t comm)
 
 EXPORT_SYMBOL_GPL (ad_sd_set_comm)
 
int ad_sd_write_reg (struct ad_sigma_delta *sigma_delta, unsigned int reg, unsigned int size, unsigned int val)
 
 EXPORT_SYMBOL_GPL (ad_sd_write_reg)
 
int ad_sd_read_reg (struct ad_sigma_delta *sigma_delta, unsigned int reg, unsigned int size, unsigned int *val)
 
 EXPORT_SYMBOL_GPL (ad_sd_read_reg)
 
int ad_sd_calibrate_all (struct ad_sigma_delta *sigma_delta, const struct ad_sd_calib_data *cb, unsigned int n)
 
 EXPORT_SYMBOL_GPL (ad_sd_calibrate_all)
 
int ad_sigma_delta_single_conversion (struct iio_dev *indio_dev, const struct iio_chan_spec *chan, int *val)
 
 EXPORT_SYMBOL_GPL (ad_sigma_delta_single_conversion)
 
int ad_sd_validate_trigger (struct iio_dev *indio_dev, struct iio_trigger *trig)
 
 EXPORT_SYMBOL_GPL (ad_sd_validate_trigger)
 
int ad_sd_setup_buffer_and_trigger (struct iio_dev *indio_dev)
 
 EXPORT_SYMBOL_GPL (ad_sd_setup_buffer_and_trigger)
 
void ad_sd_cleanup_buffer_and_trigger (struct iio_dev *indio_dev)
 
 EXPORT_SYMBOL_GPL (ad_sd_cleanup_buffer_and_trigger)
 
int ad_sd_init (struct ad_sigma_delta *sigma_delta, struct iio_dev *indio_dev, struct spi_device *spi, const struct ad_sigma_delta_info *info)
 
 EXPORT_SYMBOL_GPL (ad_sd_init)
 
 MODULE_AUTHOR ("Lars-Peter Clausen <[email protected]>")
 
 MODULE_DESCRIPTION ("Analog Devices Sigma-Delta ADCs")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define AD_SD_COMM_CHAN_MASK   0x3

Definition at line 29 of file ad_sigma_delta.c.

#define AD_SD_REG_COMM   0x00

Definition at line 31 of file ad_sigma_delta.c.

#define AD_SD_REG_DATA   0x03

Definition at line 32 of file ad_sigma_delta.c.

Function Documentation

int ad_sd_calibrate_all ( struct ad_sigma_delta sigma_delta,
const struct ad_sd_calib_data cb,
unsigned int  n 
)

ad_sd_calibrate_all() - Performs channel calibration : The sigma delta device : Array of channels and calibration type to perform
: Number of items in cb

Returns 0 on success, an error code otherwise.

Definition at line 223 of file ad_sigma_delta.c.

void ad_sd_cleanup_buffer_and_trigger ( struct iio_dev indio_dev)

ad_sd_cleanup_buffer_and_trigger() - : The IIO device

Definition at line 528 of file ad_sigma_delta.c.

int ad_sd_init ( struct ad_sigma_delta sigma_delta,
struct iio_dev indio_dev,
struct spi_device spi,
const struct ad_sigma_delta_info info 
)

ad_sd_init() - Initializes a ad_sigma_delta struct : The ad_sigma_delta device : The IIO device which the Sigma Delta device is used for : The SPI device for the ad_sigma_delta device : Device specific callbacks and options

This function needs to be called before any other operations are performed on the ad_sigma_delta struct.

Definition at line 545 of file ad_sigma_delta.c.

int ad_sd_read_reg ( struct ad_sigma_delta sigma_delta,
unsigned int  reg,
unsigned int  size,
unsigned int val 
)

ad_sd_read_reg() - Read a register

: The sigma delta device : Address of the register : Size of the register (1-4) : Read value

Returns 0 on success, an error code otherwise.

Definition at line 146 of file ad_sigma_delta.c.

void ad_sd_set_comm ( struct ad_sigma_delta sigma_delta,
uint8_t  comm 
)

ad_sd_set_comm() - Set communications register

: The sigma delta device : New value for the communications register

Definition at line 40 of file ad_sigma_delta.c.

int ad_sd_setup_buffer_and_trigger ( struct iio_dev indio_dev)

ad_sd_setup_buffer_and_trigger() - : The IIO device

Definition at line 505 of file ad_sigma_delta.c.

int ad_sd_validate_trigger ( struct iio_dev indio_dev,
struct iio_trigger trig 
)

ad_sd_validate_trigger() - validate_trigger callback for ad_sigma_delta devices : The IIO device : The new trigger

Returns: 0 if the 'trig' matches the trigger registered by the ad_sigma_delta device, -EINVAL otherwise.

Definition at line 431 of file ad_sigma_delta.c.

int ad_sd_write_reg ( struct ad_sigma_delta sigma_delta,
unsigned int  reg,
unsigned int  size,
unsigned int  val 
)

ad_sd_write_reg() - Write a register

: The sigma delta device : Address of the register : Size of the register (0-3) : Value to write to the register

Returns 0 on success, an error code otherwise.

Definition at line 58 of file ad_sigma_delta.c.

int ad_sigma_delta_single_conversion ( struct iio_dev indio_dev,
const struct iio_chan_spec chan,
int val 
)

ad_sigma_delta_single_conversion() - Performs a single data conversion : The IIO device : The conversion is done for this channel : Pointer to the location where to store the read value

Returns: 0 on success, an error value otherwise.

Definition at line 247 of file ad_sigma_delta.c.

EXPORT_SYMBOL_GPL ( ad_sd_set_comm  )
EXPORT_SYMBOL_GPL ( ad_sd_write_reg  )
EXPORT_SYMBOL_GPL ( ad_sd_read_reg  )
EXPORT_SYMBOL_GPL ( ad_sd_calibrate_all  )
EXPORT_SYMBOL_GPL ( ad_sigma_delta_single_conversion  )
EXPORT_SYMBOL_GPL ( ad_sd_validate_trigger  )
EXPORT_SYMBOL_GPL ( ad_sd_setup_buffer_and_trigger  )
EXPORT_SYMBOL_GPL ( ad_sd_cleanup_buffer_and_trigger  )
EXPORT_SYMBOL_GPL ( ad_sd_init  )
MODULE_AUTHOR ( "Lars-Peter Clausen <[email protected]>"  )
MODULE_DESCRIPTION ( "Analog Devices Sigma-Delta ADCs"  )
MODULE_LICENSE ( "GPL v2 )