11 #include <linux/module.h>
15 #include <linux/adb.h>
16 #include <linux/pmu.h>
17 #include <linux/slab.h>
19 static struct pmu_battery_dev {
26 #define to_pmu_battery_dev(x) container_of(x, struct pmu_battery_dev, bat)
55 .properties = pmu_ac_props,
57 .get_property = pmu_get_ac_prop,
64 static char *pmu_batt_types[] = {
65 "Smart",
"Comet",
"Hooper",
"Unknown"
72 return pmu_batt_types[0];
74 return pmu_batt_types[1];
76 return pmu_batt_types[2];
79 return pmu_batt_types[3];
82 static int pmu_bat_get_property(
struct power_supply *psy,
102 val->
strval = pmu_bat_get_model_name(pbi);
143 static int __init pmu_bat_init(
void)
148 bat_pdev = platform_device_register_simple(
"pmu-battery",
150 if (IS_ERR(bat_pdev)) {
151 ret = PTR_ERR(bat_pdev);
152 goto pdev_register_failed;
157 goto ac_register_failed;
160 struct pmu_battery_dev *pbat = kzalloc(
sizeof(*pbat),
165 sprintf(pbat->name,
"PMU_battery_%d", i);
166 pbat->bat.name = pbat->name;
167 pbat->bat.properties = pmu_bat_props;
168 pbat->bat.num_properties =
ARRAY_SIZE(pmu_bat_props);
169 pbat->bat.get_property = pmu_bat_get_property;
175 goto battery_register_failed;
182 battery_register_failed:
192 pdev_register_failed:
197 static void __exit pmu_bat_exit(
void)