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

Commit 3f00b5f3 authored by Zhenhua Huang's avatar Zhenhua Huang
Browse files

power: smb1360: Fix issue for property CHARGING_ENABLED reporting



Bit0 of register 0x4B stands for whether it is in charging status,
not enabling status. Fix this by using a variable to indicate.

Change-Id: I5b9bfdb86ea141fef019f6ed1689ab251732c3a9
Signed-off-by: default avatarZhenhua Huang <zhenhuah@codeaurora.org>
parent d6415d1a
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -897,20 +897,6 @@ static int smb1360_get_prop_batt_status(struct smb1360_chip *chip)
		return POWER_SUPPLY_STATUS_CHARGING;
}

static int smb1360_get_prop_charging_status(struct smb1360_chip *chip)
{
	int rc;
	u8 reg = 0;

	rc = smb1360_read(chip, STATUS_3_REG, &reg);
	if (rc) {
		pr_err("Couldn't read STATUS_3_REG rc=%d\n", rc);
		return 0;
	}

	return (reg & CHG_EN_BIT) ? 1 : 0;
}

static int smb1360_get_prop_charge_type(struct smb1360_chip *chip)
{
	int rc;
@@ -1403,7 +1389,7 @@ static int smb1360_battery_get_property(struct power_supply *psy,
		val->intval = smb1360_get_prop_batt_status(chip);
		break;
	case POWER_SUPPLY_PROP_CHARGING_ENABLED:
		val->intval = smb1360_get_prop_charging_status(chip);
		val->intval = !chip->charging_disabled_status;
		break;
	case POWER_SUPPLY_PROP_CHARGE_TYPE:
		val->intval = smb1360_get_prop_charge_type(chip);