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

Commit 8d975a2b authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Abhijeet Dharmapurikar
Browse files

power: smb1351-charger: Check if SMB1351 is present before configuring it



While configuring SMB1351 for parallel operation do a dummy read of
the SMB1351 version register to check if it is present.

Change-Id: Ib5f5646a40f8f595238ffb8f79a2b27b468cfc8d
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 7540c129
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1351,6 +1351,13 @@ static int smb1351_parallel_set_chg_present(struct smb1351_charger *chip,
	int rc;
	u8 reg;

	/* Check if SMB1351 is present */
	rc = smb1351_read_reg(chip, CHG_REVISION_REG, &reg);
	if (rc) {
		pr_debug("Failed to detect smb1351-parallel-charger, may be absent\n");
		return -ENODEV;
	}

	if (present == chip->parallel_charger_present) {
		pr_debug("present %d -> %d, skipping\n",
				chip->parallel_charger_present, present);