summaryrefslogtreecommitdiff
path: root/zephyr/subsys
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-06-27 15:40:11 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-01 19:12:04 +0000
commitbe3e2d6cdd49f8f957d6efc94e8c6f4e17b54634 (patch)
treeb95e43b34327e7a41c75219626f52b9e990a53d5 /zephyr/subsys
parent0f7df8c86d96f441e0e7a0fdb381a7c80cb9a90f (diff)
downloadchrome-ec-be3e2d6cdd49f8f957d6efc94e8c6f4e17b54634.tar.gz
zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c: Format with clang-format
BUG=b:236386294 BRANCH=none TEST=none Change-Id: Iee2782fc32c857462eaa2ca869b22c2756405cd1 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730922 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'zephyr/subsys')
-rw-r--r--zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c65
1 files changed, 30 insertions, 35 deletions
diff --git a/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c b/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c
index 561c789e80..2bbcce4d39 100644
--- a/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c
+++ b/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c
@@ -8,8 +8,7 @@
#include <x86_non_dsx_common_pwrseq_sm_handler.h>
-static K_KERNEL_STACK_DEFINE(pwrseq_thread_stack,
- CONFIG_AP_PWRSEQ_STACK_SIZE);
+static K_KERNEL_STACK_DEFINE(pwrseq_thread_stack, CONFIG_AP_PWRSEQ_STACK_SIZE);
static struct k_thread pwrseq_thread_data;
static struct pwrseq_context pwrseq_ctx;
/* S5 inactive timer*/
@@ -26,13 +25,12 @@ static ATOMIC_DEFINE(flags, FLAGS_MAX);
/* Delay in ms when starting from G3 */
static uint32_t start_from_g3_delay_ms;
-
LOG_MODULE_REGISTER(ap_pwrseq, CONFIG_AP_PWRSEQ_LOG_LEVEL);
/**
* @brief power_state names for debug
*/
-static const char * const pwrsm_dbg[] = {
+static const char *const pwrsm_dbg[] = {
[SYS_POWER_STATE_G3] = "G3",
[SYS_POWER_STATE_S5] = "S5",
[SYS_POWER_STATE_S4] = "S4",
@@ -94,7 +92,7 @@ enum power_states_ndsx pwr_sm_get_state(void)
return pwrseq_ctx.power_state;
}
-const char * const pwr_sm_get_state_name(enum power_states_ndsx state)
+const char *const pwr_sm_get_state_name(enum power_states_ndsx state)
{
return pwrsm_dbg[state];
}
@@ -235,7 +233,7 @@ static int common_pwr_sm_run(int state)
case SYS_POWER_STATE_G3S5:
if ((power_get_signals() & PWRSEQ_G3S5_UP_SIGNAL) ==
- PWRSEQ_G3S5_UP_VALUE)
+ PWRSEQ_G3S5_UP_VALUE)
return SYS_POWER_STATE_S5;
else
return SYS_POWER_STATE_S5G3;
@@ -243,15 +241,15 @@ static int common_pwr_sm_run(int state)
case SYS_POWER_STATE_S5:
/* In S5 make sure no more signal lost */
/* If A-rails are stable then move to higher state */
- if (board_ap_power_check_power_rails_enabled()
- && rsmrst_power_is_good()) {
+ if (board_ap_power_check_power_rails_enabled() &&
+ rsmrst_power_is_good()) {
/* rsmrst is intact */
rsmrst_pass_thru_handler();
if (signals_valid_and_off(IN_PCH_SLP_S5)) {
k_timer_stop(&s5_inactive_timer);
/* Clear the timer running flag */
atomic_clear_bit(flags,
- S5_INACTIVE_TIMER_RUNNING);
+ S5_INACTIVE_TIMER_RUNNING);
/* Clear any request to exit hard-off */
atomic_clear_bit(flags, START_FROM_G3);
LOG_INF("Clearing request to exit G3");
@@ -277,20 +275,20 @@ static int common_pwr_sm_run(int state)
* and it is started (and the flag is set),
* otherwise it is already set, so no change.
*/
- if (!atomic_test_and_set_bit(flags,
- S5_INACTIVE_TIMER_RUNNING)) {
+ if (!atomic_test_and_set_bit(
+ flags, S5_INACTIVE_TIMER_RUNNING)) {
/*
* Timer is not started, or needs
* restarting.
*/
k_timer_start(&s5_inactive_timer,
- K_SECONDS(AP_PWRSEQ_DT_VALUE(
- s5_inactivity_timeout)),
- K_NO_WAIT);
+ K_SECONDS(AP_PWRSEQ_DT_VALUE(
+ s5_inactivity_timeout)),
+ K_NO_WAIT);
} else if (k_timer_status_get(&s5_inactive_timer) > 0) {
/* Timer is expired */
atomic_clear_bit(flags,
- S5_INACTIVE_TIMER_RUNNING);
+ S5_INACTIVE_TIMER_RUNNING);
return SYS_POWER_STATE_S5G3;
}
}
@@ -373,7 +371,7 @@ static int common_pwr_sm_run(int state)
case SYS_POWER_STATE_S0ix:
/* System in S0 only if SLP_S0 and SLP_S3 are de-asserted */
if (power_signals_off(IN_PCH_SLP_S0) &&
- signals_valid_and_off(IN_PCH_SLP_S3)) {
+ signals_valid_and_off(IN_PCH_SLP_S3)) {
/* TODO: Make sure ap reset handling is done
* before leaving S0ix.
*/
@@ -425,19 +423,19 @@ static int common_pwr_sm_run(int state)
return SYS_POWER_STATE_S0S3;
#if CONFIG_AP_PWRSEQ_S0IX
- /*
- * SLP_S0 may assert in system idle scenario without a kernel
- * freeze call. This may cause interrupt storm since there is
- * no freeze/unfreeze of threads/process in the idle scenario.
- * Ignore the SLP_S0 assertions in idle scenario by checking
- * the host sleep state.
- */
+ /*
+ * SLP_S0 may assert in system idle scenario without a
+ * kernel freeze call. This may cause interrupt storm
+ * since there is no freeze/unfreeze of threads/process
+ * in the idle scenario. Ignore the SLP_S0 assertions in
+ * idle scenario by checking the host sleep state.
+ */
} else if (ap_power_sleep_get_notify() ==
- AP_POWER_SLEEP_SUSPEND &&
- power_signals_on(IN_PCH_SLP_S0)) {
+ AP_POWER_SLEEP_SUSPEND &&
+ power_signals_on(IN_PCH_SLP_S0)) {
return SYS_POWER_STATE_S0S0ix;
} else if (ap_power_sleep_get_notify() ==
- AP_POWER_SLEEP_RESUME) {
+ AP_POWER_SLEEP_RESUME) {
ap_power_sleep_notify_transition(AP_POWER_SLEEP_RESUME);
#endif /* CONFIG_AP_PWRSEQ_S0IX */
}
@@ -537,9 +535,8 @@ static void pwrseq_loop_thread(void *p1, void *p2, void *p3)
this_in_signals = power_get_signals();
if (this_in_signals != last_in_signals ||
- curr_state != last_state) {
- LOG_INF("power state %d = %s, in 0x%04x",
- curr_state,
+ curr_state != last_state) {
+ LOG_INF("power state %d = %s, in 0x%04x", curr_state,
pwr_sm_get_state_name(curr_state),
this_in_signals);
last_in_signals = this_in_signals;
@@ -569,14 +566,12 @@ static void pwrseq_loop_thread(void *p1, void *p2, void *p3)
static inline void create_pwrseq_thread(void)
{
- k_thread_create(&pwrseq_thread_data,
- pwrseq_thread_stack,
+ k_thread_create(&pwrseq_thread_data, pwrseq_thread_stack,
K_KERNEL_STACK_SIZEOF(pwrseq_thread_stack),
- (k_thread_entry_t)pwrseq_loop_thread,
- NULL, NULL, NULL,
+ (k_thread_entry_t)pwrseq_loop_thread, NULL, NULL, NULL,
CONFIG_AP_PWRSEQ_THREAD_PRIORITY, 0,
- IS_ENABLED(CONFIG_AP_PWRSEQ_AUTOSTART) ? K_NO_WAIT
- : K_FOREVER);
+ IS_ENABLED(CONFIG_AP_PWRSEQ_AUTOSTART) ? K_NO_WAIT :
+ K_FOREVER);
k_thread_name_set(&pwrseq_thread_data, "pwrseq_task");
}