From b06d417e821c8681261d6e5f1139e5d101d147fc Mon Sep 17 00:00:00 2001 From: Peter Marheine Date: Tue, 26 Nov 2019 10:52:17 +1100 Subject: puff: update PP3300_SNS divider The schematic has changed to 9.31k / 47k resistors on this input. BUG=b:1829597655 TEST=still builds BRANCH=None Change-Id: I2856df05b2611edd30d497a35bb871b8f5b173e9 Signed-off-by: Peter Marheine Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1935467 Reviewed-by: Andrew McRae Commit-Queue: Nicolas Boichat --- board/puff/board.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/board/puff/board.c b/board/puff/board.c index 77d632b9a3..7e27178469 100644 --- a/board/puff/board.c +++ b/board/puff/board.c @@ -98,11 +98,17 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct adc_t adc_channels[] = { - [ADC_SNS_PP3300] = { /* 9/11 voltage divider */ + [ADC_SNS_PP3300] = { + /* + * 4700/5631 voltage divider: can take the value out of range + * for 32-bit signed integers, so truncate to 470/563 yielding + * <0.1% error and a maximum intermediate value of 1623457792, + * which comfortably fits in int32. + */ .name = "SNS_PP3300", .input_ch = NPCX_ADC_CH2, - .factor_mul = ADC_MAX_VOLT * 11, - .factor_div = (ADC_READ_MAX + 1) * 9, + .factor_mul = ADC_MAX_VOLT * 563, + .factor_div = (ADC_READ_MAX + 1) * 470, }, [ADC_SNS_PP1050] = { .name = "SNS_PP1050", -- cgit v1.2.1