summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2015-01-05 15:58:07 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-07 23:26:12 +0000
commit0825fdf352d29430c8a3415f80371e0d8dacd20e (patch)
tree75a9b7eb8fb61dfcfe41937e702bf86c9f91f305
parente75c33e283deeef58fec03fed91df372b176dfcb (diff)
downloadchrome-ec-0825fdf352d29430c8a3415f80371e0d8dacd20e.tar.gz
Read ADC channels one by one for STM32F
Currently, we are seeing problem with adc_read_all_channels() for STM32F, and thus 'adc' console command reports incorrect values. Before that's fixed, read ADC channels one by one to work around this problem. BRANCH=Ryu BUG=chrome-os-partner:33971 TEST='adc' on Ryu Signed-off-by: Vic Yang <victoryang@chromium.org> Change-Id: Iae92b82b24f6a843b9d46a8804da1e51d33ed7cb Reviewed-on: https://chromium-review.googlesource.com/231125 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/stm32/adc-stm32f.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/chip/stm32/adc-stm32f.c b/chip/stm32/adc-stm32f.c
index d1ffcd7f63..1d71b37c86 100644
--- a/chip/stm32/adc-stm32f.c
+++ b/chip/stm32/adc-stm32f.c
@@ -59,7 +59,7 @@ static void adc_configure(int ain_id)
STM32_ADC_CR1 &= ~(1 << 8);
}
-static void adc_configure_all(void)
+static void __attribute__((unused)) adc_configure_all(void)
{
int i;
@@ -210,6 +210,11 @@ int adc_read_channel(enum adc_channel ch)
value * adc->factor_mul / adc->factor_div + adc->shift;
}
+/*
+ * adc_read_all_channels() is not working properly on STM32F373.
+ * TODO(crosbug.com/p/33971): Fix it.
+ */
+#if 0
int adc_read_all_channels(int *data)
{
int i;
@@ -255,6 +260,15 @@ exit_all_channels:
mutex_unlock(&adc_lock);
return ret;
}
+#endif
+
+int adc_read_all_channels(int *data)
+{
+ int i;
+ for (i = 0; i < ADC_CH_COUNT; ++i)
+ data[i] = adc_read_channel(i);
+ return EC_SUCCESS;
+}
static void adc_init(void)
{