summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/coral/board.c10
-rw-r--r--board/eve/board.c10
-rw-r--r--board/grunt/board.c10
-rw-r--r--board/kahlee/board.c10
-rw-r--r--board/kevin/charge_ramp.c10
-rw-r--r--board/nautilus/board.c11
-rw-r--r--board/poppy/board.c11
-rw-r--r--board/reef/board.c10
-rw-r--r--board/reef_it8320/board.c10
-rw-r--r--board/samus_pd/board.c2
-rw-r--r--common/charge_ramp_sw.c5
-rw-r--r--common/charge_state_v2.c7
-rw-r--r--include/charge_ramp.h7
-rw-r--r--include/charge_state.h10
-rw-r--r--test/charge_ramp.c2
15 files changed, 22 insertions, 103 deletions
diff --git a/board/coral/board.c b/board/coral/board.c
index 9fe3aaae78..650b89d317 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -663,16 +663,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
}
/**
- * Return if board is consuming full amount of input current
- */
-int board_is_consuming_full_charge(void)
-{
- int chg_perc = charge_get_percent();
-
- return chg_perc > 2 && chg_perc < 95;
-}
-
-/**
* Return if VBUS is sagging too low
*/
int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
diff --git a/board/eve/board.c b/board/eve/board.c
index e0f168fca4..ca5b43d63c 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -542,16 +542,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
}
/**
- * Return if board is consuming full amount of input current
- */
-int board_is_consuming_full_charge(void)
-{
- int chg_perc = charge_get_percent();
-
- return chg_perc > 2 && chg_perc < 95;
-}
-
-/**
* Return if VBUS is sagging too low
*/
int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
diff --git a/board/grunt/board.c b/board/grunt/board.c
index d08843dfb6..cd2ebcd215 100644
--- a/board/grunt/board.c
+++ b/board/grunt/board.c
@@ -417,16 +417,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
}
/**
- * Return if board is consuming full amount of input current
- */
-int board_is_consuming_full_charge(void)
-{
- int chg_perc = charge_get_percent();
-
- return chg_perc > 2 && chg_perc < 95;
-}
-
-/**
* Return if VBUS is sagging too low
*/
int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
diff --git a/board/kahlee/board.c b/board/kahlee/board.c
index dd57f8edcd..3826d4a181 100644
--- a/board/kahlee/board.c
+++ b/board/kahlee/board.c
@@ -417,16 +417,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
}
/**
- * Return if board is consuming full amount of input current
- */
-int board_is_consuming_full_charge(void)
-{
- int chg_perc = charge_get_percent();
-
- return chg_perc > 2 && chg_perc < 95;
-}
-
-/**
* Return if VBUS is sagging too low
*/
int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
diff --git a/board/kevin/charge_ramp.c b/board/kevin/charge_ramp.c
index 350c58924b..134f2e62de 100644
--- a/board/kevin/charge_ramp.c
+++ b/board/kevin/charge_ramp.c
@@ -20,13 +20,3 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
{
return charger_get_vbus_voltage(port) < BD9995X_BC12_MIN_VOLTAGE;
}
-
-/**
- * Return if board is consuming full amount of input current
- */
-int board_is_consuming_full_charge(void)
-{
- int chg_pct = charge_get_percent();
-
- return chg_pct > 2 && chg_pct < 95;
-}
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index 84f5684739..a8e1a7d630 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -795,17 +795,6 @@ int board_get_ramp_current_limit(int supplier, int sup_curr)
}
}
-/**
- * Return if board is consuming full amount of input current
- */
-int board_is_consuming_full_charge(void)
-{
- int chg_perc = charge_get_percent();
-
- return chg_perc > 2 && chg_perc < 95;
-}
-
-
void board_hibernate(void)
{
CPRINTS("Triggering PMIC shutdown.");
diff --git a/board/poppy/board.c b/board/poppy/board.c
index d13361c108..b80be0b7dd 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -802,17 +802,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
-/**
- * Return if board is consuming full amount of input current
- */
-int board_is_consuming_full_charge(void)
-{
- int chg_perc = charge_get_percent();
-
- return chg_perc > 2 && chg_perc < 95;
-}
-
-
void board_hibernate(void)
{
CPRINTS("Triggering PMIC shutdown.");
diff --git a/board/reef/board.c b/board/reef/board.c
index f4696b8ce2..cff56b7657 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -655,16 +655,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
}
/**
- * Return if board is consuming full amount of input current
- */
-int board_is_consuming_full_charge(void)
-{
- int chg_perc = charge_get_percent();
-
- return chg_perc > 2 && chg_perc < 95;
-}
-
-/**
* Return if VBUS is sagging too low
*/
int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c
index 1c33c2ec65..a7f275a9f4 100644
--- a/board/reef_it8320/board.c
+++ b/board/reef_it8320/board.c
@@ -440,16 +440,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
}
/**
- * Return if board is consuming full amount of input current
- */
-int board_is_consuming_full_charge(void)
-{
- int chg_perc = charge_get_percent();
-
- return chg_perc > 2 && chg_perc < 95;
-}
-
-/**
* Return if VBUS is sagging too low
*/
int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c
index fc4c22d207..4a617ede97 100644
--- a/board/samus_pd/board.c
+++ b/board/samus_pd/board.c
@@ -363,7 +363,7 @@ int pd_is_max_request_allowed(void)
/**
* Return if board is consuming full amount of input current
*/
-int board_is_consuming_full_charge(void)
+int charge_is_consuming_full_input_current(void)
{
return batt_soc >= 1 && batt_soc < HIGH_BATT_THRESHOLD;
}
diff --git a/common/charge_ramp_sw.c b/common/charge_ramp_sw.c
index cfdfa50c21..d572115043 100644
--- a/common/charge_ramp_sw.c
+++ b/common/charge_ramp_sw.c
@@ -7,6 +7,7 @@
#include "charge_manager.h"
#include "charge_ramp.h"
+#include "charge_state.h"
#include "common.h"
#include "console.h"
#include "ec_commands.h"
@@ -224,7 +225,7 @@ void chg_ramp_task(void *u)
* If we are not drawing full charge, then don't ramp,
* just wait in this state, until we are.
*/
- if (!board_is_consuming_full_charge()) {
+ if (!charge_is_consuming_full_input_current()) {
task_wait_time = CURRENT_DRAW_DELAY;
break;
}
@@ -258,7 +259,7 @@ void chg_ramp_task(void *u)
task_wait_time = RAMP_CURR_DELAY;
/* Pause ramping if we are not drawing full current */
- if (!board_is_consuming_full_charge()) {
+ if (!charge_is_consuming_full_input_current()) {
task_wait_time = CURRENT_DRAW_DELAY;
break;
}
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index ae039c61d2..df87184813 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -1101,6 +1101,13 @@ int charge_get_battery_temp(int idx, int *temp_ptr)
return EC_SUCCESS;
}
+int charge_is_consuming_full_input_current(void)
+{
+ int chg_pct = charge_get_percent();
+
+ return chg_pct > 2 && chg_pct < 95;
+}
+
int charge_set_input_current_limit(int ma, int mv)
{
/*
diff --git a/include/charge_ramp.h b/include/charge_ramp.h
index 51ad777aa1..c4082fdbf2 100644
--- a/include/charge_ramp.h
+++ b/include/charge_ramp.h
@@ -17,13 +17,6 @@ enum chg_ramp_vbus_state {
};
/**
- * Check if board is consuming full input current
- *
- * @return Board is consuming full input current
- */
-int board_is_consuming_full_charge(void);
-
-/**
* Check if VBUS is too low
*
* @param port Charge ramp port
diff --git a/include/charge_state.h b/include/charge_state.h
index 0cf70c22de..fb1a41527a 100644
--- a/include/charge_state.h
+++ b/include/charge_state.h
@@ -92,6 +92,16 @@ uint32_t charge_get_flags(void);
int charge_get_percent(void);
/**
+ * Check if board is consuming full input current
+ *
+ * This returns true if the battery charge percentage is between 2% and 95%
+ * exclusive.
+ *
+ * @return Board is consuming full input current
+ */
+int charge_is_consuming_full_input_current(void);
+
+/**
* Return non-zero if discharging and battery so low we should shut down.
*/
int charge_want_shutdown(void);
diff --git a/test/charge_ramp.c b/test/charge_ramp.c
index e3dce7a860..f6f8bd542e 100644
--- a/test/charge_ramp.c
+++ b/test/charge_ramp.c
@@ -64,7 +64,7 @@ int usb_charger_ramp_max(int supplier, int sup_curr)
return 0;
}
-int board_is_consuming_full_charge(void)
+int charge_is_consuming_full_input_current(void)
{
return charge_limit_ma <= system_load_current_ma;
}