12 #include <linux/module.h>
13 #include <linux/device.h>
18 #define PSY_PROP(psy, prop, val) (psy->get_property(psy, \
19 POWER_SUPPLY_PROP_##prop, val))
21 #define _MPSY_PROP(prop, val) (main_battery->get_property(main_battery, \
24 #define MPSY_PROP(prop, val) _MPSY_PROP(POWER_SUPPLY_PROP_##prop, val)
45 static int __find_main_battery(
struct device *
dev,
void *
data)
51 if (bp->
bat->use_for_apm) {
73 static void find_main_battery(
void)
80 bp.
main = main_battery;
85 main_battery = bp.
main;
114 main_battery = bp.
bat;
189 return ((
cur.intval -
full.intval) * 60L) /
I.intval;
191 return -((
cur.intval -
empty.intval) * 60L) /
I.intval;
194 static int calculate_time(
int status)
213 static int calculate_capacity(
enum apm_source source)
270 ret = ((
cur.intval -
empty.intval) * 100L) /
342 if (!
MPSY_PROP(TIME_TO_FULL_AVG, &time_to_full) ||
343 !
MPSY_PROP(TIME_TO_FULL_NOW, &time_to_full))
344 info->
time = time_to_full.intval / 60;
346 info->
time = calculate_time(status.intval);
348 if (!
MPSY_PROP(TIME_TO_EMPTY_AVG, &time_to_empty) ||
349 !
MPSY_PROP(TIME_TO_EMPTY_NOW, &time_to_empty))
350 info->
time = time_to_empty.intval / 60;
352 info->
time = calculate_time(status.intval);
358 static int __init apm_battery_init(
void)
366 static void __exit apm_battery_exit(
void)