summaryrefslogtreecommitdiff
path: root/board/scarlet
diff options
context:
space:
mode:
Diffstat (limited to 'board/scarlet')
-rw-r--r--board/scarlet/battery.c20
-rw-r--r--board/scarlet/board.c122
-rw-r--r--board/scarlet/board.h47
-rw-r--r--board/scarlet/build.mk2
-rw-r--r--board/scarlet/ec.tasklist2
-rw-r--r--board/scarlet/gpio.inc2
-rw-r--r--board/scarlet/led.c30
-rw-r--r--board/scarlet/usb_pd_policy.c7
8 files changed, 112 insertions, 120 deletions
diff --git a/board/scarlet/battery.c b/board/scarlet/battery.c
index 0be4cc93e2..5d4412f66c 100644
--- a/board/scarlet/battery.c
+++ b/board/scarlet/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -32,11 +32,7 @@
static uint8_t batt_id = 0xff;
/* Do not change the enum values. We directly use strap gpio level to index. */
-enum battery_type {
- BATTERY_SIMPLO = 0,
- BATTERY_AETECH,
- BATTERY_COUNT
-};
+enum battery_type { BATTERY_SIMPLO = 0, BATTERY_AETECH, BATTERY_COUNT };
static const struct battery_info info[] = {
[BATTERY_SIMPLO] = {
@@ -192,7 +188,7 @@ int charger_profile_override(struct charge_state_data *curr)
else {
for (temp_zone = 0; temp_zone < TEMP_ZONE_COUNT; temp_zone++) {
if (bat_temp_c <
- temp_zones[batt_id][temp_zone].temp_max)
+ temp_zones[batt_id][temp_zone].temp_max)
break;
}
}
@@ -233,9 +229,10 @@ int charger_profile_override(struct charge_state_data *curr)
curr->requested_voltage =
temp_zones[batt_id][temp_zone].desired_voltage;
- curr->requested_current = (charge_phase) ?
- CHARGE_PHASE_CHANGED_CURRENT_MA :
- temp_zones[batt_id][temp_zone].desired_current;
+ curr->requested_current =
+ (charge_phase) ?
+ CHARGE_PHASE_CHANGED_CURRENT_MA :
+ temp_zones[batt_id][temp_zone].desired_current;
break;
case TEMP_OUT_OF_RANGE:
curr->requested_current = curr->requested_voltage = 0;
@@ -281,8 +278,7 @@ static void board_charge_termination(void)
te = 1;
}
}
-DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE,
- board_charge_termination,
+DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE, board_charge_termination,
HOOK_PRIO_DEFAULT);
/* Customs options controllable by host command. */
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index 3d9049c983..34e5cc456c 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,6 +24,7 @@
#include "hooks.h"
#include "host_command.h"
#include "i2c.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -43,8 +44,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -68,27 +69,23 @@ static void warm_reset_request_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "charger",
- .port = I2C_PORT_CHARGER,
- .kbps = 400,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
+ { .name = "charger",
+ .port = I2C_PORT_CHARGER,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -104,22 +101,22 @@ const struct charger_config_t chg_chips[] = {
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PP1250_S3_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP1250_S3_PWR_GOOD"},
- {GPIO_PP900_S0_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP900_S0_PWR_GOOD"},
- {GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD"},
- {GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED"},
+ { GPIO_PP1250_S3_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP1250_S3_PWR_GOOD" },
+ { GPIO_PP900_S0_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP900_S0_PWR_GOOD" },
+ { GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD" },
+ { GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
#ifdef CONFIG_TEMP_SENSOR_TMP432
/* Temperature sensors data; must be in same order as enum temp_sensor_id. */
const struct temp_sensor_t temp_sensors[] = {
- {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_LOCAL, 4},
- {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE1, 4},
- {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE2, 4},
+ { "TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_LOCAL, 4 },
+ { "TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE1, 4 },
+ { "TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE2, 4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -128,9 +125,9 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
* same order as enum temp_sensor_id. To always ignore any temp, use 0.
*/
struct ec_thermal_config thermal_params[] = {
- {{0, 0, 0}, 0, 0}, /* TMP432_Internal */
- {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */
- {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */
+ { { 0, 0, 0 }, 0, 0 }, /* TMP432_Internal */
+ { { 0, 0, 0 }, 0, 0 }, /* TMP432_Sensor_1 */
+ { { 0, 0, 0 }, 0, 0 }, /* TMP432_Sensor_2 */
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
#endif
@@ -154,11 +151,14 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
};
@@ -166,11 +166,11 @@ void board_reset_pd_mcu(void)
{
}
-enum critical_shutdown board_critical_shutdown_check(
- struct charge_state_data *curr)
+enum critical_shutdown
+board_critical_shutdown_check(struct charge_state_data *curr)
{
if ((curr->batt.flags & BATT_FLAG_BAD_VOLTAGE) ||
- (curr->batt.voltage <= BAT_LOW_VOLTAGE_THRESH))
+ (curr->batt.voltage <= BAT_LOW_VOLTAGE_THRESH))
return CRITICAL_SHUTDOWN_CUTOFF;
else
return CRITICAL_SHUTDOWN_IGNORE;
@@ -212,11 +212,11 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int extpower_is_present(void)
@@ -252,8 +252,7 @@ static void board_spi_enable(void)
spi_enable(&spi_devices[0], 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -265,8 +264,7 @@ static void board_spi_disable(void)
gpio_config_module(MODULE_SPI_CONTROLLER, 0);
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
static void board_init(void)
@@ -306,8 +304,8 @@ void board_config_pre_init(void)
* Ch4: USART1_TX / Ch5: USART1_RX (1000)
* Ch6: SPI2_RX / Ch7: SPI2_TX (0011)
*/
- STM32_DMA_CSELR(STM32_DMAC_CH4) = (8 << 12) | (8 << 16) |
- (3 << 20) | (3 << 24);
+ STM32_DMA_CSELR(STM32_DMAC_CH4) = (8 << 12) | (8 << 16) | (3 << 20) |
+ (3 << 24);
}
enum scarlet_board_version {
@@ -335,16 +333,16 @@ struct {
enum scarlet_board_version version;
int expect_mv;
} const scarlet_boards[] = {
- { BOARD_VERSION_REV0, 109 }, /* 51.1K , 2.2K(gru 3.3K) ohm */
- { BOARD_VERSION_REV1, 211 }, /* 51.1k , 6.8K ohm */
- { BOARD_VERSION_REV2, 319 }, /* 51.1K , 11K ohm */
- { BOARD_VERSION_REV3, 427 }, /* 56K , 17.4K ohm */
- { BOARD_VERSION_REV4, 542 }, /* 51.1K , 22K ohm */
- { BOARD_VERSION_REV5, 666 }, /* 51.1K , 30K ohm */
- { BOARD_VERSION_REV6, 781 }, /* 51.1K , 39.2K ohm */
- { BOARD_VERSION_REV7, 900 }, /* 56K , 56K ohm */
- { BOARD_VERSION_REV8, 1023 }, /* 47K , 61.9K ohm */
- { BOARD_VERSION_REV9, 1137 }, /* 47K , 80.6K ohm */
+ { BOARD_VERSION_REV0, 109 }, /* 51.1K , 2.2K(gru 3.3K) ohm */
+ { BOARD_VERSION_REV1, 211 }, /* 51.1k , 6.8K ohm */
+ { BOARD_VERSION_REV2, 319 }, /* 51.1K , 11K ohm */
+ { BOARD_VERSION_REV3, 427 }, /* 56K , 17.4K ohm */
+ { BOARD_VERSION_REV4, 542 }, /* 51.1K , 22K ohm */
+ { BOARD_VERSION_REV5, 666 }, /* 51.1K , 30K ohm */
+ { BOARD_VERSION_REV6, 781 }, /* 51.1K , 39.2K ohm */
+ { BOARD_VERSION_REV7, 900 }, /* 56K , 56K ohm */
+ { BOARD_VERSION_REV8, 1023 }, /* 47K , 61.9K ohm */
+ { BOARD_VERSION_REV9, 1137 }, /* 47K , 80.6K ohm */
{ BOARD_VERSION_REV10, 1240 }, /* 56K , 124K ohm */
{ BOARD_VERSION_REV11, 1343 }, /* 51.1K , 150K ohm */
{ BOARD_VERSION_REV12, 1457 }, /* 47K , 200K ohm */
@@ -400,11 +398,9 @@ static struct mutex g_base_mutex;
static struct bmi_drv_data_t g_bmi160_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
/*
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
index 19fda5382f..1d1a7ced79 100644
--- a/board/scarlet/board.h
+++ b/board/scarlet/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,12 +15,12 @@
/* Optional modules */
#define CONFIG_ADC
-#undef CONFIG_ADC_WATCHDOG
+#undef CONFIG_ADC_WATCHDOG
#define CONFIG_CHIPSET_RK3399
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_RTC
#define CONFIG_EMULATED_SYSRQ
-#undef CONFIG_HIBERNATE
+#undef CONFIG_HIBERNATE
#define CONFIG_HOSTCMD_RTC
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
@@ -40,7 +40,7 @@
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands for testing */
-#undef CONFIG_UART_CONSOLE
+#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 1
#define CONFIG_UART_RX_DMA
@@ -92,8 +92,7 @@
/* Camera VSYNC */
#define CONFIG_SYNC
#define CONFIG_SYNC_COMMAND
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
/* To be able to indicate the device is in tablet mode. */
#define CONFIG_TABLET_MODE
@@ -137,33 +136,33 @@
#endif
/* Battery parameters for max17055 ModelGauge m5 algorithm. */
-#define BATTERY_MAX17055_RSENSE 5 /* m-ohm */
-#define BATTERY_DESIRED_CHARGING_CURRENT 4000 /* mA */
+#define BATTERY_MAX17055_RSENSE 5 /* m-ohm */
+#define BATTERY_DESIRED_CHARGING_CURRENT 4000 /* mA */
#define CONFIG_THROTTLE_AP_ON_BAT_DISCHG_CURRENT
-#define BAT_MAX_DISCHG_CURRENT 5000 /* mA */
+#define BAT_MAX_DISCHG_CURRENT 5000 /* mA */
#define CONFIG_THROTTLE_AP_ON_BAT_VOLTAGE
#define BAT_LOW_VOLTAGE_THRESH 3200 /* mV */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 12850
+#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 12850
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
/* Timer selection */
-#define TIM_CLOCK32 2
+#define TIM_CLOCK32 2
#define TIM_WATCHDOG 7
/* 48 MHz SYSCLK clock frequency */
#define CPU_CLOCK 48000000
/* Optional for testing */
-#undef CONFIG_PECI
-#undef CONFIG_PSTORE
+#undef CONFIG_PECI
+#undef CONFIG_PSTORE
/* Modules we want to exclude */
#undef CONFIG_CMD_BATTFAKE
@@ -176,24 +175,24 @@
#define CONFIG_TASK_PROFILING
-#define I2C_PORT_CHARGER 0
-#define I2C_PORT_BATTERY 0
+#define I2C_PORT_CHARGER 0
+#define I2C_PORT_BATTERY 0
#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_TCPC0 1
+#define I2C_PORT_TCPC0 1
/* Route sbs host requests to virtual battery driver */
#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_MKBP_INPUT_DEVICES
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
/* Define the host events which are allowed to wakeup AP in S3. */
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
#ifndef __ASSEMBLER__
diff --git a/board/scarlet/build.mk b/board/scarlet/build.mk
index f2966fea6a..adecf6b4ea 100644
--- a/board/scarlet/build.mk
+++ b/board/scarlet/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/scarlet/ec.tasklist b/board/scarlet/ec.tasklist
index 1548272184..08baec1e86 100644
--- a/board/scarlet/ec.tasklist
+++ b/board/scarlet/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/scarlet/gpio.inc b/board/scarlet/gpio.inc
index 9c45295a7f..15ce1cb681 100644
--- a/board/scarlet/gpio.inc
+++ b/board/scarlet/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/scarlet/led.c b/board/scarlet/led.c
index d327ee46d6..6f42f462cf 100644
--- a/board/scarlet/led.c
+++ b/board/scarlet/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -28,7 +28,7 @@ enum led_color {
LED_RED,
LED_AMBER,
LED_GREEN,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int bat_led_set_color(enum led_color color)
@@ -69,13 +69,13 @@ static void scarlet_led_set_battery(void)
break;
case PWR_STATE_DISCHARGE:
if (charge_get_percent() < 3)
- bat_led_set_color((battery_second & 1)
- ? LED_OFF : LED_AMBER);
+ bat_led_set_color((battery_second & 1) ? LED_OFF :
+ LED_AMBER);
else if (charge_get_percent() < 10)
- bat_led_set_color((battery_second & 3)
- ? LED_OFF : LED_AMBER);
+ bat_led_set_color((battery_second & 3) ? LED_OFF :
+ LED_AMBER);
else if (charge_get_percent() >= BATTERY_LEVEL_NEAR_FULL &&
- (chflags & CHARGE_FLAG_EXTERNAL_POWER))
+ (chflags & CHARGE_FLAG_EXTERNAL_POWER))
bat_led_set_color(LED_GREEN);
else
bat_led_set_color(LED_OFF);
@@ -87,11 +87,11 @@ static void scarlet_led_set_battery(void)
bat_led_set_color(LED_GREEN);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE. */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- bat_led_set_color(
- (battery_second & 0x2) ? LED_GREEN : LED_AMBER);
- else
- bat_led_set_color(LED_GREEN);
+ bat_led_set_color(LED_GREEN);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ bat_led_set_color((battery_second & 0x2) ? LED_GREEN :
+ LED_AMBER);
break;
default:
/* Other states don't alter LED behavior */
@@ -112,10 +112,12 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
if (led_id == EC_LED_ID_BATTERY_LED) {
gpio_set_level(GPIO_BAT_LED_RED,
(brightness[EC_LED_COLOR_RED] != 0) ?
- BAT_LED_ON : BAT_LED_OFF);
+ BAT_LED_ON :
+ BAT_LED_OFF);
gpio_set_level(GPIO_BAT_LED_GREEN,
(brightness[EC_LED_COLOR_GREEN] != 0) ?
- BAT_LED_ON : BAT_LED_OFF);
+ BAT_LED_ON :
+ BAT_LED_OFF);
return EC_SUCCESS;
}
return EC_ERROR_UNKNOWN;
diff --git a/board/scarlet/usb_pd_policy.c b/board/scarlet/usb_pd_policy.c
index cba4540ecd..919e7a8864 100644
--- a/board/scarlet/usb_pd_policy.c
+++ b/board/scarlet/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,8 +21,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en;
@@ -33,7 +33,6 @@ int board_vbus_source_enabled(int port)
int pd_set_power_supply_ready(int port)
{
-
pd_set_vbus_discharge(port, 0);
/* Provide VBUS */
vbus_en = 1;