diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-09-21 14:08:36 -0700 |
---|---|---|
committer | Tom Hughes <tomhughes@chromium.org> | 2022-09-22 12:59:38 -0700 |
commit | c453fd704268ef72de871b0c5ac7a989de662334 (patch) | |
tree | fcf6ce5810f9ff9e3c8cce434812dd75492269ed /board/mithrax | |
parent | 6c1587ca70f558b4f96b3f0b18ad8b027d3ba99d (diff) | |
parent | 28712dae9d7ed1e694f7622cc083afa71090d4d5 (diff) | |
download | chrome-ec-c453fd704268ef72de871b0c5ac7a989de662334.tar.gz |
Merge remote-tracking branch cros/main into firmware-fpmcu-dartmonkey-releasefirmware-fpmcu-dartmonkey-release
Generated by: ./util/update_release_branch.py --board dartmonkey --relevant_paths_file
./util/fingerprint-relevant-paths.txt firmware-fpmcu-dartmonkey-release
Relevant changes:
git log --oneline 6c1587ca70..28712dae9d -- board/nocturne_fp
board/dartmonkey common/fpsensor docs/fingerprint driver/fingerprint
util/getversion.sh
ded9307b79 util/getversion.sh: Fix version when not in a git repo
956055e692 board: change Google USB vendor info
71b2ef709d Update license boilerplate text in source code files
33e11afda0 Revert "fpsensor: Build fpsensor source file with C++"
c8d0360723 fpsensor: Build fpsensor source file with C++
bc113abd53 fpsensor: Fix g++ compiler error
150a58a0dc fpsensor: Fix fp_set_sensor_mode return type
b33b5ce85b fpsensor: Remove nested designators for C++ compatibility
2e864b2539 tree-wide: const-ify argv for console commands
56d8b360f9 test: Add test for get ikm failure when seed not set
3a3d6c3690 test: Add test for fpsensor trivial key failure
233e6bbd08 fpsensor_crypto: Abstract calls to hmac_SHA256
0a041b285b docs/fingerprint: Typo correction
c03fab67e2 docs/fingerprint: Fix the path of fputils.py
0b5d4baf5a util/getversion.sh: Fix empty file list handling
6e128fe760 FPMCU dev board environment with Satlab
3eb29b6aa5 builtin: Move ssize_t to sys/types.h
345d62ebd1 docs/fingerprint: Update power numbers for latest dartmonkey release
c25ffdb316 common: Conditionally support printf %l and %i modifiers
9a3c514b45 test: Add a test to check if the debugger is connected
54e603413f Move standard library tests to their own file
43fa6b4bf8 docs/fingerprint: Update power numbers for latest bloonchipper release
25536f9a84 driver/fingerprint/fpc/bep/fpc_sensor_spi.c: Format with clang-format
4face99efd driver/fingerprint/fpc/libfp/fpc_sensor_pal.h: Format with clang-format
738de2b575 trng: Rename rand to trng_rand
14b8270edd docs/fingerprint: Update dragonclaw power numbers
0b268f93d1 driver/fingerprint/fpc/libfp/fpc_private.c: Format with clang-format
f80da163f2 driver/fingerprint/fpc/libfp/fpc_private.h: Format with clang-format
a0751778f4 board/nocturne_fp/ro_workarounds.c: Format with clang-format
5e9c85c9b1 driver/fingerprint/fpc/libfp/fpc_sensor_pal.c: Format with clang-format
c1f9dd3cf8 driver/fingerprint/fpc/libfp/fpc_bio_algorithm.h: Format with clang-format
eb1e1bed8d driver/fingerprint/fpc/libfp/fpc1145_private.h: Format with clang-format
6e7b611821 driver/fingerprint/fpc/bep/fpc_bio_algorithm.h: Format with clang-format
e0589cd5e2 driver/fingerprint/fpc/bep/fpc1035_private.h: Format with clang-format
58f0246dbe board/nocturne_fp/board_ro.c: Format with clang-format
7905e556a0 common/fpsensor/fpsensor_crypto.c: Format with clang-format
21289d170c driver/fingerprint/fpc/bep/fpc1025_private.h: Format with clang-format
98a20f937e common/fpsensor/fpsensor_state.c: Format with clang-format
a2d255d8af common/fpsensor/fpsensor.c: Format with clang-format
84e53a65da board/nocturne_fp/board.h: Format with clang-format
73055eeb3f driver/fingerprint/fpc/bep/fpc_private.c: Format with clang-format
0f7b5cb509 common/fpsensor/fpsensor_private.h: Format with clang-format
1ceade6e65 driver/fingerprint/fpc/bep/fpc_private.h: Format with clang-format
dca9d74321 Revert "trng: Rename rand to trng_rand"
a6b0b3554f trng: Rename rand to trng_rand
28d0b75b70 third_party/boringssl: Remove unused header
BRANCH=None
BUG=b:244387210 b:242720240 b:215613183 b:242720910 b:236386294
BUG=b:234181908 b:244781166 b:234781655 b:234143158 b:234181908
BUG=b:237344361 b:236025198 b:234181908 b:180945056 chromium:1098010
BUG=b:246424843 b:234181908 b:131913998
TEST=`make -j buildall`
TEST=./util/run_device_tests.py --board dartmonkey
Test "aes": PASSED
Test "cec": PASSED
Test "cortexm_fpu": PASSED
Test "crc": PASSED
Test "flash_physical": PASSED
Test "flash_write_protect": PASSED
Test "fpsensor_hw": PASSED
Test "fpsensor_spi_ro": PASSED
Test "fpsensor_spi_rw": PASSED
Test "fpsensor_uart_ro": PASSED
Test "fpsensor_uart_rw": PASSED
Test "mpu_ro": PASSED
Test "mpu_rw": PASSED
Test "mutex": PASSED
Test "pingpong": PASSED
Test "printf": PASSED
Test "queue": PASSED
Test "rollback_region0": PASSED
Test "rollback_region1": PASSED
Test "rollback_entropy": PASSED
Test "rtc": PASSED
Test "sha256": PASSED
Test "sha256_unrolled": PASSED
Test "static_if": PASSED
Test "stdlib": PASSED
Test "system_is_locked_wp_on": PASSED
Test "system_is_locked_wp_off": PASSED
Test "timer_dos": PASSED
Test "utils": PASSED
Test "utils_str": PASSED
Test "panic_data_dartmonkey_v2.0.2887": PASSED
Test "panic_data_nocturne_fp_v2.2.64": PASSED
Test "panic_data_nami_fp_v2.2.144": PASSED
Force-Relevant-Builds: all
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I2c312583a709fedae8fe11d92c22328c3b634bc7
Diffstat (limited to 'board/mithrax')
-rw-r--r-- | board/mithrax/battery.c | 31 | ||||
-rw-r--r-- | board/mithrax/board.c | 44 | ||||
-rw-r--r-- | board/mithrax/board.h | 161 | ||||
-rw-r--r-- | board/mithrax/build.mk | 2 | ||||
-rw-r--r-- | board/mithrax/charger_isl9241.c | 12 | ||||
-rw-r--r-- | board/mithrax/ec.tasklist | 2 | ||||
-rw-r--r-- | board/mithrax/fans.c | 4 | ||||
-rw-r--r-- | board/mithrax/fw_config.c | 4 | ||||
-rw-r--r-- | board/mithrax/fw_config.h | 42 | ||||
-rw-r--r-- | board/mithrax/gpio.inc | 2 | ||||
-rw-r--r-- | board/mithrax/i2c.c | 2 | ||||
-rw-r--r-- | board/mithrax/keyboard.c | 173 | ||||
-rw-r--r-- | board/mithrax/keyboard_customization.c | 89 | ||||
-rw-r--r-- | board/mithrax/keyboard_customization.h | 76 | ||||
-rw-r--r-- | board/mithrax/led.c | 41 | ||||
-rw-r--r-- | board/mithrax/pwm.c | 2 | ||||
-rw-r--r-- | board/mithrax/sensors.c | 60 | ||||
-rw-r--r-- | board/mithrax/usbc_config.c | 124 | ||||
-rw-r--r-- | board/mithrax/usbc_config.h | 12 |
19 files changed, 329 insertions, 554 deletions
diff --git a/board/mithrax/battery.c b/board/mithrax/battery.c index 8c03169b1c..16840d5b3d 100644 --- a/board/mithrax/battery.c +++ b/board/mithrax/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. * @@ -87,6 +87,35 @@ const struct board_batt_params board_battery_info[] = { .discharging_max_c = 60, }, }, + [BATTERY_C340] = { + .fuel_gauge = { + .manuf_name = "AS3FXXD3KB", + .device_name = "C340152", + .ship_mode = { + .reg_addr = 0x00, + .reg_data = { 0x0010, 0x0010 }, + }, + .fet = { + .reg_addr = 0x99, + .reg_mask = 0x000C, + .disconnect_val = 0x000C, + .cfet_mask = 0x0004, + .cfet_off_val = 0x0004, + } + }, + .batt_info = { + .voltage_max = 13350, + .voltage_normal = 11985, /* mV */ + .voltage_min = 9000, /* mV */ + .precharge_current = 256, /* mA */ + .start_charging_min_c = 0, + .start_charging_max_c = 45, + .charging_min_c = 0, + .charging_max_c = 60, + .discharging_min_c = -20, + .discharging_max_c = 60, + }, + }, }; BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); diff --git a/board/mithrax/board.c b/board/mithrax/board.c index 3db87618f8..69ba7d5b32 100644 --- a/board/mithrax/board.c +++ b/board/mithrax/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. */ @@ -25,12 +25,15 @@ #include "tablet_mode.h" #include "throttle_ap.h" #include "usbc_config.h" +#include "keyboard_backlight.h" +#include "rgb_keyboard.h" +#include "ec_commands.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) static void rgb_backlight_config(void); @@ -57,14 +60,6 @@ static void board_chipset_resume(void) } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); -/* Called on AP S0 -> S3 transition */ -static void board_chipset_suspend(void) -{ - /* Turn off the keyboard backlight if it's on. */ - gpio_set_level(GPIO_EC_KB_BL_EN_L, 1); -} -DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); - /* Called on AP S5 -> S3 transition */ static void board_chipset_startup(void) { @@ -97,8 +92,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; } @@ -119,18 +114,11 @@ enum battery_present battery_hw_present(void) static void board_init(void) { - if (ec_cfg_usb_db_type() == DB_USB4_NCT3807) - db_update_usb4_config_from_config(); - - if (ec_cfg_usb_mb_type() == MB_USB4_TBT) - mb_update_usb4_tbt_config_from_config(); - if (ec_cfg_stylus() == STYLUS_PRSENT) gpio_enable_interrupt(GPIO_PEN_DET_ODL); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); - /** * Deferred function to handle pen detect change */ @@ -153,8 +141,7 @@ DECLARE_HOOK(HOOK_INIT, pendetect_deferred, HOOK_PRIO_DEFAULT); void pen_detect_interrupt(enum gpio_signal s) { /* Trigger deferred notification of pen detect change */ - hook_call_deferred(&pendetect_deferred_data, - 500 * MSEC); + hook_call_deferred(&pendetect_deferred_data, 500 * MSEC); } void pen_config(void) @@ -182,3 +169,16 @@ static void rgb_backlight_config(void) else gpio_set_level(GPIO_EN_PP5000_LED, 0); } + +void board_kblight_init(void) +{ + if ((IS_ENABLED(CONFIG_PWM_KBLIGHT)) && + (ec_cfg_kb_backlight() == SOLID_COLOR)) { + kblight_register(&kblight_pwm); + rgbkbd_type = EC_RGBKBD_TYPE_UNKNOWN; + } else if ((IS_ENABLED(CONFIG_RGB_KEYBOARD)) && + (ec_cfg_kb_backlight() == RGB)) { + kblight_register(&kblight_rgbkbd); + rgbkbd_type = EC_RGBKBD_TYPE_FOUR_ZONES_4_LEDS; + } +} diff --git a/board/mithrax/board.h b/board/mithrax/board.h index c9d2112b2c..d12375d678 100644 --- a/board/mithrax/board.h +++ b/board/mithrax/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. */ @@ -29,11 +29,11 @@ /* LED */ #define CONFIG_LED_ONOFF_STATES #define CONFIG_LED_ONOFF_STATES_BAT_LOW 10 -#define GPIO_BAT_LED_AMBER_L GPIO_LED_3_L -#define GPIO_BAT_LED_WHITE_L GPIO_LED_4_L +#define GPIO_BAT_LED_AMBER_L GPIO_LED_3_L +#define GPIO_BAT_LED_WHITE_L GPIO_LED_4_L /* Sensors */ -#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */ +#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */ #define CONFIG_ACCEL_LSM6DSO_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) @@ -49,8 +49,8 @@ /* Lid accel */ #define CONFIG_LID_ANGLE #define CONFIG_LID_ANGLE_UPDATE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL -#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL +#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL +#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL #define CONFIG_ACCEL_LIS2DWL #define CONFIG_ACCEL_LIS2DW_AS_BASE #define CONFIG_ACCEL_LIS2DW12_INT_EVENT \ @@ -61,16 +61,15 @@ #define CONFIG_CMD_ACCEL_INFO /* USB Type A Features */ -#define USB_PORT_COUNT 1 +#define USB_PORT_COUNT 1 #define CONFIG_USB_PORT_POWER_DUMB /* USB Type C and USB PD defines */ #define CONFIG_IO_EXPANDER #define CONFIG_IO_EXPANDER_NCT38XX -#define CONFIG_IO_EXPANDER_PORT_COUNT 2 +#define CONFIG_IO_EXPANDER_PORT_COUNT 2 #define CONFIG_USB_PD_TCPM_PS8815 -#define CONFIG_USBC_RETIMER_INTEL_BB /* I2C control host command */ #define CONFIG_HOSTCMD_I2C_CONTROL @@ -82,17 +81,17 @@ #define CONFIG_USBC_PPC_NX20P3483 /* TODO: b/177608416 - measure and check these values on mithrax */ -#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 65000 -#define PD_MAX_CURRENT_MA 3250 -#define PD_MAX_VOLTAGE_MV 20000 +#define PD_OPERATING_POWER_MW 15000 +#define PD_MAX_POWER_MW 65000 +#define PD_MAX_CURRENT_MA 3250 +#define PD_MAX_VOLTAGE_MV 20000 /* * Macros for GPIO signals used in common code that don't match the @@ -100,74 +99,66 @@ * 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_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL -#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_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_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL +#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL +#define GPIO_WP_L GPIO_EC_WP_ODL /* System has back-lit keyboard */ #define CONFIG_KEYBOARD_BACKLIGHT /* I2C Bus Configuration */ -#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 +#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 -#define I2C_PORT_USB_C2_TCPC NPCX_I2C_PORT1_0 -#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1 +#define I2C_PORT_USB_C2_TCPC NPCX_I2C_PORT1_0 +#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1 -#define I2C_PORT_USB_C2_PPC NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C2_PPC NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C2_BC12 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C2_BC12 NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C2_MUX NPCX_I2C_PORT3_0 -#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1 +#define I2C_PORT_USB_C2_MUX NPCX_I2C_PORT3_0 +#define I2C_PORT_USB_C1_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_KBMCU 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_MP2964 NPCX_I2C_PORT7_0 +#define I2C_PORT_KBMCU NPCX_I2C_PORT3_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_C1_BB_RETIMER_I2C_ADDR 0x56 -#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58 - -/* Enabling Thunderbolt-compatible mode */ -#define CONFIG_USB_PD_TBT_COMPAT_MODE - -/* Enabling USB4 mode */ -#define CONFIG_USB_PD_USB4 /* Retimer */ #define CONFIG_USBC_RETIMER_FW_UPDATE @@ -178,26 +169,28 @@ #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 10 +#define CONFIG_CHARGER_SENSE_RESISTOR 10 +#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* RGB Keyboard */ #ifdef SECTION_IS_RW #define CONFIG_RGB_KEYBOARD -#define CONFIG_LED_DRIVER_TLC59116F /* TLC59116F on I2C */ -#define TLC59116F_I2C_ADDR_FLAG TLC59116F_ADDR3_FLAG +#define CONFIG_LED_DRIVER_TLC59116F /* TLC59116F on I2C */ +#define TLC59116F_I2C_ADDR_FLAG TLC59116F_ADDR3_FLAG #endif /* SECTION_IS_RW */ -#define RGB_GRID0_COL 4 -#define RGB_GRID0_ROW 1 +#define RGB_GRID0_COL 4 +#define RGB_GRID0_ROW 1 + +#define CONFIG_PWM_KBLIGHT #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" @@ -215,40 +208,26 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; -enum sensor_id { - LID_ACCEL = 0, - BASE_ACCEL, - BASE_GYRO, - SENSOR_COUNT -}; +enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT }; -enum ioex_port { - IOEX_C2_NCT38XX = 0, - IOEX_C1_NCT38XX, - IOEX_PORT_COUNT -}; +enum ioex_port { IOEX_C2_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT }; enum battery_type { BATTERY_C536, BATTERY_C490, + BATTERY_C340, BATTERY_TYPE_COUNT }; 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 }; void pen_detect_interrupt(enum gpio_signal s); diff --git a/board/mithrax/build.mk b/board/mithrax/build.mk index a7ec1987de..ca2d2e6c70 100644 --- a/board/mithrax/build.mk +++ b/board/mithrax/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. # diff --git a/board/mithrax/charger_isl9241.c b/board/mithrax/charger_isl9241.c index 10bc45b333..a9eafe353e 100644 --- a/board/mithrax/charger_isl9241.c +++ b/board/mithrax/charger_isl9241.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[] = { @@ -85,7 +84,6 @@ __overridable void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { charge_ma = (charge_ma * 90) / 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); } diff --git a/board/mithrax/ec.tasklist b/board/mithrax/ec.tasklist index b6a6557d1e..8949bb98e7 100644 --- a/board/mithrax/ec.tasklist +++ b/board/mithrax/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/mithrax/fans.c b/board/mithrax/fans.c index 1f75eb6ca3..fd7b380f77 100644 --- a/board/mithrax/fans.c +++ b/board/mithrax/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/mithrax/fw_config.c b/board/mithrax/fw_config.c index 6985059d50..17b623371f 100644 --- a/board/mithrax/fw_config.c +++ b/board/mithrax/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. */ @@ -9,7 +9,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 mithrax_cbi_fw_config fw_config; BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t)); diff --git a/board/mithrax/fw_config.h b/board/mithrax/fw_config.h index 4e9ba7f3c6..c7053c0da4 100644 --- a/board/mithrax/fw_config.h +++ b/board/mithrax/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,43 +14,31 @@ * Source of truth is the project/brya/mithrax/config.star configuration file. */ -enum ec_cfg_usb_db_type { - DB_USB3_PS8815 = 1, - DB_USB4_NCT3807 = 2 -}; +enum ec_cfg_usb_db_type { DB_USB_ABSENT = 0, DB_USB3_PS8815 = 1 }; enum ec_cfg_keyboard_backlight_type { KEYBOARD_BACKLIGHT_DISABLED = 0, KEYBOARD_BACKLIGHT_ENABLED = 1 }; -enum ec_cfg_usb_mb_type { - MB_USB4_TBT = 0, - MB_USB3_NON_TBT = 1 -}; +enum ec_cfg_usb_mb_type { NA = 0, MB_USB3_NON_TBT = 1 }; -enum ec_cfg_stylus_type { - STYLUS_ABSENT = 0, - STYLUS_PRSENT = 1 -}; +enum ec_cfg_stylus_type { STYLUS_ABSENT = 0, STYLUS_PRSENT = 1 }; -enum ec_cfg_kb_backlight_type { - SOLID_COLOR = 0, - RGB = 1 -}; +enum ec_cfg_kb_backlight_type { SOLID_COLOR = 0, RGB = 1 }; union mithrax_cbi_fw_config { struct { - enum ec_cfg_usb_db_type usb_db : 3; - uint32_t wifi : 1; - enum ec_cfg_kb_backlight_type rgb : 1; - enum ec_cfg_stylus_type stylus : 1; - enum ec_cfg_keyboard_backlight_type kb_bl : 1; - uint32_t audio : 3; - uint32_t thermal : 2; - uint32_t table_mode : 1; - enum ec_cfg_usb_mb_type usb_mb : 3; - uint32_t reserved_1 : 16; + enum ec_cfg_usb_db_type usb_db : 3; + uint32_t wifi : 1; + enum ec_cfg_kb_backlight_type rgb : 1; + enum ec_cfg_stylus_type stylus : 1; + enum ec_cfg_keyboard_backlight_type kb_bl : 1; + uint32_t audio : 3; + uint32_t thermal : 2; + uint32_t table_mode : 1; + enum ec_cfg_usb_mb_type usb_mb : 3; + uint32_t reserved_1 : 16; }; uint32_t raw_value; }; diff --git a/board/mithrax/gpio.inc b/board/mithrax/gpio.inc index 133efd0390..1ee2ae40f0 100644 --- a/board/mithrax/gpio.inc +++ b/board/mithrax/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/mithrax/i2c.c b/board/mithrax/i2c.c index 7833d1c154..76a9dfdc1c 100644 --- a/board/mithrax/i2c.c +++ b/board/mithrax/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. */ diff --git a/board/mithrax/keyboard.c b/board/mithrax/keyboard.c index 6534c7bc63..36830958f5 100644 --- a/board/mithrax/keyboard.c +++ b/board/mithrax/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. */ @@ -61,145 +61,20 @@ const uint8_t rgbkbd_count = ARRAY_SIZE(rgbkbds); const uint8_t rgbkbd_hsize = RGB_GRID0_COL; const uint8_t rgbkbd_vsize = RGB_GRID0_ROW; -#define LED(x, y) RGBKBD_COORD((x), (y)) -#define DELM RGBKBD_DELM +enum ec_rgbkbd_type rgbkbd_type; +#define LED(x, y) RGBKBD_COORD((x), (y)) +#define DELM RGBKBD_DELM + const uint8_t rgbkbd_map[] = { - DELM, /* 0: (null) */ - LED(0, 0), DELM, /* 1: ~ ` */ - LED(0, 0), DELM, /* 2: ! 1 */ - LED(0, 0), DELM, /* 3: @ 2 */ - LED(0, 0), DELM, /* 4: # 3 */ - LED(1, 0), DELM, /* 5: $ 4 */ - LED(1, 0), DELM, /* 6: % 5 */ - LED(1, 0), DELM, /* 7: ^ 6 */ - LED(2, 0), DELM, /* 8: & 7 */ - LED(2, 0), DELM, /* 9: * 8 */ - LED(2, 0), DELM, /* 10: ( 9 */ - LED(2, 0), DELM, /* 11: ) 0 */ - LED(2, 0), DELM, /* 12: _ - */ - LED(3, 0), DELM, /* 13: + = */ - DELM, /* 14: (null) */ - LED(3, 0), DELM, /* 15: backspace */ - LED(0, 0), DELM, /* 16: tab */ - LED(0, 0), DELM, /* 17: q */ - LED(0, 0), DELM, /* 18: w */ - LED(0, 0), DELM, /* 19: e */ - LED(1, 0), DELM, /* 20: r */ - LED(1, 0), DELM, /* 21: t */ - LED(1, 0), DELM, /* 22: y */ - LED(2, 0), DELM, /* 23: u */ - LED(2, 0), DELM, /* 24: i */ - LED(2, 0), DELM, /* 25: o */ - LED(2, 0), DELM, /* 26: p */ - LED(2, 0), DELM, /* 27: [ { */ - LED(3, 0), DELM, /* 28: ] } */ - LED(3, 0), DELM, /* 29: \ | */ - LED(0, 0), DELM, /* 30: caps lock */ - LED(0, 0), DELM, /* 31: a */ - LED(0, 0), DELM, /* 32: s */ - LED(0, 0), DELM, /* 33: d */ - LED(1, 0), DELM, /* 34: f */ - LED(1, 0), DELM, /* 35: g */ - LED(1, 0), DELM, /* 36: h */ - LED(2, 0), DELM, /* 37: j */ - LED(2, 0), DELM, /* 38: k */ - LED(2, 0), DELM, /* 39: l */ - LED(3, 0), DELM, /* 40: ; : */ - LED(3, 0), DELM, /* 41: " ' */ - DELM, /* 42: (null) */ - LED(3, 0), DELM, /* 43: enter */ - LED(0, 0), DELM, /* 44: L-shift */ - DELM, /* 45: (null) */ - LED(0, 0), DELM, /* 46: z */ - LED(0, 0), DELM, /* 47: x */ - LED(0, 0), DELM, /* 48: c */ - LED(1, 0), DELM, /* 49: v */ - LED(1, 0), DELM, /* 50: b */ - LED(1, 0), DELM, /* 51: n */ - LED(2, 0), DELM, /* 52: m */ - LED(2, 0), DELM, /* 53: , < */ - LED(2, 0), DELM, /* 54: . > */ - LED(3, 0), DELM, /* 55: / ? */ - DELM, /* 56: (null) */ - LED(3, 0), DELM, /* 57: R-shift */ - LED(0, 0), DELM, /* 58: L-ctrl */ - LED(3, 0), DELM, /* 59: power */ - LED(0, 0), DELM, /* 60: L-alt */ - LED(0, 0), LED(1, 0), - LED(2, 0), DELM, /* 61: space */ - LED(2, 0), DELM, /* 62: R-alt */ - DELM, /* 63: (null) */ - LED(2, 0), DELM, /* 64: R-ctrl */ - DELM, /* 65: (null) */ - DELM, /* 66: (null) */ - DELM, /* 67: (null) */ - DELM, /* 68: (null) */ - DELM, /* 69: (null) */ - DELM, /* 70: (null) */ - DELM, /* 71: (null) */ - DELM, /* 72: (null) */ - DELM, /* 73: (null) */ - DELM, /* 74: (null) */ - DELM, /* 75: (null) */ - DELM, /* 76: delete */ - DELM, /* 77: (null) */ - DELM, /* 78: (null) */ - LED(3, 0), DELM, /* 79: left */ - DELM, /* 80: home */ - DELM, /* 81: end */ - DELM, /* 82: (null) */ - LED(3, 0), DELM, /* 83: up */ - LED(3, 0), DELM, /* 84: down */ - DELM, /* 85: page up */ - DELM, /* 86: page down */ - DELM, /* 87: (null) */ - DELM, /* 88: (null) */ - LED(3, 0), DELM, /* 89: right */ - DELM, /* 90: (null) */ - DELM, /* 91: numpad 7 */ - DELM, /* 92: numpad 4 */ - DELM, /* 93: numpad 1 */ - DELM, /* 94: (null) */ - DELM, /* 95: numpad / */ - DELM, /* 96: numpad 8 */ - DELM, /* 97: numpad 5 */ - DELM, /* 98: numpad 2 */ - DELM, /* 99: numpad 0 */ - DELM, /* 100: numpad * */ - DELM, /* 101: numpad 9 */ - DELM, /* 102: numpad 6 */ - DELM, /* 103: numpad 3 */ - DELM, /* 104: numpad . */ - DELM, /* 105: numpad - */ - DELM, /* 106: numpad + */ - DELM, /* 107: (null) */ - DELM, /* 108: numpad enter */ - DELM, /* 109: (null) */ - LED(0, 0), DELM, /* 110: esc */ - LED(0, 0), DELM, /* T1: back */ - LED(0, 0), DELM, /* T2: refresh */ - LED(1, 0), DELM, /* T3: full screen */ - LED(1, 0), DELM, /* T4: overview */ - LED(1, 0), DELM, /* T5: snapshot */ - LED(2, 0), DELM, /* T6: brightness down */ - LED(2, 0), DELM, /* T7: brightness up */ - LED(2, 0), DELM, /* T8: mute */ - LED(2, 0), DELM, /* T9: volume down */ - LED(3, 0), DELM, /* T10: volume up */ - DELM, /* T11: (null) */ - DELM, /* T12: (null) */ - DELM, /* T13: (null) */ - DELM, /* T14: (null) */ - DELM, /* T15: (null) */ - DELM, /* 126: (null) */ - DELM, /* 127: (null) */ + DELM, LED(0, 0), DELM, LED(1, 0), DELM, + LED(2, 0), DELM, LED(3, 0), DELM, DELM, }; #undef LED #undef DELM const size_t rgbkbd_map_size = ARRAY_SIZE(rgbkbd_map); -__override const struct ec_response_keybd_config -*board_vivaldi_keybd_config(void) +__override const struct ec_response_keybd_config * +board_vivaldi_keybd_config(void) { return &mithrax_kb; } @@ -213,20 +88,20 @@ __override const struct key { uint8_t row; uint8_t col; } vivaldi_keys[] = { - {.row = 4, .col = 2}, /* T1 */ - {.row = 3, .col = 2}, /* T2 */ - {.row = 2, .col = 2}, /* T3 */ - {.row = 1, .col = 2}, /* T4 */ - {.row = 4, .col = 4}, /* T5 */ - {.row = 3, .col = 4}, /* T6 */ - {.row = 2, .col = 4}, /* T7 */ - {.row = 2, .col = 9}, /* T8 */ - {.row = 1, .col = 9}, /* T9 */ - {.row = 1, .col = 4}, /* T10 */ - {.row = 0, .col = 4}, /* T11 */ - {.row = 1, .col = 5}, /* T12 */ - {.row = 3, .col = 5}, /* T13 */ - {.row = 2, .col = 1}, /* T14 */ - {.row = 0, .col = 1}, /* T15 */ + { .row = 4, .col = 2 }, /* T1 */ + { .row = 3, .col = 2 }, /* T2 */ + { .row = 2, .col = 2 }, /* T3 */ + { .row = 1, .col = 2 }, /* T4 */ + { .row = 4, .col = 4 }, /* T5 */ + { .row = 3, .col = 4 }, /* T6 */ + { .row = 2, .col = 4 }, /* T7 */ + { .row = 2, .col = 9 }, /* T8 */ + { .row = 1, .col = 9 }, /* T9 */ + { .row = 1, .col = 4 }, /* T10 */ + { .row = 0, .col = 4 }, /* T11 */ + { .row = 1, .col = 5 }, /* T12 */ + { .row = 3, .col = 5 }, /* T13 */ + { .row = 2, .col = 1 }, /* T14 */ + { .row = 0, .col = 1 }, /* T15 */ }; BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS); diff --git a/board/mithrax/keyboard_customization.c b/board/mithrax/keyboard_customization.c index 4e45de34be..cc3623390f 100644 --- a/board/mithrax/keyboard_customization.c +++ b/board/mithrax/keyboard_customization.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The ChromiumOS Authors. +/* 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. */ @@ -12,24 +12,23 @@ #include "keyboard_raw.h" static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = { - {0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0x0000, 0x0000, 0x0000}, - {0x001f, 0x0076, 0x0017, 0x000e, 0x001c, 0x003a, 0x000d, 0x0016}, - {0x006c, 0xe024, 0xe01d, 0xe020, 0xe038, 0xe071, 0x0026, 0x002a}, - {0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x0029, 0x0025, 0x002d}, - {0x0078, 0xe032, 0xe035, 0xe02c, 0xe02d, 0x0041, 0x001e, 0x001d}, - {0x0051, 0x0007, 0x005b, 0x000f, 0x0042, 0x0022, 0x003e, 0x0043}, - {0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x001b, 0x003d, 0x003c}, - {0x0000, 0x0012, 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0059}, - {0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x0024, 0x0044, 0x004d}, - {0x0045, 0xe021, 0xe023, 0x002f, 0x004b, 0x0049, 0x0046, 0x001a}, - {0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000}, - {0xe07a, 0x005d, 0xe075, 0x006b, 0x005a, 0xe072, 0x004a, 0x0066}, - {0xe06b, 0xe074, 0xe069, 0x0067, 0xe06c, 0x0064, 0x0015, 0xe07d}, - {0x0073, 0x007c, 0x007b, 0x0074, 0x0071, 0xe04a, 0x0070, 0x0021}, - {0x0023, 0xe05a, 0x0075, 0x0079, 0x007a, 0x0072, 0x007d, 0x0069}, + { 0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0x0000, 0x0000, 0x0000 }, + { 0x001f, 0x0076, 0x0017, 0x000e, 0x001c, 0x003a, 0x000d, 0x0016 }, + { 0x006c, 0xe024, 0xe01d, 0xe020, 0xe038, 0xe071, 0x0026, 0x002a }, + { 0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x0029, 0x0025, 0x002d }, + { 0x0078, 0xe032, 0xe035, 0xe02c, 0xe02d, 0x0041, 0x001e, 0x001d }, + { 0x0051, 0x0007, 0x005b, 0x000f, 0x0042, 0x0022, 0x003e, 0x0043 }, + { 0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x001b, 0x003d, 0x003c }, + { 0x0000, 0x0012, 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0059 }, + { 0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x0024, 0x0044, 0x004d }, + { 0x0045, 0xe021, 0xe023, 0x002f, 0x004b, 0x0049, 0x0046, 0x001a }, + { 0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000 }, + { 0xe07a, 0x005d, 0xe075, 0x006b, 0x005a, 0xe072, 0x004a, 0x0066 }, + { 0xe06b, 0xe074, 0xe069, 0x0067, 0xe06c, 0x0064, 0x0015, 0xe07d }, + { 0x0073, 0x007c, 0x007b, 0x0074, 0x0071, 0xe04a, 0x0070, 0x0021 }, + { 0x0023, 0xe05a, 0x0075, 0x0079, 0x007a, 0x0072, 0x007d, 0x0069 }, }; - uint16_t get_scancode_set2(uint8_t row, uint8_t col) { if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) @@ -64,38 +63,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/mithrax/keyboard_customization.h b/board/mithrax/keyboard_customization.h index b177a11eb4..1d0e6ec483 100644 --- a/board/mithrax/keyboard_customization.h +++ b/board/mithrax/keyboard_customization.h @@ -1,4 +1,4 @@ -/* Copyright 2022 The ChromiumOS Authors. +/* 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,47 +25,47 @@ 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 11 -#define KEYBOARD_ROW_DOWN 5 -#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN) -#define KEYBOARD_COL_ESC 1 -#define KEYBOARD_ROW_ESC 1 -#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC) -#define KEYBOARD_COL_KEY_H 6 -#define KEYBOARD_ROW_KEY_H 1 -#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H) -#define KEYBOARD_COL_KEY_R 3 -#define KEYBOARD_ROW_KEY_R 7 -#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R) -#define KEYBOARD_COL_LEFT_ALT 10 -#define KEYBOARD_ROW_LEFT_ALT 6 -#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT) -#define KEYBOARD_COL_REFRESH 2 -#define KEYBOARD_ROW_REFRESH 3 -#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH) -#define KEYBOARD_COL_RIGHT_ALT 10 -#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 4 -#define KEYBOARD_DEFAULT_ROW_VOL_UP 1 -#define KEYBOARD_COL_LEFT_CTRL 0 -#define KEYBOARD_ROW_LEFT_CTRL 2 +#define KEYBOARD_COL_DOWN 11 +#define KEYBOARD_ROW_DOWN 5 +#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN) +#define KEYBOARD_COL_ESC 1 +#define KEYBOARD_ROW_ESC 1 +#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC) +#define KEYBOARD_COL_KEY_H 6 +#define KEYBOARD_ROW_KEY_H 1 +#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H) +#define KEYBOARD_COL_KEY_R 3 +#define KEYBOARD_ROW_KEY_R 7 +#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R) +#define KEYBOARD_COL_LEFT_ALT 10 +#define KEYBOARD_ROW_LEFT_ALT 6 +#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT) +#define KEYBOARD_COL_REFRESH 2 +#define KEYBOARD_ROW_REFRESH 3 +#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH) +#define KEYBOARD_COL_RIGHT_ALT 10 +#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 4 +#define KEYBOARD_DEFAULT_ROW_VOL_UP 1 +#define KEYBOARD_COL_LEFT_CTRL 0 +#define KEYBOARD_ROW_LEFT_CTRL 2 #define KEYBOARD_MASK_LEFT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_CTRL) #define KEYBOARD_COL_RIGHT_CTRL 0 #define KEYBOARD_ROW_RIGHT_CTRL 4 #define KEYBOARD_MASK_RIGHT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_CTRL) -#define KEYBOARD_COL_SEARCH 0 -#define KEYBOARD_ROW_SEARCH 3 -#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH) -#define KEYBOARD_COL_KEY_0 9 -#define KEYBOARD_ROW_KEY_0 0 -#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0) -#define KEYBOARD_COL_KEY_1 1 -#define KEYBOARD_ROW_KEY_1 7 -#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1) -#define KEYBOARD_COL_KEY_2 4 -#define KEYBOARD_ROW_KEY_2 6 -#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2) +#define KEYBOARD_COL_SEARCH 0 +#define KEYBOARD_ROW_SEARCH 3 +#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH) +#define KEYBOARD_COL_KEY_0 9 +#define KEYBOARD_ROW_KEY_0 0 +#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0) +#define KEYBOARD_COL_KEY_1 1 +#define KEYBOARD_ROW_KEY_1 7 +#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1) +#define KEYBOARD_COL_KEY_2 4 +#define KEYBOARD_ROW_KEY_2 6 +#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2) #define KEYBOARD_COL_LEFT_SHIFT 7 #define KEYBOARD_ROW_LEFT_SHIFT 1 #define KEYBOARD_MASK_LEFT_SHIFT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_SHIFT) diff --git a/board/mithrax/led.c b/board/mithrax/led.c index 5abaed2a25..660fc8ce2d 100644 --- a/board/mithrax/led.c +++ b/board/mithrax/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. * @@ -11,26 +11,33 @@ #include "led_onoff_states.h" #include "system.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; -__override const int led_charge_lvl_2 = 94; +__override const int led_charge_lvl_2 = 95; __override struct led_descriptor - led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { - [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, - [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, - [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, - {LED_OFF, 3 * LED_ONE_SEC} }, - [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC}, - {LED_OFF, 3 * LED_ONE_SEC} }, - [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * LED_ONE_SEC} }, -}; + led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { + [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER, + LED_INDEFINITE } }, + [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER, + LED_INDEFINITE } }, + [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER, + 1 * LED_ONE_SEC }, + { LED_OFF, 3 * LED_ONE_SEC } }, + [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE, + 1 * LED_ONE_SEC }, + { LED_OFF, 3 * LED_ONE_SEC } }, + [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } }, + [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER, + 1 * LED_ONE_SEC }, + { LED_OFF, 1 * LED_ONE_SEC } }, + }; const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED, diff --git a/board/mithrax/pwm.c b/board/mithrax/pwm.c index ffc90e910a..8f3759316e 100644 --- a/board/mithrax/pwm.c +++ b/board/mithrax/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/mithrax/sensors.c b/board/mithrax/sensors.c index fff002dda6..b72022a0e0 100644 --- a/board/mithrax/sensors.c +++ b/board/mithrax/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. */ @@ -46,18 +46,14 @@ K_MUTEX_DEFINE(g_base_accel_mutex); static struct stprivate_data g_lis2dw12_data; static struct lsm6dso_data lsm6dso_data; -static const mat33_fp_t lid_standard_ref = { - { FLOAT_TO_FP(1), 0, 0}, - { 0, FLOAT_TO_FP(1), 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; +static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 }, + { 0, FLOAT_TO_FP(1), 0 }, + { 0, 0, FLOAT_TO_FP(1) } }; /* TODO(b/184779743): verify orientation matrix */ -static const mat33_fp_t base_standard_ref = { - { 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 = { { FLOAT_TO_FP(1), 0, 0 }, + { 0, FLOAT_TO_FP(-1), 0 }, + { 0, 0, FLOAT_TO_FP(-1) } }; struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -146,24 +142,18 @@ DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_INIT_I2C + 1); /* Temperature sensor configuration */ const struct temp_sensor_t temp_sensors[] = { - [TEMP_SENSOR_1_DDR_SOC] = { - .name = "DDR and SOC", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_1_DDR_SOC - }, - [TEMP_SENSOR_2_FAN] = { - .name = "FAN", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_2_FAN - }, - [TEMP_SENSOR_3_CHARGER] = { - .name = "Charger", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_3_CHARGER - }, + [TEMP_SENSOR_1_DDR_SOC] = { .name = "DDR and SOC", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_1_DDR_SOC }, + [TEMP_SENSOR_2_FAN] = { .name = "FAN", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_2_FAN }, + [TEMP_SENSOR_3_CHARGER] = { .name = "Charger", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_3_CHARGER }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); @@ -177,8 +167,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(70), \ [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ @@ -207,8 +197,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_FAN \ - { \ +#define THERMAL_FAN \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(60), \ [EC_TEMP_THRESH_HALT] = C_TO_K(70), \ @@ -221,8 +211,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU; } __maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN; -#define THERMAL_CHARGER \ - { \ +#define THERMAL_CHARGER \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ [EC_TEMP_THRESH_HALT] = C_TO_K(80), \ diff --git a/board/mithrax/usbc_config.c b/board/mithrax/usbc_config.c index b1b28ab7c2..10189bbf50 100644 --- a/board/mithrax/usbc_config.c +++ b/board/mithrax/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. */ @@ -33,8 +33,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 */ struct tcpc_config_t tcpc_config[] = { @@ -63,17 +63,6 @@ struct tcpc_config_t tcpc_config[] = { BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT); BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT); -struct tcpc_config_t tcpc_config_c1 = { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_USB_C1_TCPC, - .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS, - }, - .drv = &nct38xx_tcpm_drv, - .flags = TCPC_FLAGS_TCPCI_REV2_0 | - TCPC_FLAGS_NO_DEBUG_ACC_CONTROL, -}; - /* USBC PPC configuration */ struct ppc_config_t ppc_chips[] = { [USBC_PORT_C2] = { @@ -92,71 +81,40 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT); unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); -struct ppc_config_t ppc_chips_c1 = { - .i2c_port = I2C_PORT_USB_C1_PPC, - .i2c_addr_flags = SYV682X_ADDR0_FLAGS, - .drv = &syv682x_drv, -}; - -/* USBC mux configuration - Alder Lake includes internal mux */ -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 usbc1_tcss_usb_mux = { - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, -}; - /* * USB3 DB mux configuration - the top level mux still needs to be set * to the virtual_usb_mux_driver so the AP gets notified of mux changes * and updates the TCSS configuration on state changes. */ -static const struct usb_mux usbc1_usb3_db_retimer = { - .usb_port = USBC_PORT_C1, - .driver = &tcpci_tcpm_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, +static const struct usb_mux_chain usbc1_usb3_db_retimer = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C1, + .driver = &tcpci_tcpm_usb_mux_driver, + .hpd_update = &ps8xxx_tcpc_update_hpd_status, + }, }; -struct usb_mux usb_muxes[] = { +struct usb_mux_chain usb_muxes[] = { [USBC_PORT_C2] = { - .usb_port = USBC_PORT_C2, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C2, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, }, [USBC_PORT_C1] = { - /* PS8815 DB */ - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - .next_mux = &usbc1_usb3_db_retimer, + .mux = &(const struct usb_mux) { + /* PS8815 DB */ + .usb_port = USBC_PORT_C1, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, + .next = &usbc1_usb3_db_retimer, }, }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); -static const struct usb_mux usb_muxes_c1 = { - .usb_port = USBC_PORT_C1, - .driver = &bb_usb_retimer, - .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C1_MUX, - .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, - .next_mux = &usbc1_tcss_usb_mux, -}; - -static const struct usb_mux usb_muxes_c2 = { - .usb_port = USBC_PORT_C2, - .driver = &bb_usb_retimer, - .hpd_update = bb_retimer_hpd_update, - .i2c_port = I2C_PORT_USB_C2_MUX, - .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR, - .next_mux = &usbc2_tcss_usb_mux, -}; - - /* BC1.2 charger detect configuration */ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { [USBC_PORT_C2] = { @@ -251,10 +209,6 @@ void board_reset_pd_mcu(void) gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 0); gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0); - if (ec_cfg_usb_db_type() == DB_USB4_NCT3807) - gpio_set_level(GPIO_USB_C1_RST_ODL, 0); - - /* * delay for power-on to reset-off and min. assertion time */ @@ -264,9 +218,6 @@ void board_reset_pd_mcu(void) gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 1); gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1); - if (ec_cfg_usb_db_type() == DB_USB4_NCT3807) - gpio_set_level(GPIO_USB_C1_RST_ODL, 1); - /* wait for chips to come up */ msleep(50); @@ -288,8 +239,6 @@ static void board_tcpc_init(void) * C0/C2 TCPC, so they must be set up after the TCPC has * been taken out of reset. */ - if (ec_cfg_usb_db_type() == DB_USB4_NCT3807) - enable_ioex(IOEX_C1_NCT38XX); enable_ioex(IOEX_C2_NCT38XX); } @@ -361,14 +310,7 @@ void ppc_interrupt(enum gpio_signal signal) { switch (signal) { case GPIO_USB_C1_PPC_INT_ODL: - switch (ec_cfg_usb_db_type()) { - case DB_USB3_PS8815: - nx20p348x_interrupt(USBC_PORT_C1); - break; - case DB_USB4_NCT3807: - syv682x_interrupt(USBC_PORT_C1); - break; - } + nx20p348x_interrupt(USBC_PORT_C1); break; case GPIO_USB_C2_PPC_INT_ODL: syv682x_interrupt(USBC_PORT_C2); @@ -392,12 +334,6 @@ __override bool board_is_dts_port(int port) __override bool board_is_tbt_usb4_port(int port) { - if (((port == USBC_PORT_C2) && - (ec_cfg_usb_mb_type() == MB_USB4_TBT)) || - ((port == USBC_PORT_C1) && - (ec_cfg_usb_db_type() == DB_USB4_NCT3807))) - return true; - return false; } @@ -408,15 +344,3 @@ __override enum tbt_compat_cable_speed board_get_max_tbt_speed(int port) return TBT_SS_TBT_GEN3; } - -void db_update_usb4_config_from_config(void) -{ - tcpc_config[USBC_PORT_C1] = tcpc_config_c1; - ppc_chips[USBC_PORT_C1] = ppc_chips_c1; - usb_muxes[USBC_PORT_C1] = usb_muxes_c1; -} - -void mb_update_usb4_tbt_config_from_config(void) -{ - usb_muxes[USBC_PORT_C2] = usb_muxes_c2; -} diff --git a/board/mithrax/usbc_config.h b/board/mithrax/usbc_config.h index aaf1d02b10..22242d7c5b 100644 --- a/board/mithrax/usbc_config.h +++ b/board/mithrax/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,18 +8,12 @@ #ifndef __CROS_EC_USBC_CONFIG_H #define __CROS_EC_USBC_CONFIG_H -#define CONFIG_USB_PD_PORT_MAX_COUNT 2 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPC_RUNTIME_CONFIG #define CONFIG_USB_MUX_RUNTIME_CONFIG -enum usbc_port { - USBC_PORT_C2 = 0, - USBC_PORT_C1, - USBC_PORT_COUNT -}; +enum usbc_port { USBC_PORT_C2 = 0, USBC_PORT_C1, USBC_PORT_COUNT }; void config_usb_db_type(void); -void db_update_usb4_config_from_config(void); -void mb_update_usb4_tbt_config_from_config(void); #endif /* __CROS_EC_USBC_CONFIG_H */ |