diff options
Diffstat (limited to 'board/bugzzy')
-rw-r--r-- | board/bugzzy/battery.c | 9 | ||||
-rw-r--r-- | board/bugzzy/board.c | 168 | ||||
-rw-r--r-- | board/bugzzy/board.h | 89 | ||||
-rw-r--r-- | board/bugzzy/build.mk | 2 | ||||
-rw-r--r-- | board/bugzzy/cbi_ssfc.c | 6 | ||||
-rw-r--r-- | board/bugzzy/cbi_ssfc.h | 3 | ||||
-rw-r--r-- | board/bugzzy/ec.tasklist | 2 | ||||
-rw-r--r-- | board/bugzzy/gpio.inc | 2 | ||||
-rw-r--r-- | board/bugzzy/led.c | 72 | ||||
-rw-r--r-- | board/bugzzy/usb_pd_policy.c | 6 |
10 files changed, 170 insertions, 189 deletions
diff --git a/board/bugzzy/battery.c b/board/bugzzy/battery.c index 23318890f3..2df4848d05 100644 --- a/board/bugzzy/battery.c +++ b/board/bugzzy/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. * @@ -85,7 +85,7 @@ const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SDI; int charger_profile_override(struct charge_state_data *curr) { if ((chipset_in_state(CHIPSET_STATE_ON)) && - (curr->requested_current > CHARGING_CURRENT_45C)) + (curr->requested_current > CHARGING_CURRENT_45C)) curr->requested_current = CHARGING_CURRENT_45C; return 0; @@ -115,7 +115,7 @@ static void reduce_input_voltage_when_full(void) int port; if (charge_get_percent() == 100 && - chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) { + chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) { if (max_pd_voltage_mv != PD_VOLTAGE_WHEN_FULL) { saved_input_voltage = max_pd_voltage_mv; max_pd_voltage_mv = PD_VOLTAGE_WHEN_FULL; @@ -131,5 +131,4 @@ static void reduce_input_voltage_when_full(void) pd_set_external_voltage_limit(port, max_pd_voltage_mv); } } -DECLARE_HOOK(HOOK_SECOND, reduce_input_voltage_when_full, - HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_SECOND, reduce_input_voltage_when_full, HOOK_PRIO_DEFAULT); diff --git a/board/bugzzy/board.c b/board/bugzzy/board.c index 25fc04a20a..5a28fb2c25 100644 --- a/board/bugzzy/board.c +++ b/board/bugzzy/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. */ @@ -44,8 +44,8 @@ #include "usb_pd.h" #include "usb_pd_tcpm.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) #define INT_RECHECK_US 5000 @@ -85,7 +85,6 @@ static void usb_c0_interrupt(enum gpio_signal s) /* Check the line again in 5ms */ hook_call_deferred(&check_c0_line_data, INT_RECHECK_US); - } /* C1 interrupt line shared by BC 1.2, TCPC, and charger */ @@ -120,7 +119,6 @@ static void sub_usb_c1_interrupt(enum gpio_signal s) /* Check the line again in 5ms */ hook_call_deferred(&check_c1_line_data, INT_RECHECK_US); - } static void sub_hdmi_hpd_interrupt(enum gpio_signal s) @@ -181,22 +179,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /* 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 = "Charger", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_2}, - [TEMP_SENSOR_3] = {.name = "Skin1", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_3}, - [TEMP_SENSOR_4] = {.name = "Skin2", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_4}, + [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 = "Charger", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_2 }, + [TEMP_SENSOR_3] = { .name = "Skin1", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_3 }, + [TEMP_SENSOR_4] = { .name = "Skin2", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_4 }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); @@ -212,16 +210,17 @@ void board_init(void) if (get_cbi_fw_config_db() == DB_1A_HDMI) { /* Disable i2c on HDMI pins */ - gpio_config_pin(MODULE_I2C, - GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, 0); - gpio_config_pin(MODULE_I2C, - GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0); + gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, + 0); + gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, + 0); /* Set HDMI and sub-rail enables to output */ gpio_set_flags(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, chipset_in_state(CHIPSET_STATE_ON) ? - GPIO_ODR_LOW : GPIO_ODR_HIGH); - gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH); + GPIO_ODR_LOW : + GPIO_ODR_HIGH); + gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH); /* Select HDMI option */ gpio_set_level(GPIO_HDMI_SEL_L, 0); @@ -230,8 +229,7 @@ void board_init(void) gpio_enable_interrupt(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL); } else { /* Set SDA as an input */ - gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, - GPIO_INPUT); + gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, GPIO_INPUT); /* Enable C1 interrupt and check if it needs processing */ gpio_enable_interrupt(GPIO_SUB_C1_INT_EN_RAILS_ODL); @@ -300,10 +298,9 @@ __override void board_power_5v_enable(int enable) gpio_set_level(GPIO_SUB_C1_INT_EN_RAILS_ODL, !enable); } else { if (isl923x_set_comparator_inversion(1, !!enable)) - CPRINTS("Failed to %sable sub rails!", enable ? - "en" : "dis"); + CPRINTS("Failed to %sable sub rails!", + enable ? "en" : "dis"); } - } __override uint8_t board_get_usb_pd_port_count(void) @@ -328,13 +325,11 @@ int board_is_sourcing_vbus(int port) tcpc_read(port, TCPC_REG_POWER_STATUS, ®val); return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS); - } 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; @@ -398,8 +393,8 @@ int board_set_active_charge_port(int 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) { int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT); @@ -426,23 +421,17 @@ static struct mutex g_base_mutex; static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA; /* 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 const mat33_fp_t base_standard_ref_lsm = { - { FLOAT_TO_FP(1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; +static const mat33_fp_t base_standard_ref_lsm = { { FLOAT_TO_FP(1), 0, 0 }, + { 0, FLOAT_TO_FP(-1), 0 }, + { 0, 0, FLOAT_TO_FP(-1) } }; struct motion_sensor_t ldm6dsm_base_accel = { .name = "Base Accel", @@ -481,8 +470,7 @@ struct motion_sensor_t ldm6dsm_base_gyro = { .location = MOTIONSENSE_LOC_BASE, .drv = &lsm6dsm_drv, .mutex = &g_base_mutex, - .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, - MOTIONSENSE_TYPE_GYRO), + .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, MOTIONSENSE_TYPE_GYRO), .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, .default_range = 1000 | ROUND_UP_FLAG, /* dps */ @@ -601,9 +589,8 @@ void motion_interrupt(enum gpio_signal signal) lsm6dsm_interrupt(signal); } -__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 = 1; *kp_div = 20; @@ -671,44 +658,44 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { static int ps8743_tune_mux_c0(const struct usb_mux *me); static int ps8743_tune_mux_c1(const struct usb_mux *me); -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 = PS8743_I2C_ADDR0_FLAG, - .driver = &ps8743_usb_mux_driver, - .board_init = &ps8743_tune_mux_c0, + .mux = + &(const struct usb_mux){ + .usb_port = 0, + .i2c_port = I2C_PORT_USB_C0, + .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG, + .driver = &ps8743_usb_mux_driver, + .board_init = &ps8743_tune_mux_c0, + }, }, { - .usb_port = 1, - .i2c_port = I2C_PORT_SUB_USB_C1, - .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG, - .driver = &ps8743_usb_mux_driver, - .board_init = &ps8743_tune_mux_c1, + .mux = + &(const struct usb_mux){ + .usb_port = 1, + .i2c_port = I2C_PORT_SUB_USB_C1, + .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG, + .driver = &ps8743_usb_mux_driver, + .board_init = &ps8743_tune_mux_c1, + }, } }; /* USB Mux C0 : board_init of PS8743 */ static int ps8743_tune_mux_c0(const struct usb_mux *me) { - ps8743_tune_usb_eq(me, - PS8743_USB_EQ_TX_3_6_DB, - PS8743_USB_EQ_RX_16_0_DB); + ps8743_tune_usb_eq(me, PS8743_USB_EQ_TX_3_6_DB, + PS8743_USB_EQ_RX_16_0_DB); return EC_SUCCESS; } /* USB Mux C1 : board_init of PS8743 */ static int ps8743_tune_mux_c1(const struct usb_mux *me) { - ps8743_tune_usb_eq(me, - PS8743_USB_EQ_TX_3_6_DB, - PS8743_USB_EQ_RX_16_0_DB); + ps8743_tune_usb_eq(me, PS8743_USB_EQ_TX_3_6_DB, + PS8743_USB_EQ_RX_16_0_DB); - ps8743_write(me, - PS8743_REG_USB_SWING, - PS8743_LFPS_SWG_TD); - ps8743_write(me, - PS8743_REG_DP_SETTING, - PS8743_DP_SWG_ADJ_P15P); + ps8743_write(me, PS8743_REG_USB_SWING, PS8743_LFPS_SWG_TD); + ps8743_write(me, PS8743_REG_DP_SETTING, PS8743_DP_SWG_ADJ_P15P); return EC_SUCCESS; } @@ -735,7 +722,7 @@ uint16_t tcpc_get_alert_status(void) } if (board_get_usb_pd_port_count() > 1 && - !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) { + !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) { if (!tcpc_read16(1, TCPC_REG_ALERT, ®val)) { /* TCPCI spec Rev 1.0 says to ignore bits 14:12. */ if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0)) @@ -765,8 +752,8 @@ static const struct ec_response_keybd_config keybd1 = { /* No function keys, no numeric keypad, has screenlock key */ .capabilities = KEYBD_CAP_SCRNLOCK_KEY, }; -__override const struct ec_response_keybd_config -*board_vivaldi_keybd_config(void) +__override const struct ec_response_keybd_config * +board_vivaldi_keybd_config(void) { /* * Future boards should use fw_config if needed. @@ -830,11 +817,11 @@ static void panel_power_change_deferred(void) gpio_set_level(GPIO_EN_LCD_ENN, signal); } else if (signal != 0) { i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS, - ISL98607_REG_VBST_OUT, ISL98607_VBST_OUT_5P65); + ISL98607_REG_VBST_OUT, ISL98607_VBST_OUT_5P65); i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS, - ISL98607_REG_VN_OUT, ISL98607_VN_OUT_5P5); + ISL98607_REG_VN_OUT, ISL98607_VN_OUT_5P5); i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS, - ISL98607_REG_VP_OUT, ISL98607_VP_OUT_5P5); + ISL98607_REG_VP_OUT, ISL98607_VP_OUT_5P5); } gpio_set_level(GPIO_TSP_TA, signal & extpower_is_present()); } @@ -878,9 +865,8 @@ static void lcd_reset_change_deferred(void) if (signal == 0) return; - i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS, - ISL98607_REG_ENABLE, ISL97607_VP_VN_VBST_DIS); - + i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS, ISL98607_REG_ENABLE, + ISL97607_VP_VN_VBST_DIS); } DECLARE_DEFERRED(lcd_reset_change_deferred); void lcd_reset_change_interrupt(enum gpio_signal signal) @@ -927,8 +913,6 @@ void backlit_gpio_tick(void) if (board_id >= 4 && signal == 1) i2c_write16(I2C_PORT_LCD, I2C_ADDR_MP3372_FLAGS, - MP3372_REG_ISET_CHEN, - MP3372_ISET_15P3_CHEN_ALL); - + MP3372_REG_ISET_CHEN, MP3372_ISET_15P3_CHEN_ALL); } DECLARE_HOOK(HOOK_TICK, backlit_gpio_tick, HOOK_PRIO_DEFAULT); diff --git a/board/bugzzy/board.h b/board/bugzzy/board.h index 722375b34b..707314d02a 100644 --- a/board/bugzzy/board.h +++ b/board/bugzzy/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. */ @@ -32,12 +32,15 @@ /* 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 #define CONFIG_CHARGE_RAMP_HW -#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) #define CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS @@ -60,9 +63,8 @@ #define GPIO_BAT_LED_GREEN_L GPIO_LED_G_ODL #define GPIO_PWR_LED_BLUE_L GPIO_LED_B_ODL - /* PWM */ -#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */ +#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */ /* Thermistors */ #define CONFIG_TEMP_SENSOR @@ -97,23 +99,23 @@ #undef PD_POWER_SUPPLY_TURN_OFF_DELAY #undef CONFIG_USBC_VCONN_SWAP_DELAY_US /* 20% margin added for these timings */ -#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */ -#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */ +#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */ +#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */ #undef CONFIG_USBC_VCONN_SWAP_DELAY_US -#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */ +#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */ /* I2C configuration */ -#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 -#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 -#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 -#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0 +#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 +#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 +#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 +#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0 #define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 -#define I2C_PORT_LCD NPCX_I2C_PORT3_0 +#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 +#define I2C_PORT_LCD NPCX_I2C_PORT3_0 /* TODO(b:147440290): Need to handle multiple charger ICs */ -#define I2C_PORT_CHARGER I2C_PORT_USB_C0 +#define I2C_PORT_CHARGER I2C_PORT_USB_C0 -#define I2C_PORT_ACCEL I2C_PORT_SENSOR +#define I2C_PORT_ACCEL I2C_PORT_SENSOR #define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */ #define I2C_ADDR_ISL98607_FLAGS 0x29 @@ -121,30 +123,30 @@ /* ISL98607 registers and value */ /* Enable VP / VN / VBST */ -#define ISL98607_REG_ENABLE 0x05 -#define ISL98607_VP_VN_VBST_EN 0x07 -#define ISL97607_VP_VN_VBST_DIS 0x00 +#define ISL98607_REG_ENABLE 0x05 +#define ISL98607_VP_VN_VBST_EN 0x07 +#define ISL97607_VP_VN_VBST_DIS 0x00 /* VBST Voltage Adjustment */ -#define ISL98607_REG_VBST_OUT 0x06 -#define ISL98607_VBST_OUT_5P65 0x0a +#define ISL98607_REG_VBST_OUT 0x06 +#define ISL98607_VBST_OUT_5P65 0x0a /* VN Voltage Adjustment */ -#define ISL98607_REG_VN_OUT 0x08 -#define ISL98607_VN_OUT_5P5 0x0a +#define ISL98607_REG_VN_OUT 0x08 +#define ISL98607_VN_OUT_5P5 0x0a /* VP Voltage Adjustment */ -#define ISL98607_REG_VP_OUT 0x09 -#define ISL98607_VP_OUT_5P5 0x0a +#define ISL98607_REG_VP_OUT 0x09 +#define ISL98607_VP_OUT_5P5 0x0a /* MP3372 registers and value */ /* ISET & CHEN */ -#define MP3372_REG_ISET_CHEN 0x00 -#define MP3372_ISET_21P8_CHEN_ALL 0x70ff -#define MP3372_ISET_19P4_CHEN_ALL 0x63ff -#define MP3372_ISET_18P0_CHEN_ALL 0x5cff -#define MP3372_ISET_15P8_CHEN_ALL 0x50ff -#define MP3372_ISET_15P3_CHEN_ALL 0x4eff +#define MP3372_REG_ISET_CHEN 0x00 +#define MP3372_ISET_21P8_CHEN_ALL 0x70ff +#define MP3372_ISET_19P4_CHEN_ALL 0x63ff +#define MP3372_ISET_18P0_CHEN_ALL 0x5cff +#define MP3372_ISET_15P8_CHEN_ALL 0x50ff +#define MP3372_ISET_15P3_CHEN_ALL 0x4eff /* * I2C pin names for baseboard * @@ -158,18 +160,18 @@ #define CONFIG_CMD_ACCELS #define CONFIG_CMD_ACCEL_INFO -#define CONFIG_ACCELGYRO_BMI160 /* Base accel */ +#define CONFIG_ACCELGYRO_BMI160 /* Base accel */ /* Lid operates in forced mode, base in interrupt mode */ #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 \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) -#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ +#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ #define CONFIG_ACCEL_LSM6DSM_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) @@ -204,21 +206,16 @@ enum temp_sensor_id { }; enum adc_channel { - ADC_TEMP_SENSOR_1, /* ADC0 */ - ADC_TEMP_SENSOR_2, /* ADC1 */ - ADC_TEMP_SENSOR_3, /* ADC5 */ - ADC_TEMP_SENSOR_4, /* ADC6 */ - ADC_SUB_ANALOG, /* ADC2 */ - ADC_VSNS_PP3300_A, /* ADC9 */ + ADC_TEMP_SENSOR_1, /* ADC0 */ + ADC_TEMP_SENSOR_2, /* ADC1 */ + ADC_TEMP_SENSOR_3, /* ADC5 */ + ADC_TEMP_SENSOR_4, /* ADC6 */ + ADC_SUB_ANALOG, /* ADC2 */ + ADC_VSNS_PP3300_A, /* ADC9 */ ADC_CH_COUNT }; -enum sensor_id { - LID_ACCEL, - BASE_ACCEL, - BASE_GYRO, - SENSOR_COUNT -}; +enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT }; /* List of possible batteries */ enum battery_type { diff --git a/board/bugzzy/build.mk b/board/bugzzy/build.mk index 815a285d83..5b37e085ef 100644 --- a/board/bugzzy/build.mk +++ b/board/bugzzy/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/bugzzy/cbi_ssfc.c b/board/bugzzy/cbi_ssfc.c index c4b859f133..81f3ee0dad 100644 --- a/board/bugzzy/cbi_ssfc.c +++ b/board/bugzzy/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/bugzzy/cbi_ssfc.h b/board/bugzzy/cbi_ssfc.h index 935049b6ae..bf8853a43a 100644 --- a/board/bugzzy/cbi_ssfc.h +++ b/board/bugzzy/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. */ @@ -56,5 +56,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/bugzzy/ec.tasklist b/board/bugzzy/ec.tasklist index d4fb416bce..29666dd959 100644 --- a/board/bugzzy/ec.tasklist +++ b/board/bugzzy/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/bugzzy/gpio.inc b/board/bugzzy/gpio.inc index b8bd5bf604..8e0fa56768 100644 --- a/board/bugzzy/gpio.inc +++ b/board/bugzzy/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/bugzzy/led.c b/board/bugzzy/led.c index 17da244534..cad2d5ed0b 100644 --- a/board/bugzzy/led.c +++ b/board/bugzzy/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. * @@ -12,8 +12,8 @@ #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 = 1; @@ -21,33 +21,36 @@ __override const int led_charge_lvl_2 = 100; /* bugzzy : There are 3 leds for AC, Battery and Power */ __override struct led_descriptor - led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { - [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * LED_ONE_SEC} }, - [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} }, - [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0_BAT_LOW] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC}, - {LED_OFF, 0.5 * LED_ONE_SEC} }, - [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * LED_ONE_SEC} }, -}; + led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { + [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED, + 1 * LED_ONE_SEC }, + { LED_OFF, 1 * LED_ONE_SEC } }, + [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED, + LED_INDEFINITE } }, + [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_GREEN, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } }, + [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } }, + [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } }, + [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, + 0.5 * LED_ONE_SEC }, + { LED_OFF, 0.5 * LED_ONE_SEC } }, + [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC }, + { LED_OFF, 1 * LED_ONE_SEC } }, + }; __override const struct led_descriptor - led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = { - [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} }, - [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} }, - [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} }, - [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} }, -}; - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_BATTERY_LED, - EC_LED_ID_POWER_LED -}; + led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = { + [PWR_LED_STATE_ON] = { { EC_LED_COLOR_BLUE, LED_INDEFINITE } }, + [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } }, + [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } }, + [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } }, + }; + +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED, + EC_LED_ID_POWER_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -57,7 +60,7 @@ __override void led_set_color_power(enum ec_led_colors color) /* Don't set led if led_auto_control is disabled. */ if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) || - !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { + !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { return; } @@ -70,8 +73,7 @@ __override void led_set_color_power(enum ec_led_colors color) return; } - if (color == EC_LED_COLOR_BLUE) - { + if (color == EC_LED_COLOR_BLUE) { gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL); gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL); gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_ON_LVL); @@ -87,7 +89,7 @@ __override void led_set_color_battery(enum ec_led_colors color) /* Don't set led if led_auto_control is disabled. */ if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) || - !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { + !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { return; } @@ -140,12 +142,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_PWR_LED_BLUE_L, LED_OFF_LVL); gpio_set_level(GPIO_BAT_LED_GREEN_L, - !brightness[EC_LED_COLOR_GREEN]); + !brightness[EC_LED_COLOR_GREEN]); gpio_set_level(GPIO_BAT_LED_RED_L, - !brightness[EC_LED_COLOR_RED]); + !brightness[EC_LED_COLOR_RED]); } else if (led_id == EC_LED_ID_POWER_LED) { gpio_set_level(GPIO_PWR_LED_BLUE_L, - !brightness[EC_LED_COLOR_BLUE]); + !brightness[EC_LED_COLOR_BLUE]); gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL); gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL); } diff --git a/board/bugzzy/usb_pd_policy.c b/board/bugzzy/usb_pd_policy.c index 15faf41ffc..83c09bb99e 100644 --- a/board/bugzzy/usb_pd_policy.c +++ b/board/bugzzy/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) { |