diff options
author | Anand Gadiyar <gadiyar@ti.com> | 2012-09-09 12:55:01 +0530 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 13:01:11 +0200 |
commit | e4fb4c5366e051e5f596b93f9709bc004dd3ecf5 (patch) | |
tree | 823eed115365c46493d20f61de25dcac0165b185 | |
parent | 272dc9e62a7356e45b730ea40f8bd4d236411f87 (diff) | |
download | kernel_samsung_tuna-e4fb4c5366e051e5f596b93f9709bc004dd3ecf5.zip kernel_samsung_tuna-e4fb4c5366e051e5f596b93f9709bc004dd3ecf5.tar.gz kernel_samsung_tuna-e4fb4c5366e051e5f596b93f9709bc004dd3ecf5.tar.bz2 |
twl6030 battery: pass nominal capacity from board file
Pass the nominal battery capacity from the board file instead of
hardcoding it in the driver.
TODO: This needs to be done for the blaze as well, although it's
rarely run off the battery
Change-Id: I15cba65f062c70f3b1e26f3c03db59e3af0d6ea9
Signed-off-by: Sivakumar Pothireddy <sivakumar.pothireddy@ti.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Conflicts:
arch/arm/mach-omap2/board-44xx-power.c
-rw-r--r-- | drivers/power/twl6030_bci_battery.c | 11 | ||||
-rw-r--r-- | include/linux/i2c/twl.h | 1 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/power/twl6030_bci_battery.c b/drivers/power/twl6030_bci_battery.c index 39b04ac..10f2c40 100644 --- a/drivers/power/twl6030_bci_battery.c +++ b/drivers/power/twl6030_bci_battery.c @@ -300,6 +300,7 @@ struct twl6030_bci_device_info { unsigned int capacity; unsigned int capacity_debounce_count; + unsigned int max_battery_capacity; unsigned int boot_capacity_mAh; unsigned int prev_capacity; unsigned int wakelock_enabled; @@ -328,9 +329,6 @@ struct twl6030_bci_device_info { unsigned int min_vbus_val; }; -/* FIXME: Make this a platform data passed down from the board file */ -#define BATT_CAPACITY_MAH 4000 - /* Battery capacity estimation table */ struct batt_capacity_chart { int volt; @@ -1700,8 +1698,8 @@ static int capacity_changed(struct twl6030_bci_device_info *di) accumulated_charge = ((acc_value - (di->cc_offset * samples)) * 5 / 6) >> 14; - curr_capacity = (di->boot_capacity_mAh + accumulated_charge) - / (BATT_CAPACITY_MAH / 100); + curr_capacity = (di->boot_capacity_mAh + accumulated_charge) / + (di->max_battery_capacity / 100); dev_dbg(di->dev, "voltage %d\n", di->voltage_mV); dev_dbg(di->dev, "initial capacity %d mAh, accumulated %d mAh, total %d mAh\n", @@ -2859,7 +2857,8 @@ static int __devinit twl6030_bci_battery_probe(struct platform_device *pdev) di->voltage_mV); di->capacity = capacity_lookup(di->voltage_mV); - di->boot_capacity_mAh = di->capacity * (BATT_CAPACITY_MAH / 100); + di->max_battery_capacity = pdata->max_battery_capacity; + di->boot_capacity_mAh = di->max_battery_capacity * di->capacity / 100; ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, &hw_state, STS_HW_CONDITIONS); if (ret) goto bk_batt_failed; diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index b3802c2..a24cbae 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -636,6 +636,7 @@ struct twl4030_bci_platform_data { unsigned int max_charger_currentmA; unsigned int max_charger_voltagemV; unsigned int termination_currentmA; + unsigned int max_battery_capacity; unsigned int max_bat_voltagemV; unsigned int low_bat_voltagemV; |