diff options
Diffstat (limited to 'board/vell')
-rw-r--r-- | board/vell/battery.c | 2 | ||||
-rw-r--r-- | board/vell/board.c | 7 | ||||
-rw-r--r-- | board/vell/board.h | 144 | ||||
-rw-r--r-- | board/vell/build.mk | 2 | ||||
-rw-r--r-- | board/vell/charger.c | 16 | ||||
-rw-r--r-- | board/vell/ec.tasklist | 2 | ||||
-rw-r--r-- | board/vell/fans.c | 4 | ||||
-rw-r--r-- | board/vell/fw_config.c | 4 | ||||
-rw-r--r-- | board/vell/fw_config.h | 14 | ||||
-rw-r--r-- | board/vell/gpio.inc | 10 | ||||
-rw-r--r-- | board/vell/i2c.c | 2 | ||||
-rw-r--r-- | board/vell/keyboard.c | 15 | ||||
-rw-r--r-- | board/vell/led.c | 75 | ||||
-rw-r--r-- | board/vell/pwm.c | 2 | ||||
-rw-r--r-- | board/vell/sensors.c | 65 | ||||
-rw-r--r-- | board/vell/thermal.c | 60 | ||||
-rw-r--r-- | board/vell/usbc_config.c | 117 | ||||
-rw-r--r-- | board/vell/usbc_config.h | 4 |
18 files changed, 276 insertions, 269 deletions
diff --git a/board/vell/battery.c b/board/vell/battery.c index 15041415a1..0ffb7fb015 100644 --- a/board/vell/battery.c +++ b/board/vell/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/vell/board.c b/board/vell/board.c index 47774afec5..7496df1b86 100644 --- a/board/vell/board.c +++ b/board/vell/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. */ @@ -17,6 +17,7 @@ #include "fw_config.h" #include "hooks.h" #include "lid_switch.h" +#include "panic.h" #include "power_button.h" #include "power.h" #include "registers.h" @@ -27,8 +28,8 @@ #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) static void board_chipset_startup(void) { diff --git a/board/vell/board.h b/board/vell/board.h index eabb09d75a..a17be43a50 100644 --- a/board/vell/board.h +++ b/board/vell/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. */ @@ -45,13 +45,14 @@ /* 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 #define CONFIG_USBC_RETIMER_INTEL_BB @@ -61,16 +62,16 @@ #define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50 /* TODO: b/177608416 - measure and check these values on brya */ -#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 */ /* USB Type C and USB PD defines */ -#define PD_OPERATING_POWER_MW 15000 -#define PD_MAX_CURRENT_MA 5000 -#define PD_MAX_VOLTAGE_MV 20000 +#define PD_OPERATING_POWER_MW 15000 +#define PD_MAX_CURRENT_MA 5000 +#define PD_MAX_VOLTAGE_MV 20000 /* Max Power = 100 W */ -#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000) +#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000) /* * Macros for GPIO signals used in common code that don't match the @@ -78,84 +79,78 @@ * 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_KBD_KSO2 GPIO_EC_KSO_02_INV -#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_KBD_KSO2 GPIO_EC_KSO_02_INV +#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_RIGHT_LED_AMBER_L GPIO_LED_1_L -#define GPIO_RIGHT_LED_WHITE_L GPIO_LED_2_L -#define GPIO_LEFT_LED_AMBER_L GPIO_LED_3_L -#define GPIO_LEFT_LED_WHITE_L GPIO_LED_4_L +#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_RIGHT_LED_AMBER_L GPIO_LED_1_L +#define GPIO_RIGHT_LED_WHITE_L GPIO_LED_2_L +#define GPIO_LEFT_LED_AMBER_L GPIO_LED_3_L +#define GPIO_LEFT_LED_WHITE_L GPIO_LED_4_L /* 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_C0_C1_PPC NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C2_C3_PPC NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C2_C3_PPC NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C2_C3_BC12 NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C2_C3_BC12 NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0 -#define I2C_PORT_USB_C2_C3_MUX NPCX_I2C_PORT3_0 +#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0 +#define I2C_PORT_USB_C2_C3_MUX NPCX_I2C_PORT3_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_BATTERY NPCX_I2C_PORT5_0 +#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0 +#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 -#define I2C_ADDR_EEPROM_FLAGS 0x50 +#define I2C_ADDR_EEPROM_FLAGS 0x50 /* * see b/174768555#comment22 */ -#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: b/220634230, Disable BBR firmware update temporally, - * revert this patch once confirm BBR firmware update is ready - * on kernel. - */ /* Retimer */ -#if 0 #define CONFIG_USBC_RETIMER_FW_UPDATE -#endif /* Thermal features */ #define CONFIG_THERMISTOR @@ -164,22 +159,23 @@ #define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B /* Fan features */ -#define CONFIG_FANS FAN_CH_COUNT +#define CONFIG_FANS FAN_CH_COUNT +#define CONFIG_FAN_BYPASS_SLOW_RESPONSE #define CONFIG_CUSTOM_FAN_CONTROL -#define RPM_DEVIATION 1 +#define RPM_DEVIATION 1 /* Charger defines */ #define CONFIG_CHARGER_ISL9241 #define CONFIG_CHARGE_RAMP_SW -#define CONFIG_CHARGER_SENSE_RESISTOR 5 -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 +#define CONFIG_CHARGER_SENSE_RESISTOR 5 +#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Keyboard features */ #define CONFIG_KEYBOARD_FACTORY_TEST #define CONFIG_KEYBOARD_REFRESH_ROW3 #undef CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE -#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 3 +#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 3 /* * Older boards have a different ADC assignment. @@ -189,7 +185,7 @@ #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" @@ -211,11 +207,7 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; -enum sensor_id { - CLEAR_ALS = 0, - RGB_ALS, - SENSOR_COUNT -}; +enum sensor_id { CLEAR_ALS = 0, RGB_ALS, SENSOR_COUNT }; enum ioex_port { IOEX_C0_NCT38XX = 0, @@ -232,20 +224,14 @@ enum battery_type { }; enum pwm_channel { - PWM_CH_KBLIGHT = 0, /* PWM3 */ - PWM_CH_FAN, /* PWM5 */ + PWM_CH_KBLIGHT = 0, /* PWM3 */ + PWM_CH_FAN, /* PWM5 */ 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 }; #ifdef CONFIG_KEYBOARD_FACTORY_TEST extern const int keyboard_factory_scan_pins[][2]; diff --git a/board/vell/build.mk b/board/vell/build.mk index c43f37b4dd..cad0da2a4e 100644 --- a/board/vell/build.mk +++ b/board/vell/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/vell/charger.c b/board/vell/charger.c index 0b35b7ba29..e33a0ed44a 100644 --- a/board/vell/charger.c +++ b/board/vell/charger.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. */ @@ -16,9 +16,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[] = { @@ -82,17 +81,16 @@ 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) { /* * Limit the input current to 96% negotiated limit, * to account for the charger chip margin. */ charge_ma = charge_ma * 96 / 100; - charge_set_input_current_limit(MAX(charge_ma, - CONFIG_CHARGER_INPUT_CURRENT), - charge_mv); + charge_set_input_current_limit( + MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } static void set_ac_prochot(void) diff --git a/board/vell/ec.tasklist b/board/vell/ec.tasklist index 924d708a6b..0bae104a07 100644 --- a/board/vell/ec.tasklist +++ b/board/vell/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/vell/fans.c b/board/vell/fans.c index fb2b29f502..b3fc2f8585 100644 --- a/board/vell/fans.c +++ b/board/vell/fans.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. */ @@ -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/vell/fw_config.c b/board/vell/fw_config.c index 9c28c3ca58..bf5e29fe05 100644 --- a/board/vell/fw_config.c +++ b/board/vell/fw_config.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,7 +10,7 @@ #include "cros_board_info.h" #include "fw_config.h" -#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args) static union brya_cbi_fw_config fw_config; BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t)); diff --git a/board/vell/fw_config.h b/board/vell/fw_config.h index 6e4eb3ef58..fea6c9a8da 100644 --- a/board/vell/fw_config.h +++ b/board/vell/fw_config.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. */ @@ -27,12 +27,12 @@ enum ec_cfg_keyboard_backlight_type { union brya_cbi_fw_config { struct { - enum ec_cfg_usb_db_type usb_db : 4; - 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; + enum ec_cfg_usb_db_type usb_db : 4; + 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/vell/gpio.inc b/board/vell/gpio.inc index 4c5b630658..9f6ce7cc7e 100644 --- a/board/vell/gpio.inc +++ b/board/vell/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. */ @@ -142,23 +142,23 @@ GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW) /* GPIO02_P1 to PU */ /* GPIO03_P1 to PU */ IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_ODR_HIGH) -IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_LOW) +IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_OUT_LOW) IOEX(USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 7), GPIO_ODR_LOW) IOEX(USB_C1_RT_RST_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 2), GPIO_ODR_LOW) /* GPIO03_P2 to PU */ IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 4), GPIO_ODR_HIGH) -IOEX(USB_C1_FRS_EN, EXPIN(IOEX_C1_NCT38XX, 0, 6), GPIO_LOW) +IOEX(USB_C1_FRS_EN, EXPIN(IOEX_C1_NCT38XX, 0, 6), GPIO_OUT_LOW) /* GPIO07_P2 to PU */ /* GPIO02_P1 to PU */ /* GPIO03_P1 to PU */ IOEX(USB_C2_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 4), GPIO_ODR_HIGH) -IOEX(USB_C2_FRS_EN, EXPIN(IOEX_C2_NCT38XX, 0, 6), GPIO_LOW) +IOEX(USB_C2_FRS_EN, EXPIN(IOEX_C2_NCT38XX, 0, 6), GPIO_OUT_LOW) IOEX(USB_C2_RT_RST_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 7), GPIO_ODR_LOW) IOEX(USB_C3_RT_RST_ODL, EXPIN(IOEX_C3_NCT38XX, 0, 2), GPIO_ODR_LOW) /* GPIO03_P2 to PU */ IOEX(USB_C3_OC_ODL, EXPIN(IOEX_C3_NCT38XX, 0, 4), GPIO_ODR_HIGH) -IOEX(USB_C3_FRS_EN, EXPIN(IOEX_C3_NCT38XX, 0, 6), GPIO_LOW) +IOEX(USB_C3_FRS_EN, EXPIN(IOEX_C3_NCT38XX, 0, 6), GPIO_OUT_LOW) /* GPIO07_P2 to PU */ diff --git a/board/vell/i2c.c b/board/vell/i2c.c index 4f505d74c7..822de9a0d1 100644 --- a/board/vell/i2c.c +++ b/board/vell/i2c.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/vell/keyboard.c b/board/vell/keyboard.c index 7a51f8dd39..f541f51e3b 100644 --- a/board/vell/keyboard.c +++ b/board/vell/keyboard.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,7 +48,6 @@ __override const struct ec_response_keybd_config * board_vivaldi_keybd_config(void) { return &keybd1; - } #ifdef CONFIG_KEYBOARD_FACTORY_TEST @@ -58,13 +57,13 @@ board_vivaldi_keybd_config(void) * The connector has 24 pins total, and there is no pin 0. */ const int keyboard_factory_scan_pins[][2] = { - {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6}, - {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7}, - {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7}, - {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3}, - {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1}, + { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, + { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 }, + { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 }, + { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, + { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, }; const int keyboard_factory_scan_pins_used = - ARRAY_SIZE(keyboard_factory_scan_pins); + ARRAY_SIZE(keyboard_factory_scan_pins); #endif diff --git a/board/vell/led.c b/board/vell/led.c index 4387d1a6d7..cd9304b2cf 100644 --- a/board/vell/led.c +++ b/board/vell/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. * @@ -22,15 +22,13 @@ #define BATT_LOW_BCT 10 #define LED_TICK_INTERVAL_MS (500 * MSEC) -#define LED_CYCLE_TIME_MS (2000 * MSEC) -#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS) -#define LED_ON_TIME_MS (1000 * MSEC) -#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS) - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_LEFT_LED, - EC_LED_ID_RIGHT_LED -}; +#define LED_CYCLE_TIME_MS (2000 * MSEC) +#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS) +#define LED_ON_TIME_MS (1000 * MSEC) +#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS) + +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED, + EC_LED_ID_RIGHT_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -38,13 +36,10 @@ enum led_color { LED_OFF = 0, LED_AMBER, LED_WHITE, - LED_COLOR_COUNT /* Number of colors, not a color itself */ + LED_COLOR_COUNT /* Number of colors, not a color itself */ }; -enum led_port { - RIGHT_PORT = 0, - LEFT_PORT -}; +enum led_port { RIGHT_PORT = 0, LEFT_PORT }; uint8_t bat_led_on; uint8_t bat_led_off; @@ -66,9 +61,9 @@ static void led_set_color_battery(int port, enum led_color color) enum gpio_signal amber_led, white_led; amber_led = (port == RIGHT_PORT ? GPIO_RIGHT_LED_AMBER_L : - GPIO_LEFT_LED_AMBER_L); + GPIO_LEFT_LED_AMBER_L); white_led = (port == RIGHT_PORT ? GPIO_RIGHT_LED_WHITE_L : - GPIO_LEFT_LED_WHITE_L); + GPIO_LEFT_LED_WHITE_L); switch (color) { case LED_WHITE: @@ -148,16 +143,15 @@ static void set_active_port_color(enum led_color color) if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) led_set_color_battery(RIGHT_PORT, - (port == RIGHT_PORT) ? color : LED_OFF); + (port == RIGHT_PORT) ? color : LED_OFF); if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) led_set_color_battery(LEFT_PORT, - (port == LEFT_PORT) ? color : LED_OFF); + (port == LEFT_PORT) ? color : LED_OFF); } static void led_set_battery(void) { static unsigned int battery_ticks; - uint32_t chflags = charge_get_flags(); battery_ticks++; @@ -173,43 +167,52 @@ static void led_set_battery(void) */ if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { if (charge_get_percent() < BATT_LOW_BCT) - led_set_color_battery(RIGHT_PORT, - (battery_ticks % LED_TICKS_PER_CYCLE - < LED_ON_TICKS) ? LED_AMBER : LED_OFF); + led_set_color_battery( + RIGHT_PORT, + (battery_ticks % LED_TICKS_PER_CYCLE < + LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); else led_set_color_battery(RIGHT_PORT, LED_OFF); } if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { if (charge_get_percent() < BATT_LOW_BCT) - led_set_color_battery(LEFT_PORT, - (battery_ticks % LED_TICKS_PER_CYCLE - < LED_ON_TICKS) ? LED_AMBER : LED_OFF); + led_set_color_battery( + LEFT_PORT, + (battery_ticks % LED_TICKS_PER_CYCLE < + LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); else led_set_color_battery(LEFT_PORT, LED_OFF); } break; case PWR_STATE_ERROR: if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { - led_set_color_battery(RIGHT_PORT, (battery_ticks & 0x1) - ? LED_AMBER : LED_OFF); + led_set_color_battery( + RIGHT_PORT, + (battery_ticks & 0x1) ? LED_AMBER : LED_OFF); } if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { - led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1) - ? LED_AMBER : LED_OFF); + led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1) ? + LED_AMBER : + LED_OFF); } break; case PWR_STATE_CHARGE_NEAR_FULL: set_active_port_color(LED_WHITE); break; case PWR_STATE_IDLE: /* External power connected in IDLE */ - if (chflags & CHARGE_FLAG_FORCE_IDLE) - set_active_port_color((battery_ticks % - LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? - LED_AMBER : LED_OFF); - else - set_active_port_color(LED_WHITE); + set_active_port_color(LED_WHITE); + break; + case PWR_STATE_FORCED_IDLE: + set_active_port_color( + (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); break; default: /* Other states don't alter LED behavior */ diff --git a/board/vell/pwm.c b/board/vell/pwm.c index 90fb4dac68..94fb4e8929 100644 --- a/board/vell/pwm.c +++ b/board/vell/pwm.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/vell/sensors.c b/board/vell/sensors.c index 0528a62717..f088fc8867 100644 --- a/board/vell/sensors.c +++ b/board/vell/sensors.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. */ @@ -61,7 +61,7 @@ static struct als_drv_data_t g_tcs3400_data = { .als_cal.offset = 0, .als_cal.channel_scale = { .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kc from VPD */ - .cover_scale = ALS_CHANNEL_SCALE(1.0), /* CT */ + .cover_scale = ALS_CHANNEL_SCALE(0.23), /* CT */ }, }; @@ -71,39 +71,39 @@ static struct als_drv_data_t g_tcs3400_data = { */ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = { .calibration.rgb_cal[X] = { - .offset = 0, - .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(1.0), + .offset = 448, /* 447.5509362 */ + .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(-0.45511034), + .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(-0.21956361), + .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0.32628044), + .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.3610898), .scale = { .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) + .cover_scale = ALS_CHANNEL_SCALE(0.08) } }, .calibration.rgb_cal[Y] = { - .offset = 0, - .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(1.0), + .offset = 436, /* 435.9025807*/ + .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(-0.50765776), + .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(-0.34142269), + .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0.55352908), + .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.35923454), .scale = { .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kg */ .cover_scale = ALS_CHANNEL_SCALE(1.0) }, }, .calibration.rgb_cal[Z] = { - .offset = 0, - .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0), - .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(1.0), + .offset = 287, /* 286.51472391*/ + .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(-0.11635731), + .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(-0.76700456), + .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(1.36663521), + .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.18494607), .scale = { .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */ - .cover_scale = ALS_CHANNEL_SCALE(1.0) + .cover_scale = ALS_CHANNEL_SCALE(0.54) } }, - .calibration.irt = INT_TO_FP(1), + .calibration.irt = FLOAT_TO_FP(0.06), .saturation.again = TCS_DEFAULT_AGAIN, .saturation.atime = TCS_DEFAULT_ATIME, }; @@ -207,8 +207,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_HIGH] = C_TO_K(90), \ [EC_TEMP_THRESH_HALT] = C_TO_K(95), \ @@ -225,8 +225,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_CHARGER \ - { \ +#define THERMAL_CHARGER \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \ [EC_TEMP_THRESH_HALT] = C_TO_K(95), \ @@ -244,8 +244,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(70), \ [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ @@ -264,8 +264,8 @@ __maybe_unused static const struct ec_thermal_config thermal_wwan = * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_DDR \ - { \ +#define THERMAL_DDR \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ @@ -274,8 +274,7 @@ __maybe_unused static const struct ec_thermal_config thermal_wwan = [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ }, \ } -__maybe_unused static const struct ec_thermal_config thermal_ddr = - THERMAL_DDR; +__maybe_unused static const struct ec_thermal_config thermal_ddr = THERMAL_DDR; /* * TODO(b/203839956): update for Alder Lake/vell @@ -284,8 +283,8 @@ __maybe_unused static const struct ec_thermal_config thermal_ddr = * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_REGULATOR \ - { \ +#define THERMAL_REGULATOR \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \ [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ @@ -299,7 +298,7 @@ __maybe_unused static const struct ec_thermal_config thermal_regulator = struct ec_thermal_config thermal_params[] = { [TEMP_SENSOR_1_SOC] = thermal_cpu, - [TEMP_SENSOR_2_CHARGER] = thermal_charger, + [TEMP_SENSOR_2_CHARGER] = thermal_charger, [TEMP_SENSOR_3_WWAN] = thermal_wwan, [TEMP_SENSOR_4_DDR] = thermal_ddr, [TEMP_SENSOR_5_REGULATOR] = thermal_regulator, diff --git a/board/vell/thermal.c b/board/vell/thermal.c index e72b86e3b1..29d438761b 100644 --- a/board/vell/thermal.c +++ b/board/vell/thermal.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,7 +15,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_THERMAL, outstr) -#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args) +#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args) struct fan_step { /* @@ -37,27 +37,27 @@ struct fan_step { static const struct fan_step fan_table[] = { { /* level 0 */ - .on = {48, 60, 48, 47, -1}, - .off = {99, 99, 99, 99, -1}, - .rpm = {0}, + .on = { 48, 62, 48, 50, -1 }, + .off = { 99, 99, 99, 99, -1 }, + .rpm = { 0 }, }, { /* level 1 */ - .on = {50, 60, 50, 49, -1}, - .off = {47, 99, 47, 46, -1}, - .rpm = {3600}, + .on = { 50, 62, 50, 52, -1 }, + .off = { 47, 99, 47, 49, -1 }, + .rpm = { 3200 }, }, { /* level 2 */ - .on = {53, 60, 53, 52, -1}, - .off = {49, 99, 49, 48, -1}, - .rpm = {4100}, + .on = { 53, 62, 53, 54, -1 }, + .off = { 49, 99, 49, 51, -1 }, + .rpm = { 4050 }, }, { /* level 3 */ - .on = {100, 100, 100, 100, -1}, - .off = {51, 59, 51, 50, -1}, - .rpm = {5500}, + .on = { 100, 100, 100, 100, -1 }, + .off = { 51, 60, 51, 52, -1 }, + .rpm = { 5800 }, }, }; @@ -82,33 +82,31 @@ static int fan_table_to_rpm(int fan, int *temp) temp[TEMP_SENSOR_4_DDR] < prev_tmp[TEMP_SENSOR_4_DDR]) { for (i = current_level; i > 0; i--) { if (temp[TEMP_SENSOR_1_SOC] < - fan_table[i].off[TEMP_SENSOR_1_SOC] && + fan_table[i].off[TEMP_SENSOR_1_SOC] && temp[TEMP_SENSOR_2_CHARGER] < - fan_table[i].off[TEMP_SENSOR_2_CHARGER] && + fan_table[i].off[TEMP_SENSOR_2_CHARGER] && temp[TEMP_SENSOR_3_WWAN] < - fan_table[i].off[TEMP_SENSOR_3_WWAN] && + fan_table[i].off[TEMP_SENSOR_3_WWAN] && temp[TEMP_SENSOR_4_DDR] < - fan_table[i].off[TEMP_SENSOR_4_DDR]) + fan_table[i].off[TEMP_SENSOR_4_DDR]) current_level = i - 1; else break; } } else if (temp[TEMP_SENSOR_1_SOC] > prev_tmp[TEMP_SENSOR_1_SOC] || temp[TEMP_SENSOR_2_CHARGER] > - prev_tmp[TEMP_SENSOR_2_CHARGER] || - temp[TEMP_SENSOR_3_WWAN] > - prev_tmp[TEMP_SENSOR_3_WWAN] || - temp[TEMP_SENSOR_4_DDR] > - prev_tmp[TEMP_SENSOR_4_DDR]) { + prev_tmp[TEMP_SENSOR_2_CHARGER] || + temp[TEMP_SENSOR_3_WWAN] > prev_tmp[TEMP_SENSOR_3_WWAN] || + temp[TEMP_SENSOR_4_DDR] > prev_tmp[TEMP_SENSOR_4_DDR]) { for (i = current_level; i < NUM_FAN_LEVELS; i++) { if (temp[TEMP_SENSOR_1_SOC] > - fan_table[i].on[TEMP_SENSOR_1_SOC] || + fan_table[i].on[TEMP_SENSOR_1_SOC] || (temp[TEMP_SENSOR_2_CHARGER] > - fan_table[i].on[TEMP_SENSOR_2_CHARGER] && - temp[TEMP_SENSOR_3_WWAN] > - fan_table[i].on[TEMP_SENSOR_3_WWAN]) || + fan_table[i].on[TEMP_SENSOR_2_CHARGER] && + temp[TEMP_SENSOR_3_WWAN] > + fan_table[i].on[TEMP_SENSOR_3_WWAN]) || temp[TEMP_SENSOR_4_DDR] > - fan_table[i].on[TEMP_SENSOR_4_DDR]) + fan_table[i].on[TEMP_SENSOR_4_DDR]) current_level = i + 1; else break; @@ -129,10 +127,8 @@ static int fan_table_to_rpm(int fan, int *temp) void board_override_fan_control(int fan, int *tmp) { - if (chipset_in_state(CHIPSET_STATE_ON | - CHIPSET_STATE_ANY_SUSPEND)) { + if (chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND)) { fan_set_rpm_mode(FAN_CH(fan), 1); - fan_set_rpm_target(FAN_CH(fan), - fan_table_to_rpm(fan, tmp)); + fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, tmp)); } } diff --git a/board/vell/usbc_config.c b/board/vell/usbc_config.c index 6da618b42e..694ce202d1 100644 --- a/board/vell/usbc_config.c +++ b/board/vell/usbc_config.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. */ @@ -35,8 +35,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[] = { @@ -85,21 +85,25 @@ struct ppc_config_t ppc_chips[] = { [USBC_PORT_C0] = { .i2c_port = I2C_PORT_USB_C0_C1_PPC, .i2c_addr_flags = SYV682X_ADDR0_FLAGS, + .frs_en = IOEX_USB_C0_FRS_EN, .drv = &syv682x_drv, }, [USBC_PORT_C1] = { .i2c_port = I2C_PORT_USB_C0_C1_PPC, .i2c_addr_flags = SYV682X_ADDR1_FLAGS, + .frs_en = IOEX_USB_C1_FRS_EN, .drv = &syv682x_drv, }, [USBC_PORT_C2] = { .i2c_port = I2C_PORT_USB_C2_C3_PPC, .i2c_addr_flags = SYV682X_ADDR2_FLAGS, + .frs_en = IOEX_USB_C2_FRS_EN, .drv = &syv682x_drv, }, [USBC_PORT_C3] = { .i2c_port = I2C_PORT_USB_C2_C3_PPC, .i2c_addr_flags = SYV682X_ADDR0_FLAGS, + .frs_en = IOEX_USB_C3_FRS_EN, .drv = &syv682x_drv, }, }; @@ -110,63 +114,84 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); struct ppc_config_t ppc_chips_old_c3 = { .i2c_port = I2C_PORT_USB_C2_C3_PPC, .i2c_addr_flags = SYV682X_ADDR3_FLAGS, + .frs_en = IOEX_USB_C3_FRS_EN, .drv = &syv682x_drv, }; /* 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); @@ -253,8 +278,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; } diff --git a/board/vell/usbc_config.h b/board/vell/usbc_config.h index 447c03efb3..694b316ee8 100644 --- a/board/vell/usbc_config.h +++ b/board/vell/usbc_config.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. */ @@ -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, |