From c7eb5a5cce1aaf6a07231085e63a36c3431ee920 Mon Sep 17 00:00:00 2001 From: Jack Rosenthal Date: Mon, 27 Jun 2022 14:38:52 -0600 Subject: common/power_button_x86.c: Format with clang-format BUG=b:236386294 BRANCH=none TEST=none Change-Id: I91d391bd5d39b8263dcc343bbf132b4fd71e9597 Signed-off-by: Jack Rosenthal Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729701 Reviewed-by: Jeremy Bettis --- common/power_button_x86.c | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) (limited to 'common/power_button_x86.c') diff --git a/common/power_button_x86.c b/common/power_button_x86.c index fd24f7a75b..3e2cb51ef2 100644 --- a/common/power_button_x86.c +++ b/common/power_button_x86.c @@ -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); } -- cgit v1.2.1 From 71b2ef709dcb14260f5fdaa3ab4ced005a29fb46 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 12 Sep 2022 14:54:36 -0400 Subject: Update license boilerplate text in source code files Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis Reviewed-by: Jack Rosenthal --- common/power_button_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/power_button_x86.c') diff --git a/common/power_button_x86.c b/common/power_button_x86.c index 3e2cb51ef2..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. */ -- cgit v1.2.1