From: Przemyslaw Marczak
Date: Tue, 25 Mar 2014 11:27:05 +0000 (+0100)
Subject: samsung: misc: new command: battery and config CONFIG_CMD_BATTERY
X-Git-Tag: accepted/tizen/unified/20191107.062134~237
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a56820234256209aac5b6c397805a5816f4769e;p=platform%2Fkernel%2Fu-boot.git
samsung: misc: new command: battery and config CONFIG_CMD_BATTERY
This feature allows to enable interactive charger by command line
or use interactive charger for display battery charge level.
Usage:
- battery [] []
Option "state" will display battery screen for 2 seconds.
Option "charge" will start interactive charger mode.
Interactive charger mode can be stopped by:
- pressing CTRL+C keys combination,
or device reset by:
- pressing PWR key for 5 seconds (only if SOC > 20% - one grey bar),
- pressing PWR key for 10 seconds, which is PMIC reset.
Change-Id: I622830198f6cba4f0fa30798b02aa003c55332bb
Signed-off-by: Przemyslaw Marczak
---
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 86d234d..d7c6f12 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -676,6 +676,34 @@ warning:
return CMD_RET_SUCCESS;
}
+
+#ifdef CONFIG_CMD_BATTERY
+int do_battery(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ int cmd;
+
+ if (argc != 2)
+ return CMD_RET_USAGE;
+
+ if (!strcmp("charge", argv[1]))
+ cmd = CMD_BATTERY_CHARGE;
+ else if (!strcmp("state", argv[1]))
+ cmd = CMD_BATTERY_STATE;
+ else
+ return CMD_RET_USAGE;
+
+ if (battery(cmd))
+ return CMD_RET_FAILURE;
+
+ return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(battery, CONFIG_SYS_MAXARGS, 1, do_battery,
+ "Battery interactive charger",
+ " or \n"
+ "Enable interactive charger or display battery state screen"
+);
+#endif /* CONFIG_CMD_BATTERY */
#endif
void check_boot_mode(void)