Commit 59c23eab authored by Michael Hennerich's avatar Michael Hennerich Committed by Greg Kroah-Hartman

staging: IIO: DAC: New driver for the AD5504 and AD55041 High Voltage DACs

Changes since V1:

IIO: DAC: Apply review feedback from Jonathan

Fix array size and declare const.
Fix reversed dacY_powerdown read back.
Use individual attribute groups instead of is_visible.
Fix event naming and add the _en file.

Changes since V2:

IIO: DAC: AD5504 use proper event type
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d6f087ec
......@@ -21,6 +21,16 @@ config AD5446
To compile this driver as a module, choose M here: the
module will be called ad5446.
config AD5504
tristate "Analog Devices AD5504/AD5501 DAC SPI driver"
depends on SPI
help
Say yes here to build support for Analog Devices AD5504, AD5501,
High Voltage Digital to Analog Converter.
To compile this driver as a module, choose M here: the
module will be called ad5504.
config MAX517
tristate "Maxim MAX517/518/519 DAC driver"
depends on I2C && EXPERIMENTAL
......
......@@ -3,5 +3,6 @@
#
obj-$(CONFIG_AD5624R_SPI) += ad5624r_spi.o
obj-$(CONFIG_AD5504) += ad5504.o
obj-$(CONFIG_AD5446) += ad5446.o
obj-$(CONFIG_MAX517) += max517.o
This diff is collapsed.
/*
* AD5504 SPI DAC driver
*
* Copyright 2011 Analog Devices Inc.
*
* Licensed under the GPL-2.
*/
#ifndef SPI_AD5504_H_
#define SPI_AD5504_H_
#define AD5505_BITS 12
#define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1)
#define AD5504_CMD_READ (1 << 15)
#define AD5504_CMD_WRITE (0 << 15)
#define AD5504_ADDR(addr) ((addr) << 12)
/* Registers */
#define AD5504_ADDR_NOOP 0
#define AD5504_ADDR_DAC0 1
#define AD5504_ADDR_DAC1 2
#define AD5504_ADDR_DAC2 3
#define AD5504_ADDR_DAC3 4
#define AD5504_ADDR_ALL_DAC 5
#define AD5504_ADDR_CTRL 7
/* Control Register */
#define AD5504_DAC_PWR(ch) ((ch) << 2)
#define AD5504_DAC_PWRDWN_MODE(mode) ((mode) << 6)
#define AD5504_DAC_PWRDN_20K 0
#define AD5504_DAC_PWRDN_3STATE 1
/*
* TODO: struct ad5504_platform_data needs to go into include/linux/iio
*/
struct ad5504_platform_data {
u16 vref_mv;
};
/**
* struct ad5446_state - driver instance specific data
* @indio_dev: the industrial I/O device
* @us: spi_device
* @reg: supply regulator
* @vref_mv: actual reference voltage used
* @work_alarm: bh work structure for event handling
* @last_timestamp: timestamp of last event interrupt
* @pwr_down_mask power down mask
* @pwr_down_mode current power down mode
*/
struct ad5504_state {
struct iio_dev *indio_dev;
struct spi_device *spi;
struct regulator *reg;
unsigned short vref_mv;
struct work_struct work_alarm;
s64 last_timestamp;
unsigned pwr_down_mask;
unsigned pwr_down_mode;
};
/**
* ad5504_supported_device_ids:
*/
enum ad5504_supported_device_ids {
ID_AD5504,
ID_AD5501,
};
#endif /* SPI_AD5504_H_ */
......@@ -266,6 +266,7 @@ struct iio_const_attr {
#define IIO_EV_CLASS_MAGN 4
#define IIO_EV_CLASS_LIGHT 5
#define IIO_EV_CLASS_PROXIMITY 6
#define IIO_EV_CLASS_TEMP 7
#define IIO_EV_MOD_X 0
#define IIO_EV_MOD_Y 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment