Loading drivers/power/power_supply_core.c +22 −0 Original line number Diff line number Diff line Loading @@ -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 Loading include/linux/power_supply.h +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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; } Loading Loading
drivers/power/power_supply_core.c +22 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
include/linux/power_supply.h +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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; } Loading