diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/coral/board.c | 12 | ||||
-rw-r--r-- | board/elm/board.c | 12 | ||||
-rw-r--r-- | board/eve/board.c | 12 | ||||
-rw-r--r-- | board/fizz/board.h | 1 | ||||
-rw-r--r-- | board/grunt/board.c | 13 | ||||
-rw-r--r-- | board/kahlee/board.c | 13 | ||||
-rw-r--r-- | board/kevin/board.c | 25 | ||||
-rw-r--r-- | board/nautilus/board.c | 9 | ||||
-rw-r--r-- | board/nefario/board.c | 27 | ||||
-rw-r--r-- | board/poppy/board.c | 9 | ||||
-rw-r--r-- | board/reef/board.c | 12 | ||||
-rw-r--r-- | board/reef_it8320/board.c | 12 | ||||
-rw-r--r-- | board/rowan/board.c | 12 | ||||
-rw-r--r-- | board/samus_pd/board.c | 2 | ||||
-rw-r--r-- | board/samus_pd/board.h | 1 | ||||
-rw-r--r-- | board/scarlet/board.c | 28 | ||||
-rw-r--r-- | board/servo_v4/board.h | 1 | ||||
-rw-r--r-- | board/zoombini/board.c | 27 |
18 files changed, 5 insertions, 223 deletions
diff --git a/board/coral/board.c b/board/coral/board.c index 650b89d317..a862541c1b 100644 --- a/board/coral/board.c +++ b/board/coral/board.c @@ -593,17 +593,6 @@ int board_set_active_charge_port(int charge_port) { enum bd9995x_charge_port bd9995x_port; int bd9995x_port_select = 1; - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < 2) - return -1; switch (charge_port) { case USB_PD_PORT_ANX74XX: @@ -632,7 +621,6 @@ int board_set_active_charge_port(int charge_port) } CPRINTS("New chg p%d", charge_port); - initialized = 1; return bd9995x_select_input_port(bd9995x_port, bd9995x_port_select); } diff --git a/board/elm/board.c b/board/elm/board.c index 6d7d9746bb..701f61ac6c 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -289,17 +289,6 @@ int board_set_active_charge_port(int charge_port) charge_port < CONFIG_USB_PD_PORT_COUNT); /* check if we are source VBUS on the port */ int source = gpio_get_level(GPIO_USB_C0_5V_EN); - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < 2) - return -1; if (is_real_port && source) { CPRINTF("Skip enable p%d", charge_port); @@ -316,7 +305,6 @@ int board_set_active_charge_port(int charge_port) gpio_set_level(GPIO_USB_C0_CHARGE_L, 0); } - initialized = 1; return EC_SUCCESS; } diff --git a/board/eve/board.c b/board/eve/board.c index ca5b43d63c..d6b4d87c38 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -472,17 +472,6 @@ int board_set_active_charge_port(int charge_port) { enum bd9995x_charge_port bd9995x_port; int bd9995x_port_select = 1; - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < 2) - return -1; switch (charge_port) { case 0: @@ -511,7 +500,6 @@ int board_set_active_charge_port(int charge_port) } CPRINTS("New chg p%d", charge_port); - initialized = 1; return bd9995x_select_input_port(bd9995x_port, bd9995x_port_select); } diff --git a/board/fizz/board.h b/board/fizz/board.h index a1203c140a..1e79eb97a1 100644 --- a/board/fizz/board.h +++ b/board/fizz/board.h @@ -64,6 +64,7 @@ /* Charger */ #define CONFIG_CHARGE_MANAGER +#undef CONFIG_CHARGE_MANAGER_SAFE_MODE #define CONFIG_CHARGER_LIMIT_POWER_THRESH_CHG_MW 50000 diff --git a/board/grunt/board.c b/board/grunt/board.c index cd2ebcd215..9a4b341ee7 100644 --- a/board/grunt/board.c +++ b/board/grunt/board.c @@ -356,18 +356,6 @@ int pd_snk_is_vbus_provided(int port) */ int board_set_active_charge_port(int charge_port) { - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < 2) - return -1; - switch (charge_port) { case 0: /* Don't charge from a source port */ @@ -395,7 +383,6 @@ int board_set_active_charge_port(int charge_port) } CPRINTS("New chg p%d", charge_port); - initialized = 1; return EC_SUCCESS; } diff --git a/board/kahlee/board.c b/board/kahlee/board.c index 3826d4a181..159063aa51 100644 --- a/board/kahlee/board.c +++ b/board/kahlee/board.c @@ -356,18 +356,6 @@ int pd_snk_is_vbus_provided(int port) */ int board_set_active_charge_port(int charge_port) { - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < 2) - return -1; - switch (charge_port) { case 0: /* Don't charge from a source port */ @@ -395,7 +383,6 @@ int board_set_active_charge_port(int charge_port) } CPRINTS("New chg p%d", charge_port); - initialized = 1; return EC_SUCCESS; } diff --git a/board/kevin/board.c b/board/kevin/board.c index c10a93c0bd..41d987597d 100644 --- a/board/kevin/board.c +++ b/board/kevin/board.c @@ -208,19 +208,6 @@ int board_set_active_charge_port(int charge_port) { enum bd9995x_charge_port bd9995x_port; int bd9995x_port_select = 1; - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) { - CPRINTS("Bat critical, don't stop charging"); - return -1; - } switch (charge_port) { case 0: case 1: @@ -240,7 +227,6 @@ int board_set_active_charge_port(int charge_port) } CPRINTS("New chg p%d", charge_port); - initialized = 1; return bd9995x_select_input_port(bd9995x_port, bd9995x_port_select); } @@ -248,17 +234,6 @@ int board_set_active_charge_port(int charge_port) void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { - /* - * Ignore lower charge ceiling on PD transition if our battery is - * critical, as we may brownout. - */ - if (supplier == CHARGE_SUPPLIER_PD && - charge_ma < 1500 && - charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) { - CPRINTS("Using max ilim %d", max_ma); - charge_ma = max_ma; - } - charge_set_input_current_limit(MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } diff --git a/board/nautilus/board.c b/board/nautilus/board.c index a8e1a7d630..97ccb674e6 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -708,7 +708,6 @@ DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT); */ int board_set_active_charge_port(int charge_port) { - static uint8_t initialized; /* charge port is a physical port */ int is_real_port = (charge_port >= 0 && charge_port < CONFIG_USB_PD_PORT_COUNT); @@ -721,13 +720,6 @@ int board_set_active_charge_port(int charge_port) return EC_ERROR_INVAL; } - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) { - CPRINTS("Bat critical, don't stop charging"); - return -1; - } - CPRINTF("New chg p%d", charge_port); if (charge_port == CHARGE_PORT_NONE) { @@ -743,7 +735,6 @@ int board_set_active_charge_port(int charge_port) GPIO_USB_C0_CHARGE_L, 0); } - initialized = 1; return EC_SUCCESS; } diff --git a/board/nefario/board.c b/board/nefario/board.c index 30657fcc78..9016198162 100644 --- a/board/nefario/board.c +++ b/board/nefario/board.c @@ -190,20 +190,6 @@ int board_set_active_charge_port(int charge_port) { enum bd9995x_charge_port bd9995x_port; int bd9995x_port_select = 1; - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - (charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON || - battery_get_disconnect_state() == BATTERY_DISCONNECTED)) { - CPRINTS("Bat critical, don't stop charging"); - return -1; - } CPRINTS("New chg p%d", charge_port); @@ -224,25 +210,12 @@ int board_set_active_charge_port(int charge_port) break; } - initialized = 1; return bd9995x_select_input_port(bd9995x_port, bd9995x_port_select); } void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { - /* - * Ignore lower charge ceiling on PD transition if our battery is - * critical, as we may brownout. - */ - if (supplier == CHARGE_SUPPLIER_PD && - charge_ma < 1500 && - (charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON || - battery_get_disconnect_state() == BATTERY_DISCONNECTED)) { - CPRINTS("Using max ilim %d", max_ma); - charge_ma = max_ma; - } - charge_set_input_current_limit( MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } diff --git a/board/poppy/board.c b/board/poppy/board.c index b80be0b7dd..513f17441c 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -748,7 +748,6 @@ DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT); */ int board_set_active_charge_port(int charge_port) { - static uint8_t initialized; /* charge port is a physical port */ int is_real_port = (charge_port >= 0 && charge_port < CONFIG_USB_PD_PORT_COUNT); @@ -761,13 +760,6 @@ int board_set_active_charge_port(int charge_port) return EC_ERROR_INVAL; } - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) { - CPRINTS("Bat critical, don't stop charging"); - return -1; - } - CPRINTF("New chg p%d", charge_port); if (charge_port == CHARGE_PORT_NONE) { @@ -783,7 +775,6 @@ int board_set_active_charge_port(int charge_port) GPIO_USB_C0_CHARGE_L, 0); } - initialized = 1; return EC_SUCCESS; } diff --git a/board/reef/board.c b/board/reef/board.c index cff56b7657..4431adab25 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -585,17 +585,6 @@ int board_set_active_charge_port(int charge_port) { enum bd9995x_charge_port bd9995x_port; int bd9995x_port_select = 1; - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < 2) - return -1; switch (charge_port) { case USB_PD_PORT_ANX74XX: @@ -624,7 +613,6 @@ int board_set_active_charge_port(int charge_port) } CPRINTS("New chg p%d", charge_port); - initialized = 1; return bd9995x_select_input_port(bd9995x_port, bd9995x_port_select); } diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c index a7f275a9f4..8256cd1a3e 100644 --- a/board/reef_it8320/board.c +++ b/board/reef_it8320/board.c @@ -370,17 +370,6 @@ int board_set_active_charge_port(int charge_port) { enum bd9995x_charge_port bd9995x_port = 0; int bd9995x_port_select = 1; - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < 2) - return -1; switch (charge_port) { case 0: @@ -409,7 +398,6 @@ int board_set_active_charge_port(int charge_port) } CPRINTS("New chg p%d", charge_port); - initialized = 1; return bd9995x_select_input_port(bd9995x_port, bd9995x_port_select); } diff --git a/board/rowan/board.c b/board/rowan/board.c index b3e09679bd..31e0da5cea 100644 --- a/board/rowan/board.c +++ b/board/rowan/board.c @@ -303,17 +303,6 @@ int board_set_active_charge_port(int charge_port) charge_port < CONFIG_USB_PD_PORT_COUNT); /* check if we are source VBUS on the port */ int source = gpio_get_level(GPIO_USB_C0_5V_EN); - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < 2) - return -1; if (is_real_port && source) { CPRINTF("Skip enable p%d", charge_port); @@ -330,7 +319,6 @@ int board_set_active_charge_port(int charge_port) gpio_set_level(GPIO_USB_C0_CHARGE_L, 0); } - initialized = 1; return EC_SUCCESS; } diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c index 4a617ede97..3087b9ce03 100644 --- a/board/samus_pd/board.c +++ b/board/samus_pd/board.c @@ -475,6 +475,8 @@ static void board_update_battery_soc(int soc) { if (batt_soc != soc) { batt_soc = soc; + if (batt_soc >= CONFIG_CHARGE_MANAGER_BAT_PCT_SAFE_MODE_EXIT) + charge_manager_leave_safe_mode(); board_update_charge_limit(desired_charge_rate_ma); hook_notify(HOOK_BATTERY_SOC_CHANGE); } diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h index 4aaae34fcc..300b308dac 100644 --- a/board/samus_pd/board.h +++ b/board/samus_pd/board.h @@ -21,6 +21,7 @@ #define CONFIG_BOARD_PRE_INIT #define CONFIG_CHARGE_MANAGER #define CONFIG_CHARGE_RAMP_SW +#undef CONFIG_CMD_CHARGE_SUPPLIER_INFO #undef CONFIG_CMD_HASH #undef CONFIG_CMD_HCDEBUG #undef CONFIG_CMD_I2C_SCAN diff --git a/board/scarlet/board.c b/board/scarlet/board.c index f496abcda9..f0899842ff 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -166,21 +166,6 @@ uint16_t tcpc_get_alert_status(void) int board_set_active_charge_port(int charge_port) { - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - (charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON || - battery_get_disconnect_state() == BATTERY_DISCONNECTED)) { - CPRINTS("Bat critical, don't stop charging"); - return -1; - } - CPRINTS("New chg p%d", charge_port); switch (charge_port) { @@ -198,25 +183,12 @@ int board_set_active_charge_port(int charge_port) break; } - initialized = 1; return EC_SUCCESS; } void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { - /* - * Ignore lower charge ceiling on PD transition if our battery is - * critical, as we may brownout. - */ - if (supplier == CHARGE_SUPPLIER_PD && - charge_ma < 1500 && - (charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON || - battery_get_disconnect_state() == BATTERY_DISCONNECTED)) { - CPRINTS("Using max ilim %d", max_ma); - charge_ma = max_ma; - } - charge_set_input_current_limit(MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } diff --git a/board/servo_v4/board.h b/board/servo_v4/board.h index 8b81800466..aef30865b6 100644 --- a/board/servo_v4/board.h +++ b/board/servo_v4/board.h @@ -91,6 +91,7 @@ #undef CONFIG_TASK_PROFILING #define CONFIG_CHARGE_MANAGER +#undef CONFIG_CHARGE_MANAGER_SAFE_MODE #define CONFIG_USB_POWER_DELIVERY #define CONFIG_CMD_PD #define CONFIG_USB_PD_DUAL_ROLE diff --git a/board/zoombini/board.c b/board/zoombini/board.c index 59aca1962f..61aabdb543 100644 --- a/board/zoombini/board.c +++ b/board/zoombini/board.c @@ -256,24 +256,11 @@ int board_set_active_charge_port(int port) { int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_COUNT); - static int initialized; int i; if (!is_real_port && port != CHARGE_PORT_NONE) return EC_ERROR_INVAL; - /* - * Reject charge port none if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - port == CHARGE_PORT_NONE && - charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) { - CPRINTS("Bat critical, don't stop charging"); - return EC_ERROR_BUSY; - } - CPRINTS("New chg p%d", port); if (port == CHARGE_PORT_NONE) { @@ -281,7 +268,6 @@ int board_set_active_charge_port(int port) gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 1); gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 1); gpio_set_level(GPIO_USB_C2_CHARGE_EN_L, 1); - initialized = 1; return EC_SUCCESS; } @@ -297,7 +283,6 @@ int board_set_active_charge_port(int port) gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, port != 0); gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, port != 1); gpio_set_level(GPIO_USB_C2_CHARGE_EN_L, port != 2); - initialized = 1; /* * Turn on the PP2 FET such that power actually flows and turn off the @@ -316,18 +301,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { /* - * Ignore lower charge ceiling on PD transition if our battery is - * critical, as we may brownout. - */ - if (supplier == CHARGE_SUPPLIER_PD && - charge_ma < 1500 && - charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) { - CPRINTS("Using max ilim %d", max_ma); - charge_ma = max_ma; - } - - - /* * To protect the charge inductor, at voltages above 18V we should * set the current limit to 2.7A. */ |