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>
This commit is contained in:
Vic Yang
2015-01-05 15:58:07 -08:00
committed by ChromeOS Commit Bot
parent e75c33e283
commit 0825fdf352

View File

@@ -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)
{