diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-09-21 14:10:01 -0700 |
---|---|---|
committer | Tom Hughes <tomhughes@chromium.org> | 2022-09-22 12:49:33 -0700 |
commit | 2bcf863b492fe7ed8105c853814dba6ed32ba719 (patch) | |
tree | fcf6ce5810f9ff9e3c8cce434812dd75492269ed /board/woomax/board.c | |
parent | e5fb0b9ba488614b5684e640530f00821ab7b943 (diff) | |
parent | 28712dae9d7ed1e694f7622cc083afa71090d4d5 (diff) | |
download | chrome-ec-firmware-fpmcu-bloonchipper-release.tar.gz |
Merge remote-tracking branch cros/main into firmware-fpmcu-bloonchipper-releasefirmware-fpmcu-bloonchipper-release
Generated by: ./util/update_release_branch.py --board bloonchipper
--relevant_paths_file ./util/fingerprint-relevant-paths.txt firmware-
fpmcu-bloonchipper-release
Relevant changes:
git log --oneline e5fb0b9ba4..28712dae9d -- board/hatch_fp
board/bloonchipper 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
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
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
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
dc3e9008b8 board/hatch_fp/board.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:246424843 b:234181908 b:244781166 b:234181908 b:244387210
BUG=b:242720240 chromium:1098010 b:180945056 b:236025198 b:234181908
BUG=b:234181908 b:237344361 b:131913998 b:236386294 b:234143158
BUG=b:234781655 b:215613183 b:242720910
TEST=`make -j buildall`
TEST=./test/run_device_tests.py --board bloonchipper
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 "stm32f_rtc": PASSED
Test "panic_data_bloonchipper_v2.0.4277": PASSED
Test "panic_data_bloonchipper_v2.0.5938": PASSED
Force-Relevant-Builds: all
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I264ad0ffe7afcd507a1e483c6e934a9c4fea47c3
Diffstat (limited to 'board/woomax/board.c')
-rw-r--r-- | board/woomax/board.c | 410 |
1 files changed, 262 insertions, 148 deletions
diff --git a/board/woomax/board.c b/board/woomax/board.c index e45fd91623..747c576fc2 100644 --- a/board/woomax/board.c +++ b/board/woomax/board.c @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -19,7 +19,7 @@ #include "driver/retimer/pi3hdx1204.h" #include "driver/retimer/ps8802.h" #include "driver/retimer/ps8811.h" -#include "driver/retimer/ps8818.h" +#include "driver/retimer/ps8818_public.h" #include "driver/temp_sensor/sb_tsi.h" #include "driver/usb_mux/amd_fp5.h" #include "extpower.h" @@ -44,8 +44,8 @@ #include "gpio_list.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) /* Motion sensors */ static struct mutex g_lid_mutex; @@ -64,15 +64,15 @@ static const mat33_fp_t lid_standard_ref = { }; static const mat33_fp_t base_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)}, + { 0, FLOAT_TO_FP(-1), 0 }, + { FLOAT_TO_FP(-1), 0, 0 }, + { 0, 0, FLOAT_TO_FP(-1) }, }; static const mat33_fp_t base_standard_ref_icm = { - { FLOAT_TO_FP(1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(-1)}, + { FLOAT_TO_FP(1), 0, 0 }, + { 0, FLOAT_TO_FP(-1), 0 }, + { 0, 0, FLOAT_TO_FP(-1) }, }; /* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */ @@ -294,8 +294,8 @@ static void board_chipset_resume(void) int val; rv = i2c_read8(I2C_PORT_USBA0, - PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1, - PS8811_REG1_USB_BEQ_LEVEL, &val); + PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1, + PS8811_REG1_USB_BEQ_LEVEL, &val); if (!rv) break; } @@ -307,8 +307,7 @@ static void board_chipset_resume(void) if (ec_config_has_hdmi_retimer_pi3hdx1204()) { ioex_set_level(IOEX_HDMI_POWER_EN_DB, 1); msleep(PI3HDX1204_POWER_ON_DELAY_MS); - pi3hdx1204_enable(I2C_PORT_TCPC1, - PI3HDX1204_I2C_ADDR_FLAGS, + pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, hpd); } } @@ -319,9 +318,7 @@ static void board_chipset_suspend(void) ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0); if (ec_config_has_hdmi_retimer_pi3hdx1204()) { - pi3hdx1204_enable(I2C_PORT_TCPC1, - PI3HDX1204_I2C_ADDR_FLAGS, - 0); + pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 0); ioex_set_level(IOEX_HDMI_POWER_EN_DB, 0); } @@ -340,35 +337,31 @@ static int woomax_ps8818_mux_set(const struct usb_mux *me, /* USB specific config */ if (mux_state & USB_PD_MUX_USB_ENABLED) { /* Boost the USB gain */ - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_APTX1EQ_10G_LEVEL, - PS8818_EQ_LEVEL_UP_MASK, - PS8818_EQ_LEVEL_UP_18DB); + rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1, + PS8818_REG1_APTX1EQ_10G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_18DB); if (rv) return rv; - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_APTX2EQ_10G_LEVEL, - PS8818_EQ_LEVEL_UP_MASK, - PS8818_EQ_LEVEL_UP_18DB); + rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1, + PS8818_REG1_APTX2EQ_10G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_18DB); if (rv) return rv; - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_APTX1EQ_5G_LEVEL, - PS8818_EQ_LEVEL_UP_MASK, - PS8818_EQ_LEVEL_UP_19DB); + rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1, + PS8818_REG1_APTX1EQ_5G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_19DB); if (rv) return rv; - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_APTX2EQ_5G_LEVEL, - PS8818_EQ_LEVEL_UP_MASK, - PS8818_EQ_LEVEL_UP_19DB); + rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1, + PS8818_REG1_APTX2EQ_5G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_19DB); if (rv) return rv; } @@ -376,11 +369,10 @@ static int woomax_ps8818_mux_set(const struct usb_mux *me, /* DP specific config */ if (mux_state & USB_PD_MUX_DP_ENABLED) { /* Boost the DP gain */ - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_DPEQ_LEVEL, - PS8818_DPEQ_LEVEL_UP_MASK, - PS8818_DPEQ_LEVEL_UP_19DB); + rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1, + PS8818_REG1_DPEQ_LEVEL, + PS8818_DPEQ_LEVEL_UP_MASK, + PS8818_DPEQ_LEVEL_UP_19DB); if (rv) return rv; @@ -391,21 +383,18 @@ static int woomax_ps8818_mux_set(const struct usb_mux *me, } if (!(mux_state & USB_PD_MUX_POLARITY_INVERTED)) { - rv = ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_CRX1EQ_10G_LEVEL, - PS8818_EQ_LEVEL_UP_MASK, - PS8818_EQ_LEVEL_UP_19DB); + rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1, + PS8818_REG1_CRX1EQ_10G_LEVEL, + PS8818_EQ_LEVEL_UP_MASK, + PS8818_EQ_LEVEL_UP_19DB); rv |= ps8818_i2c_write(me, PS8818_REG_PAGE1, - PS8818_REG1_APRX1_DE_LEVEL, 0x02); + PS8818_REG1_APRX1_DE_LEVEL, 0x02); } /* set the RX input termination */ - rv |= ps8818_i2c_field_update8(me, - PS8818_REG_PAGE1, - PS8818_REG1_RX_PHY, - PS8818_RX_INPUT_TERM_MASK, - PS8818_RX_INPUT_TERM_85_OHM); + rv |= ps8818_i2c_field_update8(me, PS8818_REG_PAGE1, PS8818_REG1_RX_PHY, + PS8818_RX_INPUT_TERM_MASK, + PS8818_RX_INPUT_TERM_85_OHM); /* set register 0x40 ICP1 for 1G PD loop */ rv |= ps8818_i2c_write(me, PS8818_REG_PAGE1, 0x40, 0x84); @@ -425,11 +414,10 @@ static int woomax_ps8802_mux_set(const struct usb_mux *me, /* USB specific config */ if (mux_state & USB_PD_MUX_USB_ENABLED) { /* Boost the USB gain */ - rv = ps8802_i2c_field_update16(me, - PS8802_REG_PAGE2, - PS8802_REG2_USB_SSEQ_LEVEL, - PS8802_USBEQ_LEVEL_UP_MASK, - PS8802_USBEQ_LEVEL_UP_19DB); + rv = ps8802_i2c_field_update16(me, PS8802_REG_PAGE2, + PS8802_REG2_USB_SSEQ_LEVEL, + PS8802_USBEQ_LEVEL_UP_MASK, + PS8802_USBEQ_LEVEL_UP_19DB); if (rv) return rv; } @@ -437,11 +425,10 @@ static int woomax_ps8802_mux_set(const struct usb_mux *me, /* DP specific config */ if (mux_state & USB_PD_MUX_DP_ENABLED) { /*Boost the DP gain */ - rv = ps8802_i2c_field_update16(me, - PS8802_REG_PAGE2, - PS8802_REG2_DPEQ_LEVEL, - PS8802_DPEQ_LEVEL_UP_MASK, - PS8802_DPEQ_LEVEL_UP_19DB); + rv = ps8802_i2c_field_update16(me, PS8802_REG_PAGE2, + PS8802_REG2_DPEQ_LEVEL, + PS8802_DPEQ_LEVEL_UP_MASK, + PS8802_DPEQ_LEVEL_UP_19DB); if (rv) return rv; @@ -453,11 +440,10 @@ static int woomax_ps8802_mux_set(const struct usb_mux *me, } /* Set extra swing level tuning at 800mV/P0 */ - rv = ps8802_i2c_field_update8(me, - PS8802_REG_PAGE1, - PS8802_800MV_LEVEL_TUNING, - PS8802_EXTRA_SWING_LEVEL_P0_MASK, - PS8802_EXTRA_SWING_LEVEL_P0_UP_1); + rv = ps8802_i2c_field_update8(me, PS8802_REG_PAGE1, + PS8802_800MV_LEVEL_TUNING, + PS8802_EXTRA_SWING_LEVEL_P0_MASK, + PS8802_EXTRA_SWING_LEVEL_P0_UP_1); return rv; } @@ -470,6 +456,9 @@ const struct usb_mux usbc1_woomax_ps8818 = { .board_set = &woomax_ps8818_mux_set, }; +/* Place holder for second mux in USBC1 chain */ +struct usb_mux_chain usbc1_mux1; + static void setup_mux(void) { if (ec_config_has_usbc1_retimer_ps8802()) { @@ -481,13 +470,11 @@ static void setup_mux(void) * Replace usb_muxes[USBC_PORT_C1] with the PS8802 * table entry. */ - memcpy(&usb_muxes[USBC_PORT_C1], - &usbc1_ps8802, - sizeof(struct usb_mux)); + usb_muxes[USBC_PORT_C1].mux = &usbc1_ps8802; /* Set the AMD FP5 as the secondary MUX */ - usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux; - usb_muxes[USBC_PORT_C1].board_set = &woomax_ps8802_mux_set; + usbc1_mux1.mux = &usbc1_amd_fp5_usb_mux; + usbc1_ps8802.board_set = &woomax_ps8802_mux_set; /* Don't have the AMD FP5 flip */ usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP; @@ -501,91 +488,213 @@ static void setup_mux(void) * Replace usb_muxes[USBC_PORT_C1] with the AMD FP5 * table entry. */ - memcpy(&usb_muxes[USBC_PORT_C1], - &usbc1_amd_fp5_usb_mux, - sizeof(struct usb_mux)); + usb_muxes[USBC_PORT_C1].mux = &usbc1_amd_fp5_usb_mux; /* Set the PS8818 as the secondary MUX */ - usb_muxes[USBC_PORT_C1].next_mux = &usbc1_woomax_ps8818; + usbc1_mux1.mux = &usbc1_woomax_ps8818; } } -enum pi3dpx1207_usb_conf { - USB_DP = 0, - USB_DP_INV, - USB, - USB_INV, - DP, - DP_INV -}; +enum pi3dpx1207_usb_conf { USB_DP = 0, USB_DP_INV, USB, USB_INV, DP, DP_INV }; static uint8_t pi3dpx1207_picasso_eq[] = { /*usb_dp*/ - 0x13, 0x11, 0x20, 0x62, 0x06, 0x5B, 0x5B, - 0x07, 0x03, 0x40, 0xFC, 0x42, 0x71, + 0x13, + 0x11, + 0x20, + 0x62, + 0x06, + 0x5B, + 0x5B, + 0x07, + 0x03, + 0x40, + 0xFC, + 0x42, + 0x71, /*usb_dp_inv */ - 0x13, 0x11, 0x20, 0x72, 0x06, 0x03, 0x07, - 0x5B, 0x5B, 0x23, 0xFC, 0x42, 0x71, + 0x13, + 0x11, + 0x20, + 0x72, + 0x06, + 0x03, + 0x07, + 0x5B, + 0x5B, + 0x23, + 0xFC, + 0x42, + 0x71, /*usb*/ - 0x13, 0x11, 0x20, 0x42, 0x00, 0x03, 0x07, - 0x07, 0x03, 0x00, 0x42, 0x42, 0x71, + 0x13, + 0x11, + 0x20, + 0x42, + 0x00, + 0x03, + 0x07, + 0x07, + 0x03, + 0x00, + 0x42, + 0x42, + 0x71, /*usb_inv*/ - 0x13, 0x11, 0x20, 0x52, 0x00, 0x03, 0x07, - 0x07, 0x03, 0x02, 0x42, 0x42, 0x71, + 0x13, + 0x11, + 0x20, + 0x52, + 0x00, + 0x03, + 0x07, + 0x07, + 0x03, + 0x02, + 0x42, + 0x42, + 0x71, /*dp*/ - 0x13, 0x11, 0x20, 0x22, 0x06, 0x5B, 0x5B, - 0x5B, 0x5B, 0x60, 0xFC, 0xFC, 0x71, + 0x13, + 0x11, + 0x20, + 0x22, + 0x06, + 0x5B, + 0x5B, + 0x5B, + 0x5B, + 0x60, + 0xFC, + 0xFC, + 0x71, /*dp_inv*/ - 0x13, 0x11, 0x20, 0x32, 0x06, 0x5B, 0x5B, - 0x5B, 0x5B, 0x63, 0xFC, 0xFC, 0x71, + 0x13, + 0x11, + 0x20, + 0x32, + 0x06, + 0x5B, + 0x5B, + 0x5B, + 0x5B, + 0x63, + 0xFC, + 0xFC, + 0x71, }; static uint8_t pi3dpx1207_dali_eq[] = { /*usb_dp*/ - 0x13, 0x11, 0x20, 0x62, 0x06, 0x5B, 0x5B, - 0x07, 0x07, 0x40, 0xFC, 0x42, 0x71, + 0x13, + 0x11, + 0x20, + 0x62, + 0x06, + 0x5B, + 0x5B, + 0x07, + 0x07, + 0x40, + 0xFC, + 0x42, + 0x71, /*usb_dp_inv*/ - 0x13, 0x11, 0x20, 0x72, 0x06, 0x07, 0x07, - 0x5B, 0x5B, 0x23, 0xFC, 0x42, 0x71, + 0x13, + 0x11, + 0x20, + 0x72, + 0x06, + 0x07, + 0x07, + 0x5B, + 0x5B, + 0x23, + 0xFC, + 0x42, + 0x71, /*usb*/ - 0x13, 0x11, 0x20, 0x42, 0x00, 0x07, 0x07, - 0x07, 0x07, 0x00, 0x42, 0x42, 0x71, + 0x13, + 0x11, + 0x20, + 0x42, + 0x00, + 0x07, + 0x07, + 0x07, + 0x07, + 0x00, + 0x42, + 0x42, + 0x71, /*usb_inv*/ - 0x13, 0x11, 0x20, 0x52, 0x00, 0x07, 0x07, - 0x07, 0x07, 0x02, 0x42, 0x42, 0x71, + 0x13, + 0x11, + 0x20, + 0x52, + 0x00, + 0x07, + 0x07, + 0x07, + 0x07, + 0x02, + 0x42, + 0x42, + 0x71, /*dp*/ - 0x13, 0x11, 0x20, 0x22, 0x06, 0x5B, 0x5B, - 0x5B, 0x5B, 0x60, 0xFC, 0xFC, 0x71, + 0x13, + 0x11, + 0x20, + 0x22, + 0x06, + 0x5B, + 0x5B, + 0x5B, + 0x5B, + 0x60, + 0xFC, + 0xFC, + 0x71, /*dp_inv*/ - 0x13, 0x11, 0x20, 0x32, 0x06, 0x5B, 0x5B, - 0x5B, 0x5B, 0x63, 0xFC, 0xFC, 0x71, + 0x13, + 0x11, + 0x20, + 0x32, + 0x06, + 0x5B, + 0x5B, + 0x5B, + 0x5B, + 0x63, + 0xFC, + 0xFC, + 0x71, }; static int board_pi3dpx1207_mux_set(const struct usb_mux *me, - mux_state_t mux_state) + mux_state_t mux_state) { - int rv = EC_SUCCESS; + int rv = EC_SUCCESS; enum pi3dpx1207_usb_conf usb_mode = 0; /* USB */ if (mux_state & USB_PD_MUX_USB_ENABLED) { /* USB with DP */ if (mux_state & USB_PD_MUX_DP_ENABLED) { - usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) - ? USB_DP_INV - : USB_DP; + usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ? + USB_DP_INV : + USB_DP; } /* USB without DP */ else { - usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) - ? USB_INV - : USB; + usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ? + USB_INV : + USB; } } /* DP without USB */ else if (mux_state & USB_PD_MUX_DP_ENABLED) { - usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) - ? DP_INV - : DP; + usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ? DP_INV : + DP; } /* Nothing enabled */ else @@ -594,10 +703,11 @@ static int board_pi3dpx1207_mux_set(const struct usb_mux *me, /* Write the retimer config byte */ if (ec_config_has_usbc1_retimer_ps8802()) rv = i2c_xfer(me->i2c_port, me->i2c_addr_flags, - &pi3dpx1207_dali_eq[usb_mode*13], 13, NULL, 0); + &pi3dpx1207_dali_eq[usb_mode * 13], 13, NULL, 0); else rv = i2c_xfer(me->i2c_port, me->i2c_addr_flags, - &pi3dpx1207_picasso_eq[usb_mode*13], 13, NULL, 0); + &pi3dpx1207_picasso_eq[usb_mode * 13], 13, NULL, + 0); return rv; } @@ -612,24 +722,30 @@ const struct pi3dpx1207_usb_control pi3dpx1207_controls[] = { }; BUILD_ASSERT(ARRAY_SIZE(pi3dpx1207_controls) == USBC_PORT_COUNT); -const struct usb_mux usbc0_pi3dpx1207_usb_retimer = { - .usb_port = USBC_PORT_C0, - .i2c_port = I2C_PORT_TCPC0, - .i2c_addr_flags = PI3DPX1207_I2C_ADDR_FLAGS, - .driver = &pi3dpx1207_usb_retimer, - .board_set = &board_pi3dpx1207_mux_set, +const struct usb_mux_chain usbc0_pi3dpx1207_usb_retimer = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C0, + .i2c_port = I2C_PORT_TCPC0, + .i2c_addr_flags = PI3DPX1207_I2C_ADDR_FLAGS, + .driver = &pi3dpx1207_usb_retimer, + .board_set = &board_pi3dpx1207_mux_set, + }, }; -struct usb_mux usb_muxes[] = { +struct usb_mux_chain usb_muxes[] = { [USBC_PORT_C0] = { - .usb_port = USBC_PORT_C0, - .i2c_port = I2C_PORT_USB_AP_MUX, - .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, - .driver = &amd_fp5_usb_mux_driver, - .next_mux = &usbc0_pi3dpx1207_usb_retimer, + .mux = &(const struct usb_mux) { + .usb_port = USBC_PORT_C0, + .i2c_port = I2C_PORT_USB_AP_MUX, + .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, + .driver = &amd_fp5_usb_mux_driver, + }, + .next = &usbc0_pi3dpx1207_usb_retimer, }, [USBC_PORT_C1] = { /* Filled in dynamically at startup */ + .next = &usbc1_mux1, }, }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); @@ -667,7 +783,7 @@ DECLARE_HOOK(HOOK_INIT, setup_fw_config, HOOK_PRIO_INIT_I2C + 2); /* Physical fans. These are logically separate from pwm_channels. */ 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 = -1, }; @@ -758,8 +874,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_THERMISTOR \ - { \ +#define THERMAL_THERMISTOR \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(95), \ [EC_TEMP_THRESH_HALT] = C_TO_K(100), \ @@ -774,8 +890,8 @@ __maybe_unused static const struct ec_thermal_config thermal_thermistor = /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_CPU \ - { \ +#define THERMAL_CPU \ + { \ .temp_host = { \ [EC_TEMP_THRESH_HIGH] = C_TO_K(95), \ [EC_TEMP_THRESH_HALT] = C_TO_K(100), \ @@ -813,8 +929,8 @@ static const struct ec_response_keybd_config woomax_kb = { .capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD, }; -__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 &woomax_kb; } @@ -833,10 +949,9 @@ static void hdmi_hpd_handler(void) { int hpd = gpio_get_level(GPIO_DP1_HPD_EC_IN); - pi3hdx1204_enable(I2C_PORT_TCPC1, - PI3HDX1204_I2C_ADDR_FLAGS, - chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON) - && hpd); + pi3hdx1204_enable( + I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, + chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON) && hpd); } DECLARE_DEFERRED(hdmi_hpd_handler); @@ -856,9 +971,8 @@ int board_usbc_port_to_hpd_gpio_or_ioex(int port) * USB-C1 OPT3 DB use GPIO_USB_C1_HPD_IN_DB for board version 2 */ else if (ec_config_has_mst_hub_rtd2141b()) - return (board_ver >= 2) - ? GPIO_USB_C1_HPD_IN_DB - : IOEX_USB_C1_HPD_IN_DB; + return (board_ver >= 2) ? GPIO_USB_C1_HPD_IN_DB : + IOEX_USB_C1_HPD_IN_DB; /* USB-C1 OPT1 DB use DP2_HPD. */ return GPIO_DP2_HPD; |