Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * AD5624R SPI DAC driver
0004  *
0005  * Copyright 2010-2011 Analog Devices Inc.
0006  */
0007 #ifndef SPI_AD5624R_H_
0008 #define SPI_AD5624R_H_
0009 
0010 #define AD5624R_DAC_CHANNELS            4
0011 
0012 #define AD5624R_ADDR_DAC0           0x0
0013 #define AD5624R_ADDR_DAC1           0x1
0014 #define AD5624R_ADDR_DAC2           0x2
0015 #define AD5624R_ADDR_DAC3           0x3
0016 #define AD5624R_ADDR_ALL_DAC            0x7
0017 
0018 #define AD5624R_CMD_WRITE_INPUT_N       0x0
0019 #define AD5624R_CMD_UPDATE_DAC_N        0x1
0020 #define AD5624R_CMD_WRITE_INPUT_N_UPDATE_ALL    0x2
0021 #define AD5624R_CMD_WRITE_INPUT_N_UPDATE_N  0x3
0022 #define AD5624R_CMD_POWERDOWN_DAC       0x4
0023 #define AD5624R_CMD_RESET           0x5
0024 #define AD5624R_CMD_LDAC_SETUP          0x6
0025 #define AD5624R_CMD_INTERNAL_REFER_SETUP    0x7
0026 
0027 #define AD5624R_LDAC_PWRDN_NONE         0x0
0028 #define AD5624R_LDAC_PWRDN_1K           0x1
0029 #define AD5624R_LDAC_PWRDN_100K         0x2
0030 #define AD5624R_LDAC_PWRDN_3STATE       0x3
0031 
0032 /**
0033  * struct ad5624r_chip_info - chip specific information
0034  * @channels:       channel spec for the DAC
0035  * @int_vref_mv:    AD5620/40/60: the internal reference voltage
0036  */
0037 
0038 struct ad5624r_chip_info {
0039     const struct iio_chan_spec  *channels;
0040     u16             int_vref_mv;
0041 };
0042 
0043 /**
0044  * struct ad5446_state - driver instance specific data
0045  * @indio_dev:      the industrial I/O device
0046  * @us:         spi_device
0047  * @chip_info:      chip model specific constants, available modes etc
0048  * @reg:        supply regulator
0049  * @vref_mv:        actual reference voltage used
0050  * @pwr_down_mask   power down mask
0051  * @pwr_down_mode   current power down mode
0052  */
0053 
0054 struct ad5624r_state {
0055     struct spi_device       *us;
0056     const struct ad5624r_chip_info  *chip_info;
0057     struct regulator        *reg;
0058     unsigned short          vref_mv;
0059     unsigned            pwr_down_mask;
0060     unsigned            pwr_down_mode;
0061 };
0062 
0063 /**
0064  * ad5624r_supported_device_ids:
0065  * The AD5624/44/64 parts are available in different
0066  * fixed internal reference voltage options.
0067  */
0068 
0069 enum ad5624r_supported_device_ids {
0070     ID_AD5624R3,
0071     ID_AD5644R3,
0072     ID_AD5664R3,
0073     ID_AD5624R5,
0074     ID_AD5644R5,
0075     ID_AD5664R5,
0076 };
0077 
0078 #endif /* SPI_AD5624R_H_ */