summaryrefslogtreecommitdiff
path: root/board/spring
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2012-09-24 17:07:19 +0800
committerGerrit <chrome-bot@google.com>2012-09-26 08:58:59 -0700
commit1b14b2c922808ac1f7084f301d54173ca0074bf7 (patch)
treee2caa3a413513daf3dbb4bca4bfe65992755ab97 /board/spring
parentcfcd1412eae4f9f14076d357106709372ca6dc0b (diff)
downloadchrome-ec-1b14b2c922808ac1f7084f301d54173ca0074bf7.tar.gz
stm32f: ADC driver
This adds basic ADC support for multiple channel conversion. BUG=chrome-os-partner:14316 BRANCH=none TEST=1. Boot on snow. 2. Use keyboard signal as input. Check read value changes as input signal changes. Change-Id: I3c15c37446fa9273d098f6d581573c11ced45b5e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/33883 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/spring')
-rw-r--r--board/spring/board.c12
-rw-r--r--board/spring/board.h10
2 files changed, 22 insertions, 0 deletions
diff --git a/board/spring/board.c b/board/spring/board.c
index 10d7eb2f1c..9b52f48552 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -4,6 +4,7 @@
*/
/* Spring board-specific configuration */
+#include "adc.h"
#include "board.h"
#include "chipset.h"
#include "common.h"
@@ -14,6 +15,7 @@
#include "i2c.h"
#include "pmu_tpschrome.h"
#include "registers.h"
+#include "stm32_adc.h"
#include "timer.h"
#include "util.h"
@@ -95,6 +97,16 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"ILIM_500", GPIO_B, (1<<4), GPIO_OUT_LOW, NULL},
};
+/* ADC channels */
+const struct adc_t adc_channels[ADC_CH_COUNT] = {
+ /* Micro USB ID pin. Raw ADC value. */
+ [ADC_CH_USB_ID] = {"USB_ID", 0, 1, 1, 0, STM32_AIN(5), 0},
+ /* Micro USB D+ sense pin. Raw ADC value. */
+ [ADC_CH_USB_DP_SNS] = {"USB_DP_SNS", 0, 1, 1, 0, STM32_AIN(2), 0},
+ /* Micro USB D- sense pin. Raw ADC value. */
+ [ADC_CH_USB_DN_SNS] = {"USB_DN_SNS", 0, 1, 1, 0, STM32_AIN(4), 0},
+};
+
void configure_board(void)
{
uint32_t val;
diff --git a/board/spring/board.h b/board/spring/board.h
index 8acd4fc187..b8ec6ab2ea 100644
--- a/board/spring/board.h
+++ b/board/spring/board.h
@@ -55,6 +55,16 @@
/* Battery */
#define CONFIG_BATTERY_BQ20Z453
+/* ADC signal */
+#define CONFIG_ADC
+enum adc_channel {
+ ADC_CH_USB_ID = 0,
+ ADC_CH_USB_DP_SNS,
+ ADC_CH_USB_DN_SNS,
+
+ ADC_CH_COUNT
+};
+
/* GPIO signal list */
enum gpio_signal {
/* Inputs with interrupt handlers are first for efficiency */