diff options
author | Lu Zhang <lu.zhang@bitland.corp-partner.google.com> | 2020-06-03 21:33:48 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-05 05:16:51 +0000 |
commit | 1a91ab29a3b91e6a5e3829b6e6bcb2954bb283bd (patch) | |
tree | bb2e0cc33db4b9d74c70d6d504c3e606a4efd2c4 /board/vilboz | |
parent | 3f8bb7574edbd3bf00e39a9f2ab97bfc297f7689 (diff) | |
download | chrome-ec-1a91ab29a3b91e6a5e3829b6e6bcb2954bb283bd.tar.gz |
vilboz: Remove PCAL6408 entirely and enable HDMI
BUG=b:157182792, b:158125500
BRANCH=none
TEST=make BOARD=vilboz
Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: I71e38117309277c39ed245535643d601e8759d28
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2227782
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com>
Commit-Queue: Lu Zhang <lu.zhang@bitland.corp-partner.google.com>
Diffstat (limited to 'board/vilboz')
-rw-r--r-- | board/vilboz/board.c | 49 | ||||
-rw-r--r-- | board/vilboz/board.h | 11 | ||||
-rw-r--r-- | board/vilboz/gpio.inc | 16 |
3 files changed, 44 insertions, 32 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 diff --git a/board/vilboz/board.h b/board/vilboz/board.h index 3795a3bb87..f2e67cf316 100644 --- a/board/vilboz/board.h +++ b/board/vilboz/board.h @@ -82,6 +82,16 @@ enum pwm_channel { PWM_CH_COUNT }; +enum ioex_port { + IOEX_C0_NCT3807 = 0, + IOEX_C1_NCT3807, + IOEX_PORT_COUNT +}; + +#define PORT_TO_HPD(port) ((port == 0) \ + ? GPIO_USB3_C0_DP2_HPD \ + : GPIO_DP1_HPD) + /***************************************************************************** * CBI EC FW Configuration @@ -159,7 +169,6 @@ static inline bool ec_config_has_hdmi_retimer_pi3hdx1204(void) } /* These IO expander GPIOs vary with DB option. */ -extern enum gpio_signal IOEX_USB_A1_RETIMER_EN; extern enum gpio_signal IOEX_USB_A1_CHARGE_EN_DB_L; #endif /* !__ASSEMBLER__ */ diff --git a/board/vilboz/gpio.inc b/board/vilboz/gpio.inc index 94074ad6cd..abdf0b8adb 100644 --- a/board/vilboz/gpio.inc +++ b/board/vilboz/gpio.inc @@ -11,7 +11,8 @@ GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(3, 4), GPIO_INT_FALLING, tcpc_alert_event) GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(F, 1), GPIO_INT_FALLING, c1_tcpc_interrupt) GPIO_INT(USB_C0_PPC_FAULT_ODL, PIN(6, 3), GPIO_INT_FALLING, ppc_interrupt) -GPIO_INT(USB_C1_PPC_INT_ODL, PIN(D, 4), GPIO_INT_FALLING, ppc_interrupt) +/* TODO remove ppc C1 */ +UNIMPLEMENTED(USB_C1_PPC_INT_ODL) GPIO_INT(USB_C0_BC12_INT_ODL, PIN(9, 3), GPIO_INT_FALLING | GPIO_PULL_UP, bc12_interrupt) GPIO_INT(USB_C1_BC12_INT_ODL, PIN(A, 4), GPIO_INT_FALLING | GPIO_PULL_UP, bc12_interrupt) GPIO_INT(SLP_S3_L, PIN(7, 4), GPIO_INT_BOTH, power_signal_interrupt) @@ -25,6 +26,7 @@ GPIO_INT(EC_WP_L, PIN(5, 0), GPIO_INT_BOTH, switch_interrupt) GPIO_INT(VOLDN_BTN_ODL, PIN(A, 6), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) GPIO_INT(VOLUP_BTN_ODL, PIN(9, 5), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) GPIO_INT(6AXIS_INT_L, PIN(A, 0), GPIO_INT_FALLING | GPIO_PULL_UP, lsm6dsm_interrupt) +GPIO_INT(HDMI_CONN_HPD_3V3, PIN(D, 4), GPIO_INT_BOTH, hdmi_hpd_interrupt) /* GPIO_INT_BOTH is required for PSL wake from hibernate, but we don't need an interrupt handler. */ GPIO(EC_RST_ODL, PIN(0, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH) @@ -44,7 +46,9 @@ GPIO(EC_FCH_WAKE_L, PIN(0, 3), GPIO_OUT_HIGH) /* Wake SOC */ GPIO(EC_FCH_SCI_ODL, PIN(7, 6), GPIO_ODR_HIGH) /* SCI to SOC */ GPIO(EC_SYS_RST_L, PIN(C, 7), GPIO_ODR_HIGH) /* Cold Reset to SOC */ GPIO(USB_C0_TCPC_RST_L, PIN(E, 1), GPIO_OUT_HIGH) /* C0 TCPC Reset */ -GPIO(USB_C1_TCPC_RST_L, PIN(F, 0), GPIO_OUT_HIGH) /* C1 TCPC Reset */ +/* TODO will remove TCPC C1 */ +UNIMPLEMENTED(USB_C1_TCPC_RST_L) +GPIO(EN_USB_A1_5V, PIN(F, 0), GPIO_OUT_LOW) /* A1 5V Source Enable */ GPIO(USB3_C0_DP2_HPD, PIN(F, 5), GPIO_OUT_LOW) /* C0 DP Hotplug Detect */ GPIO(DP1_HPD, PIN(F, 4), GPIO_OUT_LOW) /* C1 DP Hotplug Detect */ GPIO(EC_H1_PACKET_MODE, PIN(8, 6), GPIO_OUT_LOW) /* H1 Packet Mode */ @@ -59,9 +63,6 @@ GPIO(LED3_PWM, PIN(C, 3), GPIO_OUT_HIGH) * Dalboz has 2 DB options, with different IO expanders. IOEX_C1_NCT3807 is the * OPT1 DB (USB-C1), IOEX_HDMI_PCAL6408 is the OPT2 DB (HDMI). */ - -IOEX_INT(HDMI_CONN_HPD_3V3_DB, EXPIN(IOEX_HDMI_PCAL6408, 0, 4), GPIO_INT_BOTH, hdmi_hpd_interrupt) - IOEX(USB_C0_FAULT_ODL, EXPIN(IOEX_C0_NCT3807, 0, 3), GPIO_ODR_HIGH) /* C0 Fault to SOC */ IOEX(USB_C0_TCPC_FASTSW_CTL_EN, EXPIN(IOEX_C0_NCT3807, 0, 4), GPIO_OUT_LOW) /* C0 FastSwitch Control */ IOEX(USB_C1_FAULT_ODL, EXPIN(IOEX_C0_NCT3807, 1, 0), GPIO_ODR_HIGH) /* C1 Fault to SOC */ @@ -72,7 +73,6 @@ IOEX(EN_USB_A0_5V, EXPIN(IOEX_C0_NCT3807, 1, 5), GPIO_OUT_LOW) /* A0 5V Source IOEX(USB_A0_CHARGE_EN_L, EXPIN(IOEX_C0_NCT3807, 1, 6), GPIO_OUT_HIGH) /* A0 5V High Current Enable */ IOEX(USB_C0_SBU_FLIP, EXPIN(IOEX_C0_NCT3807, 1, 7), GPIO_OUT_LOW) /* C0 SBU Flip */ -IOEX(USB_A1_RETIMER_EN_OPT1, EXPIN(IOEX_C1_NCT3807, 0, 0), GPIO_OUT_LOW) /* A1 Retimer Enable */ IOEX(USB_C1_HPD_IN_DB, EXPIN(IOEX_C1_NCT3807, 0, 2), GPIO_OUT_LOW) /* C1 HPD */ IOEX(USB_C1_TCPC_FASTSW_CTL_EN, EXPIN(IOEX_C1_NCT3807, 0, 4), GPIO_OUT_LOW) /* C1 FastSwitch Control */ IOEX(USB_C1_SBU_FAULT_DB_ODL, EXPIN(IOEX_C1_NCT3807, 1, 2), GPIO_INPUT) /* C1 SBU Fault */ @@ -81,10 +81,6 @@ IOEX(USB_C1_DATA_EN, EXPIN(IOEX_C1_NCT3807, 1, 5), GPIO_OUT_HIGH) /* C1 Retimer IOEX(EN_USB_A1_5V_DB_OPT1, EXPIN(IOEX_C1_NCT3807, 1, 6), GPIO_OUT_LOW) /* A1 5V Source Enable */ IOEX(USB_A1_CHARGE_EN_DB_L_OPT1,EXPIN(IOEX_C1_NCT3807, 1, 7), GPIO_OUT_HIGH) /* A1 5V High Current Enable */ -IOEX(USB_A1_RETIMER_EN_OPT2, EXPIN(IOEX_HDMI_PCAL6408, 0, 0), GPIO_OUT_LOW) /* A1 Retimer Enable */ -IOEX(EN_USB_A1_5V_DB_OPT2, EXPIN(IOEX_HDMI_PCAL6408, 0, 1), GPIO_OUT_LOW) /* A1 5V Source Enable */ -IOEX(USB_A1_CHARGE_EN_DB_L_OPT2,EXPIN(IOEX_HDMI_PCAL6408, 0, 2), GPIO_OUT_HIGH) /* A1 5V High Current Enable */ -IOEX(HDMI_DATA_EN_DB, EXPIN(IOEX_HDMI_PCAL6408, 0, 3), GPIO_OUT_HIGH) /* HDMI Retimer Enable */ /* * The NPCX LPC driver configures and controls SCI, so PCH_SCI_ODL [PIN(7, 6)] |