diff options
author | Ruibin Chang <ruibin.chang@ite.com.tw> | 2020-03-12 11:34:55 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-13 05:00:32 +0000 |
commit | afb7e5bf31dd1a1d94f552554103952b0cc74cc6 (patch) | |
tree | 0db990967404cf09f7aa2a7985c9a912f47cb846 | |
parent | d7e7049b4569865b28c136ffc37c4ec0a0f061f8 (diff) | |
download | chrome-ec-afb7e5bf31dd1a1d94f552554103952b0cc74cc6.tar.gz |
it83xx/clock: Disable voltage comparator modules in hibernate
Disable all voltage comparator modules in hibernate
for better power consumption.
vcmp_enable() is moved out of #ifdef to avoid implicit
declaration error, because whether we define the CONFIG_ or not,
compiler always checks if (IS_ENABLED(CONFIG_)) { } block codes.
BUG=none
BRANCH=none
TEST=check voltage comparator control registers by console
Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
Change-Id: I4ab10a0a67cf00e5d697a2298711e589ccbc8eab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2097802
Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | chip/it83xx/adc_chip.h | 2 | ||||
-rw-r--r-- | chip/it83xx/clock.c | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/chip/it83xx/adc_chip.h b/chip/it83xx/adc_chip.h index e894e97b64..dd236994de 100644 --- a/chip/it83xx/adc_chip.h +++ b/chip/it83xx/adc_chip.h @@ -134,7 +134,7 @@ extern const struct adc_t adc_channels[]; * This must match the enum board_vcmp list provided by the board. */ extern const struct vcmp_t vcmp_list[]; -void vcmp_enable(int index, int enable); #endif +void vcmp_enable(int index, int enable); #endif /* __CROS_EC_ADC_CHIP_H */ diff --git a/chip/it83xx/clock.c b/chip/it83xx/clock.c index 755644ce9e..7684c48457 100644 --- a/chip/it83xx/clock.c +++ b/chip/it83xx/clock.c @@ -514,6 +514,15 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds) it83xx_disable_pd_module(i); } + if (IS_ENABLED(CONFIG_ADC_VOLTAGE_COMPARATOR)) { + /* + * Disable all voltage comparator modules in hibernate + * for better power consumption. + */ + for (i = CHIP_VCMP0; i < CHIP_VCMP_COUNT; i++) + vcmp_enable(i, 0); + } + for (i = 0; i < hibernate_wake_pins_used; ++i) gpio_enable_interrupt(hibernate_wake_pins[i]); |