diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-10-29 12:56:29 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-10-30 10:45:07 -0700 |
commit | fdd3d90bd78fd753356d8aa3373e066141851a35 (patch) | |
tree | 357e4c651b98b8907ef19e0ea8429f506bd8904c /board | |
parent | 1d916d7c6b25de10c870cf7f35a44d3654d9f099 (diff) | |
download | chrome-ec-fdd3d90bd78fd753356d8aa3373e066141851a35.tar.gz |
Clean up ADC module
ADC config structs are now chip-specific; this saves code size
(several hundred bytes on LM4, since no need for 24-entry ADC channel
to GPIO mapping table).
BUG=chrome-os-partner:15579
BRANCH=none
TEST='adc' with system on and off; ChargerCurrent should be bigger when on.
Change-Id: Ia88b3f043438bec049f2d2ad39fc42dcf86d9424
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36798
Diffstat (limited to 'board')
-rw-r--r-- | board/bds/board.c | 4 | ||||
-rw-r--r-- | board/link/board.c | 8 | ||||
-rw-r--r-- | board/spring/board.c | 6 |
3 files changed, 8 insertions, 10 deletions
diff --git a/board/bds/board.c b/board/bds/board.c index 04e3d56c67..ccbe69b38c 100644 --- a/board/bds/board.c +++ b/board/bds/board.c @@ -19,7 +19,7 @@ const struct adc_t adc_channels[ADC_CH_COUNT] = { * = -225 * ADC_VALUE / ADC_READ_MAX + 420.5 */ {"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420, - LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */}, + LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0}, /* Charger current is mapped from 0~4000mA to 0~1.6V. * And ADC maps 0~3.3V to ADC_READ_MAX. @@ -28,7 +28,7 @@ const struct adc_t adc_channels[ADC_CH_COUNT] = { * board, but that's good enough for debugging the ADC. */ {"BDSPot", LM4_ADC_SEQ1, 33 * 4000, ADC_READ_MAX * 16, 0, - LM4_AIN(0), 0x06 /* IE0 | END0 */}, + LM4_AIN(0), 0x06 /* IE0 | END0 */, LM4_GPIO_E, (1<<3)}, }; diff --git a/board/link/board.c b/board/link/board.c index 5f7fbf1106..e4fbb53423 100644 --- a/board/link/board.c +++ b/board/link/board.c @@ -5,8 +5,7 @@ /* EC for Link board configuration */ #include "adc.h" -#include "board.h" -#include "config.h" +#include "common.h" #include "gpio.h" #include "i2c.h" #include "lm4_adc.h" @@ -22,7 +21,6 @@ #define power_button_interrupt NULL #endif - /* GPIO signal list. Must match order from enum gpio_signal. */ const struct gpio_info gpio_list[GPIO_COUNT] = { /* Inputs with interrupt handlers are first for efficiency */ @@ -126,13 +124,13 @@ const struct adc_t adc_channels[ADC_CH_COUNT] = { * = -225 * ADC_VALUE / ADC_READ_MAX + 420.5 */ {"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420, - LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */}, + LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0}, /* Charger current is mapped from 0~4000mA to 0~1.6V. * And ADC maps 0~3.3V to ADC_READ_MAX. */ {"ChargerCurrent", LM4_ADC_SEQ1, 33 * 4000, ADC_READ_MAX * 16, 0, - LM4_AIN(11), 0x06 /* IE0 | END0 */}, + LM4_AIN(11), 0x06 /* IE0 | END0 */, LM4_GPIO_B, (1<<5)}, }; /* I2C ports */ diff --git a/board/spring/board.c b/board/spring/board.c index 5542f2354f..9316aaad52 100644 --- a/board/spring/board.c +++ b/board/spring/board.c @@ -99,11 +99,11 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { /* ADC channels */ const struct adc_t adc_channels[ADC_CH_COUNT] = { /* Micro USB ID pin. Raw ADC value. */ - [ADC_CH_USB_ID] = {"USB_ID", 0, 1, 1, 0, STM32_AIN(5), 0}, + [ADC_CH_USB_ID] = {"USB_ID", 1, 1, 0, STM32_AIN(5)}, /* Micro USB D+ sense pin. Raw ADC value. */ - [ADC_CH_USB_DP_SNS] = {"USB_DP_SNS", 0, 1, 1, 0, STM32_AIN(2), 0}, + [ADC_CH_USB_DP_SNS] = {"USB_DP_SNS", 1, 1, 0, STM32_AIN(2)}, /* Micro USB D- sense pin. Raw ADC value. */ - [ADC_CH_USB_DN_SNS] = {"USB_DN_SNS", 0, 1, 1, 0, STM32_AIN(4), 0}, + [ADC_CH_USB_DN_SNS] = {"USB_DN_SNS", 1, 1, 0, STM32_AIN(4)}, }; void configure_board(void) |