Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

power_supply: Add new power supply properties CHARGE_CURRENT/VOLTAGE_MAX

There are different types of chargers avalibale like AC, Solar, USB,
etc.. Even in USB we have different types SDP/DCP/CDP/ACA and all these
chargers have different o/p ratings. For example SDP supports only 500mA
of charge current whereas AC charger can support upto 8A or more.

Similarly batteries also come with charge current and voltage ratings
and these ratings vary depending on its capacity and the technology
used.

This patch adds two new power supply properties
CONSTANT_CHARGE_CURRENT_MAX and CONSTANT_CHARGE_CURRENT_MAX.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>

authored by

Ramakrishna Pallala and committed by
Anton Vorontsov
2815b786 c6b2744c

+10
+4
Documentation/power/power_supply_class.txt
··· 116 116 relative, time-based measurements. 117 117 118 118 CONSTANT_CHARGE_CURRENT - constant charge current programmed by charger. 119 + CONSTANT_CHARGE_CURRENT_MAX - maximum charge current supported by the 120 + power supply object. 119 121 120 122 CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger. 123 + CONSTANT_CHARGE_VOLTAGE_MAX - maximum charge voltage supported by the 124 + power supply object. 121 125 122 126 ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. 123 127
+2
drivers/power/power_supply_sysfs.c
··· 161 161 POWER_SUPPLY_ATTR(charge_avg), 162 162 POWER_SUPPLY_ATTR(charge_counter), 163 163 POWER_SUPPLY_ATTR(constant_charge_current), 164 + POWER_SUPPLY_ATTR(constant_charge_current_max), 164 165 POWER_SUPPLY_ATTR(constant_charge_voltage), 166 + POWER_SUPPLY_ATTR(constant_charge_voltage_max), 165 167 POWER_SUPPLY_ATTR(energy_full_design), 166 168 POWER_SUPPLY_ATTR(energy_empty_design), 167 169 POWER_SUPPLY_ATTR(energy_full),
+4
include/linux/power_supply.h
··· 111 111 POWER_SUPPLY_PROP_CHARGE_AVG, 112 112 POWER_SUPPLY_PROP_CHARGE_COUNTER, 113 113 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT, 114 + POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, 114 115 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, 116 + POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, 115 117 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 116 118 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, 117 119 POWER_SUPPLY_PROP_ENERGY_FULL, ··· 251 249 case POWER_SUPPLY_PROP_CHARGE_AVG: 252 250 case POWER_SUPPLY_PROP_CHARGE_COUNTER: 253 251 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: 252 + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: 254 253 case POWER_SUPPLY_PROP_CURRENT_MAX: 255 254 case POWER_SUPPLY_PROP_CURRENT_NOW: 256 255 case POWER_SUPPLY_PROP_CURRENT_AVG: ··· 280 277 case POWER_SUPPLY_PROP_VOLTAGE_AVG: 281 278 case POWER_SUPPLY_PROP_VOLTAGE_OCV: 282 279 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 280 + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX: 283 281 case POWER_SUPPLY_PROP_POWER_NOW: 284 282 return 1; 285 283 default: