diff options
author | Vic Yang <victoryang@chromium.org> | 2013-08-29 16:48:36 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-09-05 03:10:16 +0000 |
commit | ba57c3141ae39aaf49738677beaf675b5b79cb77 (patch) | |
tree | 82efdbd920bbb9d7d64e7a9547ab274e4894e7fa /board | |
parent | b57a5fe0edfcd8fa264c2f83755f5c6ae73d8435 (diff) | |
download | chrome-ec-ba57c3141ae39aaf49738677beaf675b5b79cb77.tar.gz |
Add Kirby ADC channel definition
Kirby has the same ADC channels as Spring, but with different scales and
pin assignments.
BUG=chrome-os-partner:22055
TEST=Read ADC channel voltage
BRANCH=None
Change-Id: Ibb618a77647c0477eeb0e8d983df07a258fdb75a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/167460
Diffstat (limited to 'board')
-rw-r--r-- | board/kirby/board.c | 20 | ||||
-rw-r--r-- | board/kirby/board.h | 11 |
2 files changed, 31 insertions, 0 deletions
diff --git a/board/kirby/board.c b/board/kirby/board.c index 4a702b2781..9301f938f0 100644 --- a/board/kirby/board.c +++ b/board/kirby/board.c @@ -4,6 +4,7 @@ */ /* Pit board-specific configuration */ +#include "adc.h" #include "battery_pack.h" #include "common.h" #include "extpower.h" @@ -16,6 +17,7 @@ #include "pwm_data.h" #include "registers.h" #include "spi.h" +#include "stm32_adc.h" #include "task.h" #include "util.h" @@ -125,6 +127,24 @@ const struct pwm_t pwm_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); +/* ADC channels */ +const struct adc_t adc_channels[] = { + /* + * VBUS voltage sense pin. + * Sense pin 1.8V is converted to 4096. Accounting for the 3x + * voltage divider, the conversion factor is 5400mV/4096. + */ + [ADC_CH_USB_VBUS_SNS] = {"USB_VBUS_SNS", 5400, 4096, 0, STM32_AIN(12)}, + /* + * Micro USB D+ sense pin. Voltage divider = 2/3. + * Converted to mV (2700mV/4096). + */ + [ADC_CH_USB_DP_SNS] = {"USB_DP_SNS", 2700, 4096, 0, STM32_AIN(10)}, + /* Micro USB D- sense pin. Same scale as for D+. */ + [ADC_CH_USB_DN_SNS] = {"USB_DN_SNS", 2700, 4096, 0, STM32_AIN(11)}, +}; +BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); + /* I2C ports */ const struct i2c_port_t i2c_ports[] = { {"host", I2C_PORT_HOST, 100}, diff --git a/board/kirby/board.h b/board/kirby/board.h index 138f7984d1..462f7d0e37 100644 --- a/board/kirby/board.h +++ b/board/kirby/board.h @@ -11,6 +11,8 @@ /* Optional features */ #define CONFIG_CHARGER #define CONFIG_CHARGER_BQ24192 +#define CONFIG_ADC +#define CONFIG_ADC_CLOCK #define CONFIG_CHIPSET_GAIA #undef CONFIG_CHIPSET_HAS_PP1350 #undef CONFIG_CHIPSET_HAS_PP5000 @@ -71,6 +73,15 @@ enum pwm_channel { PWM_CH_COUNT }; +/* ADC signals */ +enum adc_channel { + ADC_CH_USB_VBUS_SNS = 0, + ADC_CH_USB_DP_SNS, + ADC_CH_USB_DN_SNS, + /* Number of ADC channels */ + ADC_CH_COUNT +}; + /* GPIO signal list */ enum gpio_signal { /* Inputs with interrupt handlers are first for efficiency */ |