ad5624r.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * AD5624R SPI DAC driver
  3. *
  4. * Copyright 2010-2011 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2.
  7. */
  8. #ifndef SPI_AD5624R_H_
  9. #define SPI_AD5624R_H_
  10. #define AD5624R_DAC_CHANNELS 4
  11. #define AD5624R_ADDR_DAC0 0x0
  12. #define AD5624R_ADDR_DAC1 0x1
  13. #define AD5624R_ADDR_DAC2 0x2
  14. #define AD5624R_ADDR_DAC3 0x3
  15. #define AD5624R_ADDR_ALL_DAC 0x7
  16. #define AD5624R_CMD_WRITE_INPUT_N 0x0
  17. #define AD5624R_CMD_UPDATE_DAC_N 0x1
  18. #define AD5624R_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2
  19. #define AD5624R_CMD_WRITE_INPUT_N_UPDATE_N 0x3
  20. #define AD5624R_CMD_POWERDOWN_DAC 0x4
  21. #define AD5624R_CMD_RESET 0x5
  22. #define AD5624R_CMD_LDAC_SETUP 0x6
  23. #define AD5624R_CMD_INTERNAL_REFER_SETUP 0x7
  24. #define AD5624R_LDAC_PWRDN_NONE 0x0
  25. #define AD5624R_LDAC_PWRDN_1K 0x1
  26. #define AD5624R_LDAC_PWRDN_100K 0x2
  27. #define AD5624R_LDAC_PWRDN_3STATE 0x3
  28. /**
  29. * struct ad5624r_chip_info - chip specific information
  30. * @channels: channel spec for the DAC
  31. * @int_vref_mv: AD5620/40/60: the internal reference voltage
  32. */
  33. struct ad5624r_chip_info {
  34. const struct iio_chan_spec *channels;
  35. u16 int_vref_mv;
  36. };
  37. /**
  38. * struct ad5446_state - driver instance specific data
  39. * @indio_dev: the industrial I/O device
  40. * @us: spi_device
  41. * @chip_info: chip model specific constants, available modes etc
  42. * @reg: supply regulator
  43. * @vref_mv: actual reference voltage used
  44. * @pwr_down_mask power down mask
  45. * @pwr_down_mode current power down mode
  46. */
  47. struct ad5624r_state {
  48. struct spi_device *us;
  49. const struct ad5624r_chip_info *chip_info;
  50. struct regulator *reg;
  51. unsigned short vref_mv;
  52. unsigned pwr_down_mask;
  53. unsigned pwr_down_mode;
  54. };
  55. /**
  56. * ad5624r_supported_device_ids:
  57. * The AD5624/44/64 parts are available in different
  58. * fixed internal reference voltage options.
  59. */
  60. enum ad5624r_supported_device_ids {
  61. ID_AD5624R3,
  62. ID_AD5644R3,
  63. ID_AD5664R3,
  64. ID_AD5624R5,
  65. ID_AD5644R5,
  66. ID_AD5664R5,
  67. };
  68. #endif /* SPI_AD5624R_H_ */