summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYilun Lin <yllin@chromium.org>2019-08-20 13:46:44 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-22 08:48:58 +0000
commitbe490b7261308362c6831ba2804c1504ba6aac15 (patch)
treedf7beea4424b322f718ce9016d89eb4314188ae6
parent60c1f84d024395fac90f144ad5a027f56b5ff3d0 (diff)
downloadchrome-ec-be490b7261308362c6831ba2804c1504ba6aac15.tar.gz
power: Replace weak attr with __overridable
This CL annotates __overridable to the following functions: board_system_is_idle power_chipset_handle_host_sleep_event power_board_handle_host_sleep_event TEST=make buildall BUG=none BRANCH=none Change-Id: I0168b69c49fab5672238711d4f3a6a5517cdd8b3 Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1761759 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--board/atlas/board.c3
-rw-r--r--board/nautilus/board.c3
-rw-r--r--board/nocturne/board.c3
-rw-r--r--board/poppy/board.c3
-rw-r--r--board/rammus/board.c3
-rw-r--r--board/samus/board.c4
-rw-r--r--include/chipset.h4
-rw-r--r--include/power.h9
-rw-r--r--power/common.c12
-rw-r--r--power/intel_x86.c10
10 files changed, 29 insertions, 25 deletions
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 1c86e589d8..6f49c78e91 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -365,7 +365,8 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
BD99992GW_REG_V085ACNT, 0x6a);
}
-void power_board_handle_host_sleep_event(enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(
+ enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index 5f79473bd7..48b316cd45 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -378,7 +378,8 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
}
-void power_board_handle_host_sleep_event(enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(
+ enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index faf18c359f..16a30571d4 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -520,7 +520,8 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x6a);
}
-void power_board_handle_host_sleep_event(enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(
+ enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
diff --git a/board/poppy/board.c b/board/poppy/board.c
index a6125ff3c6..b4eae018f3 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -468,7 +468,8 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
}
-void power_board_handle_host_sleep_event(enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(
+ enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
diff --git a/board/rammus/board.c b/board/rammus/board.c
index 6ba7907346..660ca860bc 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -390,7 +390,8 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
}
-void power_board_handle_host_sleep_event(enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(
+ enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
diff --git a/board/samus/board.c b/board/samus/board.c
index 02b80940f8..a7ec373d62 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -478,8 +478,8 @@ enum ec_error_list keyboard_scancode_callback(uint16_t *make_code,
#define HIBERNATE_BATT_PCT 10
#define HIBERNATE_BATT_SEC (3600 * 24)
-enum critical_shutdown board_system_is_idle(uint64_t last_shutdown_time,
- uint64_t *target, uint64_t now)
+__override enum critical_shutdown board_system_is_idle(
+ uint64_t last_shutdown_time, uint64_t *target, uint64_t now)
{
if (charge_get_percent() <= HIBERNATE_BATT_PCT) {
uint64_t t = last_shutdown_time + HIBERNATE_BATT_SEC * SEC_UL;
diff --git a/include/chipset.h b/include/chipset.h
index 05eeb844a1..9b30b7f454 100644
--- a/include/chipset.h
+++ b/include/chipset.h
@@ -246,8 +246,8 @@ void chipset_watchdog_interrupt(enum gpio_signal signal);
* @param now Current time
* @return Action to take
*/
-enum critical_shutdown board_system_is_idle(uint64_t last_shutdown_time,
- uint64_t *target, uint64_t now);
+__override_proto enum critical_shutdown board_system_is_idle(
+ uint64_t last_shutdown_time, uint64_t *target, uint64_t now);
#ifdef CONFIG_CMD_AP_RESET_LOG
diff --git a/include/power.h b/include/power.h
index b2ca21d83d..60f071a1dc 100644
--- a/include/power.h
+++ b/include/power.h
@@ -221,9 +221,9 @@ struct host_sleep_event_context {
* @param state Current host sleep state updated by the host.
* @param ctx Possible sleep parameters and return values, depending on state.
*/
-void
-power_chipset_handle_host_sleep_event(enum host_sleep_event state,
- struct host_sleep_event_context *ctx);
+__override_proto void power_chipset_handle_host_sleep_event(
+ enum host_sleep_event state,
+ struct host_sleep_event_context *ctx);
/**
* Provide callback to allow board to take any action on host sleep event
@@ -231,7 +231,8 @@ power_chipset_handle_host_sleep_event(enum host_sleep_event state,
*
* @param state Current host sleep state updated by the host.
*/
-void power_board_handle_host_sleep_event(enum host_sleep_event state);
+__override_proto void power_board_handle_host_sleep_event(
+ enum host_sleep_event state);
/*
* This is the default state of host sleep event. Calls to
diff --git a/power/common.c b/power/common.c
index 7dddd00682..f0fc3117d3 100644
--- a/power/common.c
+++ b/power/common.c
@@ -290,9 +290,8 @@ static void power_set_active_wake_mask(void)
static void power_set_active_wake_mask(void) { }
#endif
-__attribute__((weak))
-enum critical_shutdown board_system_is_idle(uint64_t last_shutdown_time,
- uint64_t *target, uint64_t now)
+__overridable enum critical_shutdown board_system_is_idle(
+ uint64_t last_shutdown_time, uint64_t *target, uint64_t now)
{
return now > *target ?
CRITICAL_SHUTDOWN_HIBERNATE : CRITICAL_SHUTDOWN_IGNORE;
@@ -882,9 +881,8 @@ DECLARE_CONSOLE_COMMAND(pause_in_s5, command_pause_in_s5,
/* Track last reported sleep event */
static enum host_sleep_event host_sleep_state;
-void __attribute__((weak))
-power_chipset_handle_host_sleep_event(enum host_sleep_event state,
- struct host_sleep_event_context *ctx)
+__overridable void power_chipset_handle_host_sleep_event(
+ enum host_sleep_event state, struct host_sleep_event_context *ctx)
{
/* Default weak implementation -- no action required. */
}
@@ -955,7 +953,7 @@ void power_set_host_sleep_state(enum host_sleep_event state)
static uint32_t pwr_5v_en_req;
static struct mutex pwr_5v_ctl_mtx;
-void __attribute__((weak)) power_5v_enable(task_id_t tid, int enable)
+void power_5v_enable(task_id_t tid, int enable)
{
mutex_lock(&pwr_5v_ctl_mtx);
diff --git a/power/intel_x86.c b/power/intel_x86.c
index 1574041ae4..093e9cbc1a 100644
--- a/power/intel_x86.c
+++ b/power/intel_x86.c
@@ -641,15 +641,15 @@ void common_intel_x86_handle_rsmrst(enum power_state state)
#ifdef CONFIG_POWER_TRACK_HOST_SLEEP_STATE
-void __attribute__((weak))
-power_board_handle_host_sleep_event(enum host_sleep_event state)
+__overridable void power_board_handle_host_sleep_event(
+ enum host_sleep_event state)
{
/* Default weak implementation -- no action required. */
}
-void
-power_chipset_handle_host_sleep_event(enum host_sleep_event state,
- struct host_sleep_event_context *ctx)
+__override void power_chipset_handle_host_sleep_event(
+ enum host_sleep_event state,
+ struct host_sleep_event_context *ctx)
{
power_board_handle_host_sleep_event(state);