Only do the reset if the percentage is valid. This fixes the scenario
where the reset is incorrectly attempted on power up.
Change-Id: If62de88bf10f363389127328d0f5448821e7beea
Signed-off-by: Greg Meiste <w30289@motorola.com>
Signed-off-by: Dima Zavin <dima@android.com>
static void ds2781_reset_if_necessary(struct ds2781_device_info *di)
{
- if (di->status.percentage < 100) {
+ /* If we have read from the DS2781 and the percentage is not 100%,
+ * the ACR should be reset. */
+ if (di->raw[DS2781_REG_RSNSP] && (di->status.percentage < 100)) {
dev_err(di->dev, "Charge complete before 100 percent.\n");
dev_err(di->dev, "Resetting ACR registers to Full 40 value.\n");