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

Commit 37b2c18b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-charger: make the battery capacity writeable"

parents 582ff179 ef9bf4d1
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -340,6 +340,7 @@ struct qpnp_chg_chip {
	unsigned int			cold_batt_p;
	int				warm_bat_decidegc;
	int				cool_bat_decidegc;
	int				fake_battery_soc;
	unsigned int			safe_current;
	unsigned int			revision;
	unsigned int			type;
@@ -1692,6 +1693,7 @@ qpnp_batt_property_is_writeable(struct power_supply *psy,
	case POWER_SUPPLY_PROP_VOLTAGE_MIN:
	case POWER_SUPPLY_PROP_COOL_TEMP:
	case POWER_SUPPLY_PROP_WARM_TEMP:
	case POWER_SUPPLY_PROP_CAPACITY:
		return 1;
	default:
		break;
@@ -2047,6 +2049,9 @@ get_prop_capacity(struct qpnp_chg_chip *chip)
	union power_supply_propval ret = {0,};
	int battery_status, bms_status, soc, charger_in;

	if (chip->fake_battery_soc >= 0)
		return chip->fake_battery_soc;

	if (chip->use_default_batt_values || !get_prop_batt_present(chip))
		return DEFAULT_CAPACITY;

@@ -3537,6 +3542,10 @@ qpnp_batt_power_set_property(struct power_supply *psy,
	case POWER_SUPPLY_PROP_WARM_TEMP:
		rc = qpnp_chg_configure_jeita(chip, psp, val->intval);
		break;
	case POWER_SUPPLY_PROP_CAPACITY:
		chip->fake_battery_soc = val->intval;
		power_supply_changed(&chip->batt_psy);
		break;
	case POWER_SUPPLY_PROP_CHARGING_ENABLED:
		chip->charging_disabled = !(val->intval);
		if (chip->charging_disabled) {
@@ -4375,6 +4384,7 @@ qpnp_charger_probe(struct spmi_device *spmi)
	}

	chip->prev_usb_max_ma = -EINVAL;
	chip->fake_battery_soc = -EINVAL;
	chip->dev = &(spmi->dev);
	chip->spmi = spmi;