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

Commit 5c505e8d 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-smbcharger: expose CURRENT_MAX prop via batt psy"

parents fe907777 c809c4f1
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -5940,6 +5940,24 @@ static int smbchg_get_prop_batt_charge_counter(struct smbchg_chip *chip)
	return val.intval;
}

static int smbchg_get_prop_batt_current_max(struct smbchg_chip *chip)
{
	int rc;
	union power_supply_propval val;

	if (!chip->usb_psy)
		return -EINVAL;

	rc = power_supply_get_property(chip->usb_psy,
				POWER_SUPPLY_PROP_CURRENT_MAX, &val);
	if (rc < 0) {
		pr_smb(PR_STATUS, "Couldn't get current max rc = %d\n", rc);
		return rc;
	}

	return val.intval;
}

static void update_typec_capability_status(struct smbchg_chip *chip,
					const union power_supply_propval *val)
{
@@ -6118,6 +6136,7 @@ static enum power_supply_property smbchg_battery_properties[] = {
	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
	POWER_SUPPLY_PROP_VOLTAGE_MAX,
	POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
	POWER_SUPPLY_PROP_CURRENT_MAX,
	POWER_SUPPLY_PROP_CURRENT_NOW,
	POWER_SUPPLY_PROP_TEMP,
	POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -6283,6 +6302,9 @@ static int smbchg_battery_get_property(struct power_supply *psy,
	case POWER_SUPPLY_PROP_VOLTAGE_MAX:
		val->intval = smbchg_float_voltage_get(chip);
		break;
	case POWER_SUPPLY_PROP_CURRENT_MAX:
		val->intval = smbchg_get_prop_batt_current_max(chip);
		break;
	case POWER_SUPPLY_PROP_HEALTH:
		val->intval = get_prop_batt_health(chip);
		break;