summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-06-05 14:25:47 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-06 02:55:41 +0000
commitea07b1851b0fef035a253ab2ab4e788228a06a19 (patch)
tree9f6eb428e806a22bbf5ae0757868622d8ed062c5
parent58719e30730e6420533514dabd27c188e60ae607 (diff)
downloadchrome-ec-ea07b1851b0fef035a253ab2ab4e788228a06a19.tar.gz
glados: enable ADC channels
Enable ADC channels on Glados. For now only VBUS is scaled accurately into mV, the rest are ADC counts. BUG=none BRANCH=none TEST="adc" from EC console and verify VBUS measurement matches for zinger at 20V and donette at 5V. Change-Id: I1af70df5b851ba654c8feb7c97d190d393421a29 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275685 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--board/glados/board.c15
-rw-r--r--board/glados/board.h11
2 files changed, 26 insertions, 0 deletions
diff --git a/board/glados/board.c b/board/glados/board.c
index a1f8e9dd5f..2d17d671f7 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -5,6 +5,7 @@
/* Glados board-specific configuration */
+#include "adc_chip.h"
#include "button.h"
#include "charger.h"
#include "console.h"
@@ -71,6 +72,20 @@ const struct power_signal_info power_signal_list[] = {
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
+/* ADC channels */
+const struct adc_t adc_channels[] = {
+ /* Battery pack thermisor */
+ [ADC_BATT_TEMP] = {"BATT_TEMP", 1, 1, 0, 0},
+ /* Vbus sensing. Converted to mV, full ADC is equivalent to 33V. */
+ [ADC_VBUS] = {"VBUS", 33000, 1024, 0, 1},
+ /* Adapter current output or battery discharging current */
+ [ADC_AMON_BMON] = {"AMON_BMON", 1, 1, 0, 3},
+ /* System current consumption */
+ [ADC_PSYS] = {"PSYS", 1, 1, 0, 4},
+
+};
+BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
+
const struct i2c_port_t i2c_ports[] = {
{"batt", MEC1322_I2C0_0, 100, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
{"muxes", MEC1322_I2C0_1, 100, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
diff --git a/board/glados/board.h b/board/glados/board.h
index 44db0f5a3c..4f1eb3dd50 100644
--- a/board/glados/board.h
+++ b/board/glados/board.h
@@ -9,6 +9,7 @@
#define __BOARD_H
/* Optional features */
+#define CONFIG_ADC
#define CONFIG_BATTERY_SMART
#define CONFIG_BUTTON_COUNT 2
@@ -68,6 +69,16 @@
#include "gpio_signal.h"
#include "registers.h"
+/* ADC signal */
+enum adc_channel {
+ ADC_BATT_TEMP,
+ ADC_VBUS,
+ ADC_AMON_BMON,
+ ADC_PSYS,
+ /* Number of ADC channels */
+ ADC_CH_COUNT
+};
+
/* power signal definitions */
enum power_signal {
X86_RSMRST_L_PWRGD = 0,