2 * AD5446 SPI DAC driver
4 * Copyright 2010 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
8 #ifndef IIO_ADC_AD5446_H_
9 #define IIO_ADC_AD5446_H_
11 /* DAC Control Bits */
13 #define AD5446_LOAD (0x0 << 14) /* Load and update */
14 #define AD5446_SDO_DIS (0x1 << 14) /* Disable SDO */
15 #define AD5446_NOP (0x2 << 14) /* No operation */
16 #define AD5446_CLK_RISING (0x3 << 14) /* Clock data on rising edge */
18 #define RES_MASK(bits) ((1 << (bits)) - 1)
20 struct ad5446_chip_info {
21 u8 bits; /* number of DAC bits */
22 u8 storagebits; /* number of bits written to the DAC */
23 u8 left_shift; /* number of bits the datum must be shifted */
24 char sign; /* [s]igned or [u]nsigned */
28 struct iio_dev *indio_dev;
29 struct spi_device *spi;
30 const struct ad5446_chip_info *chip_info;
31 struct regulator *reg;
32 struct work_struct poll_work;
33 unsigned short vref_mv;
34 struct spi_transfer xfer;
35 struct spi_message msg;
39 enum ad5446_supported_device_ids {
46 #endif /* IIO_ADC_AD5446_H_ */