diff options
author | Dave Parker <dparker@chromium.org> | 2013-08-30 14:30:36 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-09-03 23:37:44 +0000 |
commit | 10f58e5f19263ea0d2b9d81869d28c5f7a4201e6 (patch) | |
tree | cd05fa39d87c92f9690fad814a31b1691a8be2ac /board | |
parent | 32045efb23efdb8c68689ff871a24b9c19c75546 (diff) | |
download | chrome-ec-10f58e5f19263ea0d2b9d81869d28c5f7a4201e6.tar.gz |
Peppy: Correct adc calculation of charger current
BUG=chrome-os-partner:22405
BRANCH=peppy
TEST=Run 'adc' command. Measure charger current reported against
actual current.
Change-Id: I1772a781d9d0100e69a5fd1e9a9590252ccd88d6
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/167711
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/peppy/board.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/board/peppy/board.c b/board/peppy/board.c index 4a6a70afdf..f8142076be 100644 --- a/board/peppy/board.c +++ b/board/peppy/board.c @@ -165,11 +165,13 @@ const struct adc_t adc_channels[] = { {"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420, LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0}, - /* HEY: need different equation for Peppy*/ - /* Charger current is mapped from 0~4000mA to 0~1.6V. - * And ADC maps 0~3.3V to ADC_READ_MAX. + /* IOUT == ICMNT is on PE3/AIN0 */ + /* We have 0.01-ohm resistors, and IOUT is 20X the differential + * voltage, so 1000mA ==> 200mV. + * ADC returns 0x000-0xFFF, which maps to 0.0-3.3V (as configured). + * mA = 1000 * ADC_VALUE / ADC_READ_MAX * 3300 / 200 */ - {"ChargerCurrent", LM4_ADC_SEQ1, 33 * 4000, ADC_READ_MAX * 16, 0, + {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 2, 0, LM4_AIN(0), 0x06 /* IE0 | END0 */, LM4_GPIO_E, (1<<3)}, }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); |