ec_commands: EC_CMD_BATTERY_GET_DYNAMIC: Clarify the meaning of flags

flags are actually _not_ BATT_FLAG_*, but EC_BATT_FLAG_*. Clarify
that in the comment, and add a new EC_BATT_FLAG_INVALID flag to
indicate that some of the data may be invalid (dual-battery master
needs to know that to make appropriate charging/discharging
decision).

BRANCH=none
BUG=b:65697962
BUG=b:65697620
TEST=Flash hammer and wand, flags make sense.

Change-Id: I3c428c850020a29b3f452504b60b52946a04c503
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/859400
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Nicolas Boichat
2018-01-08 15:04:39 +08:00
committed by chrome-bot
parent 31e68a035b
commit 5ec8f4f495
2 changed files with 9 additions and 1 deletions

View File

@@ -218,6 +218,9 @@ static void update_dynamic_battery_info(void)
batt_present = 0;
}
if (curr.batt.flags & EC_BATT_FLAG_INVALID_DATA)
tmp |= EC_BATT_FLAG_INVALID_DATA;
if (!(curr.batt.flags & BATT_FLAG_BAD_VOLTAGE))
*memmap_volt = curr.batt.voltage;
@@ -356,6 +359,9 @@ static void update_dynamic_battery_info(void)
batt_present = 0;
}
if (curr.batt.flags & EC_BATT_FLAG_INVALID_DATA)
tmp |= EC_BATT_FLAG_INVALID_DATA;
if (!(curr.batt.flags & BATT_FLAG_BAD_VOLTAGE))
base_battery_dynamic.actual_voltage = curr.batt.voltage;

View File

@@ -163,6 +163,8 @@
#define EC_BATT_FLAG_DISCHARGING 0x04
#define EC_BATT_FLAG_CHARGING 0x08
#define EC_BATT_FLAG_LEVEL_CRITICAL 0x10
/* Set if some of the dynamic data is invalid (or outdated). */
#define EC_BATT_FLAG_INVALID_DATA 0x20
/* Switch flags at EC_MEMMAP_SWITCHES */
#define EC_SWITCH_LID_OPEN 0x01
@@ -4724,7 +4726,7 @@ struct __ec_align2 ec_response_battery_dynamic_info {
int16_t actual_current; /* Battery current (mA); negative=discharging */
int16_t remaining_capacity; /* Remaining capacity (mAh) */
int16_t full_capacity; /* Capacity (mAh, might change occasionally) */
int16_t flags; /* Flags, see BATT_FLAG_* in battery.h */
int16_t flags; /* Flags, see EC_BATT_FLAG_* */
int16_t desired_voltage; /* Charging voltage desired by battery (mV) */
int16_t desired_current; /* Charging current desired by battery (mA) */
};