1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * AD5624R SPI DAC driver
5 * Copyright 2010-2011 Analog Devices Inc.
10 #define AD5624R_DAC_CHANNELS 4
12 #define AD5624R_ADDR_DAC0 0x0
13 #define AD5624R_ADDR_DAC1 0x1
14 #define AD5624R_ADDR_DAC2 0x2
15 #define AD5624R_ADDR_DAC3 0x3
16 #define AD5624R_ADDR_ALL_DAC 0x7
18 #define AD5624R_CMD_WRITE_INPUT_N 0x0
19 #define AD5624R_CMD_UPDATE_DAC_N 0x1
20 #define AD5624R_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2
21 #define AD5624R_CMD_WRITE_INPUT_N_UPDATE_N 0x3
22 #define AD5624R_CMD_POWERDOWN_DAC 0x4
23 #define AD5624R_CMD_RESET 0x5
24 #define AD5624R_CMD_LDAC_SETUP 0x6
25 #define AD5624R_CMD_INTERNAL_REFER_SETUP 0x7
27 #define AD5624R_LDAC_PWRDN_NONE 0x0
28 #define AD5624R_LDAC_PWRDN_1K 0x1
29 #define AD5624R_LDAC_PWRDN_100K 0x2
30 #define AD5624R_LDAC_PWRDN_3STATE 0x3
33 * struct ad5624r_chip_info - chip specific information
34 * @channels: channel spec for the DAC
35 * @int_vref_mv: AD5620/40/60: the internal reference voltage
38 struct ad5624r_chip_info
{
39 const struct iio_chan_spec
*channels
;
44 * struct ad5446_state - driver instance specific data
45 * @indio_dev: the industrial I/O device
47 * @chip_info: chip model specific constants, available modes etc
48 * @reg: supply regulator
49 * @vref_mv: actual reference voltage used
50 * @pwr_down_mask power down mask
51 * @pwr_down_mode current power down mode
54 struct ad5624r_state
{
55 struct spi_device
*us
;
56 const struct ad5624r_chip_info
*chip_info
;
57 struct regulator
*reg
;
58 unsigned short vref_mv
;
59 unsigned pwr_down_mask
;
60 unsigned pwr_down_mode
;
64 * ad5624r_supported_device_ids:
65 * The AD5624/44/64 parts are available in different
66 * fixed internal reference voltage options.
69 enum ad5624r_supported_device_ids
{
78 #endif /* SPI_AD5624R_H_ */