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