summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Zieba <robertzieba@google.com>2022-12-08 16:09:44 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-12-09 16:54:06 +0000
commit18eedb20812b2ffe66981caa65f5b5d3142a28b2 (patch)
treec01202ae3d04dca805a01a78eeb209bdb3ed15b9
parent2be2df7a1cc61699b86d88355d72edcd8ad40def (diff)
downloadchrome-ec-18eedb20812b2ffe66981caa65f5b5d3142a28b2.tar.gz
charger: Add prochot printing function
Add `print_charger_prochot` function and corresponding entry to charger driver struct to accommodate calling this functionality in a generic way. BRANCH=none BUG=b:227768313 TEST=Builds LOW_COVERAGE_REASON=No generic CrOS EC charger emulator Change-Id: Iabc9b33de55436b2bbdd9c372738d7356536c874 Signed-off-by: Robert Zieba <robertzieba@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4087540 Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--common/charger.c9
-rw-r--r--include/charger.h9
-rw-r--r--zephyr/Kconfig.charger4
-rw-r--r--zephyr/shim/include/config_chip.h5
4 files changed, 27 insertions, 0 deletions
diff --git a/common/charger.c b/common/charger.c
index 198dc0db8c..9c644236d4 100644
--- a/common/charger.c
+++ b/common/charger.c
@@ -189,6 +189,15 @@ void print_charger_debug(int chgnum)
ccputs("disabled\n");
}
+void print_charger_prochot(int chgnum)
+{
+ if ((chgnum < 0) || (chgnum >= board_get_charger_chip_count()))
+ return;
+
+ if (chg_chips[chgnum].drv->dump_prochot)
+ chg_chips[chgnum].drv->dump_prochot(chgnum);
+}
+
static int command_charger(int argc, const char **argv)
{
int d;
diff --git a/include/charger.h b/include/charger.h
index df3f3f65dd..949195256a 100644
--- a/include/charger.h
+++ b/include/charger.h
@@ -154,6 +154,9 @@ struct charger_drv {
/* Dumps charger registers */
void (*dump_registers)(int chgnum);
+
+ /* Dumps prochot status information */
+ void (*dump_prochot)(int chgnum);
};
struct charger_config_t {
@@ -415,6 +418,12 @@ enum ec_error_list charger_get_battery_cells(int chgnum, int *cells);
*/
void print_charger_debug(int chgnum);
+/*
+ * Print prochot status for debugging purposes
+ * @param chgnum: charger IC index.
+ */
+void print_charger_prochot(int chgnum);
+
/**
* Get the value of CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON
*/
diff --git a/zephyr/Kconfig.charger b/zephyr/Kconfig.charger
index 1505cc0948..ee47a06040 100644
--- a/zephyr/Kconfig.charger
+++ b/zephyr/Kconfig.charger
@@ -780,4 +780,8 @@ config PLATFORM_EC_DC_PROCHOT_CURRENT_MA
To set the PROCHOT# signal assertion threshold for battery over
discharging current conditions.
+config PLATFORM_EC_CHARGER_DUMP_PROCHOT
+ bool "Enable support for prochot status dumping functions"
+ default n
+
endif # PLATFORM_EC_CHARGER
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 5ab7fb05d7..8d80efde44 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -372,6 +372,11 @@
#define CONFIG_DC_PROCHOT_CURRENT_MA CONFIG_PLATFORM_EC_DC_PROCHOT_CURRENT_MA
#endif
+#undef CONFIG_CHARGER_DUMP_PROCHOT
+#ifdef CONFIG_PLATFORM_EC_CHARGER_DUMP_PROCHOT
+#define CONFIG_CHARGER_DUMP_PROCHOT
+#endif
+
#undef CONFIG_CHARGER_RAA489000
#ifdef CONFIG_PLATFORM_EC_CHARGER_RAA489000
#define CONFIG_CHARGER_RAA489000