diff options
-rw-r--r-- | board/fizz/board.c | 1 | ||||
-rw-r--r-- | board/glkrvp/board.h | 1 | ||||
-rw-r--r-- | board/scarlet/board.c | 31 | ||||
-rw-r--r-- | common/charge_manager.c | 4 | ||||
-rw-r--r-- | include/charge_manager.h | 8 |
5 files changed, 12 insertions, 33 deletions
diff --git a/board/fizz/board.c b/board/fizz/board.c index 6ce83044d2..2aaf71beb9 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -14,7 +14,6 @@ #include "button.h" #include "charge_manager.h" #include "charge_state.h" -#include "charge_ramp.h" #include "charger.h" #include "chipset.h" #include "console.h" diff --git a/board/glkrvp/board.h b/board/glkrvp/board.h index 21c3a0effc..96d463369b 100644 --- a/board/glkrvp/board.h +++ b/board/glkrvp/board.h @@ -56,7 +56,6 @@ /* USB-A config */ /* USB PD config */ -#define CONFIG_USB_CHARGER #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 #define CONFIG_USB_PD_PORT_COUNT 2 diff --git a/board/scarlet/board.c b/board/scarlet/board.c index de5fe6ac8e..7ae9598490 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -281,9 +281,6 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, static void board_init(void) { - int i; - struct charge_port_info charge_none; - /* Enable TCPC alert interrupts */ gpio_enable_interrupt(GPIO_USB_C0_PD_INT_L); @@ -297,34 +294,6 @@ static void board_init(void) /* Sensor Init */ if (system_jumped_to_this_image() && chipset_in_state(CHIPSET_STATE_ON)) board_spi_enable(); - - /* - * Even if we don't support BC 1.2, we still need to initialize - * non-PD/USB-C charge suppliers to make charge manager seeded. - */ - charge_none.voltage = 0; - charge_none.current = 0; - - for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) { - charge_manager_update_charge(CHARGE_SUPPLIER_PROPRIETARY, - i, - &charge_none); - charge_manager_update_charge(CHARGE_SUPPLIER_BC12_CDP, - i, - &charge_none); - charge_manager_update_charge(CHARGE_SUPPLIER_BC12_DCP, - i, - &charge_none); - charge_manager_update_charge(CHARGE_SUPPLIER_BC12_SDP, - i, - &charge_none); - charge_manager_update_charge(CHARGE_SUPPLIER_OTHER, - i, - &charge_none); - charge_manager_update_charge(CHARGE_SUPPLIER_VBUS, - i, - &charge_none); - } } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); diff --git a/common/charge_manager.c b/common/charge_manager.c index a36b4e8aa4..71169fe97f 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -35,12 +35,14 @@ test_mockable const int supplier_priority[] = { [CHARGE_SUPPLIER_DEDICATED] = 0, #endif [CHARGE_SUPPLIER_TYPEC] = 1, +#ifdef CHARGE_MANAGER_BC12 [CHARGE_SUPPLIER_PROPRIETARY] = 1, [CHARGE_SUPPLIER_BC12_DCP] = 2, [CHARGE_SUPPLIER_BC12_CDP] = 3, [CHARGE_SUPPLIER_BC12_SDP] = 4, [CHARGE_SUPPLIER_OTHER] = 5, [CHARGE_SUPPLIER_VBUS] = 6 +#endif }; BUILD_ASSERT(ARRAY_SIZE(supplier_priority) == CHARGE_SUPPLIER_COUNT); @@ -274,6 +276,7 @@ static void charge_manager_fill_power_info(int port, case CHARGE_SUPPLIER_TYPEC: r->type = USB_CHG_TYPE_C; break; +#ifdef CHARGE_MANAGER_BC12 case CHARGE_SUPPLIER_PROPRIETARY: r->type = USB_CHG_TYPE_PROPRIETARY; break; @@ -289,6 +292,7 @@ static void charge_manager_fill_power_info(int port, case CHARGE_SUPPLIER_VBUS: r->type = USB_CHG_TYPE_VBUS; break; +#endif #if CONFIG_DEDICATED_CHARGE_PORT_COUNT > 0 case CHARGE_SUPPLIER_DEDICATED: r->type = USB_CHG_TYPE_DEDICATED; diff --git a/include/charge_manager.h b/include/charge_manager.h index 30c6c8cc85..868a4257b4 100644 --- a/include/charge_manager.h +++ b/include/charge_manager.h @@ -17,6 +17,12 @@ #define CHARGE_CURRENT_UNINITIALIZED -1 #define CHARGE_VOLTAGE_UNINITIALIZED -1 +/* Only track BC1.2 charge current if we support BC1.2 charging */ +#if defined(HAS_TASK_USB_CHG) || defined(HAS_TASK_USB_CHG_P0) || \ +defined(TEST_BUILD) +#define CHARGE_MANAGER_BC12 +#endif + /** * Time to delay for detecting the charger type (must be long enough for BC1.2 * driver to get supplier information and notify charge manager). @@ -27,12 +33,14 @@ enum charge_supplier { CHARGE_SUPPLIER_PD, CHARGE_SUPPLIER_TYPEC, +#ifdef CHARGE_MANAGER_BC12 CHARGE_SUPPLIER_BC12_DCP, CHARGE_SUPPLIER_BC12_CDP, CHARGE_SUPPLIER_BC12_SDP, CHARGE_SUPPLIER_PROPRIETARY, CHARGE_SUPPLIER_OTHER, CHARGE_SUPPLIER_VBUS, +#endif /* CHARGE_MANAGER_BC12 */ #if CONFIG_DEDICATED_CHARGE_PORT_COUNT > 0 CHARGE_SUPPLIER_DEDICATED, #endif |