diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2013-02-25 18:18:49 -0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-02-25 22:22:34 -0800 |
commit | 2cf4d02acdd3ca3eec4a925666e839f0de23c0b0 (patch) | |
tree | f52035cb8c3efa9fe575157805678e757fe4fc9a /board | |
parent | 10f34bf8a99204b78bc7318d988048f180059a60 (diff) | |
download | chrome-ec-2cf4d02acdd3ca3eec4a925666e839f0de23c0b0.tar.gz |
keep ADC reference voltage on between successive reads
To decrease the amount of time needed for PMU ADC reads, add the option
to keep the ADC reference voltage enable as its stabilization time is
the longest pole.
Also set the stabilization time to 10ms as the max defined in the
datasheet.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:17997
TEST=on Spring, measure EC_CMD_POWER_INFO latency and see it going from
49ms to 18ms.
Change-Id: I7ed20bcddab165250108eb9f768539b19fa251de
Reviewed-on: https://gerrit.chromium.org/gerrit/44008
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/spring/board.c | 6 | ||||
-rw-r--r-- | board/spring/usb_charging.c | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/board/spring/board.c b/board/spring/board.c index 8307dd9ab8..da74c966ee 100644 --- a/board/spring/board.c +++ b/board/spring/board.c @@ -345,8 +345,10 @@ static int power_command_info(struct host_cmd_handler_args *args) struct ec_response_power_info *r = args->response; r->voltage_ac = adc_read_channel(ADC_CH_USB_VBUS_SNS); - r->voltage_system = pmu_adc_read(ADC_VAC) * 17000 / 1024; - r->current_system = pmu_adc_read(ADC_IAC) * 20 * 33 / 1024; + r->voltage_system = pmu_adc_read(ADC_VAC, ADC_FLAG_KEEP_ON) + * 17000 / 1024; + r->current_system = pmu_adc_read(ADC_IAC, 0) + * 20 * 33 / 1024; r->usb_dev_type = board_get_usb_dev_type(); r->usb_current_limit = board_get_usb_current_limit(); args->response_size = sizeof(*r); diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c index a7f3e45728..ce864e1d9f 100644 --- a/board/spring/usb_charging.c +++ b/board/spring/usb_charging.c @@ -426,10 +426,14 @@ static int command_batdebug(int argc, char **argv) { int val; ccprintf("VBUS = %d mV\n", adc_read_channel(ADC_CH_USB_VBUS_SNS)); - ccprintf("VAC = %d mV\n", pmu_adc_read(ADC_VAC) * 17000 / 1024); - ccprintf("IAC = %d mA\n", pmu_adc_read(ADC_IAC) * 20 * 33 / 1024); - ccprintf("VBAT = %d mV\n", pmu_adc_read(ADC_VBAT) * 17000 / 1024); - ccprintf("IBAT = %d mA\n", pmu_adc_read(ADC_IBAT) * 50 * 40 / 1024); + ccprintf("VAC = %d mV\n", pmu_adc_read(ADC_VAC, ADC_FLAG_KEEP_ON) + * 17000 / 1024); + ccprintf("IAC = %d mA\n", pmu_adc_read(ADC_IAC, ADC_FLAG_KEEP_ON) + * 20 * 33 / 1024); + ccprintf("VBAT = %d mV\n", pmu_adc_read(ADC_VBAT, ADC_FLAG_KEEP_ON) + * 17000 / 1024); + ccprintf("IBAT = %d mA\n", pmu_adc_read(ADC_IBAT, 0) + * 50 * 40 / 1024); ccprintf("PWM = %d%%\n", STM32_TIM_CCR1(3)); battery_current(&val); ccprintf("Battery Current = %d mA\n", val); |