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

Commit 7ec2dd7a authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar
Browse files

power: qpnp-smbcharger: clear weak charger flag in src_det irq handler



We often see that a newly inserted charger is declared weak charger
because that status is incorrectly carried forward from the previous
charger insertion. This is especially true when usbin_uv interrupt
is triggered before or simultaneously along with src_detect interrupt.
The usbin_uv interrupt sees that the charger is present and it ends
up marking the charger as weak.

Fix this by ensuring the weak charger status is cleared upon a rising
src_detect interrupt too. The driver currently clears it only for the
falling edge case.

CRs-Fixed: 876999
Change-Id: I5d25571e653aa95dece5eca00de74b7d3b829e2e
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent da9777c8
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -5313,14 +5313,14 @@ static irqreturn_t src_detect_handler(int irq, void *_chip)
	 * instead of the USBIN_UV handler since the latter is untrustworthy
	 * when the battery voltage is high.
	 */
	chip->very_weak_charger = false;
	rc = smbchg_primary_usb_en(chip, true, REASON_WEAK_CHARGER, &unused);
	if (rc < 0)
		pr_err("could not enable charger: %d\n", rc);

	if (src_detect) {
		update_usb_status(chip, usb_present, 0);
	} else {
		chip->very_weak_charger = false;
		rc = smbchg_primary_usb_en(chip, true,
				REASON_WEAK_CHARGER, &unused);
		if (rc)
			pr_err("could not enable charger: %d", rc);
		update_usb_status(chip, 0, false);
		chip->aicl_irq_count = 0;
	}