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

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

power: smb135x-charger: Check if SMB1357 is present before configuring it



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

Change-Id: Id99779bbe6984d9be485c016f8993eff396ae793
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 8d975a2b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1723,6 +1723,13 @@ static int smb135x_parallel_set_chg_present(struct smb135x_chg *chip,
	u8 val;
	int rc;

	/* Check if SMB135x is present */
	rc = smb135x_read(chip, VERSION1_REG, &val);
	if (rc) {
		pr_debug("Failed to detect smb135x-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);