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

Commit db1755be authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar
Browse files

qpnp-smb2: fix FV and FCC reporting



Currently the read of battery's voltage_max property (FV) and battery's
current_max property (FCC) returns the value of DEFAULT_VOTER voter.

But such a voter doesn't exist on battery's voltage_max property. Fix it
by returning the value voted by BATT_PROFILE_VOTER.

Change-Id: I2dac98f2ce9a423d5045788dbe120591f10c5a9e
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent b186b398
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1046,7 +1046,8 @@ static int smb2_batt_get_prop(struct power_supply *psy,
		rc = smblib_get_prop_batt_voltage_now(chg, val);
		break;
	case POWER_SUPPLY_PROP_VOLTAGE_MAX:
		val->intval = get_client_vote(chg->fv_votable, DEFAULT_VOTER);
		val->intval = get_client_vote(chg->fv_votable,
				BATT_PROFILE_VOTER);
		break;
	case POWER_SUPPLY_PROP_CHARGE_QNOVO_ENABLE:
		rc = smblib_get_prop_charge_qnovo_enable(chg, val);
@@ -1064,7 +1065,7 @@ static int smb2_batt_get_prop(struct power_supply *psy,
		break;
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
		val->intval = get_client_vote(chg->fcc_votable,
					      DEFAULT_VOTER);
					      BATT_PROFILE_VOTER);
		break;
	case POWER_SUPPLY_PROP_TEMP:
		rc = smblib_get_prop_batt_temp(chg, val);
+5 −3
Original line number Diff line number Diff line
@@ -1642,6 +1642,7 @@ int smblib_get_prop_batt_health(struct smb_charger *chg,
{
	union power_supply_propval pval;
	int rc;
	int effective_fv_uv;
	u8 stat;

	rc = smblib_read(chg, BATTERY_CHARGER_STATUS_2_REG, &stat);
@@ -1660,10 +1661,11 @@ int smblib_get_prop_batt_health(struct smb_charger *chg,
			 * If Vbatt is within 40mV above Vfloat, then don't
			 * treat it as overvoltage.
			 */
			if (pval.intval >=
				get_effective_result(chg->fv_votable) + 40000) {
			effective_fv_uv = get_effective_result(chg->fv_votable);
			if (pval.intval >= effective_fv_uv + 40000) {
				val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
				smblib_err(chg, "battery over-voltage\n");
				smblib_err(chg, "battery over-voltage vbat_fg = %duV, fv = %duV\n",
						pval.intval, effective_fv_uv);
				goto done;
			}
		}