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

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

Merge "power: core: add set_voltage_limit API"

parents 8680ddf4 5df7b70a
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -52,6 +52,28 @@ static bool __power_supply_is_supplied_by(struct power_supply *supplier,
	return false;
}

/**
 * power_supply_set_voltage_limit - set current limit
 * @psy:	the power supply to control
 * @limit:	current limit in uV from the power supply.
 *		0 will disable the power supply.
 *
 * This function will set a maximum supply current from a source
 * and it will disable the charger when limit is 0.
 */
int power_supply_set_voltage_limit(struct power_supply *psy, int limit)
{
	const union power_supply_propval ret = {limit,};

	if (psy->set_property)
		return psy->set_property(psy, POWER_SUPPLY_PROP_VOLTAGE_MAX,
								&ret);

	return -ENXIO;
}
EXPORT_SYMBOL(power_supply_set_voltage_limit);


/**
 * power_supply_set_current_limit - set current limit
 * @psy:	the power supply to control
+4 −0
Original line number Diff line number Diff line
@@ -261,6 +261,7 @@ extern void power_supply_changed(struct power_supply *psy);
extern int power_supply_am_i_supplied(struct power_supply *psy);
extern int power_supply_set_battery_charged(struct power_supply *psy);
extern int power_supply_set_current_limit(struct power_supply *psy, int limit);
extern int power_supply_set_voltage_limit(struct power_supply *psy, int limit);
extern int power_supply_set_online(struct power_supply *psy, bool enable);
extern int power_supply_set_health_state(struct power_supply *psy, int health);
extern int power_supply_set_present(struct power_supply *psy, bool enable);
@@ -281,6 +282,9 @@ static inline int power_supply_am_i_supplied(struct power_supply *psy)
							{ return -ENOSYS; }
static inline int power_supply_set_battery_charged(struct power_supply *psy)
							{ return -ENOSYS; }
static inline int power_supply_set_voltage_limit(struct power_supply *psy,
							int limit)
							{ return -ENOSYS; }
static inline int power_supply_set_current_limit(struct power_supply *psy,
							int limit)
							{ return -ENOSYS; }