2 * AD5446 SPI DAC driver
4 * Copyright 2010 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
8 #ifndef IIO_DAC_AD5446_H_
9 #define IIO_DAC_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 AD5620_LOAD (0x0 << 14) /* Load and update Norm Operation*/
19 #define AD5620_PWRDWN_1k (0x1 << 14) /* Power-down: 1kOhm to GND */
20 #define AD5620_PWRDWN_100k (0x2 << 14) /* Power-down: 100kOhm to GND */
21 #define AD5620_PWRDWN_TRISTATE (0x3 << 14) /* Power-down: Three-state */
23 #define AD5660_LOAD (0x0 << 16) /* Load and update Norm Operation*/
24 #define AD5660_PWRDWN_1k (0x1 << 16) /* Power-down: 1kOhm to GND */
25 #define AD5660_PWRDWN_100k (0x2 << 16) /* Power-down: 100kOhm to GND */
26 #define AD5660_PWRDWN_TRISTATE (0x3 << 16) /* Power-down: Three-state */
28 #define MODE_PWRDWN_1k 0x1
29 #define MODE_PWRDWN_100k 0x2
30 #define MODE_PWRDWN_TRISTATE 0x3
33 * struct ad5446_state - driver instance specific data
35 * @chip_info: chip model specific constants, available modes etc
36 * @reg: supply regulator
37 * @poll_work: bottom half of polling interrupt handler
38 * @vref_mv: actual reference voltage used
39 * @xfer: default spi transfer
40 * @msg: default spi message
41 * @data: spi transmit buffer
45 struct spi_device
*spi
;
46 const struct ad5446_chip_info
*chip_info
;
47 struct regulator
*reg
;
48 struct work_struct poll_work
;
49 unsigned short vref_mv
;
51 unsigned pwr_down_mode
;
53 struct spi_transfer xfer
;
54 struct spi_message msg
;
62 * struct ad5446_chip_info - chip specific information
63 * @channel: channel spec for the DAC
64 * @int_vref_mv: AD5620/40/60: the internal reference voltage
65 * @store_sample: chip specific helper function to store the datum
66 * @store_sample: chip specific helper function to store the powerpown cmd
69 struct ad5446_chip_info
{
70 struct iio_chan_spec channel
;
72 void (*store_sample
) (struct ad5446_state
*st
, unsigned val
);
73 void (*store_pwr_down
) (struct ad5446_state
*st
, unsigned mode
);
77 * ad5446_supported_device_ids:
78 * The AD5620/40/60 parts are available in different fixed internal reference
79 * voltage options. The actual part numbers may look differently
80 * (and a bit cryptic), however this style is used to make clear which
81 * parts are supported here.
84 enum ad5446_supported_device_ids
{
103 #endif /* IIO_DAC_AD5446_H_ */