diff options
Diffstat (limited to 'board/vilboz/board.c')
-rw-r--r-- | board/vilboz/board.c | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/board/vilboz/board.c b/board/vilboz/board.c index 4e0461469d..7c74794d9d 100644 --- a/board/vilboz/board.c +++ b/board/vilboz/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. */ @@ -11,7 +11,7 @@ #include "driver/accelgyro_lsm6dsm.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ioexpander/pcal6408.h" -#include "driver/ppc/aoz1380.h" +#include "driver/ppc/aoz1380_public.h" #include "driver/tcpm/nct38xx.h" #include "driver/usb_mux/amd_fp5.h" #include "extpower.h" @@ -33,8 +33,8 @@ #include "usb_mux.h" #include "usbc_ppc.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) /* This I2C moved. Temporarily detect and support the V0 HW. */ int I2C_PORT_BATTERY = I2C_PORT_BATTERY_V1; @@ -55,17 +55,13 @@ static struct stprivate_data g_lis2dwl_data; static struct lsm6dsm_data g_lsm6dsm_data = LSM6DSM_DATA; /* Matrix to rotate accelrator into standard reference frame */ -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) } }; -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(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */ struct motion_sensor_t motion_sensors[] = { @@ -180,18 +176,23 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = { * Since FSUSB42UMX is not a i2c device, .i2c_port and * .i2c_addr_flags are not required here. */ -const struct usb_mux usbc0_sbu_mux = { - .usb_port = USBC_PORT_C0, - .driver = &usbc0_sbu_mux_driver, +const struct usb_mux_chain usbc0_sbu_mux = { + .mux = + &(const struct usb_mux){ + .usb_port = USBC_PORT_C0, + .driver = &usbc0_sbu_mux_driver, + }, }; -const struct usb_mux usb_muxes[] = { +const 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_sbu_mux, + .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_sbu_mux, }, }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); @@ -219,8 +220,7 @@ void ppc_interrupt(enum gpio_signal signal) int board_set_active_charge_port(int port) { - int is_valid_port = (port >= 0 && - port < CONFIG_USB_PD_PORT_MAX_COUNT); + int is_valid_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT); int i; if (port == CHARGE_PORT_NONE) { @@ -241,7 +241,6 @@ int board_set_active_charge_port(int port) return EC_ERROR_INVAL; } - /* Check if the port is sourcing VBUS. */ if (ppc_is_sourcing_vbus(port)) { CPRINTFUSB("Skip enable C%d", port); @@ -323,7 +322,6 @@ static void reset_nct38xx_port(int port) msleep(NCT3807_RESET_POST_DELAY_MS); } - void board_reset_pd_mcu(void) { /* Reset TCPC0 */ @@ -367,8 +365,7 @@ int board_pd_set_frs_enable(int port, int enable) /* Use the TCPC to enable fast switch when FRS included */ if (port == USBC_PORT_C0) { - rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN, - !!enable); + rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN, !!enable); } return rv; @@ -509,7 +506,7 @@ const int usb_port_enable[USBA_PORT_COUNT] = { }; __override void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) + int max_ma, int charge_mv) { /* * Limit the input current to 95% negotiated limit, @@ -517,7 +514,6 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma, */ charge_ma = charge_ma * 95 / 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); } |