summaryrefslogtreecommitdiff
path: root/baseboard
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-06-27 13:15:39 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-29 11:10:28 +0000
commit7d89813c3da82651f055e7665999a962a4b20ccd (patch)
tree26bb60b0e83ce9b3a61caaf58b5ce3d3b000a7cb /baseboard
parentd2c9f8e25ee78e5e8c5879ce1e7cb60a9d4d238b (diff)
downloadchrome-ec-7d89813c3da82651f055e7665999a962a4b20ccd.tar.gz
baseboard/honeybuns/baseboard.c: Format with clang-format
BUG=b:236386294 BRANCH=none TEST=none Change-Id: Icd49188dc3f45848603f55b2d756d92d49bf9563 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3727888 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r--baseboard/honeybuns/baseboard.c57
1 files changed, 24 insertions, 33 deletions
diff --git a/baseboard/honeybuns/baseboard.c b/baseboard/honeybuns/baseboard.c
index e7df1b6ef4..58d07168c8 100644
--- a/baseboard/honeybuns/baseboard.c
+++ b/baseboard/honeybuns/baseboard.c
@@ -18,20 +18,17 @@
#include "driver/tcpm/tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
#define POWER_BUTTON_SHORT_USEC (300 * MSEC)
#define POWER_BUTTON_LONG_USEC (5000 * MSEC)
#define POWER_BUTTON_DEBOUNCE_USEC (30)
-#define BUTTON_EVT_CHANGE BIT(0)
-#define BUTTON_EVT_INFO BIT(1)
+#define BUTTON_EVT_CHANGE BIT(0)
+#define BUTTON_EVT_INFO BIT(1)
-enum power {
- POWER_OFF,
- POWER_ON
-};
+enum power { POWER_OFF, POWER_ON };
enum button {
BUTTON_RELEASE,
@@ -66,7 +63,7 @@ __maybe_unused static void board_power_sequence(int enable)
int i;
if (enable) {
- for(i = 0; i < board_power_seq_count; i++) {
+ for (i = 0; i < board_power_seq_count; i++) {
gpio_set_level(board_power_seq[i].signal,
board_power_seq[i].level);
CPRINTS("power seq: rail = %d", i);
@@ -74,7 +71,7 @@ __maybe_unused static void board_power_sequence(int enable)
msleep(board_power_seq[i].delay_ms);
}
} else {
- for(i = board_power_seq_count - 1; i >= 0; i--) {
+ for (i = board_power_seq_count - 1; i >= 0; i--) {
gpio_set_level(board_power_seq[i].signal,
!board_power_seq[i].level);
CPRINTS("sequence[%d]: level = %d", i,
@@ -89,20 +86,16 @@ __maybe_unused static void board_power_sequence(int enable)
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "i2c1",
- .port = I2C_PORT_I2C1,
- .kbps = 400,
- .scl = GPIO_EC_I2C1_SCL,
- .sda = GPIO_EC_I2C1_SDA
- },
- {
- .name = "i2c3",
- .port = I2C_PORT_I2C3,
- .kbps = 400,
- .scl = GPIO_EC_I2C3_SCL,
- .sda = GPIO_EC_I2C3_SDA
- },
+ { .name = "i2c1",
+ .port = I2C_PORT_I2C1,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C1_SCL,
+ .sda = GPIO_EC_I2C1_SDA },
+ { .name = "i2c3",
+ .port = I2C_PORT_I2C3,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C3_SCL,
+ .sda = GPIO_EC_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -246,7 +239,7 @@ static void baseboard_init(void)
#else
/* Set up host port usbc to present Rd on CC lines */
- if(baseboard_usbc_init(USB_PD_PORT_HOST))
+ if (baseboard_usbc_init(USB_PD_PORT_HOST))
CPRINTS("usbc: Failed to set up sink path");
else
CPRINTS("usbc: sink path configure success!");
@@ -381,11 +374,11 @@ void power_button_task(void *u)
* Default wait state: Only need to check if the button
* is pressed and start the short press timer.
*/
- if (evt & BUTTON_EVT_CHANGE && button_level ==
- BUTTON_PRESSED_LEVEL) {
+ if (evt & BUTTON_EVT_CHANGE &&
+ button_level == BUTTON_PRESSED_LEVEL) {
state = BUTTON_PRESS;
timer_us = (POWER_BUTTON_SHORT_USEC -
- POWER_BUTTON_DEBOUNCE_USEC);
+ POWER_BUTTON_DEBOUNCE_USEC);
}
break;
case BUTTON_PRESS:
@@ -399,7 +392,7 @@ void power_button_task(void *u)
} else {
/* Start long press timer */
timer_us = POWER_BUTTON_LONG_USEC -
- POWER_BUTTON_SHORT_USEC;
+ POWER_BUTTON_SHORT_USEC;
/*
* If dock is currently off, then change to the
* power on state. If dock is already on, then
@@ -407,7 +400,7 @@ void power_button_task(void *u)
*/
if (dock_state == POWER_OFF) {
baseboard_power_on();
- state = BUTTON_PRESS_POWER_ON;
+ state = BUTTON_PRESS_POWER_ON;
} else {
state = BUTTON_PRESS_SHORT;
}
@@ -476,7 +469,6 @@ void baseboard_power_button_evt(int level)
static int command_pwr_btn(int argc, char **argv)
{
-
if (argc == 1) {
task_set_event(TASK_ID_POWER_BUTTON, BUTTON_EVT_INFO);
return EC_SUCCESS;
@@ -494,8 +486,7 @@ static int command_pwr_btn(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(pwr_btn, command_pwr_btn,
- "<on|off|mf>",
+DECLARE_CONSOLE_COMMAND(pwr_btn, command_pwr_btn, "<on|off|mf>",
"Simulate Power Button Press");
#endif