diff options
author | Ryan Zhang <Ryan.Zhang@quanta.corp-partner.google.com> | 2017-09-12 09:52:52 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-14 11:36:35 -0700 |
commit | afecf86f44f73fa6b618be82536d0c25d908d7a4 (patch) | |
tree | ddf9609f84730907af4f5713cea89e5f918e4025 /board/coral | |
parent | 857ab8ffa23cdceb019323d96ec076df71809486 (diff) | |
download | chrome-ec-afecf86f44f73fa6b618be82536d0c25d908d7a4.tar.gz |
Coral: expose more data to ectool
Servo / Suzy-Q related debugging methods is a big challenge
in factory especially after servo debug header is removed.
Expose some information to OS from EC will do a great help
for massive production.
+ expose charge/battery related state to ectool
1. chg_ctl_mode
2. manual_mode
3. battery_seems_to_be_dead
4. battery_seems_to_be_disconnected
5. battery_was_removed
6. disch_on_ac (learn mode state)
7. battery DFET
BUG=b:65265543
BRANCH=master
TEST=`ectool chargestate param x10000~0x20006 get correct state`
Change-Id: Ib64ab3c7b68a634ea098425c93e5234361cd1936
Reviewed-on: https://chromium-review.googlesource.com/662318
Commit-Ready: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board/coral')
-rw-r--r-- | board/coral/battery.c | 17 | ||||
-rw-r--r-- | board/coral/board.h | 1 |
2 files changed, 16 insertions, 2 deletions
diff --git a/board/coral/battery.c b/board/coral/battery.c index 06ebcf5d23..4f4896c868 100644 --- a/board/coral/battery.c +++ b/board/coral/battery.c @@ -66,6 +66,8 @@ static enum battery_type board_battery_type = BATTERY_TYPE_COUNT; /* Battery may delay reporting battery present */ static int battery_report_present = 1; +static int disch_on_ac; + /* * Battery info for all Coral battery types. Note that the fields * start_charging_min/max and charging_min/max are not used for the charger. @@ -455,7 +457,7 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr) int charger_profile_override(struct charge_state_data *curr) { - int disch_on_ac = charger_should_discharge_on_ac(curr); + disch_on_ac = charger_should_discharge_on_ac(curr); charger_discharge_on_ac(disch_on_ac); @@ -582,11 +584,22 @@ int board_battery_initialized(void) /* Customs options controllable by host command. */ #define PARAM_FASTCHARGE (CS_PARAM_CUSTOM_PROFILE_MIN + 0) +#define PARAM_LEARN_MODE 0x10001 +#define PARAM_DISCONNECT_STATE 0x10002 enum ec_status charger_profile_override_get_param(uint32_t param, uint32_t *value) { - return EC_RES_INVALID_PARAM; + switch (param) { + case PARAM_LEARN_MODE: + *value = disch_on_ac; + return EC_SUCCESS; + case PARAM_DISCONNECT_STATE: + *value = battery_check_disconnect(); + return EC_SUCCESS; + default: + return EC_RES_INVALID_PARAM; + } } enum ec_status charger_profile_override_set_param(uint32_t param, diff --git a/board/coral/board.h b/board/coral/board.h index dea50317a6..80af754611 100644 --- a/board/coral/board.h +++ b/board/coral/board.h @@ -48,6 +48,7 @@ /* Charger */ #define CONFIG_CHARGE_MANAGER #define CONFIG_CHARGE_RAMP +#define CONFIG_CHARGE_STATE_DEBUG #define CONFIG_CHARGER #define CONFIG_CHARGER_V2 #define CONFIG_CHARGER_BD9995X |