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

Commit 4e7ed9c6 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb5-lib: Report smb_health based on CP status"

parents cc6d7674 a5147abf
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3873,6 +3873,7 @@ int smblib_get_prop_smb_health(struct smb_charger *chg)
	int rc;
	u8 stat;
	int input_present;
	union power_supply_propval prop = {0, };

	rc = smblib_is_input_present(chg, &input_present);
	if (rc < 0)
@@ -3881,6 +3882,17 @@ int smblib_get_prop_smb_health(struct smb_charger *chg)
	if (input_present == INPUT_NOT_PRESENT)
		return POWER_SUPPLY_HEALTH_UNKNOWN;

	/*
	 * SMB health is used only for CP, report UNKNOWN if
	 * switcher is not enabled.
	 */
	if (is_cp_available(chg)) {
		rc = power_supply_get_property(chg->cp_psy,
			POWER_SUPPLY_PROP_CP_SWITCHER_EN, &prop);
		if (!rc && !prop.intval)
			return POWER_SUPPLY_HEALTH_UNKNOWN;
	}

	if (chg->wa_flags & SW_THERM_REGULATION_WA) {
		if (chg->smb_temp == -ENODATA)
			return POWER_SUPPLY_HEALTH_UNKNOWN;