diff options
author | Anand Gadiyar <gadiyar@ti.com> | 2012-09-09 12:55:01 +0530 |
---|---|---|
committer | Dmytro Kedrovskyi <x0169235@ti.com> | 2012-09-21 18:01:19 +0300 |
commit | e9eaf4534f0be7dfeb4972707eb9ee01ba1631e3 (patch) | |
tree | 0aa69ccd2d3386193d13ca1a970c5117279eb3a6 /drivers/power | |
parent | 935e0ceda7e1e6873c9adba645cdbe5bc42496a0 (diff) | |
download | kernel_samsung_espresso10-e9eaf4534f0be7dfeb4972707eb9ee01ba1631e3.zip kernel_samsung_espresso10-e9eaf4534f0be7dfeb4972707eb9ee01ba1631e3.tar.gz kernel_samsung_espresso10-e9eaf4534f0be7dfeb4972707eb9ee01ba1631e3.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>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/twl6030_bci_battery.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/power/twl6030_bci_battery.c b/drivers/power/twl6030_bci_battery.c index 0b5130a..29636d1 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", @@ -2866,7 +2864,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; |