17 #include <linux/kernel.h>
18 #include <linux/module.h>
26 #include <linux/slab.h>
33 static unsigned long wm97xx_read_bat(
struct power_supply *bat_ps)
43 static unsigned long wm97xx_read_temp(
struct power_supply *bat_ps)
53 static int wm97xx_bat_get_property(
struct power_supply *bat_ps,
69 val->
intval = wm97xx_read_bat(bat_ps);
75 val->
intval = wm97xx_read_temp(bat_ps);
100 static void wm97xx_bat_external_power_changed(
struct power_supply *bat_ps)
105 static void wm97xx_bat_update(
struct power_supply *bat_ps)
107 int old_status = bat_status;
119 if (old_status != bat_status) {
130 .get_property = wm97xx_bat_get_property,
131 .external_power_changed = wm97xx_bat_external_power_changed,
137 wm97xx_bat_update(&bat_ps);
147 static int wm97xx_bat_suspend(
struct device *
dev)
153 static int wm97xx_bat_resume(
struct device *
dev)
159 static const struct dev_pm_ops wm97xx_bat_pm_ops = {
161 .resume = wm97xx_bat_resume,
174 dev_err(&dev->
dev,
"No platform data supplied\n");
184 dev_err(&dev->
dev,
"No platform_data supplied\n");
214 prop = kzalloc(props *
sizeof(*prop),
GFP_KERNEL);
237 dev_info(&dev->
dev,
"Please consider setting proper battery "
238 "name in platform definition file, falling "
239 "back to name \"wm97xx-batt\"\n");
240 bat_ps.
name =
"wm97xx-batt";
283 .name =
"wm97xx-battery",
286 .pm = &wm97xx_bat_pm_ops,
289 .probe = wm97xx_bat_probe,