Siddartha Mohanadoss | 53c16f9 | 2011-10-17 15:57:15 -0700 | [diff] [blame] | 1 | #ifndef __EPM_ADC_H |
| 2 | #define __EPM_ADC_H |
| 3 | |
| 4 | #include <linux/i2c.h> |
| 5 | |
| 6 | struct epm_chan_request { |
| 7 | /* EPM ADC device index. 0 - ADC1, 1 - ADC2 */ |
| 8 | uint32_t device_idx; |
| 9 | /* Channel number within the EPM ADC device */ |
| 10 | uint32_t channel_idx; |
| 11 | /* The data meaningful for each individual channel whether it is |
| 12 | * voltage, current etc. */ |
| 13 | int32_t physical; |
| 14 | }; |
| 15 | |
Siddartha Mohanadoss | 79f975f | 2012-07-11 10:13:30 -0700 | [diff] [blame] | 16 | #ifdef __KERNEL__ |
Siddartha Mohanadoss | 53c16f9 | 2011-10-17 15:57:15 -0700 | [diff] [blame] | 17 | struct epm_chan_properties { |
| 18 | uint32_t resistorValue; |
| 19 | uint32_t gain; |
| 20 | }; |
| 21 | |
| 22 | struct epm_adc_platform_data { |
| 23 | struct epm_chan_properties *channel; |
| 24 | uint32_t num_channels; |
| 25 | uint32_t num_adc; |
| 26 | uint32_t chan_per_adc; |
| 27 | uint32_t chan_per_mux; |
| 28 | struct i2c_board_info epm_i2c_board_info; |
| 29 | uint32_t bus_id; |
| 30 | uint32_t gpio_expander_base_addr; |
| 31 | }; |
Siddartha Mohanadoss | 79f975f | 2012-07-11 10:13:30 -0700 | [diff] [blame] | 32 | #endif |
Siddartha Mohanadoss | eb90c92 | 2012-03-27 22:58:06 -0700 | [diff] [blame] | 33 | |
| 34 | #define EPM_ADC_IOCTL_CODE 0x91 |
| 35 | |
| 36 | #define EPM_ADC_REQUEST _IOWR(EPM_ADC_IOCTL_CODE, 1, \ |
| 37 | struct epm_chan_request) |
| 38 | |
| 39 | #define EPM_ADC_INIT _IOR(EPM_ADC_IOCTL_CODE, 2, \ |
| 40 | uint32_t) |
| 41 | |
| 42 | #define EPM_ADC_DEINIT _IOR(EPM_ADC_IOCTL_CODE, 3, \ |
| 43 | uint32_t) |
Siddartha Mohanadoss | 53c16f9 | 2011-10-17 15:57:15 -0700 | [diff] [blame] | 44 | #endif /* __EPM_ADC_H */ |