diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-06-07 09:28:27 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-06-07 12:25:33 -0700 |
commit | f32ad15e37dd4ada6062b5f0a709d1b3c5b6e114 (patch) | |
tree | 2d1c1c7915c95468f308bf8ea6124ffb639ebb19 | |
parent | cf5b6daee3ee20ae70d87b599a76ec2decc01c62 (diff) | |
download | chrome-ec-f32ad15e37dd4ada6062b5f0a709d1b3c5b6e114.tar.gz |
Fix broken ADC gpio configuration for lm4
The ADC pins were being misconfigured for quite a while now. Let's fix 'em.
BUG=none
BRANCH=link
TEST=none
The effect was that the adc values that measure GPIO pins were less
accurate. Since no one noticed, there's probably not much that can
be done to test it.
Change-Id: I9def4eb95c89f72e5df0721e6153c8caa3ef8e2a
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57939
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | chip/lm4/adc.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/chip/lm4/adc.c b/chip/lm4/adc.c index 3bac9415c5..eb6f640680 100644 --- a/chip/lm4/adc.c +++ b/chip/lm4/adc.c @@ -20,14 +20,15 @@ static task_id_t task_waiting_on_ss[LM4_ADC_SEQ_COUNT]; static void configure_gpio(void) { - int i; + int i, port, mask; /* Use analog function for AIN */ for (i = 0; i < ADC_CH_COUNT; ++i) { if (adc_channels[i].gpio_mask) { - gpio_set_alternate_function(adc_channels[i].gpio_port, - adc_channels[i].gpio_mask, - 1); + mask = adc_channels[i].gpio_mask; + port = adc_channels[i].gpio_port; + LM4_GPIO_DEN(port) &= ~mask; + LM4_GPIO_AMSEL(port) |= mask; } } } |