summaryrefslogtreecommitdiff
path: root/board/vilboz/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/vilboz/board.c')
-rw-r--r--board/vilboz/board.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/board/vilboz/board.c b/board/vilboz/board.c
index b56a799146..20c73e170c 100644
--- a/board/vilboz/board.c
+++ b/board/vilboz/board.c
@@ -9,6 +9,7 @@
#include "driver/accel_lis2dw12.h"
#include "driver/accelgyro_lsm6dsm.h"
#include "driver/ioexpander/pcal6408.h"
+#include "driver/tcpm/nct38xx.h"
#include "driver/usb_mux/ps8740.h"
#include "driver/usb_mux/ps8743.h"
#include "extpower.h"
@@ -38,6 +39,11 @@ void c1_tcpc_interrupt(enum gpio_signal signal)
c1_tcpc_config_interrupt(signal);
}
+void hdmi_hpd_interrupt(enum gpio_signal signal)
+{
+ gpio_set_level(GPIO_DP1_HPD, gpio_get_level(signal));
+}
+
#include "gpio_list.h"
#ifdef HAS_TASK_MOTIONSENSE
@@ -144,20 +150,8 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
#endif /* HAS_TASK_MOTIONSENSE */
/* These IO expander GPIOs vary with DB option. */
-enum gpio_signal IOEX_USB_A1_RETIMER_EN = IOEX_USB_A1_RETIMER_EN_OPT1;
enum gpio_signal IOEX_USB_A1_CHARGE_EN_DB_L = IOEX_USB_A1_CHARGE_EN_DB_L_OPT1;
-static void pcal6408_handler(void)
-{
- pcal6408_ioex_event_handler(IOEX_HDMI_PCAL6408);
-}
-DECLARE_DEFERRED(pcal6408_handler);
-
-void pcal6408_interrupt(enum gpio_signal signal)
-{
- hook_call_deferred(&pcal6408_handler_data, 0);
-}
-
static int board_ps8743_mux_set(const struct usb_mux *me,
mux_state_t mux_state)
{
@@ -196,20 +190,13 @@ static void setup_fw_config(void)
if (ec_config_get_usb_db() == DALBOZ_DB_D_OPT2_USBA_HDMI) {
ccprints("DB OPT2 HDMI");
- ioex_config[IOEX_HDMI_PCAL6408].flags = 0;
- ioex_init(IOEX_HDMI_PCAL6408);
- IOEX_USB_A1_RETIMER_EN = IOEX_USB_A1_RETIMER_EN_OPT2;
- IOEX_USB_A1_CHARGE_EN_DB_L = IOEX_USB_A1_CHARGE_EN_DB_L_OPT2;
- usb_port_enable[USBA_PORT_A1] = IOEX_EN_USB_A1_5V_DB_OPT2;
- c1_tcpc_config_interrupt = pcal6408_interrupt;
- ioex_enable_interrupt(IOEX_HDMI_CONN_HPD_3V3_DB);
+ gpio_enable_interrupt(GPIO_HDMI_CONN_HPD_3V3);
} else {
ccprints("DB OPT1 USBC");
ioex_config[IOEX_C1_NCT3807].flags = 0;
ioex_init(IOEX_C1_NCT3807);
- IOEX_USB_A1_RETIMER_EN = IOEX_USB_A1_RETIMER_EN_OPT1;
IOEX_USB_A1_CHARGE_EN_DB_L = IOEX_USB_A1_CHARGE_EN_DB_L_OPT1;
- usb_port_enable[USBA_PORT_A1] = IOEX_EN_USB_A1_5V_DB_OPT1;
+ usb_port_enable[USBA_PORT_A1] = GPIO_EN_USB_A1_5V;
c1_tcpc_config_interrupt = tcpc_alert_event;
}
@@ -247,6 +234,26 @@ const struct pwm_t pwm_channels[] = {
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+struct ioexpander_config_t ioex_config[] = {
+ [IOEX_C0_NCT3807] = {
+ .i2c_host_port = I2C_PORT_TCPC0,
+ .i2c_slave_addr = NCT38XX_I2C_ADDR1_1_FLAGS,
+ .drv = &nct38xx_ioexpander_drv,
+ },
+ [IOEX_C1_NCT3807] = {
+ .i2c_host_port = I2C_PORT_TCPC1,
+ .i2c_slave_addr = NCT38XX_I2C_ADDR1_1_FLAGS,
+ .drv = &nct38xx_ioexpander_drv,
+ .flags = IOEX_FLAGS_DISABLED,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(ioex_config) == CONFIG_IO_EXPANDER_PORT_COUNT);
+
+int usb_port_enable[USBA_PORT_COUNT] = {
+ IOEX_EN_USB_A0_5V,
+ GPIO_EN_USB_A1_5V,
+};
+
/*
* If the battery is found on the V0 I2C port then re-map the battery port.
* Use HOOK_PRIO_INIT_I2C so we re-map before init_battery_type() and