From 201efb2bb0f7c4ae5f08f51b6f6b7cdfdba5b4f4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 5 Jul 2021 16:32:49 -0600 Subject: cros_ec: Allow reading the battery-charge state Add a function to read this information from the EC. It is useful for determining whether the battery has enough charge to boot. Signed-off-by: Simon Glass --- include/cros_ec.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/cros_ec.h') diff --git a/include/cros_ec.h b/include/cros_ec.h index 9396b4d2466..9dab6cdf9ba 100644 --- a/include/cros_ec.h +++ b/include/cros_ec.h @@ -652,4 +652,12 @@ int cros_ec_vstore_read(struct udevice *dev, int slot, uint8_t *data); int cros_ec_vstore_write(struct udevice *dev, int slot, const uint8_t *data, size_t size); +/** + * cros_ec_read_batt_charge() - Read the battery-charge state + * + * @dev: CROS-EC device + * @chargep: Return battery-charge state as a percentage + */ +int cros_ec_read_batt_charge(struct udevice *dev, uint *chargep); + #endif -- cgit v1.2.3