summaryrefslogtreecommitdiff
path: root/board/storo
diff options
context:
space:
mode:
Diffstat (limited to 'board/storo')
-rw-r--r--board/storo/battery.c2
-rw-r--r--board/storo/board.c334
-rw-r--r--board/storo/board.h44
-rw-r--r--board/storo/build.mk2
-rw-r--r--board/storo/cbi_ssfc.c6
-rw-r--r--board/storo/cbi_ssfc.h3
-rw-r--r--board/storo/ec.tasklist2
-rw-r--r--board/storo/gpio.inc2
-rw-r--r--board/storo/led.c45
-rw-r--r--board/storo/usb_pd_policy.c6
10 files changed, 213 insertions, 233 deletions
diff --git a/board/storo/battery.c b/board/storo/battery.c
index b28e5bbf37..5a927ffc26 100644
--- a/board/storo/battery.c
+++ b/board/storo/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 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/storo/board.c b/board/storo/board.c
index d7e0305d1f..f6f3ed5750 100644
--- a/board/storo/board.c
+++ b/board/storo/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -48,8 +48,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprints(CC_SYSTEM, format, ##args)
#define INT_RECHECK_US 5000
@@ -139,34 +139,26 @@ static void pen_detect_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -226,14 +218,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Retimer */
-enum tusb544_conf {
- USB_DP = 0,
- USB_DP_INV,
- USB,
- USB_INV,
- DP,
- DP_INV
-};
+enum tusb544_conf { USB_DP = 0, USB_DP_INV, USB, USB_INV, DP, DP_INV };
/*
* Registers we care about of are all the same between NCS8510 and TUSB544,
@@ -246,33 +231,32 @@ enum tusb544_conf {
*/
static int board_tusb544_set(const struct usb_mux *me, mux_state_t mux_state)
{
- int rv = EC_SUCCESS;
+ int rv = EC_SUCCESS;
int reg;
enum tusb544_conf usb_mode = 0;
if (mux_state & USB_PD_MUX_USB_ENABLED) {
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* USB with DP */
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_DP_INV
- : USB_DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_DP_INV :
+ USB_DP;
} else {
/* USB without DP */
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_INV
- : USB;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_INV :
+ USB;
}
} else if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* DP without USB */
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? DP_INV
- : DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ? DP_INV :
+ DP;
} else {
return EC_SUCCESS;
}
- rv = i2c_read8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL6, &reg);
+ rv = i2c_read8(me->i2c_port, me->i2c_addr_flags, TUSB544_REG_GENERAL6,
+ &reg);
if (rv)
return rv;
@@ -280,52 +264,52 @@ static int board_tusb544_set(const struct usb_mux *me, mux_state_t mux_state)
reg &= ~TUSB544_VOD_DCGAIN_SEL;
reg |= (TUSB544_VOD_DCGAIN_SETTING_5 << 2);
- rv = i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL6, reg);
+ rv = i2c_write8(me->i2c_port, me->i2c_addr_flags, TUSB544_REG_GENERAL6,
+ reg);
if (rv)
return rv;
/* Write the retimer config byte */
if (usb_mode == USB_INV) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x15);
+ TUSB544_REG_GENERAL4, 0x15);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_1, 0xff);
+ TUSB544_REG_USB3_1_1, 0xff);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_2, 0xff);
+ TUSB544_REG_USB3_1_2, 0xff);
} else if (usb_mode == USB) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x11);
+ TUSB544_REG_GENERAL4, 0x11);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_1, 0xff);
+ TUSB544_REG_USB3_1_1, 0xff);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_2, 0xff);
+ TUSB544_REG_USB3_1_2, 0xff);
} else if (usb_mode == USB_DP_INV) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x1F);
+ TUSB544_REG_GENERAL4, 0x1F);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_1, 0xff);
+ TUSB544_REG_USB3_1_1, 0xff);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_2, 0xff);
+ TUSB544_REG_USB3_1_2, 0xff);
} else if (usb_mode == USB_DP) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x1B);
+ TUSB544_REG_GENERAL4, 0x1B);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_1, 0xff);
+ TUSB544_REG_USB3_1_1, 0xff);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_2, 0xff);
+ TUSB544_REG_USB3_1_2, 0xff);
} else if (usb_mode == DP_INV) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x1E);
+ TUSB544_REG_GENERAL4, 0x1E);
} else if (usb_mode == DP) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x1A);
+ TUSB544_REG_GENERAL4, 0x1A);
}
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_DISPLAYPORT_1, 0x66);
+ TUSB544_REG_DISPLAYPORT_1, 0x66);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_DISPLAYPORT_2, 0x66);
+ TUSB544_REG_DISPLAYPORT_2, 0x66);
if (rv)
return EC_ERROR_UNKNOWN;
else
@@ -333,28 +317,37 @@ static int board_tusb544_set(const struct usb_mux *me, mux_state_t mux_state)
}
/* USB Retimer */
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
- .driver = &tusb544_drv,
- .board_set = &board_tusb544_set,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
+ .driver = &tusb544_drv,
+ .board_set = &board_tusb544_set,
+ },
};
/* USB Muxes */
-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,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
},
};
@@ -461,8 +454,7 @@ int board_is_sourcing_vbus(int port)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -526,9 +518,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 3;
*kp_div = 14;
@@ -553,17 +544,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
static struct accelgyro_saved_data_t g_bma253_data;
static struct bmi_drv_data_t g_bmi160_data;
@@ -639,11 +626,9 @@ struct motion_sensor_t motion_sensors[] = {
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-static const mat33_fp_t lid_lis2dwl_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_lis2dwl_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* Lid accel private data */
static struct stprivate_data g_lis2dwl_data;
@@ -675,11 +660,9 @@ struct motion_sensor_t lis2dwl_lid_accel = {
},
};
-static const mat33_fp_t lid_KX022_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_KX022_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
static struct kionix_accel_data g_kx022_data;
struct motion_sensor_t kx022_lid_accel = {
@@ -710,11 +693,9 @@ struct motion_sensor_t kx022_lid_accel = {
};
static struct icm_drv_data_t g_icm42607_data;
-const mat33_fp_t based_ref_icm42607 = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t based_ref_icm42607 = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t icm42607_base_accel = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -743,29 +724,26 @@ struct motion_sensor_t icm42607_base_accel = {
};
struct motion_sensor_t icm42607_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM42607,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm42607_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm42607_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &based_ref_icm42607,
- .min_frequency = ICM42607_GYRO_MIN_FREQ,
- .max_frequency = ICM42607_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM42607,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm42607_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm42607_data,
+ .port = I2C_PORT_ACCEL,
+ .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &based_ref_icm42607,
+ .min_frequency = ICM42607_GYRO_MIN_FREQ,
+ .max_frequency = ICM42607_GYRO_MAX_FREQ,
};
-
static struct bmi_drv_data_t g_bmi220_data;
-const mat33_fp_t based_ref_bmi220 = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t based_ref_bmi220 = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t bmi220_base_accel = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -794,20 +772,20 @@ struct motion_sensor_t bmi220_base_accel = {
};
struct motion_sensor_t bmi220_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI220,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi260_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_bmi220_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &based_ref_bmi220,
- .min_frequency = BMI_GYRO_MIN_FREQ,
- .max_frequency = BMI_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMI220,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi260_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_bmi220_data,
+ .port = I2C_PORT_ACCEL,
+ .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &based_ref_bmi220,
+ .min_frequency = BMI_GYRO_MIN_FREQ,
+ .max_frequency = BMI_GYRO_MAX_FREQ,
};
void board_init(void)
@@ -846,13 +824,13 @@ void board_init(void)
if (board_id > 2) {
if (get_cbi_fw_config_tablet_mode()) {
if (get_cbi_ssfc_base_sensor() ==
- SSFC_SENSOR_ICM42607) {
+ SSFC_SENSOR_ICM42607) {
motion_sensors[BASE_ACCEL] =
- icm42607_base_accel;
+ icm42607_base_accel;
motion_sensors[BASE_GYRO] = icm42607_base_gyro;
CPRINTF("BASE GYRO is ICM42607");
} else if (get_cbi_ssfc_base_sensor() ==
- SSFC_SENSOR_BMI220) {
+ SSFC_SENSOR_BMI220) {
motion_sensors[BASE_ACCEL] = bmi220_base_accel;
motion_sensors[BASE_GYRO] = bmi220_base_gyro;
CPRINTF("BASE GYRO is BMI220");
@@ -864,7 +842,7 @@ void board_init(void)
motion_sensors[LID_ACCEL] = lis2dwl_lid_accel;
CPRINTF("LID_ACCEL is LIS2DWL");
} else if (get_cbi_ssfc_lid_sensor() ==
- SSFC_SENSOR_KX022) {
+ SSFC_SENSOR_KX022) {
motion_sensors[LID_ACCEL] = kx022_lid_accel;
CPRINTF("LID_ACCEL is KX022");
} else {
@@ -878,7 +856,7 @@ void board_init(void)
* line to float.
*/
gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ GPIO_INPUT | GPIO_PULL_DOWN);
}
} else {
if (get_cbi_ssfc_base_sensor() == SSFC_SENSOR_ICM42607) {
@@ -908,34 +886,34 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
void motion_interrupt(enum gpio_signal signal)
{
- switch (get_cbi_ssfc_base_sensor()) {
- case SSFC_SENSOR_ICM42607:
- icm42607_interrupt(signal);
- break;
- case SSFC_SENSOR_BMI220:
- bmi260_interrupt(signal);
- break;
- case SSFC_SENSOR_BMI160:
- default:
- bmi160_interrupt(signal);
- break;
- }
+ switch (get_cbi_ssfc_base_sensor()) {
+ case SSFC_SENSOR_ICM42607:
+ icm42607_interrupt(signal);
+ break;
+ case SSFC_SENSOR_BMI220:
+ bmi260_interrupt(signal);
+ break;
+ case SSFC_SENSOR_BMI160:
+ default:
+ bmi160_interrupt(signal);
+ break;
+ }
}
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Cpu",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Cpu",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/storo/board.h b/board/storo/board.h
index 4532d11b4e..93dd573ba1 100644
--- a/board/storo/board.h
+++ b/board/storo/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,11 +25,14 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -37,19 +40,19 @@
/* LED */
#define CONFIG_LED_ONOFF_STATES
-#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
+#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
/* Sensors */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
#define CONFIG_ACCEL_LIS2DWL
#define CONFIG_ACCEL_KX022
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_ICM42607
#define CONFIG_ACCELGYRO_BMI220
#define CONFIG_I2C_XFER_LARGE_TRANSFER
@@ -57,7 +60,7 @@
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
@@ -95,12 +98,10 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
-
-#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
-
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
#ifndef __ASSEMBLER__
@@ -113,22 +114,15 @@ enum chg_id {
CHARGER_NUM,
};
-
-
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_TEMP_SENSOR_3, /* ADC15*/
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_TEMP_SENSOR_3, /* ADC15*/
ADC_CH_COUNT
};
diff --git a/board/storo/build.mk b/board/storo/build.mk
index 8167ca9966..01b890bf29 100644
--- a/board/storo/build.mk
+++ b/board/storo/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 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/storo/cbi_ssfc.c b/board/storo/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/storo/cbi_ssfc.c
+++ b/board/storo/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/storo/cbi_ssfc.h b/board/storo/cbi_ssfc.h
index f4a51b8e91..bc6bc92286 100644
--- a/board/storo/cbi_ssfc.h
+++ b/board/storo/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -57,5 +57,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/storo/ec.tasklist b/board/storo/ec.tasklist
index d54ff847e6..8abd36b4be 100644
--- a/board/storo/ec.tasklist
+++ b/board/storo/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 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/storo/gpio.inc b/board/storo/gpio.inc
index b7541c5259..cb07474f52 100644
--- a/board/storo/gpio.inc
+++ b/board/storo/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 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/storo/led.c b/board/storo/led.c
index d5094f1f30..76bfc05861 100644
--- a/board/storo/led.c
+++ b/board/storo/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -10,28 +10,37 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/storo/usb_pd_policy.c b/board/storo/usb_pd_policy.c
index 15faf41ffc..83c09bb99e 100644
--- a/board/storo/usb_pd_policy.c
+++ b/board/storo/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.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)
int pd_check_vconn_swap(int port)
{