From f7fcac7447d2fcd31888c207c3d739498b092455 Mon Sep 17 00:00:00 2001 From: Ko_Ko Date: Mon, 31 Aug 2020 19:18:45 +0800 Subject: Madoo: remove HDMI sub-board function Madoo doesn't support HDMI sub-board. By removing it to prevent unwanted outcome. BRANCH=None BUG=b:167168822 TEST=on function works on madoo proto build with type C sub board. Signed-off-by: Ko_Ko Change-Id: I8b3e95c520c71b0e0541d5786c296375e7556cb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2385022 Reviewed-by: Justin TerAvest Tested-by: Justin TerAvest Commit-Queue: Ko Ko --- board/madoo/board.c | 89 ++++++----------------------------------------------- 1 file changed, 10 insertions(+), 79 deletions(-) (limited to 'board/madoo/board.c') diff --git a/board/madoo/board.c b/board/madoo/board.c index 43fbb9335d..e53c7e10d4 100644 --- a/board/madoo/board.c +++ b/board/madoo/board.c @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* Waddledoo board-specific configuration */ +/* Madoo board-specific configuration */ #include "adc_chip.h" #include "button.h" @@ -74,13 +74,6 @@ static void sub_usb_c1_interrupt(enum gpio_signal s) task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12, 0); } -static void sub_hdmi_hpd_interrupt(enum gpio_signal s) -{ - int hdmi_hpd_odl = gpio_get_level(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL); - - gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, !hdmi_hpd_odl); -} - static void c0_ccsbu_ovp_interrupt(enum gpio_signal s) { cprints(CC_USBPD, "C0: CC OVP, SBU OVP, or thermal event"); @@ -127,34 +120,9 @@ void board_init(void) int on; gpio_enable_interrupt(GPIO_USB_C0_INT_ODL); + gpio_enable_interrupt(GPIO_SUB_USB_C1_INT_ODL); gpio_enable_interrupt(GPIO_USB_C0_CCSBU_OVP_ODL); - if (get_cbi_fw_config_db() == DB_1A_HDMI) { - /* Disable i2c on HDMI pins */ - gpio_config_pin(MODULE_I2C, - GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, 0); - gpio_config_pin(MODULE_I2C, - GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0); - - /* Set HDMI and sub-rail enables to output */ - gpio_set_flags(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, - chipset_in_state(CHIPSET_STATE_ON) ? - GPIO_ODR_LOW : GPIO_ODR_HIGH); - gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH); - - /* Select HDMI option */ - gpio_set_level(GPIO_HDMI_SEL_L, 0); - - /* Enable interrupt for passing through HPD */ - gpio_enable_interrupt(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL); - } else { - /* Set SDA as an input */ - gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, - GPIO_INPUT); - - /* Enable C1 interrupts */ - gpio_enable_interrupt(GPIO_SUB_C1_INT_EN_RAILS_ODL); - } /* Enable gpio interrupt for base accelgyro sensor */ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); @@ -164,27 +132,13 @@ void board_init(void) } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); -/* Enable HDMI any time the SoC is on */ -static void hdmi_enable(void) -{ - gpio_set_level(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0); -} -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, hdmi_enable, HOOK_PRIO_DEFAULT); - -static void hdmi_disable(void) -{ - gpio_set_level(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 1); -} -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, hdmi_disable, HOOK_PRIO_DEFAULT); - void board_hibernate(void) { /* * Both charger ICs need to be put into their "low power mode" before * entering the Z-state. */ - if (board_get_charger_chip_count() > 1) - raa489000_hibernate(1); + raa489000_hibernate(1); raa489000_hibernate(0); } @@ -237,35 +191,13 @@ __override void board_power_5v_enable(int enable) /* * Port 0 simply has a GPIO to turn on the 5V regulator, however, 5V is * generated locally on the sub board and we need to set the comparator - * polarity on the sub board charger IC, or send enable signal to HDMI - * DB. + * polarity on the sub board charger IC. */ set_5v_gpio(!!enable); - if (get_cbi_fw_config_db() == DB_1A_HDMI) { - gpio_set_level(GPIO_SUB_C1_INT_EN_RAILS_ODL, !enable); - } else { - if (isl923x_set_comparator_inversion(1, !!enable)) - CPRINTS("Failed to %sable sub rails!", enable ? + if (isl923x_set_comparator_inversion(1, !!enable)) + CPRINTS("Failed to %sable sub rails!", enable ? "en" : "dis"); - } - -} - -__override uint8_t board_get_usb_pd_port_count(void) -{ - if (get_cbi_fw_config_db() == DB_1A_HDMI) - return CONFIG_USB_PD_PORT_MAX_COUNT - 1; - else - return CONFIG_USB_PD_PORT_MAX_COUNT; -} - -__override uint8_t board_get_charger_chip_count(void) -{ - if (get_cbi_fw_config_db() == DB_1A_HDMI) - return CHARGER_NUM - 1; - else - return CHARGER_NUM; } int board_is_sourcing_vbus(int port) @@ -280,7 +212,7 @@ int board_is_sourcing_vbus(int port) int board_set_active_charge_port(int port) { int is_real_port = (port >= 0 && - port < board_get_usb_pd_port_count()); + port < CONFIG_USB_PD_PORT_MAX_COUNT); int i; int old_port; @@ -293,7 +225,7 @@ int board_set_active_charge_port(int port) /* Disable all ports. */ if (port == CHARGE_PORT_NONE) { - for (i = 0; i < board_get_usb_pd_port_count(); i++) + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) tcpc_write(i, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW); @@ -310,7 +242,7 @@ int board_set_active_charge_port(int port) * Turn off the other ports' sink path FETs, before enabling the * requested charge port. */ - for (i = 0; i < board_get_usb_pd_port_count(); i++) { + for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { if (i == port) continue; @@ -594,8 +526,7 @@ uint16_t tcpc_get_alert_status(void) } } - if (board_get_usb_pd_port_count() > 1 && - !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) { + if (!gpio_get_level(GPIO_SUB_USB_C1_INT_ODL)) { if (!tcpc_read16(1, TCPC_REG_ALERT, ®val)) { /* TCPCI spec Rev 1.0 says to ignore bits 14:12. */ if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0)) -- cgit v1.2.1