ad7793.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * AD7792/AD7793 SPI ADC driver
  3. *
  4. * Copyright 2011 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2.
  7. */
  8. #ifndef __LINUX_PLATFORM_DATA_AD7793_H__
  9. #define __LINUX_PLATFORM_DATA_AD7793_H__
  10. /**
  11. * enum ad7793_clock_source - AD7793 clock source selection
  12. * @AD7793_CLK_SRC_INT: Internal 64 kHz clock, not available at the CLK pin.
  13. * @AD7793_CLK_SRC_INT_CO: Internal 64 kHz clock, available at the CLK pin.
  14. * @AD7793_CLK_SRC_EXT: Use external clock.
  15. * @AD7793_CLK_SRC_EXT_DIV2: Use external clock divided by 2.
  16. */
  17. enum ad7793_clock_source {
  18. AD7793_CLK_SRC_INT,
  19. AD7793_CLK_SRC_INT_CO,
  20. AD7793_CLK_SRC_EXT,
  21. AD7793_CLK_SRC_EXT_DIV2,
  22. };
  23. /**
  24. * enum ad7793_bias_voltage - AD7793 bias voltage selection
  25. * @AD7793_BIAS_VOLTAGE_DISABLED: Bias voltage generator disabled
  26. * @AD7793_BIAS_VOLTAGE_AIN1: Bias voltage connected to AIN1(-).
  27. * @AD7793_BIAS_VOLTAGE_AIN2: Bias voltage connected to AIN2(-).
  28. * @AD7793_BIAS_VOLTAGE_AIN3: Bias voltage connected to AIN3(-).
  29. * Only valid for AD7795/AD7796.
  30. */
  31. enum ad7793_bias_voltage {
  32. AD7793_BIAS_VOLTAGE_DISABLED,
  33. AD7793_BIAS_VOLTAGE_AIN1,
  34. AD7793_BIAS_VOLTAGE_AIN2,
  35. AD7793_BIAS_VOLTAGE_AIN3,
  36. };
  37. /**
  38. * enum ad7793_refsel - AD7793 reference voltage selection
  39. * @AD7793_REFSEL_REFIN1: External reference applied between REFIN1(+)
  40. * and REFIN1(-).
  41. * @AD7793_REFSEL_REFIN2: External reference applied between REFIN2(+) and
  42. * and REFIN1(-). Only valid for AD7795/AD7796.
  43. * @AD7793_REFSEL_INTERNAL: Internal 1.17 V reference.
  44. */
  45. enum ad7793_refsel {
  46. AD7793_REFSEL_REFIN1 = 0,
  47. AD7793_REFSEL_REFIN2 = 1,
  48. AD7793_REFSEL_INTERNAL = 2,
  49. };
  50. /**
  51. * enum ad7793_current_source_direction - AD7793 excitation current direction
  52. * @AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2: Current source IEXC1 connected to pin
  53. * IOUT1, current source IEXC2 connected to pin IOUT2.
  54. * @AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1: Current source IEXC2 connected to pin
  55. * IOUT1, current source IEXC1 connected to pin IOUT2.
  56. * @AD7793_IEXEC1_IEXEC2_IOUT1: Both current sources connected to pin IOUT1.
  57. * Only valid when the current sources are set to 10 uA or 210 uA.
  58. * @AD7793_IEXEC1_IEXEC2_IOUT2: Both current sources connected to Pin IOUT2.
  59. * Only valid when the current ources are set to 10 uA or 210 uA.
  60. */
  61. enum ad7793_current_source_direction {
  62. AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2 = 0,
  63. AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1 = 1,
  64. AD7793_IEXEC1_IEXEC2_IOUT1 = 2,
  65. AD7793_IEXEC1_IEXEC2_IOUT2 = 3,
  66. };
  67. /**
  68. * enum ad7793_excitation_current - AD7793 excitation current selection
  69. * @AD7793_IX_DISABLED: Excitation current Disabled.
  70. * @AD7793_IX_10uA: Enable 10 micro-ampere excitation current.
  71. * @AD7793_IX_210uA: Enable 210 micro-ampere excitation current.
  72. * @AD7793_IX_1mA: Enable 1 milli-Ampere excitation current.
  73. */
  74. enum ad7793_excitation_current {
  75. AD7793_IX_DISABLED = 0,
  76. AD7793_IX_10uA = 1,
  77. AD7793_IX_210uA = 2,
  78. AD7793_IX_1mA = 3,
  79. };
  80. /**
  81. * struct ad7793_platform_data - AD7793 platform data
  82. * @clock_src: Clock source selection
  83. * @burnout_current: If set to true the 100nA burnout current is enabled.
  84. * @boost_enable: Enable boost for the bias voltage generator.
  85. * @buffered: If set to true configure the device for buffered input mode.
  86. * @unipolar: If set to true sample in unipolar mode, if set to false sample in
  87. * bipolar mode.
  88. * @refsel: Reference voltage selection
  89. * @bias_voltage: Bias voltage selection
  90. * @exitation_current: Excitation current selection
  91. * @current_source_direction: Excitation current direction selection
  92. */
  93. struct ad7793_platform_data {
  94. enum ad7793_clock_source clock_src;
  95. bool burnout_current;
  96. bool boost_enable;
  97. bool buffered;
  98. bool unipolar;
  99. enum ad7793_refsel refsel;
  100. enum ad7793_bias_voltage bias_voltage;
  101. enum ad7793_excitation_current exitation_current;
  102. enum ad7793_current_source_direction current_source_direction;
  103. };
  104. #endif /* IIO_ADC_AD7793_H_ */