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 <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-07-05 16:32:49 -06:00
parent ecc1ed912e
commit 201efb2bb0
2 changed files with 25 additions and 0 deletions

View File

@@ -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