diff options
Diffstat (limited to 'board/gladios/board.c')
-rw-r--r-- | board/gladios/board.c | 83 |
1 files changed, 5 insertions, 78 deletions
diff --git a/board/gladios/board.c b/board/gladios/board.c index 318272f4c2..b0fad206c0 100644 --- a/board/gladios/board.c +++ b/board/gladios/board.c @@ -16,7 +16,6 @@ #include "gpio.h" #include "gpio_signal.h" #include "hooks.h" -#include "peripheral_charger.h" #include "power.h" #include "power_button.h" #include "switch.h" @@ -41,33 +40,6 @@ const int usb_port_enable[USB_PORT_COUNT] = { }; BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_PORT_COUNT); -extern struct pchg_drv cps8100_drv; -struct pchg pchgs[] = { - [0] = { - .cfg = &(const struct pchg_config) { - .drv = &cps8100_drv, - .i2c_port = I2C_PORT_QI, - .irq_pin = GPIO_QI_INT_ODL, - .full_percent = 96, - .block_size = 128, - }, - .policy = { - [PCHG_CHIPSET_STATE_ON] = &pchg_policy_on, - [PCHG_CHIPSET_STATE_SUSPEND] = &pchg_policy_suspend, - }, - .events = QUEUE_NULL(PCHG_EVENT_QUEUE_SIZE, enum pchg_event), - }, -}; -const int pchg_count = ARRAY_SIZE(pchgs); - -__override void board_pchg_power_on(int port, bool on) -{ - if (port == 0) - gpio_set_level(GPIO_EC_QI_PWR, on); - else - CPRINTS("%s: Invalid port=%d", __func__, port); -} - /******************************************************************************/ int board_set_active_charge_port(int port) @@ -117,8 +89,6 @@ int board_set_active_charge_port(int port) switch (port) { case CHARGE_PORT_TYPEC0: - case CHARGE_PORT_TYPEC1: - case CHARGE_PORT_TYPEC2: gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1); break; case CHARGE_PORT_BARRELJACK: @@ -199,7 +169,9 @@ static void update_5v_usage(void) */ if (rear_ports > 0) base_5v_power_s5 += PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW; - if (!gpio_get_level(GPIO_HDMI_CONN_OC_ODL)) + if (!gpio_get_level(GPIO_HDMIA_CONN_OC_ODL)) + base_5v_power_s5 += PWR_S5_HDMI; + if (!gpio_get_level(GPIO_HDMIB_CONN_OC_ODL)) base_5v_power_s5 += PWR_S5_HDMI; base_5v_power_z1 = PWR_Z1_BASE_LOAD; if (usbc_overcurrent) @@ -278,7 +250,8 @@ DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1); static void board_init(void) { gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_ODL); - gpio_enable_interrupt(GPIO_HDMI_CONN_OC_ODL); + gpio_enable_interrupt(GPIO_HDMIA_CONN_OC_ODL); + gpio_enable_interrupt(GPIO_HDMIB_CONN_OC_ODL); gpio_enable_interrupt(GPIO_USB_A0_OC_ODL); gpio_enable_interrupt(GPIO_USB_A1_OC_ODL); gpio_enable_interrupt(GPIO_USB_A2_OC_ODL); @@ -336,8 +309,6 @@ void board_overcurrent_event(int port, int is_overcurrented) #define THROT_TYPE_A_FRONT BIT(0) #define THROT_TYPE_A_REAR BIT(1) #define THROT_TYPE_C0 BIT(2) -#define THROT_TYPE_C1 BIT(3) -#define THROT_TYPE_C2 BIT(4) #define THROT_PROCHOT BIT(5) /* @@ -462,26 +433,6 @@ static void power_monitor(void) gap += POWER_GAIN_TYPE_C; } /* - * If the type-C port is sourcing power, - * check whether it should be throttled. - */ - if (ppc_is_sourcing_vbus(1) && gap <= 0) { - new_state |= THROT_TYPE_C1; - headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW; - if (!(current_state & THROT_TYPE_C1)) - gap += POWER_GAIN_TYPE_C; - } - /* - * If the type-C port is sourcing power, - * check whether it should be throttled. - */ - if (ppc_is_sourcing_vbus(2) && gap <= 0) { - new_state |= THROT_TYPE_C2; - headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW; - if (!(current_state & THROT_TYPE_C2)) - gap += POWER_GAIN_TYPE_C; - } - /* * As a last resort, turn on PROCHOT to * throttle the CPU. */ @@ -562,35 +513,11 @@ static void power_monitor(void) tcpm_select_rp_value(0, rp); pd_update_contract(0); } - if (diff & THROT_TYPE_C1) { - enum tcpc_rp_value rp = (new_state & THROT_TYPE_C1) ? - TYPEC_RP_1A5 : - TYPEC_RP_3A0; - - ppc_set_vbus_source_current_limit(1, rp); - tcpm_select_rp_value(1, rp); - pd_update_contract(1); - } - if (diff & THROT_TYPE_C2) { - enum tcpc_rp_value rp = (new_state & THROT_TYPE_C2) ? - TYPEC_RP_1A5 : - TYPEC_RP_3A0; - - ppc_set_vbus_source_current_limit(2, rp); - tcpm_select_rp_value(2, rp); - pd_update_contract(2); - } if (diff & THROT_TYPE_A_REAR) { int typea_bc = (new_state & THROT_TYPE_A_REAR) ? 1 : 0; gpio_set_level(GPIO_USB_A_LOW_PWR0_OD, typea_bc); gpio_set_level(GPIO_USB_A_LOW_PWR1_OD, typea_bc); } - if (diff & THROT_TYPE_A_FRONT) { - int typea_bc = (new_state & THROT_TYPE_A_FRONT) ? 1 : 0; - - gpio_set_level(GPIO_USB_A_LOW_PWR2_OD, typea_bc); - gpio_set_level(GPIO_USB_A_LOW_PWR3_OD, typea_bc); - } hook_call_deferred(&power_monitor_data, delay); } |