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

Commit d97b2bf7 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar Committed by Subbaraman Narayanamurthy
Browse files

qpnp-smb2: Ignore status 7 register while qnovo is enabled



status7 register will indicate all the charger bits are cleared during
the rest or discharge phase of a Qnovo pulse. Moreover those bits remain
cleared after a pulse train is done and before a new pulse train is
issued.

Hence when Qnovo is active ignore status 7 register bits.

Change-Id: Ice61f8a49625081ffbf1aacaac844b929715e818
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent c11edf4e
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -1570,8 +1570,8 @@ int smblib_get_prop_batt_status(struct smb_charger *chg,
				union power_supply_propval *val)
{
	union power_supply_propval pval = {0, };
	bool usb_online, dc_online;
	u8 stat;
	bool usb_online, dc_online, qnovo_en;
	u8 stat, pt_en_cmd;
	int rc;

	rc = smblib_get_prop_usb_online(chg, &pval);
@@ -1643,7 +1643,18 @@ int smblib_get_prop_batt_status(struct smb_charger *chg,

	stat &= ENABLE_TRICKLE_BIT | ENABLE_PRE_CHARGING_BIT |
		 ENABLE_FAST_CHARGING_BIT | ENABLE_FULLON_MODE_BIT;
	if (!stat)

	rc = smblib_read(chg, QNOVO_PT_ENABLE_CMD_REG, &pt_en_cmd);
	if (rc < 0) {
		smblib_err(chg, "Couldn't read QNOVO_PT_ENABLE_CMD_REG rc=%d\n",
				rc);
		return rc;
	}

	qnovo_en = (bool)(pt_en_cmd & QNOVO_PT_ENABLE_CMD_BIT);

	/* ignore stat7 when qnovo is enabled */
	if (!qnovo_en && !stat)
		val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;

	return 0;