GPIO: Rename and move board_set_gpio_hibernate_state

This function is no longer GPIO specific and fits better as part of the
system API, so this moves it there and renames it board_hibernate_late.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j

Change-Id: I39d3ecedadaaa22142cc82c79f5d25c891f3f38c
Reviewed-on: https://chromium-review.googlesource.com/330124
Commit-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Anton Staaf
2016-03-02 13:42:18 -08:00
committed by chrome-bot
parent 952b2a54e1
commit fa1653d240
6 changed files with 16 additions and 14 deletions

View File

@@ -428,7 +428,7 @@ static void board_chipset_suspend(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
void board_set_gpio_hibernate_state(void)
void board_hibernate_late(void)
{
/* Turn off LEDs in hibernate */
gpio_set_level(GPIO_CHARGE_LED_1, 0);

View File

@@ -376,7 +376,7 @@ static void board_chipset_suspend(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
void board_set_gpio_hibernate_state(void)
void board_hibernate_late(void)
{
int i;
const uint32_t hibernate_pins[][2] = {

View File

@@ -253,8 +253,8 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds)
CPU_SCB_SYSCTRL |= 0x4;
/* Setup GPIOs for hibernate */
if (board_set_gpio_hibernate_state)
board_set_gpio_hibernate_state();
if (board_hibernate_late)
board_hibernate_late();
#ifdef CONFIG_USB_PD_PORT_COUNT
/*

View File

@@ -315,10 +315,6 @@ void system_set_gpios_and_wakeup_inputs_hibernate(void)
/* Enable wake-up inputs of hibernate_wake_pins array */
for (i = 0; i < hibernate_wake_pins_used; i++)
gpio_reset(hibernate_wake_pins[i]);
/* board-level function to set GPIOs state in hibernate */
if (board_set_gpio_hibernate_state)
board_set_gpio_hibernate_state();
}
/**
@@ -383,6 +379,13 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds)
*/
system_set_gpios_and_wakeup_inputs_hibernate();
/*
* Give the board a chance to do any late stage hibernation work.
* This is likely going to configure GPIOs for hibernation.
*/
if (board_hibernate_late)
board_hibernate_late();
/* Clear all pending IRQ otherwise wfi will have no affect */
for (i = NPCX_IRQ_0 ; i < NPCX_IRQ_COUNT ; i++)
task_clear_pending_irq(i);

View File

@@ -225,7 +225,4 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags);
*/
void gpio_set_alternate_function(uint32_t port, uint32_t mask, int func);
/* Optional board-level function to set hibernate GPIO states. */
void board_set_gpio_hibernate_state(void) __attribute__((weak));
#endif /* __CROS_EC_GPIO_H */

View File

@@ -268,11 +268,13 @@ int system_set_vbnvcontext(const uint8_t *block);
void system_hibernate(uint32_t seconds, uint32_t microseconds);
/**
* Optional board-level callback function called prior to initiating chip-level
* hibernate sequence. This function may or may not return, depending if the
* board implements an alternate hibernate method.
* Optional board-level callback functions called before and after initiating
* chip-level hibernate sequence. These function may or may not return,
* depending if the board implements an alternate hibernate method. The _late
* version is called after interrupts are disabled.
*/
void board_hibernate(void) __attribute__((weak));
void board_hibernate_late(void) __attribute__((weak));
/* Minimum duration to get proper hibernation */
#define SYSTEM_HIB_MINIMUM_DURATION 0, 150000