intel/apollolake: Add power management utility function

This patch adds a power management utility function to
clear wake status bits in ACPI GPE0 registers. We need
to call this function before going to sleep from
common smi handler function.

BUG=chrome-os-partner:55583
BRANCH=None
TEST=Verified that system goes to sleep on lidclose and
     powerd_dbus_suspend command issued from built-in
     keyboard.

Change-Id: Icd095d377c82f2e154f2e2db773f737aa49cda64
Signed-off-by: Shaunak Saha <shaunak.saha@intel.com>
Reviewed-on: https://review.coreboot.org/16298
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Shaunak Saha 2016-08-22 21:55:23 -07:00 committed by Aaron Durbin
parent f7ce40baf6
commit d6bb5495f9
2 changed files with 11 additions and 0 deletions

View File

@ -173,6 +173,7 @@ uint16_t clear_pm1_status(void);
uint32_t clear_tco_status(void); uint32_t clear_tco_status(void);
uint32_t clear_gpe_status(void); uint32_t clear_gpe_status(void);
void clear_pmc_status(void); void clear_pmc_status(void);
void clear_gpi_gpe_sts(void);
uint32_t get_smi_en(void); uint32_t get_smi_en(void);
void enable_smi(uint32_t mask); void enable_smi(uint32_t mask);
void disable_smi(uint32_t mask); void disable_smi(uint32_t mask);

View File

@ -246,6 +246,16 @@ void disable_all_gpe(void)
disable_gpe(~0); disable_gpe(~0);
} }
/* Clear the gpio gpe0 status bits in ACPI registers */
void clear_gpi_gpe_sts(void)
{
int i;
for (i = 1; i < GPE0_REG_MAX; i++) {
uint32_t gpe_sts = inl(ACPI_PMIO_BASE + GPE0_STS(i));
outl(gpe_sts, ACPI_PMIO_BASE + GPE0_STS(i));
}
}
static uint32_t reset_gpe_status(void) static uint32_t reset_gpe_status(void)
{ {