diff options
author | Przemyslaw Marczak <p.marczak@samsung.com> | 2014-03-25 12:27:05 +0100 |
---|---|---|
committer | Przemyslaw Marczak <p.marczak@samsung.com> | 2015-05-18 11:29:14 +0200 |
commit | 14b5194bec51e2eaa3307b2365954d85773aed39 (patch) | |
tree | d376fdec177473154133993d470c81ac6d1a3ea3 | |
parent | 42975719c488cbf639e7db77698612e3a70d22ce (diff) | |
download | u-boot-14b5194bec51e2eaa3307b2365954d85773aed39.tar.gz u-boot-14b5194bec51e2eaa3307b2365954d85773aed39.tar.bz2 u-boot-14b5194bec51e2eaa3307b2365954d85773aed39.zip |
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 [<state>] [<charge>]
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 <p.marczak@samsung.com>
-rw-r--r-- | board/samsung/common/misc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index 69ae99f9d0..3a0c20654a 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -642,6 +642,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", + "<charge> or <state>\n" + "Enable interactive charger or display battery state screen" +); +#endif /* CONFIG_CMD_BATTERY */ #endif void check_boot_mode(void) |