summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyoung Kim <kyoung.il.kim@intel.com>2016-02-29 11:37:58 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-03-11 15:17:29 -0800
commitc914d38c9222fdd81e5bae13e246af22f514bf2f (patch)
tree010e27c2bfc5e09cee91a20cf115de0dd0615ba6
parent1102e46ecfeb3f30591df02c1647d69c00e9f419 (diff)
downloadchrome-ec-c914d38c9222fdd81e5bae13e246af22f514bf2f.tar.gz
Kunimitsu/Lars: correct adc voltage reading
Add adc correction parameter for VBUS channel. BUG=chrome-os-partner:49192 BRANCH=glados TEST=make -j buildall Change-Id: Ia613d92936a1f4d2dcd9f1cd26f43ecfe9c0eab1 Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com> Reviewed-on: https://chromium-review.googlesource.com/331401 Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com> Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--board/kunimitsu/board.c9
-rw-r--r--board/lars/board.c9
2 files changed, 16 insertions, 2 deletions
diff --git a/board/kunimitsu/board.c b/board/kunimitsu/board.c
index be6ac09550..f092b86b63 100644
--- a/board/kunimitsu/board.c
+++ b/board/kunimitsu/board.c
@@ -96,12 +96,19 @@ const struct power_signal_info power_signal_list[] = {
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
+/* VBUS_MUL */
+#define VBUS_MUL 30123
+/* VBUS_DIV 10bit ADC */
+#define VBUS_DIV 1024
+/* VBUS_SHIFT */
+#define VBUS_SHIFT 116
+
/* ADC channels */
const struct adc_t adc_channels[] = {
/* read voltage in battery thermistor as battery present */
[ADC_BATT_PRESENT] = {"BATTPRES", 3300, 1024, 0, 0},
/* Vbus sensing. Converted to mV, full ADC is equivalent to 30V. */
- [ADC_VBUS] = {"VBUS", 30000, 1024, 0, 1},
+ [ADC_VBUS] = {"VBUS", VBUS_MUL, VBUS_DIV, VBUS_SHIFT, 1},
/* Adapter current output or battery discharging current */
[ADC_AMON_BMON] = {"AMON_BMON", 25000, 3072, 0, 3},
/*
diff --git a/board/lars/board.c b/board/lars/board.c
index 6d78d39f5e..45ff877a7d 100644
--- a/board/lars/board.c
+++ b/board/lars/board.c
@@ -79,10 +79,17 @@ const struct power_signal_info power_signal_list[] = {
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
+/* VBUS_MUL */
+#define VBUS_MUL 30405
+/* VBUS_DIV 10bit ADC */
+#define VBUS_DIV 1024
+/* VBUS_SHIFT */
+#define VBUS_SHIFT 16
+
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Vbus sensing. Converted to mV, full ADC is equivalent to 30V. */
- [ADC_VBUS] = {"VBUS", 30000, 1024, 0, 1},
+ [ADC_VBUS] = {"VBUS", VBUS_MUL, VBUS_DIV, VBUS_SHIFT, 1},
/* Adapter current output or battery discharging current */
[ADC_AMON_BMON] = {"AMON_BMON", 25000, 3072, 0, 3},
/*