Lines Matching +full:energy +full:- +full:empty

15 #include <linux/apm-emulation.h>
49 bp->bat = dev_get_drvdata(dev); in __find_main_battery()
51 if (bp->bat->desc->use_for_apm) { in __find_main_battery()
53 bp->main = bp->bat; in __find_main_battery()
57 if (!PSY_PROP(bp->bat, CHARGE_FULL_DESIGN, &bp->full) || in __find_main_battery()
58 !PSY_PROP(bp->bat, CHARGE_FULL, &bp->full)) { in __find_main_battery()
59 if (bp->full.intval > bp->max_charge) { in __find_main_battery()
60 bp->max_charge_bat = bp->bat; in __find_main_battery()
61 bp->max_charge = bp->full.intval; in __find_main_battery()
63 } else if (!PSY_PROP(bp->bat, ENERGY_FULL_DESIGN, &bp->full) || in __find_main_battery()
64 !PSY_PROP(bp->bat, ENERGY_FULL, &bp->full)) { in __find_main_battery()
65 if (bp->full.intval > bp->max_energy) { in __find_main_battery()
66 bp->max_energy_bat = bp->bat; in __find_main_battery()
67 bp->max_energy = bp->full.intval; in __find_main_battery()
121 union power_supply_propval empty; in do_calculate_time() local
134 return -1; in do_calculate_time()
167 return -1; in do_calculate_time()
173 return -1; in do_calculate_time()
176 if (_MPSY_PROP(empty_prop, &empty)) { in do_calculate_time()
178 if (_MPSY_PROP(empty_design_prop, &empty)) in do_calculate_time()
179 empty.intval = 0; in do_calculate_time()
185 return -1; in do_calculate_time()
189 return ((cur.intval - full.intval) * 60L) / I.intval; in do_calculate_time()
191 return -((cur.intval - empty.intval) * 60L) / I.intval; in do_calculate_time()
199 if (time != -1) in calculate_time()
203 if (time != -1) in calculate_time()
207 if (time != -1) in calculate_time()
210 return -1; in calculate_time()
218 union power_supply_propval empty, full, cur; in calculate_capacity() local
248 return -1; in calculate_capacity()
254 return -1; in calculate_capacity()
260 return -1; in calculate_capacity()
263 if (_MPSY_PROP(empty_prop, &empty)) { in calculate_capacity()
265 if (_MPSY_PROP(empty_design_prop, &empty)) in calculate_capacity()
266 empty.intval = 0; in calculate_capacity()
269 if (full.intval - empty.intval) in calculate_capacity()
270 ret = ((cur.intval - empty.intval) * 100L) / in calculate_capacity()
271 (full.intval - empty.intval); in calculate_capacity()
273 return -1; in calculate_capacity()
305 info->ac_line_status = APM_AC_ONLINE; in apm_battery_apm_get_power_status()
307 info->ac_line_status = APM_AC_OFFLINE; in apm_battery_apm_get_power_status()
312 info->battery_life = capacity.intval; in apm_battery_apm_get_power_status()
314 /* try calculate using energy */ in apm_battery_apm_get_power_status()
315 info->battery_life = calculate_capacity(SOURCE_ENERGY); in apm_battery_apm_get_power_status()
317 if (info->battery_life == -1) in apm_battery_apm_get_power_status()
318 info->battery_life = calculate_capacity(SOURCE_CHARGE); in apm_battery_apm_get_power_status()
319 if (info->battery_life == -1) in apm_battery_apm_get_power_status()
320 info->battery_life = calculate_capacity(SOURCE_VOLTAGE); in apm_battery_apm_get_power_status()
326 info->battery_status = APM_BATTERY_STATUS_CHARGING; in apm_battery_apm_get_power_status()
328 if (info->battery_life > 50) in apm_battery_apm_get_power_status()
329 info->battery_status = APM_BATTERY_STATUS_HIGH; in apm_battery_apm_get_power_status()
330 else if (info->battery_life > 5) in apm_battery_apm_get_power_status()
331 info->battery_status = APM_BATTERY_STATUS_LOW; in apm_battery_apm_get_power_status()
333 info->battery_status = APM_BATTERY_STATUS_CRITICAL; in apm_battery_apm_get_power_status()
335 info->battery_flag = info->battery_status; in apm_battery_apm_get_power_status()
339 info->units = APM_UNITS_MINS; in apm_battery_apm_get_power_status()
344 info->time = time_to_full.intval / 60; in apm_battery_apm_get_power_status()
346 info->time = calculate_time(status.intval); in apm_battery_apm_get_power_status()
350 info->time = time_to_empty.intval / 60; in apm_battery_apm_get_power_status()
352 info->time = calculate_time(status.intval); in apm_battery_apm_get_power_status()