diff options
Diffstat (limited to 'board/banshee')
-rw-r--r-- | board/banshee/battery.c | 2 | ||||
-rw-r--r-- | board/banshee/board.c | 103 | ||||
-rw-r--r-- | board/banshee/board.h | 142 | ||||
-rw-r--r-- | board/banshee/build.mk | 3 | ||||
-rw-r--r-- | board/banshee/charger.c | 12 | ||||
-rw-r--r-- | board/banshee/ec.tasklist | 2 | ||||
-rw-r--r-- | board/banshee/fans.c | 4 | ||||
-rw-r--r-- | board/banshee/fw_config.c | 4 | ||||
-rw-r--r-- | board/banshee/fw_config.h | 13 | ||||
-rw-r--r-- | board/banshee/gpio.inc | 2 | ||||
-rw-r--r-- | board/banshee/i2c.c | 22 | ||||
-rw-r--r-- | board/banshee/keyboard.c | 36 | ||||
-rw-r--r-- | board/banshee/keyboard_customization.c | 111 | ||||
-rw-r--r-- | board/banshee/keyboard_customization.h | 79 | ||||
-rw-r--r-- | board/banshee/led.c | 92 | ||||
-rw-r--r-- | board/banshee/pwm.c | 2 | ||||
-rw-r--r-- | board/banshee/sensors.c | 29 | ||||
-rw-r--r-- | board/banshee/tune_mp2964.c | 43 | ||||
-rw-r--r-- | board/banshee/usbc_config.c | 114 | ||||
-rw-r--r-- | board/banshee/usbc_config.h | 4 |
20 files changed, 436 insertions, 383 deletions
diff --git a/board/banshee/battery.c b/board/banshee/battery.c index 8143e6cec8..35d6a7a935 100644 --- a/board/banshee/battery.c +++ b/board/banshee/battery.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 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/banshee/board.c b/board/banshee/board.c index 8f1d8bb811..611686f88d 100644 --- a/board/banshee/board.c +++ b/board/banshee/board.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -10,14 +10,17 @@ #include "common.h" #include "compile_time_macros.h" #include "console.h" +#include "cros_board_info.h" #include "gpio.h" #include "gpio_signal.h" #include "hooks.h" #include "driver/als_tcs3400.h" #include "driver/charger/isl9241.h" +#include "driver/retimer/bb_retimer.h" #include "fw_config.h" #include "hooks.h" #include "keyboard_customization.h" +#include "keyboard_scan.h" #include "lid_switch.h" #include "power_button.h" #include "power.h" @@ -25,22 +28,47 @@ #include "switch.h" #include "throttle_ap.h" #include "usbc_config.h" +#include "watchdog.h" #include "gpio_list.h" /* Must come after other header files. */ /* Console output macros */ -#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args) -#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args) +#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args) +#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args) + +/* + * USBA card connect to chromebook the USB_3_CONNECTION + * bit would be enable. + * It will increase BBR power consumption, so clear + * USB3_Connection bit in S0ix and enable when return S0. + */ +void set_bb_retimer_usb3_state(bool enable) +{ + mux_state_t mux_state = 0; + + for (int i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { + const struct usb_mux *mux = usb_muxes[i].mux; + + mux_state = usb_mux_get(i); + + if ((mux_state & USB_PD_MUX_USB_ENABLED)) { + bb_retimer_set_usb3(mux, enable); + } + } +} /* Called on AP S3 -> S0 transition */ static void board_chipset_resume(void) { + if (chipset_in_state(CHIPSET_STATE_ON)) + set_bb_retimer_usb3_state(true); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); /* Called on AP S0 -> S3 transition */ static void board_chipset_suspend(void) { + set_bb_retimer_usb3_state(false); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); @@ -50,58 +78,97 @@ void board_set_charger_current_limit_deferred(void) int rv; if (extpower_is_present() && - (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)) + (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)) /* AC only or AC+DC but battery is disconnect */ action = MASK_SET; else action = MASK_CLR; rv = i2c_update16(chg_chips[CHARGER_SOLO].i2c_port, - chg_chips[CHARGER_SOLO].i2c_addr_flags, - ISL9241_REG_CONTROL3, - ISL9241_CONTROL3_INPUT_CURRENT_LIMIT, action); + chg_chips[CHARGER_SOLO].i2c_addr_flags, + ISL9241_REG_CONTROL3, + ISL9241_CONTROL3_INPUT_CURRENT_LIMIT, action); if (rv) - CPRINTF("Could not set charger input current limit! Error: %d\n" - , rv); + CPRINTF("Could not set charger input current limit! Error: %d\n", + rv); } DECLARE_DEFERRED(board_set_charger_current_limit_deferred); DECLARE_HOOK(HOOK_SECOND, board_set_charger_current_limit_deferred, - HOOK_PRIO_DEFAULT); + HOOK_PRIO_DEFAULT); void battery_present_interrupt(enum gpio_signal signal) { hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0); } -void board_init(void) +static uint32_t board_id; +static void configure_keyboard(void) { - int board_id = get_board_id(); + uint32_t cbi_val; - gpio_enable_interrupt(GPIO_EC_BATT_PRES_ODL); - hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0); + /* Board ID */ + if (cbi_get_board_version(&cbi_val) != EC_SUCCESS || + cbi_val > UINT8_MAX) + CPRINTS("CBI: Read Board ID failed"); + else + board_id = cbi_val; + + CPRINTS("Read Board ID: %d", board_id); if (board_id == 0) { /* keyboard_col2_inverted on board id 0 */ gpio_set_flags(GPIO_EC_KSO_04_INV, GPIO_ODR_HIGH); gpio_set_flags(GPIO_EC_KSO_05_INV, GPIO_ODR_HIGH); gpio_set_alternate_function(GPIO_PORT_1, (BIT(4) | BIT(5)), - GPIO_ALT_FUNC_DEFAULT); + GPIO_ALT_FUNC_DEFAULT); } else if (board_id == 1) { /* keyboard_col4_inverted on board id 1 */ gpio_set_flags(GPIO_EC_KSO_02_INV, GPIO_ODR_HIGH); gpio_set_flags(GPIO_EC_KSO_05_INV, GPIO_ODR_HIGH); gpio_set_alternate_function(GPIO_PORT_1, (BIT(4) | BIT(7)), - GPIO_ALT_FUNC_DEFAULT); + GPIO_ALT_FUNC_DEFAULT); } else { /* keyboard_col5_inverted on board id 2 and later */ gpio_set_flags(GPIO_EC_KSO_02_INV, GPIO_ODR_HIGH); gpio_set_flags(GPIO_EC_KSO_04_INV, GPIO_ODR_HIGH); gpio_set_alternate_function(GPIO_PORT_1, (BIT(5) | BIT(7)), - GPIO_ALT_FUNC_DEFAULT); + GPIO_ALT_FUNC_DEFAULT); + key_typ.col_refresh = KEYBOARD_COL_ID2_REFRESH; + key_typ.row_refresh = KEYBOARD_ROW_ID2_REFRESH; } - board_id_keyboard_col_inverted(board_id); + board_id_keyboard_col_inverted((int)board_id); +} + +void board_init(void) +{ + gpio_enable_interrupt(GPIO_EC_BATT_PRES_ODL); + hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); + +__override void board_pre_task_i2c_peripheral_init(void) +{ + /* Configure board specific keyboard */ + configure_keyboard(); + + /* Workaround for b:238683420 with board id >= 2 */ + +#ifdef SECTION_IS_RO + if (board_id >= 2) { + udelay(500 * MSEC); + watchdog_reload(); + CPRINTS("Add delay to check boot key"); + } +#endif +} + +__override uint8_t board_keyboard_row_refresh(void) +{ + if (board_id < 2) + return KEYBOARD_ROW_ID1_REFRESH; + else + return KEYBOARD_ROW_ID2_REFRESH; +} diff --git a/board/banshee/board.h b/board/banshee/board.h index e412fcc7d2..c456a17e68 100644 --- a/board/banshee/board.h +++ b/board/banshee/board.h @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -35,6 +35,7 @@ #define CONFIG_MP2964 /* KEYBOARD */ +#define CONFIG_KEYBOARD_MULTIPLE #define CONFIG_KEYBOARD_CUSTOMIZATION #define CONFIG_KEYBOARD_VIVALDI @@ -58,13 +59,12 @@ /* Sensors without hardware FIFO are in forced mode */ #define CONFIG_ACCEL_FORCE_MODE_MASK BIT(CLEAR_ALS) - /* USB Type C and USB PD defines */ #define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY #define CONFIG_IO_EXPANDER #define CONFIG_IO_EXPANDER_NCT38XX -#define CONFIG_IO_EXPANDER_PORT_COUNT 4 +#define CONFIG_IO_EXPANDER_PORT_COUNT 4 #define CONFIG_USB_PD_FRS_PPC @@ -79,17 +79,17 @@ #define CONFIG_USBC_PPC_SYV682X #define CONFIG_USB_PD_PPC -#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ -#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */ -#define PD_VCONN_SWAP_DELAY 5000 /* us */ +#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ +#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */ +#define PD_VCONN_SWAP_DELAY 5000 /* us */ /* * Passive USB-C cables only support up to 60W. */ -#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 /* * Macros for GPIO signals used in common code that don't match the @@ -97,67 +97,68 @@ * then redefined here to so it's more clear which signal is being used for * which purpose. */ -#define GPIO_AC_PRESENT GPIO_ACOK_OD -#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL -#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL -#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL -#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW -#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE -#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL -#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L -#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST -#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L -#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L -#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK +#define GPIO_AC_PRESENT GPIO_ACOK_OD +#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL +#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL +#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL +#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW +#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE +#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL +#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L +#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST +#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L +#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L +#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK /* * GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup * signal. */ -#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL -#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG -#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK -#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL -#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL -#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL -#define GPIO_WP_L GPIO_EC_WP_ODL +#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL +#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG +#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK +#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL +#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL +#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL +#define GPIO_WP_L GPIO_EC_WP_ODL -#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL +#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL /* System has back-lit keyboard */ #define CONFIG_PWM_KBLIGHT /* I2C Bus Configuration */ -#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 +#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 -#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0 -#define I2C_PORT_USB_C2_C3_TCPC NPCX_I2C_PORT4_1 +#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0 +#define I2C_PORT_USB_C2_C3_TCPC NPCX_I2C_PORT4_1 -#define I2C_PORT_USB_PPC_BC12 NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_PPC_BC12 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0 -#define I2C_PORT_USB_C2_C3_MUX NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0 +#define I2C_PORT_USB_C2_C3_MUX NPCX_I2C_PORT6_1 -#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 -#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0 -#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 -#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0 +#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 +#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0 +#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 +#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0 -#define I2C_ADDR_EEPROM_FLAGS 0x50 +#define I2C_ADDR_EEPROM_FLAGS 0x50 -#define I2C_ADDR_MP2964_FLAGS 0x20 +#define I2C_ADDR_MP2964_FLAGS 0x20 -#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56 -#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57 -#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58 -#define USBC_PORT_C3_BB_RETIMER_I2C_ADDR 0x59 +#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56 +#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57 +#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58 +#define USBC_PORT_C3_BB_RETIMER_I2C_ADDR 0x59 /* Enabling Thunderbolt-compatible mode */ #define CONFIG_USB_PD_TBT_COMPAT_MODE /* Enabling USB4 mode */ #define CONFIG_USB_PD_USB4 +#define CONFIG_USB_PD_DATA_RESET_MSG /* * TODO: Disable BBR firmware update temporally, @@ -175,13 +176,13 @@ #define CONFIG_TEMP_SENSOR_POWER #define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B -#define CONFIG_FANS FAN_CH_COUNT +#define CONFIG_FANS FAN_CH_COUNT /* Charger defines */ #define CONFIG_CHARGER_ISL9241 #define CONFIG_CHARGE_RAMP_SW -#define CONFIG_CHARGER_SENSE_RESISTOR 10 -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20 +#define CONFIG_CHARGER_SENSE_RESISTOR 10 +#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20 /* * Older boards have a different ADC assignment. @@ -191,10 +192,19 @@ #ifndef __ASSEMBLER__ -#include "gpio_signal.h" /* needed by registers.h */ +#include "gpio_signal.h" /* needed by registers.h */ #include "registers.h" #include "usbc_config.h" +/* I2C access in polling mode before task is initialized */ +#define CONFIG_I2C_BITBANG + +enum banshee_bitbang_i2c_channel { + I2C_BITBANG_CHAN_BRD_ID, + I2C_BITBANG_CHAN_COUNT +}; +#define I2C_BITBANG_PORT_COUNT I2C_BITBANG_CHAN_COUNT + enum adc_channel { ADC_TEMP_SENSOR_1_DDR_SOC, ADC_TEMP_SENSOR_2_AMBIENT, @@ -209,10 +219,7 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; -enum sensor_id { - CLEAR_ALS = 0, - SENSOR_COUNT -}; +enum sensor_id { CLEAR_ALS = 0, SENSOR_COUNT }; enum ioex_port { IOEX_C0_NCT38XX = 0, @@ -222,30 +229,21 @@ enum ioex_port { IOEX_PORT_COUNT }; -enum battery_type { - BATTERY_NVT, - BATTERY_TYPE_COUNT -}; +enum battery_type { BATTERY_NVT, BATTERY_TYPE_COUNT }; enum pwm_channel { - PWM_CH_SIDE_LED_R = 0, /* PWM0 (Red charger) */ - PWM_CH_SIDE_LED_G, /* PWM1 (Green charger) */ - PWM_CH_SIDE_LED_B, /* PWM2 (Blue charger) */ - PWM_CH_KBLIGHT, /* PWM3 */ - PWM_CH_FAN, /* PWM5 */ - PWM_CH_POWER_LED_W, /* PWM7 (white LED) */ + PWM_CH_SIDE_LED_R = 0, /* PWM0 (Red charger) */ + PWM_CH_SIDE_LED_G, /* PWM1 (Green charger) */ + PWM_CH_SIDE_LED_B, /* PWM2 (Blue charger) */ + PWM_CH_KBLIGHT, /* PWM3 */ + PWM_CH_FAN, /* PWM5 */ + PWM_CH_POWER_LED_W, /* PWM7 (white LED) */ PWM_CH_COUNT }; -enum fan_channel { - FAN_CH_0 = 0, - FAN_CH_COUNT -}; +enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT }; -enum mft_channel { - MFT_CH_0 = 0, - MFT_CH_COUNT -}; +enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT }; void battery_present_interrupt(enum gpio_signal signal); diff --git a/board/banshee/build.mk b/board/banshee/build.mk index 88621dd44b..78c675a67a 100644 --- a/board/banshee/build.mk +++ b/board/banshee/build.mk @@ -1,5 +1,5 @@ # -*- makefile -*- -# Copyright 2022 The Chromium OS Authors. All rights reserved. +# Copyright 2022 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # @@ -22,6 +22,5 @@ board-y+=keyboard.o board-y+=led.o board-y+=pwm.o board-y+=sensors.o -board-y+=tune_mp2964.o board-y+=usbc_config.o board-y+=keyboard_customization.o diff --git a/board/banshee/charger.c b/board/banshee/charger.c index 85e0de90fe..88f5b85a41 100644 --- a/board/banshee/charger.c +++ b/board/banshee/charger.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -15,9 +15,8 @@ #include "usb_pd.h" #include "util.h" - -#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args) +#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args) +#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args) /* Charger Chip Configuration */ const struct charger_config_t chg_chips[] = { @@ -84,7 +83,6 @@ int board_set_active_charge_port(int port) __overridable 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); } diff --git a/board/banshee/ec.tasklist b/board/banshee/ec.tasklist index 0b8d0e412b..b193da8f9f 100644 --- a/board/banshee/ec.tasklist +++ b/board/banshee/ec.tasklist @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 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/banshee/fans.c b/board/banshee/fans.c index 73bd0dcd77..0658dc8859 100644 --- a/board/banshee/fans.c +++ b/board/banshee/fans.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); static const struct fan_conf fan_conf_0 = { .flags = FAN_USE_RPM_MODE, - .ch = MFT_CH_0, /* Use MFT id to control fan */ + .ch = MFT_CH_0, /* Use MFT id to control fan */ .pgood_gpio = -1, .enable_gpio = GPIO_EN_PP5000_FAN, }; diff --git a/board/banshee/fw_config.c b/board/banshee/fw_config.c index 2ce200cc4f..dc7fe7ca2a 100644 --- a/board/banshee/fw_config.c +++ b/board/banshee/fw_config.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -10,7 +10,7 @@ #include "cros_board_info.h" #include "fw_config.h" -#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args) +#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args) static union banshee_cbi_fw_config fw_config; BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t)); diff --git a/board/banshee/fw_config.h b/board/banshee/fw_config.h index 6800c492ad..912aebca7e 100644 --- a/board/banshee/fw_config.h +++ b/board/banshee/fw_config.h @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -14,7 +14,6 @@ * Source of truth is the project/brya/brya/config.star configuration file. */ - enum ec_cfg_keyboard_backlight_type { KEYBOARD_BACKLIGHT_DISABLED = 0, KEYBOARD_BACKLIGHT_ENABLED = 1 @@ -22,11 +21,11 @@ enum ec_cfg_keyboard_backlight_type { union banshee_cbi_fw_config { struct { - uint32_t sd_db : 2; - uint32_t lte_db : 1; - enum ec_cfg_keyboard_backlight_type kb_bl : 1; - uint32_t audio : 3; - uint32_t reserved_1 : 21; + uint32_t sd_db : 2; + uint32_t lte_db : 1; + enum ec_cfg_keyboard_backlight_type kb_bl : 1; + uint32_t audio : 3; + uint32_t reserved_1 : 21; }; uint32_t raw_value; }; diff --git a/board/banshee/gpio.inc b/board/banshee/gpio.inc index 2a0e90e675..e33fa5ec06 100644 --- a/board/banshee/gpio.inc +++ b/board/banshee/gpio.inc @@ -1,6 +1,6 @@ /* -*- mode:c -*- * - * Copyright 2022 The Chromium OS Authors. All rights reserved. + * Copyright 2022 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/banshee/i2c.c b/board/banshee/i2c.c index ed92cfbf82..ea3fd38e62 100644 --- a/board/banshee/i2c.c +++ b/board/banshee/i2c.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -7,8 +7,9 @@ #include "compile_time_macros.h" #include "hooks.h" #include "i2c.h" +#include "i2c_bitbang.h" -#define BOARD_ID_FAST_PLUS_CAPABLE 2 +#define BOARD_ID_FAST_PLUS_CAPABLE 2 /* I2C port map configuration */ const struct i2c_port_t i2c_ports[] = { @@ -40,7 +41,7 @@ const struct i2c_port_t i2c_ports[] = { /* I2C3 */ .name = "retimer0,1", .port = I2C_PORT_USB_C0_C1_MUX, - .kbps = 1000, + .kbps = 400, .scl = GPIO_EC_I2C_USB_C0_C1_RT_SCL, .sda = GPIO_EC_I2C_USB_C0_C1_RT_SDA, }, @@ -64,7 +65,7 @@ const struct i2c_port_t i2c_ports[] = { /* I2C6 */ .name = "retimer2,3", .port = I2C_PORT_USB_C2_C3_MUX, - .kbps = 1000, + .kbps = 400, .scl = GPIO_EC_I2C_USB_C2_C3_RT_SCL, .sda = GPIO_EC_I2C_USB_C2_C3_RT_SDA, }, @@ -78,3 +79,16 @@ const struct i2c_port_t i2c_ports[] = { }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); + +const struct i2c_port_t i2c_bitbang_ports[] = { + [I2C_BITBANG_CHAN_BRD_ID] = { + .name = "bitbang_brd_id", + .port = I2C_PORT_EEPROM, + .kbps = 100, + .scl = GPIO_EC_I2C_MISC_SCL_R, + .sda = GPIO_EC_I2C_MISC_SDA_R, + .drv = &bitbang_drv, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(i2c_bitbang_ports) == I2C_BITBANG_CHAN_COUNT); +const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports); diff --git a/board/banshee/keyboard.c b/board/banshee/keyboard.c index 3891955b46..928f02e025 100644 --- a/board/banshee/keyboard.c +++ b/board/banshee/keyboard.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -63,8 +63,8 @@ static const struct ec_response_keybd_config banshee_kb_id2 = { .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) { if (get_board_id() <= 1) return &banshee_kb_id1; @@ -81,20 +81,20 @@ __override const struct key { uint8_t row; uint8_t col; } vivaldi_keys[] = { - {.row = 3, .col = 5}, /* T1 */ - {.row = 2, .col = 5}, /* T2 */ - {.row = 6, .col = 4}, /* T3 */ - {.row = 3, .col = 4}, /* T4 */ - {.row = 4, .col = 10}, /* T5 */ - {.row = 3, .col = 10}, /* T6 */ - {.row = 2, .col = 10}, /* T7 */ - {.row = 1, .col = 15}, /* T8 */ - {.row = 3, .col = 11}, /* T9 */ - {.row = 4, .col = 8}, /* T10 */ - {.row = 6, .col = 8}, /* T11 */ - {.row = 3, .col = 13}, /* T12 */ - {.row = 3, .col = 5}, /* T13 */ - {.row = 0, .col = 9}, /* T14 */ - {.row = 0, .col = 11}, /* T15 */ + { .row = 3, .col = 5 }, /* T1 */ + { .row = 2, .col = 5 }, /* T2 */ + { .row = 6, .col = 4 }, /* T3 */ + { .row = 3, .col = 4 }, /* T4 */ + { .row = 4, .col = 10 }, /* T5 */ + { .row = 3, .col = 10 }, /* T6 */ + { .row = 2, .col = 10 }, /* T7 */ + { .row = 1, .col = 15 }, /* T8 */ + { .row = 3, .col = 11 }, /* T9 */ + { .row = 4, .col = 8 }, /* T10 */ + { .row = 6, .col = 8 }, /* T11 */ + { .row = 3, .col = 13 }, /* T12 */ + { .row = 3, .col = 5 }, /* T13 */ + { .row = 0, .col = 9 }, /* T14 */ + { .row = 0, .col = 11 }, /* T15 */ }; BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS); diff --git a/board/banshee/keyboard_customization.c b/board/banshee/keyboard_customization.c index cf6904cb37..dfec873343 100644 --- a/board/banshee/keyboard_customization.c +++ b/board/banshee/keyboard_customization.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -10,30 +10,30 @@ #include "keyboard_config.h" #include "keyboard_protocol.h" #include "keyboard_raw.h" +#include "keyboard_scan.h" enum gpio_signal signal; static int colinv; static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { - {0x0021, 0x007B, 0x0079, 0x0072, 0x007A, 0x0071, 0x0069, 0xe04A}, - {0x002f, 0xe070, 0x007D, 0xe01f, 0x006c, 0xe06c, 0xe07d, 0x0077}, - {0x0015, 0x0070, 0x00ff, 0x000D, 0x000E, 0x0016, 0x0067, 0x001c}, - {0xe011, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0xe05a, 0x0029, 0x0024, 0xe01d, 0xe01f, 0x0026, 0xe020, 0xe07a}, - {0x0022, 0x001a, 0xe030, 0xe038, 0x001b, 0x001e, 0x001d, 0x0076}, - {0x002A, 0x0032, 0x0034, 0x002c, 0x002e, 0x0025, 0x002d, 0x002b}, - {0x003a, 0x0031, 0x0033, 0x0035, 0x0036, 0x003d, 0x003c, 0x003b}, - {0x0049, 0xe072, 0x005d, 0x0044, 0xe023, 0x0046, 0xe021, 0x004b}, - {0x0059, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0041, 0x007c, 0xe02c, 0xe02d, 0xe024, 0x003e, 0x0043, 0x0042}, - {0x0013, 0x0064, 0x0075, 0xe054, 0x0051, 0x0061, 0xe06b, 0xe02f}, - {0xe014, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x004a, 0xe075, 0x004e, 0xe032, 0x0045, 0x004d, 0x0054, 0x004c}, - {0x0052, 0x005a, 0xe03c, 0xe069, 0x0055, 0x0066, 0x005b, 0x0023}, - {0x006a, 0xe035, 0xe074, 0xe054, 0x0000, 0x006b, 0x0073, 0x0074}, + { 0x0021, 0x007B, 0x0079, 0x0072, 0x007A, 0x0071, 0x0069, 0xe04A }, + { 0x002f, 0xe070, 0x007D, 0xe01f, 0x006c, 0xe06c, 0xe07d, 0x0077 }, + { 0x0015, 0x0070, 0x00ff, 0x000D, 0x000E, 0x0016, 0x0067, 0x001c }, + { 0xe011, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + { 0xe05a, 0x0029, 0x0024, 0xe01d, 0xe01f, 0x0026, 0xe020, 0xe07a }, + { 0x0022, 0x001a, 0xe030, 0xe038, 0x001b, 0x001e, 0x001d, 0x0076 }, + { 0x002A, 0x0032, 0x0034, 0x002c, 0x002e, 0x0025, 0x002d, 0x002b }, + { 0x003a, 0x0031, 0x0033, 0x0035, 0x0036, 0x003d, 0x003c, 0x003b }, + { 0x0049, 0xe072, 0x005d, 0x0044, 0xe023, 0x0046, 0xe021, 0x004b }, + { 0x0059, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + { 0x0041, 0x007c, 0xe02c, 0xe02d, 0xe024, 0x003e, 0x0043, 0x0042 }, + { 0x0013, 0x0064, 0x0075, 0xe054, 0x0051, 0x0061, 0xe06b, 0xe02f }, + { 0xe014, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + { 0x004a, 0xe075, 0x004e, 0xe032, 0x0045, 0x004d, 0x0054, 0x004c }, + { 0x0052, 0x005a, 0xe03c, 0xe069, 0x0055, 0x0066, 0x005b, 0x0023 }, + { 0x006a, 0xe035, 0xe074, 0xe054, 0x0000, 0x006b, 0x0073, 0x0074 }, }; - uint16_t get_scancode_set2(uint8_t row, uint8_t col) { if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) @@ -47,6 +47,25 @@ void set_scancode_set2(uint8_t row, uint8_t col, uint16_t val) scancode_set2[col][row] = val; } +struct keyboard_type key_typ = { + .col_esc = KEYBOARD_COL_ESC, + .row_esc = KEYBOARD_ROW_ESC, + .col_down = KEYBOARD_COL_DOWN, + .row_down = KEYBOARD_ROW_DOWN, + .col_left_shift = KEYBOARD_COL_LEFT_SHIFT, + .row_left_shift = KEYBOARD_ROW_LEFT_SHIFT, + .col_refresh = KEYBOARD_COL_ID1_REFRESH, + .row_refresh = KEYBOARD_ROW_ID1_REFRESH, + .col_right_alt = KEYBOARD_COL_RIGHT_ALT, + .row_right_alt = KEYBOARD_ROW_RIGHT_ALT, + .col_left_alt = KEYBOARD_COL_LEFT_ALT, + .row_left_alt = KEYBOARD_ROW_LEFT_ALT, + .col_key_r = KEYBOARD_COL_KEY_R, + .row_key_r = KEYBOARD_ROW_KEY_R, + .col_key_h = KEYBOARD_COL_KEY_H, + .row_key_h = KEYBOARD_ROW_KEY_H, +}; + void board_id_keyboard_col_inverted(int board_id) { if (board_id == 0) { @@ -85,38 +104,30 @@ void board_keyboard_drive_col(int col) #ifdef CONFIG_KEYBOARD_DEBUG static char keycap_label[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { - {'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, - {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, - {'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`', - '1', KLLI_UNKNO, 'a'}, - {KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, - {KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4, - KLLI_SEARC, '3', KLLI_F3, KLLI_UNKNO}, - {'x', 'z', KLLI_F2, KLLI_F1, - 's', '2', 'w', KLLI_ESC}, - {'v', 'b', 'g', 't', - '5', '4', 'r', 'f'}, - {'m', 'n', 'h', 'y', - '6', '7', 'u', 'j'}, - {'.', KLLI_DOWN, '\\', 'o', - KLLI_F10, '9', KLLI_UNKNO, 'l'}, - {KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, - {',', KLLI_UNKNO, KLLI_F7, KLLI_F6, - KLLI_F5, '8', 'i', 'k'}, - {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9, - KLLI_UNKNO, KLLI_UNKNO, KLLI_LEFT, KLLI_UNKNO}, - {KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, - {'/', KLLI_UP, '-', KLLI_UNKNO, - '0', 'p', '[', ';'}, - {'\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO, - '=', KLLI_B_SPC, ']', 'd'}, - {KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO, - KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO}, + { 'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO }, + { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO }, + { 'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`', '1', KLLI_UNKNO, 'a' }, + { KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO }, + { KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4, KLLI_SEARC, '3', KLLI_F3, + KLLI_UNKNO }, + { 'x', 'z', KLLI_F2, KLLI_F1, 's', '2', 'w', KLLI_ESC }, + { 'v', 'b', 'g', 't', '5', '4', 'r', 'f' }, + { 'm', 'n', 'h', 'y', '6', '7', 'u', 'j' }, + { '.', KLLI_DOWN, '\\', 'o', KLLI_F10, '9', KLLI_UNKNO, 'l' }, + { KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO }, + { ',', KLLI_UNKNO, KLLI_F7, KLLI_F6, KLLI_F5, '8', 'i', 'k' }, + { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9, KLLI_UNKNO, KLLI_UNKNO, + KLLI_LEFT, KLLI_UNKNO }, + { KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO }, + { '/', KLLI_UP, '-', KLLI_UNKNO, '0', 'p', '[', ';' }, + { '\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO, '=', KLLI_B_SPC, ']', 'd' }, + { KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, + KLLI_UNKNO, KLLI_UNKNO }, }; char get_keycap_label(uint8_t row, uint8_t col) diff --git a/board/banshee/keyboard_customization.h b/board/banshee/keyboard_customization.h index 18043d7453..1b4994ded0 100644 --- a/board/banshee/keyboard_customization.h +++ b/board/banshee/keyboard_customization.h @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -25,52 +25,53 @@ extern uint8_t keyboard_cols; #define KEYBOARD_ROW_TO_MASK(r) (1 << (r)) /* Columns and masks for keys we particularly care about */ -#define KEYBOARD_COL_DOWN 8 -#define KEYBOARD_ROW_DOWN 1 -#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN) -#define KEYBOARD_COL_ESC 5 -#define KEYBOARD_ROW_ESC 7 -#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC) -#define KEYBOARD_COL_KEY_H 7 -#define KEYBOARD_ROW_KEY_H 2 -#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H) -#define KEYBOARD_COL_KEY_R 6 -#define KEYBOARD_ROW_KEY_R 6 -#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R) -#define KEYBOARD_COL_LEFT_ALT 3 -#define KEYBOARD_ROW_LEFT_ALT 1 -#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT) -#define KEYBOARD_COL_REFRESH 4 -#define KEYBOARD_ROW_REFRESH 6 -#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH) -#define KEYBOARD_COL_RIGHT_ALT 3 -#define KEYBOARD_ROW_RIGHT_ALT 0 -#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT) -#define KEYBOARD_DEFAULT_COL_VOL_UP 13 -#define KEYBOARD_DEFAULT_ROW_VOL_UP 3 -#define KEYBOARD_COL_LEFT_CTRL 12 -#define KEYBOARD_ROW_LEFT_CTRL 1 +#define KEYBOARD_COL_DOWN 8 +#define KEYBOARD_ROW_DOWN 1 +#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN) +#define KEYBOARD_COL_ESC 5 +#define KEYBOARD_ROW_ESC 7 +#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC) +#define KEYBOARD_COL_KEY_H 7 +#define KEYBOARD_ROW_KEY_H 2 +#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H) +#define KEYBOARD_COL_KEY_R 6 +#define KEYBOARD_ROW_KEY_R 6 +#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R) +#define KEYBOARD_COL_LEFT_ALT 3 +#define KEYBOARD_ROW_LEFT_ALT 1 +#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT) +#define KEYBOARD_COL_ID1_REFRESH 4 +#define KEYBOARD_ROW_ID1_REFRESH 6 +#define KEYBOARD_COL_ID2_REFRESH 5 +#define KEYBOARD_ROW_ID2_REFRESH 2 +#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ID1_REFRESH) +#define KEYBOARD_COL_RIGHT_ALT 3 +#define KEYBOARD_ROW_RIGHT_ALT 0 +#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT) +#define KEYBOARD_DEFAULT_COL_VOL_UP 13 +#define KEYBOARD_DEFAULT_ROW_VOL_UP 3 +#define KEYBOARD_COL_LEFT_CTRL 12 +#define KEYBOARD_ROW_LEFT_CTRL 1 #define KEYBOARD_MASK_LEFT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_CTRL) #define KEYBOARD_COL_RIGHT_CTRL 12 #define KEYBOARD_ROW_RIGHT_CTRL 0 #define KEYBOARD_MASK_RIGHT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_CTRL) -#define KEYBOARD_COL_SEARCH 4 -#define KEYBOARD_ROW_SEARCH 4 -#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH) -#define KEYBOARD_COL_KEY_0 13 -#define KEYBOARD_ROW_KEY_0 4 -#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0) -#define KEYBOARD_COL_KEY_1 2 -#define KEYBOARD_ROW_KEY_1 5 -#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1) -#define KEYBOARD_COL_KEY_2 5 -#define KEYBOARD_ROW_KEY_2 5 -#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2) +#define KEYBOARD_COL_SEARCH 4 +#define KEYBOARD_ROW_SEARCH 4 +#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH) +#define KEYBOARD_COL_KEY_0 13 +#define KEYBOARD_ROW_KEY_0 4 +#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0) +#define KEYBOARD_COL_KEY_1 2 +#define KEYBOARD_ROW_KEY_1 5 +#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1) +#define KEYBOARD_COL_KEY_2 5 +#define KEYBOARD_ROW_KEY_2 5 +#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2) #define KEYBOARD_COL_LEFT_SHIFT 9 #define KEYBOARD_ROW_LEFT_SHIFT 1 #define KEYBOARD_MASK_LEFT_SHIFT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_SHIFT) void board_id_keyboard_col_inverted(int board_id); - #endif /* __KEYBOARD_CUSTOMIZATION_H */ diff --git a/board/banshee/led.c b/board/banshee/led.c index b1c6a6445f..1471388085 100644 --- a/board/banshee/led.c +++ b/board/banshee/led.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -28,16 +28,15 @@ #define LED_TICKS_PER_CYCLE 10 #define LED_ON_TICKS 5 -#define BREATH_LIGHT_LENGTH 55 -#define BREATH_HOLD_LENGTH 50 -#define BREATH_OFF_LENGTH 200 +#define BREATH_LIGHT_LENGTH 100 +#define BREATH_HOLD_LENGTH 50 +#define BREATH_OFF_LENGTH 200 const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED, EC_LED_ID_POWER_LED, }; - enum breath_status { BREATH_LIGHT_UP = 0, BREATH_LIGHT_DOWN, @@ -45,26 +44,23 @@ enum breath_status { BREATH_OFF, }; -enum led_port { - RIGHT_PORT = 1, - LEFT_PORT -}; +enum led_port { RIGHT_PORT = 1, LEFT_PORT }; 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] = { 50, 0, 0 }, - [EC_LED_COLOR_GREEN] = { 0, 50, 0 }, - [EC_LED_COLOR_BLUE] = { 0, 0, 8 }, - [EC_LED_COLOR_YELLOW] = { 40, 50, 0 }, - [EC_LED_COLOR_WHITE] = { 20, 50, 25 }, - [EC_LED_COLOR_AMBER] = { 45, 5, 0 }, + /* Red, Green, Blue */ + [EC_LED_COLOR_RED] = { 50, 0, 0 }, + [EC_LED_COLOR_GREEN] = { 0, 50, 0 }, + [EC_LED_COLOR_BLUE] = { 0, 0, 8 }, + [EC_LED_COLOR_YELLOW] = { 40, 50, 0 }, + [EC_LED_COLOR_WHITE] = { 4, 10, 5 }, + [EC_LED_COLOR_AMBER] = { 45, 5, 0 }, }; struct pwm_led_color_map pwr_led_color_map[EC_LED_COLOR_COUNT] = { - /* White, Green, Red */ - [EC_LED_COLOR_WHITE] = { BREATH_LIGHT_LENGTH, 0, 0 }, + /* White, Green, Red */ + [EC_LED_COLOR_WHITE] = { BREATH_LIGHT_LENGTH, 0, 0 }, }; /* @@ -88,13 +84,11 @@ struct pwm_led pwm_leds[CONFIG_LED_PWM_COUNT] = { }, }; - uint8_t breath_led_light_up; uint8_t breath_led_light_down; uint8_t breath_led_hold; uint8_t breath_led_off; - int breath_pwm_enable; int breath_led_status; static void breath_led_pwm_deferred(void); @@ -102,21 +96,19 @@ DECLARE_DEFERRED(breath_led_pwm_deferred); /* * Breath LED API - * Max duty (percentage) = BREATH_LIGHT_LENGTH (55%) - * Fade time (second) = 550ms(In) / 550ms(Out) + * Max duty (percentage) = BREATH_LIGHT_LENGTH (100%) + * Fade time (second) = 1000ms(In) / 1000ms(Out) * Duration time (second) = BREATH_HOLD_LENGTH(500ms) * Interval time (second) = BREATH_OFF_LENGTH(2000ms) */ static void breath_led_pwm_deferred(void) { - switch (breath_led_status) { case BREATH_LIGHT_UP: - if (breath_led_light_up <= BREATH_LIGHT_LENGTH) - pwm_set_duty(PWM_CH_POWER_LED_W, - breath_led_light_up++); + if (breath_led_light_up <= BREATH_LIGHT_LENGTH) + pwm_set_duty(PWM_CH_POWER_LED_W, breath_led_light_up++); else { breath_led_light_up = 0; breath_led_light_down = BREATH_LIGHT_LENGTH; @@ -126,7 +118,7 @@ static void breath_led_pwm_deferred(void) break; case BREATH_HOLD: - if (breath_led_hold <= BREATH_HOLD_LENGTH) + if (breath_led_hold <= BREATH_HOLD_LENGTH) breath_led_hold++; else { breath_led_hold = 0; @@ -138,7 +130,7 @@ static void breath_led_pwm_deferred(void) if (breath_led_light_down != 0) pwm_set_duty(PWM_CH_POWER_LED_W, - breath_led_light_down--); + breath_led_light_down--); else { breath_led_light_down = BREATH_LIGHT_LENGTH; breath_led_status = BREATH_OFF; @@ -147,7 +139,7 @@ static void breath_led_pwm_deferred(void) break; case BREATH_OFF: - if (breath_led_off <= BREATH_OFF_LENGTH) + if (breath_led_off <= BREATH_OFF_LENGTH) breath_led_off++; else { breath_led_off = 0; @@ -157,12 +149,10 @@ static void breath_led_pwm_deferred(void) break; } - if (breath_pwm_enable) hook_call_deferred(&breath_led_pwm_deferred_data, 10 * MSEC); } - void breath_led_run(uint8_t enable) { if (enable && !breath_pwm_enable) { @@ -180,7 +170,6 @@ void breath_led_run(uint8_t enable) } } - void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) { if (led_id == EC_LED_ID_BATTERY_LED) { @@ -192,7 +181,6 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) brightness_range[EC_LED_COLOR_WHITE] = 100; } else if (led_id == EC_LED_ID_POWER_LED) brightness_range[EC_LED_COLOR_WHITE] = 100; - } void set_pwr_led_color(enum pwm_led_id id, int color) @@ -265,8 +253,8 @@ static int led_get_charge_percent(void) static void select_active_port_led(int port) { if ((charge_get_state() == PWR_STATE_DISCHARGE && - led_get_charge_percent() < 10) || - charge_get_state() == PWR_STATE_ERROR) { + led_get_charge_percent() < 10) || + charge_get_state() == PWR_STATE_ERROR) { gpio_set_level(GPIO_LEFT_SIDE, 1); gpio_set_level(GPIO_RIGHT_SIDE, 1); } else if (port == RIGHT_PORT) { @@ -283,8 +271,7 @@ static void select_active_port_led(int port) static int led_power_enable(void) { - if (gpio_get_level(GPIO_LEFT_SIDE) || - gpio_get_level(GPIO_RIGHT_SIDE)) + if (gpio_get_level(GPIO_LEFT_SIDE) || gpio_get_level(GPIO_RIGHT_SIDE)) return true; return false; @@ -309,7 +296,6 @@ static void set_active_port_color(int color) static void led_set_battery(void) { static int battery_ticks; - uint32_t chflags = charge_get_flags(); battery_ticks++; @@ -322,38 +308,43 @@ static void led_set_battery(void) if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { if (led_get_charge_percent() < 10) set_active_port_color((battery_ticks & 0x2) ? - EC_LED_COLOR_RED : -1); + EC_LED_COLOR_RED : + -1); else set_active_port_color(-1); } break; case PWR_STATE_ERROR: - set_active_port_color((battery_ticks & 0x2) ? - EC_LED_COLOR_RED : -1); + set_active_port_color((battery_ticks & 0x2) ? EC_LED_COLOR_RED : + -1); break; case PWR_STATE_CHARGE_NEAR_FULL: - set_active_port_color(EC_LED_COLOR_GREEN); + set_active_port_color(EC_LED_COLOR_WHITE); break; case PWR_STATE_IDLE: - if (chflags & CHARGE_FLAG_FORCE_IDLE) - set_active_port_color((battery_ticks & 0x4) ? - EC_LED_COLOR_AMBER : -1); - else - set_active_port_color(EC_LED_COLOR_AMBER); + set_active_port_color(EC_LED_COLOR_AMBER); + break; + case PWR_STATE_FORCED_IDLE: + set_active_port_color( + (battery_ticks & 0x4) ? EC_LED_COLOR_AMBER : -1); break; default: break; } - } static void led_set_power(void) { + /* turn off led when lid is close*/ + if (!lid_is_open()) { + set_pwr_led_color(PWM_LED1, -1); + return; + } + if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) { breath_led_run(1); return; - } - else + } else breath_led_run(0); if (chipset_in_state(CHIPSET_STATE_ON)) { @@ -369,6 +360,5 @@ static void led_tick(void) led_set_battery(); if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) led_set_power(); - } DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); diff --git a/board/banshee/pwm.c b/board/banshee/pwm.c index e02d19064d..bfe5071eca 100644 --- a/board/banshee/pwm.c +++ b/board/banshee/pwm.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 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/banshee/sensors.c b/board/banshee/sensors.c index b4b6360984..57b81b2af8 100644 --- a/board/banshee/sensors.c +++ b/board/banshee/sensors.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -40,15 +40,14 @@ struct adc_t adc_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - /* CM32183 private data */ static struct als_drv_data_t g_cm32183_data = { /** * adjusted_value = raw_value * scale + raw_value * uscale / 10000 - * the coeficient we need is 3.8 + * the coeficient we need is 3.2 */ .als_cal.scale = 3, - .als_cal.uscale = 8000, + .als_cal.uscale = 2000, .als_cal.offset = 0, .als_cal.channel_scale = { /* TODO(b/219424210): Calibrate ALS CM32183A3OP */ @@ -120,8 +119,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_CPU \ - { \ +#define THERMAL_CPU \ + { \ .temp_host = { \ [EC_TEMP_THRESH_WARN] = C_TO_K(80), \ [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ @@ -131,7 +130,7 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); [EC_TEMP_THRESH_WARN] = C_TO_K(75), \ [EC_TEMP_THRESH_HIGH] = C_TO_K(81), \ }, \ - .temp_fan_off = C_TO_K(40), \ + .temp_fan_off = C_TO_K(50), \ .temp_fan_max = C_TO_K(58), \ } __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; @@ -152,8 +151,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_AMBIENT \ - { \ +#define THERMAL_AMBIENT \ + { \ .temp_host = { \ [EC_TEMP_THRESH_WARN] = C_TO_K(85), \ [EC_TEMP_THRESH_HIGH] = C_TO_K(95), \ @@ -163,7 +162,7 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; [EC_TEMP_THRESH_WARN] = C_TO_K(70), \ [EC_TEMP_THRESH_HIGH] = C_TO_K(86), \ }, \ - .temp_fan_off = C_TO_K(40), \ + .temp_fan_off = C_TO_K(50), \ .temp_fan_max = C_TO_K(58), \ } __maybe_unused static const struct ec_thermal_config thermal_ambient = @@ -183,8 +182,8 @@ __maybe_unused static const struct ec_thermal_config thermal_ambient = /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_CHARGER \ - { \ +#define THERMAL_CHARGER \ + { \ .temp_host = { \ [EC_TEMP_THRESH_WARN] = C_TO_K(90), \ [EC_TEMP_THRESH_HIGH] = C_TO_K(100), \ @@ -194,7 +193,7 @@ __maybe_unused static const struct ec_thermal_config thermal_ambient = [EC_TEMP_THRESH_WARN] = C_TO_K(85), \ [EC_TEMP_THRESH_HIGH] = C_TO_K(91), \ }, \ - .temp_fan_off = C_TO_K(40), \ + .temp_fan_off = C_TO_K(50), \ .temp_fan_max = C_TO_K(58), \ } __maybe_unused static const struct ec_thermal_config thermal_charger = @@ -206,8 +205,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger = /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_WWAN \ - { \ +#define THERMAL_WWAN \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(130), \ [EC_TEMP_THRESH_HALT] = C_TO_K(130), \ diff --git a/board/banshee/tune_mp2964.c b/board/banshee/tune_mp2964.c deleted file mode 100644 index f67caa587e..0000000000 --- a/board/banshee/tune_mp2964.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Tune the MP2964 IMVP9.1 parameters for brya */ - -#include "common.h" -#include "compile_time_macros.h" -#include "console.h" -#include "hooks.h" -#include "mp2964.h" - -const static struct mp2964_reg_val rail_a[] = { - { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */ -}; -const static struct mp2964_reg_val rail_b[] = { - { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */ -}; - -static void mp2964_on_startup(void) -{ - static int chip_updated; - int status; - - if (get_board_id() != 1) - return; - - if (chip_updated) - return; - - chip_updated = 1; - - ccprintf("%s: attempting to tune PMIC\n", __func__); - - status = mp2964_tune(rail_a, ARRAY_SIZE(rail_a), - rail_b, ARRAY_SIZE(rail_b)); - if (status != EC_SUCCESS) - ccprintf("%s: could not update all settings\n", __func__); -} - -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, mp2964_on_startup, - HOOK_PRIO_FIRST); diff --git a/board/banshee/usbc_config.c b/board/banshee/usbc_config.c index 93292873bc..7840b865ab 100644 --- a/board/banshee/usbc_config.c +++ b/board/banshee/usbc_config.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -36,8 +36,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) /* USBC TCPC configuration */ const struct tcpc_config_t tcpc_config[] = { @@ -113,59 +113,79 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT); unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); /* USBC mux configuration - Alder Lake includes internal mux */ -static const struct usb_mux usbc0_tcss_usb_mux = { - .usb_port = USBC_PORT_C0, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, +static const struct usb_mux_chain usbc0_tcss_usb_mux = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C0, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, }; -static const struct usb_mux usbc1_tcss_usb_mux = { - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, +static const struct usb_mux_chain usbc1_tcss_usb_mux = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C1, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, }; -static const struct usb_mux usbc2_tcss_usb_mux = { - .usb_port = USBC_PORT_C2, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, +static const struct usb_mux_chain usbc2_tcss_usb_mux = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C2, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, }; -static const struct usb_mux usbc3_tcss_usb_mux = { - .usb_port = USBC_PORT_C3, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, +static const struct usb_mux_chain usbc3_tcss_usb_mux = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C3, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, }; -const struct usb_mux usb_muxes[] = { +const struct usb_mux_chain usb_muxes[] = { [USBC_PORT_C0] = { - .usb_port = USBC_PORT_C0, - .driver = &bb_usb_retimer, - .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C0_C1_MUX, - .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR, - .next_mux = &usbc0_tcss_usb_mux, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C0, + .driver = &bb_usb_retimer, + .hpd_update = bb_retimer_hpd_update, + .i2c_port = I2C_PORT_USB_C0_C1_MUX, + .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR, + }, + .next = &usbc0_tcss_usb_mux, }, [USBC_PORT_C1] = { - .usb_port = USBC_PORT_C1, - .driver = &bb_usb_retimer, - .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C0_C1_MUX, - .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, - .next_mux = &usbc1_tcss_usb_mux, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C1, + .driver = &bb_usb_retimer, + .hpd_update = bb_retimer_hpd_update, + .i2c_port = I2C_PORT_USB_C0_C1_MUX, + .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, + }, + .next = &usbc1_tcss_usb_mux, }, [USBC_PORT_C2] = { - .usb_port = USBC_PORT_C2, - .driver = &bb_usb_retimer, - .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C2_C3_MUX, - .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR, - .next_mux = &usbc2_tcss_usb_mux, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C2, + .driver = &bb_usb_retimer, + .hpd_update = bb_retimer_hpd_update, + .i2c_port = I2C_PORT_USB_C2_C3_MUX, + .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR, + }, + .next = &usbc2_tcss_usb_mux, }, [USBC_PORT_C3] = { - .usb_port = USBC_PORT_C3, - .driver = &bb_usb_retimer, - .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C2_C3_MUX, - .i2c_addr_flags = USBC_PORT_C3_BB_RETIMER_I2C_ADDR, - .next_mux = &usbc3_tcss_usb_mux, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C3, + .driver = &bb_usb_retimer, + .hpd_update = bb_retimer_hpd_update, + .i2c_port = I2C_PORT_USB_C2_C3_MUX, + .i2c_addr_flags = USBC_PORT_C3_BB_RETIMER_I2C_ADDR, + }, + .next = &usbc3_tcss_usb_mux, }, }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); @@ -252,8 +272,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state) } if (voltage < BC12_MIN_VOLTAGE) { - CPRINTS("%s: port %d: vbus %d lower than %d", __func__, - port, voltage, BC12_MIN_VOLTAGE); + CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port, + voltage, BC12_MIN_VOLTAGE); return 1; } @@ -294,7 +314,7 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable) * which powers I2C controller within retimer */ msleep(1); - } else{ + } else { ioex_set_level(rst_signal, 0); msleep(1); } diff --git a/board/banshee/usbc_config.h b/board/banshee/usbc_config.h index 9a7cf4caca..5085b28bec 100644 --- a/board/banshee/usbc_config.h +++ b/board/banshee/usbc_config.h @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -8,7 +8,7 @@ #ifndef __CROS_EC_USBC_CONFIG_H #define __CROS_EC_USBC_CONFIG_H -#define CONFIG_USB_PD_PORT_MAX_COUNT 4 +#define CONFIG_USB_PD_PORT_MAX_COUNT 4 enum usbc_port { USBC_PORT_C0 = 0, |