Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit def88530 authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Gerrit - the friendly Code Review server
Browse files

power: smb1360: Store the initial IRQ status register value



There is a possibility that an IRQ status change may not
registered if the IRQ status value (prev_val) is not updated
while reading the initial state. Make sure that the IRQ
status is updated in the irq handler structure.

CRs-Fixed: 783017
Change-Id: Ifcffb7b31f84f197eb73c7a80fafbada98f93cc0
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent dd85cf2a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2904,6 +2904,9 @@ fail_profile:
	return rc;
}

#define UPDATE_IRQ_STAT(irq_reg, value) \
		handlers[irq_reg - IRQ_A_REG].prev_val = value;

static int determine_initial_status(struct smb1360_chip *chip)
{
	int rc;
@@ -2919,6 +2922,8 @@ static int determine_initial_status(struct smb1360_chip *chip)
		dev_err(chip->dev, "Couldn't read IRQ_B_REG rc = %d\n", rc);
		return rc;
	}
	UPDATE_IRQ_STAT(IRQ_B_REG, reg);

	if (reg & IRQ_B_BATT_TERMINAL_BIT || reg & IRQ_B_BATT_MISSING_BIT)
		chip->batt_present = false;

@@ -2927,6 +2932,8 @@ static int determine_initial_status(struct smb1360_chip *chip)
		dev_err(chip->dev, "Couldn't read IRQ_C_REG rc = %d\n", rc);
		return rc;
	}
	UPDATE_IRQ_STAT(IRQ_C_REG, reg);

	if (reg & IRQ_C_CHG_TERM)
		chip->batt_full = true;

@@ -2935,6 +2942,7 @@ static int determine_initial_status(struct smb1360_chip *chip)
		dev_err(chip->dev, "Couldn't read irq A rc = %d\n", rc);
		return rc;
	}
	UPDATE_IRQ_STAT(IRQ_A_REG, reg);

	if (chip->workaround_flags & WRKRND_HARD_JEITA) {
		schedule_delayed_work(&chip->jeita_work, 0);
@@ -2956,6 +2964,8 @@ static int determine_initial_status(struct smb1360_chip *chip)
		dev_err(chip->dev, "Couldn't read irq E rc = %d\n", rc);
		return rc;
	}
	UPDATE_IRQ_STAT(IRQ_E_REG, reg);

	chip->usb_present = (reg & IRQ_E_USBIN_UV_BIT) ? false : true;
	power_supply_set_present(chip->usb_psy, chip->usb_present);