summaryrefslogtreecommitdiff
path: root/board/atlas
diff options
context:
space:
mode:
Diffstat (limited to 'board/atlas')
-rw-r--r--board/atlas/battery.c54
-rw-r--r--board/atlas/board.c192
-rw-r--r--board/atlas/board.h126
-rw-r--r--board/atlas/build.mk2
-rw-r--r--board/atlas/ec.tasklist2
-rw-r--r--board/atlas/gpio.inc2
-rw-r--r--board/atlas/led.c16
-rw-r--r--board/atlas/usb_pd_policy.c27
8 files changed, 202 insertions, 219 deletions
diff --git a/board/atlas/battery.c b/board/atlas/battery.c
index fb2fba18be..78b3be16a4 100644
--- a/board/atlas/battery.c
+++ b/board/atlas/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -18,10 +18,10 @@
#include "i2c.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHUTDOWN_DATA 0x0010
+#define SB_SHUTDOWN_DATA 0x0010
enum battery_type {
BATTERY_LG,
@@ -52,16 +52,16 @@ static int battery_report_present = 1;
* limits are given by discharging_min/max_c.
*/
static const struct battery_info batt_info_lg = {
- .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6100, /* Add 100mV for charger accuracy */
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 46,
- .charging_min_c = 10,
- .charging_max_c = 50,
- .discharging_min_c = 0,
- .discharging_max_c = 60,
+ .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
+ .voltage_normal = 7700,
+ .voltage_min = 6100, /* Add 100mV for charger accuracy */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 46,
+ .charging_min_c = 10,
+ .charging_max_c = 50,
+ .discharging_min_c = 0,
+ .discharging_max_c = 60,
};
/*
@@ -70,16 +70,16 @@ static const struct battery_info batt_info_lg = {
* limits are given by discharging_min/max_c.
*/
static const struct battery_info batt_info_lishen = {
- .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6100, /* Add 100mV for charger accuracy */
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 46,
- .charging_min_c = 10,
- .charging_max_c = 50,
- .discharging_min_c = 0,
- .discharging_max_c = 60,
+ .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
+ .voltage_normal = 7700,
+ .voltage_min = 6100, /* Add 100mV for charger accuracy */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 46,
+ .charging_min_c = 10,
+ .charging_max_c = 50,
+ .discharging_min_c = 0,
+ .discharging_max_c = 60,
};
static const struct board_batt_params info[] = {
@@ -110,7 +110,7 @@ static int board_get_battery_type(void)
if (!battery_manufacturer_name(name, sizeof(name))) {
for (i = 0; i < BATTERY_TYPE_COUNT; i++) {
if (!strncasecmp(name, info[i].manuf_name,
- ARRAY_SIZE(name)-1)) {
+ ARRAY_SIZE(name) - 1)) {
board_battery_type = i;
break;
}
@@ -139,7 +139,9 @@ DECLARE_HOOK(HOOK_INIT, board_init_battery_type, HOOK_PRIO_INIT_I2C + 1);
const struct battery_info *battery_get_info(void)
{
return info[board_battery_type == BATTERY_TYPE_COUNT ?
- DEFAULT_BATTERY_TYPE : board_battery_type].batt_info;
+ DEFAULT_BATTERY_TYPE :
+ board_battery_type]
+ .batt_info;
}
int board_cut_off_battery(void)
@@ -183,7 +185,7 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
*/
if (!battery_is_cut_off() &&
!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- (curr->batt.status & STATUS_FULLY_CHARGED))
+ (curr->batt.status & STATUS_FULLY_CHARGED))
return 1;
return 0;
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 64d0789dd9..6fbbb64b16 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,6 +29,7 @@
#include "keyboard_scan.h"
#include "lid_switch.h"
#include "motion_sense.h"
+#include "panic.h"
#include "power_button.h"
#include "power.h"
#include "pwm_chip.h"
@@ -46,8 +47,8 @@
#include "usb_pd_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)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -85,19 +86,19 @@ __override struct keyboard_scan_config keyscan_config = {
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { 3, 0, 10000 },
- [PWM_CH_DB0_LED_BLUE] = {
- 0, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB0_LED_RED] = {
- 2, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB0_LED_GREEN] = {
- 6, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB1_LED_BLUE] = {
- 1, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB1_LED_RED] = {
- 7, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB1_LED_GREEN] = {
- 5, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
+ [PWM_CH_KBLIGHT] = { 3, 0, 10000 },
+ [PWM_CH_DB0_LED_BLUE] = { 0, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB0_LED_RED] = { 2, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB0_LED_GREEN] = { 6, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB1_LED_BLUE] = { 1, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB1_LED_RED] = { 7, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB1_LED_GREEN] = { 5, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -114,66 +115,46 @@ const struct adc_t adc_channels[] = {
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT*1000/18,
- ADC_READ_MAX+1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 12.4K resistor, to read
* 0.8V @ 45 W, i.e. 56250 uW/mV. Using ADC_MAX_VOLT*56250 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT*56250*2/(ADC_READ_MAX+1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 56250 * 2 / (ADC_READ_MAX + 1), 2, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C0_POWER_SCL,
- .sda = GPIO_EC_I2C0_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C1_USB_C0_SCL,
- .sda = GPIO_EC_I2C1_USB_C0_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C2_USB_C1_SCL,
- .sda = GPIO_EC_I2C2_USB_C1_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 100,
- .scl = GPIO_EC_I2C3_SENSOR_3V3_SCL,
- .sda = GPIO_EC_I2C3_SENSOR_3V3_SDA
- },
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_EC_I2C4_BATTERY_SCL,
- .sda = GPIO_EC_I2C4_BATTERY_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C0_POWER_SCL,
+ .sda = GPIO_EC_I2C0_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C1_USB_C0_SCL,
+ .sda = GPIO_EC_I2C1_USB_C0_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C2_USB_C1_SCL,
+ .sda = GPIO_EC_I2C2_USB_C1_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C3_SENSOR_3V3_SCL,
+ .sda = GPIO_EC_I2C3_SENSOR_3V3_SDA },
+ { .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C4_BATTERY_SCL,
+ .sda = GPIO_EC_I2C4_BATTERY_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -212,16 +193,22 @@ 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 = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -247,9 +234,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
uint16_t tcpc_get_alert_status(void)
{
@@ -269,16 +256,16 @@ uint16_t tcpc_get_alert_status(void)
}
const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
/* BD99992GW temp sensors are only readable in S0 */
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM0},
- {"Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM1},
- {"DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM2},
- {"eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM3},
+ { "Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM0 },
+ { "Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM1 },
+ { "DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM2 },
+ { "eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -304,12 +291,12 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- BD99992GW_REG_PWRSTAT1, &pwrstat1);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, BD99992GW_REG_PWRSTAT1,
+ &pwrstat1);
/* PWRSTAT2 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- BD99992GW_REG_PWRSTAT2, &pwrstat2);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, BD99992GW_REG_PWRSTAT2,
+ &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
@@ -350,8 +337,8 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- BD99992GW_REG_V18ACNT, 0x2a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, BD99992GW_REG_V18ACNT,
+ 0x2a);
/*
* V085ACNT:
@@ -383,8 +370,8 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- BD99992GW_REG_V18ACNT, 0x6a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, BD99992GW_REG_V18ACNT,
+ 0x6a);
/*
* V085ACNT:
@@ -397,8 +384,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
BD99992GW_REG_V085ACNT, 0x6a);
}
-__override void power_board_handle_host_sleep_event(
- enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
@@ -517,8 +503,8 @@ int board_set_active_charge_port(int charge_port)
int is_real_port = (charge_port >= 0 &&
charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are sourcing VBUS on the port */
- int is_source = gpio_get_level(charge_port == 0 ?
- GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN);
+ int is_source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
+ GPIO_USB_C1_5V_EN);
if (is_real_port && is_source) {
CPRINTS("No charging from p%d", charge_port);
@@ -534,10 +520,12 @@ int board_set_active_charge_port(int charge_port)
} else {
/* Make sure non-charging port is disabled */
gpio_set_level(charge_port ? GPIO_EN_USB_C0_CHARGE_L :
- GPIO_EN_USB_C1_CHARGE_L, 1);
+ GPIO_EN_USB_C1_CHARGE_L,
+ 1);
/* Enable charging port */
gpio_set_level(charge_port ? GPIO_EN_USB_C1_CHARGE_L :
- GPIO_EN_USB_C0_CHARGE_L, 0);
+ GPIO_EN_USB_C0_CHARGE_L,
+ 0);
}
return EC_SUCCESS;
@@ -568,12 +556,12 @@ DECLARE_HOOK(HOOK_INIT, board_charger_init, HOOK_PRIO_DEFAULT);
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-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_ma = charger_derate(charge_ma);
- 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);
}
static void board_chipset_suspend(void)
diff --git a/board/atlas/board.h b/board/atlas/board.h
index c3ddafe2cb..0882b5742e 100644
--- a/board/atlas/board.h
+++ b/board/atlas/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -55,8 +55,8 @@
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define CONFIG_KEYBOARD_COL2_INVERTED
#define CONFIG_KEYBOARD_PROTOCOL_8042
@@ -147,29 +147,29 @@
#define CONFIG_USBC_VCONN_SWAP
/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
-#define CONFIG_HIBERNATE_PSL /* Enable PSL pins for wakeup */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define CONFIG_HIBERNATE_PSL /* Enable PSL pins for wakeup */
/* I2C ports */
-#define I2C_PORT_POWER NPCX_I2C_PORT0_0 /* pmic/charger */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT1_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT2_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT3_0 /* als */
-#define I2C_PORT_BATTERY NPCX_I2C_PORT4_1
-#define I2C_PORT_GYRO NPCX_I2C_PORT5_0 /* accel/gyro */
-
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
-#define I2C_PORT_CHARGER I2C_PORT_POWER
-#define I2C_PORT_PMIC I2C_PORT_POWER
-#define I2C_PORT_THERMAL I2C_PORT_POWER
+#define I2C_PORT_POWER NPCX_I2C_PORT0_0 /* pmic/charger */
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT1_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT2_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT3_0 /* als */
+#define I2C_PORT_BATTERY NPCX_I2C_PORT4_1
+#define I2C_PORT_GYRO NPCX_I2C_PORT5_0 /* accel/gyro */
+
+#define I2C_PORT_ACCEL I2C_PORT_GYRO
+#define I2C_PORT_CHARGER I2C_PORT_POWER
+#define I2C_PORT_PMIC I2C_PORT_POWER
+#define I2C_PORT_THERMAL I2C_PORT_POWER
/* I2C addresses */
-#define I2C_ADDR_TCPC_FLAGS 0x0B
-#define I2C_ADDR_MP2949_FLAGS 0x20
-#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_TCPC_FLAGS 0x0B
+#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
#ifndef __ASSEMBLER__
@@ -177,11 +177,11 @@
#include "registers.h"
enum temp_sensor_id {
- TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
- TEMP_SENSOR_SYSTHERM0, /* BD99992GW SYSTHERM0 */
- TEMP_SENSOR_SYSTHERM1, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_SYSTHERM2, /* BD99992GW SYSTHERM2 */
- TEMP_SENSOR_SYSTHERM3, /* BD99992GW SYSTHERM3 */
+ TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
+ TEMP_SENSOR_SYSTHERM0, /* BD99992GW SYSTHERM0 */
+ TEMP_SENSOR_SYSTHERM1, /* BD99992GW SYSTHERM1 */
+ TEMP_SENSOR_SYSTHERM2, /* BD99992GW SYSTHERM2 */
+ TEMP_SENSOR_SYSTHERM3, /* BD99992GW SYSTHERM3 */
TEMP_SENSOR_COUNT
};
@@ -202,28 +202,24 @@ enum sensor_id {
};
/* LID_ALS needs to be polled */
-#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ALS)
+#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ALS)
-enum adc_channel {
- ADC_AMON_BMON,
- ADC_PSYS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_AMON_BMON, ADC_PSYS, ADC_CH_COUNT };
/*
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Board specific handlers */
int board_get_version(void);
@@ -236,33 +232,33 @@ void board_reset_pd_mcu(void);
* vs. names hard-coded in various parts of the EC codebase.
*/
-#define GPIO_AC_PRESENT GPIO_ROP_EC_ACOK
-#define GPIO_BATTERY_PRESENT_L GPIO_EC_BATT_PRES_L
-#define GPIO_BOARD_VERSION1 GPIO_EC_BRD_ID1
-#define GPIO_BOARD_VERSION2 GPIO_EC_BRD_ID2
-#define GPIO_BOARD_VERSION3 GPIO_EC_BRD_ID3
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KB_ROW02_INV
-#define GPIO_PCH_ACOK GPIO_EC_PCH_ACPRESENT
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_RSMRST_L
-#define GPIO_PCH_SLP_SUS_L GPIO_SLP_SUS_L_PCH
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_L
-#define GPIO_PMIC_DPWROK GPIO_ROP_DSW_PWROK_EC
-#define GPIO_PMIC_SLP_SUS_L GPIO_SLP_SUS_L_PMIC
-#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
-#define GPIO_PG_EC_RSMRST_ODL GPIO_ROP_EC_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_USB_C0_5V_EN GPIO_EN_USB_C0_5V_OUT
-#define GPIO_USB_C0_PD_RST_L GPIO_USB_PD_RST_L
-#define GPIO_USB_C1_5V_EN GPIO_EN_USB_C1_5V_OUT
-#define GPIO_USB_C1_PD_RST_L GPIO_USB_PD_RST_L
-#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_AC_PRESENT GPIO_ROP_EC_ACOK
+#define GPIO_BATTERY_PRESENT_L GPIO_EC_BATT_PRES_L
+#define GPIO_BOARD_VERSION1 GPIO_EC_BRD_ID1
+#define GPIO_BOARD_VERSION2 GPIO_EC_BRD_ID2
+#define GPIO_BOARD_VERSION3 GPIO_EC_BRD_ID3
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KB_ROW02_INV
+#define GPIO_PCH_ACOK GPIO_EC_PCH_ACPRESENT
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_RSMRST_L
+#define GPIO_PCH_SLP_SUS_L GPIO_SLP_SUS_L_PCH
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_L
+#define GPIO_PMIC_DPWROK GPIO_ROP_DSW_PWROK_EC
+#define GPIO_PMIC_SLP_SUS_L GPIO_SLP_SUS_L_PMIC
+#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
+#define GPIO_PG_EC_RSMRST_ODL GPIO_ROP_EC_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_USB_C0_5V_EN GPIO_EN_USB_C0_5V_OUT
+#define GPIO_USB_C0_PD_RST_L GPIO_USB_PD_RST_L
+#define GPIO_USB_C1_5V_EN GPIO_EN_USB_C1_5V_OUT
+#define GPIO_USB_C1_PD_RST_L GPIO_USB_PD_RST_L
+#define GPIO_WP_L GPIO_EC_WP_L
/* ps8751 requires 1ms reset down assertion */
-#define PS8XXX_RST_L_RST_H_DELAY_MS 1
+#define PS8XXX_RST_L_RST_H_DELAY_MS 1
-#define ATLAS_REV_FIXED_EC_WP 4
+#define ATLAS_REV_FIXED_EC_WP 4
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/atlas/build.mk b/board/atlas/build.mk
index f1619f73cd..b7eeeb0a61 100644
--- a/board/atlas/build.mk
+++ b/board/atlas/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 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/atlas/ec.tasklist b/board/atlas/ec.tasklist
index 33e3cccb16..b0bf043717 100644
--- a/board/atlas/ec.tasklist
+++ b/board/atlas/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 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/atlas/gpio.inc b/board/atlas/gpio.inc
index 4ce44cc130..ea76ab8841 100644
--- a/board/atlas/gpio.inc
+++ b/board/atlas/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 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/atlas/led.c b/board/atlas/led.c
index 9cb4dabfd3..2a297848e3 100644
--- a/board/atlas/led.c
+++ b/board/atlas/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,13 +18,13 @@ const enum ec_led_id supported_led_ids[] = {
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 70, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 35, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
- [EC_LED_COLOR_YELLOW] = { 55, 15, 0 },
- [EC_LED_COLOR_WHITE] = { 62, 100, 31 },
- [EC_LED_COLOR_AMBER] = { 100, 31, 0 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 70, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 35, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
+ [EC_LED_COLOR_YELLOW] = { 55, 15, 0 },
+ [EC_LED_COLOR_WHITE] = { 62, 100, 31 },
+ [EC_LED_COLOR_AMBER] = { 100, 31, 0 },
};
/*
diff --git a/board/atlas/usb_pd_policy.c b/board/atlas/usb_pd_policy.c
index 77a4941a9a..fc7a2141f5 100644
--- a/board/atlas/usb_pd_policy.c
+++ b/board/atlas/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,12 +23,12 @@
#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[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -38,9 +38,9 @@ int board_vbus_source_enabled(int port)
static void board_vbus_update_source_current(int port)
{
enum gpio_signal gpio_5v_en = port ? GPIO_USB_C1_5V_EN :
- GPIO_USB_C0_5V_EN;
+ GPIO_USB_C0_5V_EN;
enum gpio_signal gpio_3a_en = port ? GPIO_EN_USB_C1_3A :
- GPIO_EN_USB_C0_3A;
+ GPIO_EN_USB_C0_3A;
/*
* 1.5 vs 3.0 A limit is controlled by a dedicated gpio where
@@ -67,8 +67,8 @@ int pd_snk_is_vbus_provided(int port)
int pd_set_power_supply_ready(int port)
{
/* Disable charging */
- gpio_set_level(port ? GPIO_EN_USB_C1_CHARGE_L :
- GPIO_EN_USB_C0_CHARGE_L, 1);
+ gpio_set_level(port ? GPIO_EN_USB_C1_CHARGE_L : GPIO_EN_USB_C0_CHARGE_L,
+ 1);
/* Ensure we advertise the proper available current quota */
charge_manager_source_port(port, 1);
@@ -111,15 +111,12 @@ int pd_check_vconn_swap(int port)
return gpio_get_level(GPIO_PMIC_SLP_SUS_L);
}
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+__override void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* Only port 0 supports device mode. */
if (port != 0)
return;
- gpio_set_level(GPIO_USB2_ID,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
- gpio_set_level(GPIO_USB2_VBUSSENSE,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
+ gpio_set_level(GPIO_USB2_ID, (data_role == PD_ROLE_UFP) ? 1 : 0);
+ gpio_set_level(GPIO_USB2_VBUSSENSE, (data_role == PD_ROLE_UFP) ? 1 : 0);
}