12 #include <linux/kernel.h>
13 #include <linux/module.h>
51 static struct tosa_bat tosa_bat_main;
52 static struct tosa_bat tosa_bat_jacket;
54 static unsigned long tosa_read_bat(
struct tosa_bat *bat)
56 unsigned long value = 0;
74 static unsigned long tosa_read_temp(
struct tosa_bat *bat)
76 unsigned long value = 0;
114 val->
intval = tosa_read_bat(bat);
129 val->
intval = tosa_read_temp(bat);
141 static bool tosa_jacket_bat_is_present(
struct tosa_bat *bat)
146 static void tosa_bat_external_power_changed(
struct power_supply *psy)
158 static void tosa_bat_update(
struct tosa_bat *bat)
201 tosa_bat_update(&tosa_bat_main);
202 tosa_bat_update(&tosa_bat_jacket);
225 static struct tosa_bat tosa_bat_main = {
229 .name =
"main-battery",
231 .properties = tosa_bat_main_props,
232 .num_properties =
ARRAY_SIZE(tosa_bat_main_props),
233 .get_property = tosa_bat_get_property,
234 .external_power_changed = tosa_bat_external_power_changed,
245 .adc_bat_divider = 414,
247 .bat_min = 1551 * 1000000 / 414,
251 .adc_temp_divider = 10000,
254 static struct tosa_bat tosa_bat_jacket = {
258 .name =
"jacket-battery",
260 .properties = tosa_bat_main_props,
261 .num_properties =
ARRAY_SIZE(tosa_bat_main_props),
262 .get_property = tosa_bat_get_property,
263 .external_power_changed = tosa_bat_external_power_changed,
266 .is_present = tosa_jacket_bat_is_present,
274 .adc_bat_divider = 414,
276 .bat_min = 1551 * 1000000 / 414,
280 .adc_temp_divider = 10000,
283 static struct tosa_bat tosa_bat_bu = {
288 .name =
"backup-battery",
290 .properties = tosa_bat_bu_props,
291 .num_properties =
ARRAY_SIZE(tosa_bat_bu_props),
292 .get_property = tosa_bat_get_property,
293 .external_power_changed = tosa_bat_external_power_changed,
297 .gpio_charge_off = -1,
303 .adc_bat_divider = 1266,
307 .adc_temp_divider = -1,
310 static struct gpio tosa_bat_gpios[] = {
341 #define tosa_bat_suspend NULL
342 #define tosa_bat_resume NULL
349 if (!machine_is_tosa())
363 goto err_psy_reg_main;
366 goto err_psy_reg_jacket;
374 "main full", &tosa_bat_main);
381 "jacket full", &tosa_bat_jacket);
388 "jacket detect", &tosa_bat_jacket);
433 .driver.name =
"wm97xx-battery",
435 .probe = tosa_bat_probe,