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

Commit 1bd6ff71 authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

power: smb1351: Enable battery-charging by default



Explicitly enable charging via register before configuring
SMB for I2C based charge-enable control. If not done, charging
remains disabled by default.

Change-Id: I02cd3450606b5861ceced3202ca24769e969c8c8
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 2198278e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
/* Copyright (c) 2015 The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -682,7 +682,7 @@ static int smb1351_battchg_disable(struct smb1351_charger *chip,
	rc = smb1351_masked_write(chip, CMD_CHG_REG, CMD_CHG_EN_BIT,
					disabled ? 0 : CMD_CHG_ENABLE);
	if (rc)
		pr_err("Couldn't %s charging rc=%d\n",
		pr_err("Couldn't %s battery-charging rc=%d\n",
					disable ? "disable" : "enable", rc);
	else
		chip->battchg_disabled_status = disabled;
@@ -962,6 +962,11 @@ static int smb1351_hw_init(struct smb1351_charger *chip)
		return rc;
	}

	/* Enable charging before we move into register based CHG_EN control */
	rc = smb1351_battchg_disable(chip, USER, chip->usb_suspended_status);
	if (rc)
		return rc;

	/* setup battery missing source */
	reg = BATT_MISSING_THERM_PIN_SOURCE_BIT;
	mask = BATT_MISSING_THERM_PIN_SOURCE_BIT;