summaryrefslogtreecommitdiff
path: root/board/dirinboz/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/dirinboz/board.c')
-rw-r--r--board/dirinboz/board.c84
1 files changed, 44 insertions, 40 deletions
diff --git a/board/dirinboz/board.c b/board/dirinboz/board.c
index d49f82773b..c6e35cf7e8 100644
--- a/board/dirinboz/board.c
+++ b/board/dirinboz/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.
*/
@@ -8,7 +8,7 @@
#include "cros_board_info.h"
#include "charge_state.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"
@@ -35,8 +35,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;
@@ -98,33 +98,43 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = {
* Since PI3USB221 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,
- .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,
+ },
+ .next = &usbc1_amd_fp5_usb_mux,
}
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -167,8 +177,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) {
@@ -189,7 +198,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);
@@ -291,7 +299,6 @@ static void reset_nct38xx_port(int port)
msleep(NCT3807_RESET_POST_DELAY_MS);
}
-
void board_reset_pd_mcu(void)
{
/* Reset TCPC0 */
@@ -362,11 +369,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;
@@ -434,14 +439,13 @@ int usb_port_enable[USBA_PORT_COUNT] = {
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {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},
+ { 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
#define CHARGING_CURRENT_500mA 500
@@ -501,13 +505,13 @@ int charger_profile_override(struct charge_state_data *curr)
}
enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
+ uint32_t *value)
{
return EC_RES_INVALID_PARAM;
}
enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
+ uint32_t value)
{
return EC_RES_INVALID_PARAM;
}