aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorSivakumar Pothireddy <sivakumar.pothireddy@ti.com>2012-04-30 19:36:02 +0530
committerZiyann <jaraidaniel@gmail.com>2014-10-01 13:01:10 +0200
commit8b4d08b021b9e1027b3595365a99bc773538521a (patch)
tree12f064b0c1e991c11cc368f2b72d8aa5cd0b0c98 /drivers/power
parent5e4869ccf5ce8f41b9e30b194480837938e93de9 (diff)
downloadkernel_samsung_tuna-8b4d08b021b9e1027b3595365a99bc773538521a.zip
kernel_samsung_tuna-8b4d08b021b9e1027b3595365a99bc773538521a.tar.gz
kernel_samsung_tuna-8b4d08b021b9e1027b3595365a99bc773538521a.tar.bz2
twl6030 battery: add lookup table for initial capacity estimation
Add a lookup table for estimating battery capacity at bootup using the battery voltage measrued at that time. The table was constructed using actual measured values for Blaze Tablets. The values don't correspond to the arbitrary values currently used in the driver. This table is something that a board file should pass to the driver. This will be introduced in a later patch - for now, we keep the values in the driver just like the current design. Change-Id: I78b35b68c7a41b67d67925dae8015405efb44b0d Signed-off-by: Sivakumar Pothireddy <sivakumar.pothireddy@ti.com> Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/twl6030_bci_battery.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/power/twl6030_bci_battery.c b/drivers/power/twl6030_bci_battery.c
index 29c4fd1..7106ed2 100644
--- a/drivers/power/twl6030_bci_battery.c
+++ b/drivers/power/twl6030_bci_battery.c
@@ -328,6 +328,22 @@ struct twl6030_bci_device_info {
unsigned int min_vbus_val;
};
+/* Battery capacity estimation table */
+struct batt_capacity_chart {
+ int volt;
+ unsigned int cap;
+};
+
+static struct batt_capacity_chart volt_cap_table[] = {
+ { .volt = 3345, .cap = 7 },
+ { .volt = 3450, .cap = 15 },
+ { .volt = 3500, .cap = 30 },
+ { .volt = 3600, .cap = 50 },
+ { .volt = 3650, .cap = 70 },
+ { .volt = 3780, .cap = 85 },
+ { .volt = 3850, .cap = 95 },
+};
+
static BLOCKING_NOTIFIER_HEAD(notifier_list);
extern u32 wakeup_timer_seconds;
@@ -1616,6 +1632,19 @@ static int twl6030_usb_autogate_charger(struct twl6030_bci_device_info *di)
return ret;
}
+static int capacity_lookup(int volt)
+{
+ int i, table_size;
+ table_size = ARRAY_SIZE(volt_cap_table);
+
+ for (i = 1; i < table_size; i++) {
+ if (volt < volt_cap_table[i].volt)
+ break;
+ }
+
+ return volt_cap_table[i-1].cap;
+}
+
static int capacity_changed(struct twl6030_bci_device_info *di)
{
int curr_capacity = di->capacity;