summaryrefslogtreecommitdiff
path: root/common/power_button_x86.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/power_button_x86.c')
-rw-r--r--common/power_button_x86.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/common/power_button_x86.c b/common/power_button_x86.c
index fd24f7a75b..efa51530e5 100644
--- a/common/power_button_x86.c
+++ b/common/power_button_x86.c
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,7 +23,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SWITCH, outstr)
-#define CPRINTS(format, args...) cprints(CC_SWITCH, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SWITCH, format, ##args)
/*
* x86 chipsets have a hardware timer on the power button input which causes
@@ -54,14 +54,14 @@
* to host v v
* @S0 make code break code
*/
-#define PWRBTN_DELAY_T0 (32 * MSEC) /* 32ms (PCH requires >16ms) */
-#define PWRBTN_DELAY_T1 (4 * SECOND - PWRBTN_DELAY_T0) /* 4 secs - t0 */
+#define PWRBTN_DELAY_T0 (32 * MSEC) /* 32ms (PCH requires >16ms) */
+#define PWRBTN_DELAY_T1 (4 * SECOND - PWRBTN_DELAY_T0) /* 4 secs - t0 */
/*
* Length of time to stretch initial power button press to give chipset a
* chance to wake up (~100ms) and react to the press (~16ms). Also used as
* pulse length for simulated power button presses when the system is off.
*/
-#define PWRBTN_INITIAL_US (200 * MSEC)
+#define PWRBTN_INITIAL_US (200 * MSEC)
enum power_button_state {
/* Button up; state machine idle */
@@ -92,18 +92,9 @@ enum power_button_state {
};
static enum power_button_state pwrbtn_state = PWRBTN_STATE_IDLE;
-static const char * const state_names[] = {
- "idle",
- "pressed",
- "t0",
- "t1",
- "held",
- "lid-open",
- "released",
- "eat-release",
- "init-on",
- "recovery",
- "was-off",
+static const char *const state_names[] = {
+ "idle", "pressed", "t0", "t1", "held", "lid-open",
+ "released", "eat-release", "init-on", "recovery", "was-off",
};
/*
@@ -139,7 +130,7 @@ static void set_pwrbtn_to_pch(int high, int init)
*/
#ifdef CONFIG_CHARGER
if (chipset_in_state(CHIPSET_STATE_ANY_OFF) && !high &&
- (charge_want_shutdown() || charge_prevent_power_on(!init))) {
+ (charge_want_shutdown() || charge_prevent_power_on(!init))) {
CPRINTS("PB PCH pwrbtn ignored due to battery level");
high = 1;
}
@@ -346,8 +337,8 @@ static void state_machine(uint64_t tnow)
if (!IS_ENABLED(CONFIG_CHARGER) || charge_prevent_power_on(0)) {
if (tnow >
- (tpb_task_start +
- CONFIG_POWER_BUTTON_INIT_TIMEOUT * SECOND)) {
+ (tpb_task_start +
+ CONFIG_POWER_BUTTON_INIT_TIMEOUT * SECOND)) {
pwrbtn_state = PWRBTN_STATE_IDLE;
break;
}
@@ -366,9 +357,9 @@ static void state_machine(uint64_t tnow)
#ifdef CONFIG_DELAY_DSW_PWROK_TO_PWRBTN
/* Check if power button is ready. If not, we'll come back. */
if (get_time().val - get_time_dsw_pwrok() <
- CONFIG_DSW_PWROK_TO_PWRBTN_US) {
+ CONFIG_DSW_PWROK_TO_PWRBTN_US) {
tnext_state = get_time_dsw_pwrok() +
- CONFIG_DSW_PWROK_TO_PWRBTN_US;
+ CONFIG_DSW_PWROK_TO_PWRBTN_US;
break;
}
#endif
@@ -444,7 +435,7 @@ void power_button_task(void *u)
* early.)
*/
CPRINTS("PB task %d = %s, wait %d", pwrbtn_state,
- state_names[pwrbtn_state], d);
+ state_names[pwrbtn_state], d);
task_wait_event(d);
}
}
@@ -533,7 +524,6 @@ static enum ec_status hc_config_powerbtn_x86(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_CONFIG_POWER_BUTTON, hc_config_powerbtn_x86,
EC_VER_MASK(0));
-
/*
* Currently, the only reason why we disable power button pulse is to allow
* detachable menu on AP to use power button for selection purpose without
@@ -554,8 +544,8 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, power_button_pulse_setting_reset,
DECLARE_HOOK(HOOK_CHIPSET_RESUME, power_button_pulse_setting_reset,
HOOK_PRIO_DEFAULT);
-#define POWER_BUTTON_SYSJUMP_TAG 0x5042 /* PB */
-#define POWER_BUTTON_HOOK_VERSION 1
+#define POWER_BUTTON_SYSJUMP_TAG 0x5042 /* PB */
+#define POWER_BUTTON_HOOK_VERSION 1
static void power_button_pulse_setting_restore_state(void)
{
@@ -574,8 +564,7 @@ DECLARE_HOOK(HOOK_INIT, power_button_pulse_setting_restore_state,
static void power_button_pulse_setting_preserve_state(void)
{
- system_add_jump_tag(POWER_BUTTON_SYSJUMP_TAG,
- POWER_BUTTON_HOOK_VERSION,
+ system_add_jump_tag(POWER_BUTTON_SYSJUMP_TAG, POWER_BUTTON_HOOK_VERSION,
sizeof(power_button_pulse_enabled),
&power_button_pulse_enabled);
}