mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
charge_state_v2: Add console command to test discharge on AC
Added support to test discharge on AC using console command.
BUG=chrome-os-partner:55572
BRANCH=none
TEST=Manually tested on Reef.
"chgstate discharge on" - Battery is discharging
"chgstate discharge off" - Battery is charging
Change-Id: I07733fe28d22b0ad6e3bd172a445e43a60650762
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/362678
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
4f75b9949a
commit
6b6a6fbca6
@@ -1313,13 +1313,30 @@ static int command_chgstate(int argc, char **argv)
|
||||
CHARGE_CONTROL_NORMAL);
|
||||
if (rv)
|
||||
return rv;
|
||||
#ifdef CONFIG_CHARGER_DISCHARGE_ON_AC
|
||||
} else if (!strcasecmp(argv[1], "discharge")) {
|
||||
if (argc <= 2)
|
||||
return EC_ERROR_PARAM_COUNT;
|
||||
if (!parse_bool(argv[2], &val))
|
||||
return EC_ERROR_PARAM2;
|
||||
rv = set_chg_ctrl_mode(val ? CHARGE_CONTROL_DISCHARGE :
|
||||
CHARGE_CONTROL_NORMAL);
|
||||
if (rv)
|
||||
return rv;
|
||||
#ifdef CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM
|
||||
rv = board_discharge_on_ac(val);
|
||||
#else
|
||||
rv = charger_discharge_on_ac(val);
|
||||
#endif /* CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM */
|
||||
if (rv)
|
||||
return rv;
|
||||
#endif /* CONFIG_CHARGER_DISCHARGE_ON_AC */
|
||||
} else if (!strcasecmp(argv[1], "debug")) {
|
||||
if (argc <= 2)
|
||||
return EC_ERROR_PARAM_COUNT;
|
||||
if (!parse_bool(argv[2], &debugging))
|
||||
return EC_ERROR_PARAM2;
|
||||
} else {
|
||||
/* maybe handle board_discharge_on_ac() too? */
|
||||
return EC_ERROR_PARAM1;
|
||||
}
|
||||
}
|
||||
@@ -1328,6 +1345,6 @@ static int command_chgstate(int argc, char **argv)
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
DECLARE_CONSOLE_COMMAND(chgstate, command_chgstate,
|
||||
"[idle|debug on|off]",
|
||||
"[idle|discharge|debug on|off]",
|
||||
"Get/set charge state machine status",
|
||||
NULL);
|
||||
|
||||
Reference in New Issue
Block a user