summaryrefslogtreecommitdiff
path: root/src/ec/google/chromeec/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ec/google/chromeec/ec.c')
-rw-r--r--src/ec/google/chromeec/ec.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index 088f2fe553..2ef2ea90d5 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -1566,3 +1566,19 @@ bool google_chromeec_is_battery_present_and_above_critical_threshold(void)
return false;
}
+
+bool google_chromeec_is_battery_present(void)
+{
+ struct ec_params_battery_dynamic_info params = {
+ .index = 0,
+ };
+ struct ec_response_battery_dynamic_info resp;
+
+ if (ec_cmd_battery_get_dynamic(PLAT_EC, &params, &resp) == 0) {
+ /* Check if battery is present */
+ if (resp.flags & EC_BATT_FLAG_BATT_PRESENT)
+ return true;
+ }
+
+ return false;
+}