Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
max1363.h
Go to the documentation of this file.
1 #ifndef _MAX1363_H_
2 #define _MAX1363_H_
3 
4 #define MAX1363_SETUP_BYTE(a) ((a) | 0x80)
5 
6 /* There is a fair bit more defined here than currently
7  * used, but the intention is to support everything these
8  * chips do in the long run */
9 
10 /* see data sheets */
11 /* max1363 and max1236, max1237, max1238, max1239 */
12 #define MAX1363_SETUP_AIN3_IS_AIN3_REF_IS_VDD 0x00
13 #define MAX1363_SETUP_AIN3_IS_REF_EXT_TO_REF 0x20
14 #define MAX1363_SETUP_AIN3_IS_AIN3_REF_IS_INT 0x40
15 #define MAX1363_SETUP_AIN3_IS_REF_REF_IS_INT 0x60
16 #define MAX1363_SETUP_POWER_UP_INT_REF 0x10
17 #define MAX1363_SETUP_POWER_DOWN_INT_REF 0x00
18 
19 /* think about includeing max11600 etc - more settings */
20 #define MAX1363_SETUP_EXT_CLOCK 0x08
21 #define MAX1363_SETUP_INT_CLOCK 0x00
22 #define MAX1363_SETUP_UNIPOLAR 0x00
23 #define MAX1363_SETUP_BIPOLAR 0x04
24 #define MAX1363_SETUP_RESET 0x00
25 #define MAX1363_SETUP_NORESET 0x02
26 /* max1363 only - though don't care on others.
27  * For now monitor modes are not implemented as the relevant
28  * line is not connected on my test board.
29  * The definitions are here as I intend to add this soon.
30  */
31 #define MAX1363_SETUP_MONITOR_SETUP 0x01
32 
33 /* Specific to the max1363 */
34 #define MAX1363_MON_RESET_CHAN(a) (1 << ((a) + 4))
35 #define MAX1363_MON_INT_ENABLE 0x01
36 
37 /* defined for readability reasons */
38 /* All chips */
39 #define MAX1363_CONFIG_BYTE(a) ((a))
40 
41 #define MAX1363_CONFIG_SE 0x01
42 #define MAX1363_CONFIG_DE 0x00
43 #define MAX1363_CONFIG_SCAN_TO_CS 0x00
44 #define MAX1363_CONFIG_SCAN_SINGLE_8 0x20
45 #define MAX1363_CONFIG_SCAN_MONITOR_MODE 0x40
46 #define MAX1363_CONFIG_SCAN_SINGLE_1 0x60
47 /* max123{6-9} only */
48 #define MAX1236_SCAN_MID_TO_CHANNEL 0x40
49 
50 /* max1363 only - merely part of channel selects or don't care for others*/
51 #define MAX1363_CONFIG_EN_MON_MODE_READ 0x18
52 
53 #define MAX1363_CHANNEL_SEL(a) ((a) << 1)
54 
55 /* max1363 strictly 0x06 - but doesn't matter */
56 #define MAX1363_CHANNEL_SEL_MASK 0x1E
57 #define MAX1363_SCAN_MASK 0x60
58 #define MAX1363_SE_DE_MASK 0x01
59 
60 #define MAX1363_MAX_CHANNELS 25
61 
66 struct max1363_mode {
69 };
70 
71 /* This must be maintained along side the max1363_mode_table in max1363_core */
73  /* Single read of a single channel */
75  /* Differential single read */
78  /* Scan to channel and mid to channel where overlapping */
82  /* Differential scan to channel and mid to channel where overlapping */
87 };
88 
102  const struct iio_info *info;
103  const struct iio_chan_spec *channels;
110 };
111 
133  const struct max1363_mode *current_mode;
135  struct regulator *reg;
136 
137  /* Using monitor modes and buffer at the same time is
138  currently not supported */
140  unsigned int monitor_speed:3;
143  /* 4x unipolar first then the fours bipolar ones */
146 };
147 
148 const struct max1363_mode
149 *max1363_match_mode(const unsigned long *mask,
150  const struct max1363_chip_info *ci);
151 
153 
154 #ifdef CONFIG_MAX1363_RING_BUFFER
155 int max1363_update_scan_mode(struct iio_dev *indio_dev,
156  const unsigned long *scan_mask);
157 int max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev);
158 void max1363_ring_cleanup(struct iio_dev *indio_dev);
159 
160 #else /* CONFIG_MAX1363_RING_BUFFER */
161 int max1363_update_scan_mode(struct iio_dev *indio_dev,
162  const long *scan_mask)
163 {
164  return 0;
165 }
166 
167 static inline int
169 {
170  return 0;
171 }
172 
173 static inline void max1363_ring_cleanup(struct iio_dev *indio_dev)
174 {
175 }
176 #endif /* CONFIG_MAX1363_RING_BUFFER */
177 #endif /* _MAX1363_H_ */