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