aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/power_supply.h
diff options
context:
space:
mode:
authorRhyland Klein <rklein@nvidia.com>2011-01-25 14:10:06 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2011-01-31 08:18:33 -0500
commit51d07566045787b99219d809639c8724506fc78a (patch)
tree7102c9c7d0855a8cbd8c2111ae878dc72847f5c1 /include/linux/power_supply.h
parent1bae4ce27c9c90344f23c65ea6966c50ffeae2f5 (diff)
bq20z75: Add support for charge properties
Adding support for charge properties for gas gauge. Also ensuring that battery mode is correct now for energy as well as charge properties by setting it on the fly. I also added 2 functions to power_supply.h to help identify the units for specific properties more easily by power supplies. Signed-off-by: Rhyland Klein <rklein@nvidia.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'include/linux/power_supply.h')
-rw-r--r--include/linux/power_supply.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 7d7325685c42..e3419fc5541e 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -213,4 +213,48 @@ extern void power_supply_unregister(struct power_supply *psy);
213/* For APM emulation, think legacy userspace. */ 213/* For APM emulation, think legacy userspace. */
214extern struct class *power_supply_class; 214extern struct class *power_supply_class;
215 215
216static inline bool power_supply_is_amp_property(enum power_supply_property psp)
217{
218 switch (psp) {
219 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
220 case POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN:
221 case POWER_SUPPLY_PROP_CHARGE_FULL:
222 case POWER_SUPPLY_PROP_CHARGE_EMPTY:
223 case POWER_SUPPLY_PROP_CHARGE_NOW:
224 case POWER_SUPPLY_PROP_CHARGE_AVG:
225 case POWER_SUPPLY_PROP_CHARGE_COUNTER:
226 case POWER_SUPPLY_PROP_CURRENT_MAX:
227 case POWER_SUPPLY_PROP_CURRENT_NOW:
228 case POWER_SUPPLY_PROP_CURRENT_AVG:
229 return 1;
230 default:
231 break;
232 }
233
234 return 0;
235}
236
237static inline bool power_supply_is_watt_property(enum power_supply_property psp)
238{
239 switch (psp) {
240 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
241 case POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN:
242 case POWER_SUPPLY_PROP_ENERGY_FULL:
243 case POWER_SUPPLY_PROP_ENERGY_EMPTY:
244 case POWER_SUPPLY_PROP_ENERGY_NOW:
245 case POWER_SUPPLY_PROP_ENERGY_AVG:
246 case POWER_SUPPLY_PROP_VOLTAGE_MAX:
247 case POWER_SUPPLY_PROP_VOLTAGE_MIN:
248 case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
249 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
250 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
251 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
252 return 1;
253 default:
254 break;
255 }
256
257 return 0;
258}
259
216#endif /* __LINUX_POWER_SUPPLY_H__ */ 260#endif /* __LINUX_POWER_SUPPLY_H__ */