diff options
author | Vic Yang <victoryang@google.com> | 2012-01-14 20:46:10 +0800 |
---|---|---|
committer | Vic Yang <victoryang@google.com> | 2012-02-02 10:24:26 +0800 |
commit | 1e5233a66d80b34230b0a462bbf2983277e7c4cc (patch) | |
tree | 813fd8d0a9520d95d039f609b617d3ae2c988604 /include/adc.h | |
parent | df1d8933223817b4b5afe33101e939ff243aa9f6 (diff) | |
download | chrome-ec-1e5233a66d80b34230b0a462bbf2983277e7c4cc.tar.gz |
Refactor ADC code and add Link charger current ADC support
Refactor ADC code and move board/chip-specific part to corresponding
directories.
Implement function and console command to read Link charger current.
BUG=chrome-os-partner:7527
TEST=Read EC temperature and POT input on BDS.
Change-Id: I7fafd310ea49d9b2781f10c3453f5488da29a08a
Diffstat (limited to 'include/adc.h')
-rw-r--r-- | include/adc.h | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/include/adc.h b/include/adc.h index 1f01f2c08f..a59c58c463 100644 --- a/include/adc.h +++ b/include/adc.h @@ -9,27 +9,24 @@ #define __CROS_EC_ADC_H #include "common.h" - -/* Value returned by adc_read_*() methods if the read failed. */ -#define ADC_READ_ERROR -1 - -/* Minimum and maximum values returned by adc_read(). */ -#define ADC_READ_MIN 0 -#define ADC_READ_MAX 4095 - -/* ADC channels */ -/* TODO: channel mapping is board-specific */ -enum adc_channel { - ADC_CH_POT = 0, +#include "board.h" + +/* Data structure to define ADC channels. */ +struct adc_t +{ + const char* name; + int sequencer; + int factor_mul; + int factor_div; + int shift; + int channel; + int flag; }; /* Initializes the module. */ int adc_init(void); -/* Reads an ADC channel. Returns the ADC value, or ADC_READ_ERROR if error. */ -int adc_read(enum adc_channel ch); - -/* Returns the internal EC temperature in K, or ADC_READ_ERROR if error. */ -int adc_read_ec_temperature(void); +/* Read ADC channel. */ +int adc_read_channel(enum adc_channel ch); #endif /* __CROS_EC_ADC_H */ |