summaryrefslogtreecommitdiff
path: root/board/shuboz/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/shuboz/board.c')
-rw-r--r--board/shuboz/board.c89
1 files changed, 45 insertions, 44 deletions
diff --git a/board/shuboz/board.c b/board/shuboz/board.c
index 027a6ee634..41d985df7c 100644
--- a/board/shuboz/board.c
+++ b/board/shuboz/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.
*/
@@ -13,7 +13,7 @@
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
#include "driver/bc12/pi3usb9201.h"
-#include "driver/ppc/aoz1380.h"
+#include "driver/ppc/aoz1380_public.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/tcpm/nct38xx.h"
#include "driver/usb_mux/amd_fp5.h"
@@ -39,8 +39,8 @@
#include "usb_pd_tcpm.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;
@@ -62,15 +62,13 @@ static const mat33_fp_t lid_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0 },
{ 0, 0, FLOAT_TO_FP(-1) },
};
-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)}
-};
+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) } };
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 */
@@ -226,8 +224,7 @@ static void board_chipset_suspend(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
-static int board_ps8743_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8743_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
int res;
@@ -242,7 +239,6 @@ static int board_ps8743_mux_set(const struct usb_mux *me,
return res;
}
-
/*****************************************************************************
* USB-C
*/
@@ -280,34 +276,44 @@ 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,
+ },
};
-struct usb_mux usbc1_amd_fp5_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+struct usb_mux_chain usbc1_amd_fp5_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+ },
};
-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_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,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
- .driver = &ps8743_usb_mux_driver,
- .board_set = &board_ps8743_mux_set,
- .next_mux = &usbc1_amd_fp5_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+ .board_set = &board_ps8743_mux_set,
+ },
+ .next = &usbc1_amd_fp5_usb_mux,
}
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -350,8 +356,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) {
@@ -372,7 +377,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);
@@ -474,7 +478,6 @@ static void reset_nct38xx_port(int port)
msleep(NCT3807_RESET_POST_DELAY_MS);
}
-
void board_reset_pd_mcu(void)
{
/* Reset TCPC0 */
@@ -545,11 +548,9 @@ 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);
} else {
- rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN, !!enable);
}
return rv;