diff options
author | Todd Poynor <toddpoynor@google.com> | 2012-07-27 11:27:33 -0700 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2013-04-29 14:42:59 -0700 |
commit | 7dff24ab2b3b0d4fae890afa36aef3716106ab77 (patch) | |
tree | f3489b4e82b8f82482714f346c78bf3faa0f1770 /include | |
parent | 65704314f05cf5a738428f145d2ac33a21f9b6d9 (diff) |
power: android battery: add generic android battery driver
Add a generic battery power supply and glue logic for talking to the
board battery driver. This driver handles common chores such as:
* periodic battery level and health monitoring
* kernel log reporting and other debugging features for key
properties provided by different charger, fuel gauge, etc.
components
* ensure properties such as battery health are made available to
userspace
* common processing for board-level battery/case temperature sensors
and policy for charging status based on battery health
Based on work by himihee.seo@samsung.com, ms925.kim@samsung.com, and
joshua.chang@samsung.com.
Change-Id: I5fa8e8d68811d84820b7a130b0245ad2b5b6d36b
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/platform_data/android_battery.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/platform_data/android_battery.h b/include/linux/platform_data/android_battery.h new file mode 100644 index 00000000000..a0749f5b9d3 --- /dev/null +++ b/include/linux/platform_data/android_battery.h @@ -0,0 +1,42 @@ +/* + * android_battery.h + * + * Copyright (C) 2012 Samsung Electronics + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef _LINUX_ANDROID_BATTERY_H +#define _LINUX_ANDROID_BATTERY_H + +enum { + CHARGE_SOURCE_NONE = 0, + CHARGE_SOURCE_AC, + CHARGE_SOURCE_USB, +}; + +struct android_bat_callbacks { + void (*charge_source_changed) + (struct android_bat_callbacks *, int); +}; + +struct android_bat_platform_data { + void (*register_callbacks)(struct android_bat_callbacks *); + void (*unregister_callbacks)(void); + void (*set_charging_current) (int); + void (*set_charging_enable) (int); + int (*poll_charge_source) (void); + int (*get_capacity) (void); + int (*get_temperature) (int *); + int (*get_voltage_now)(void); + int (*get_current_now)(int *); + + int temp_high_threshold; + int temp_high_recovery; + int temp_low_recovery; + int temp_low_threshold; +}; + +#endif |