diff options
author | Anand Gadiyar <gadiyar@ti.com> | 2012-09-18 12:29:06 +0530 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 13:01:11 +0200 |
commit | 272dc9e62a7356e45b730ea40f8bd4d236411f87 (patch) | |
tree | acf74398dca05d0ddc46fe7a62a2f696399ee45d | |
parent | 77bfbfa46a3fbc119f6073ca7d42f464def62fea (diff) | |
download | kernel_samsung_tuna-272dc9e62a7356e45b730ea40f8bd4d236411f87.zip kernel_samsung_tuna-272dc9e62a7356e45b730ea40f8bd4d236411f87.tar.gz kernel_samsung_tuna-272dc9e62a7356e45b730ea40f8bd4d236411f87.tar.bz2 |
twl6030 battery: remove ac_next_refresh
We now update capacity estimates using the gas gauge. No need to
schedule voltage-based estimates except when voltage is critically low.
(This reconciliation based on voltages will be done in a later patch).
So remove this code.
Change-Id: I46706c954e32667a84a4e64c9a0831a706755da8
Signed-off-by: Sivakumar Pothireddy <sivakumar.pothireddy@ti.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
-rw-r--r-- | drivers/power/twl6030_bci_battery.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/drivers/power/twl6030_bci_battery.c b/drivers/power/twl6030_bci_battery.c index a92840e..39b04ac 100644 --- a/drivers/power/twl6030_bci_battery.c +++ b/drivers/power/twl6030_bci_battery.c @@ -301,7 +301,6 @@ struct twl6030_bci_device_info { unsigned int capacity; unsigned int capacity_debounce_count; unsigned int boot_capacity_mAh; - unsigned long ac_next_refresh; unsigned int prev_capacity; unsigned int wakelock_enabled; @@ -1661,8 +1660,6 @@ static int capacity_lookup(int volt) static int capacity_changed(struct twl6030_bci_device_info *di) { int curr_capacity = di->capacity; - int charger_source = di->charger_source; - int charging_disabled = 0; s32 acc_value, samples = 0; int accumulated_charge; int ret; @@ -1675,60 +1672,6 @@ static int capacity_changed(struct twl6030_bci_device_info *di) * we dont update capacity if we are charging. */ - /* if it has been more than 10 minutes since our last update - * and we are charging we force a update. - */ - - if (time_after(jiffies, di->ac_next_refresh) - && (di->charger_source != POWER_SUPPLY_TYPE_BATTERY)) { - - charging_disabled = 1; - di->ac_next_refresh = jiffies + - msecs_to_jiffies(CHARGING_CAPACITY_UPDATE_PERIOD); - di->capacity = -1; - - /* We have to disable charging to read correct - * voltages. - */ - twl6030_stop_charger(di); - /*voltage setteling time*/ - msleep(200); - - di->voltage_mV = twl6030_get_gpadc_conversion(di, - di->gpadc_vbat_chnl); - } - - /* Setting the capacity level only makes sense when on - * the battery is powering the board. - */ - if ((di->charge_status == POWER_SUPPLY_STATUS_DISCHARGING) || - (di->charge_status == POWER_SUPPLY_STATUS_NOT_CHARGING)) { - - if (di->voltage_mV < 3500) - curr_capacity = 5; - else if (di->voltage_mV < 3600 && di->voltage_mV >= 3500) - curr_capacity = 20; - else if (di->voltage_mV < 3700 && di->voltage_mV >= 3600) - curr_capacity = 50; - else if (di->voltage_mV < 3800 && di->voltage_mV >= 3700) - curr_capacity = 75; - else if (di->voltage_mV < 3900 && di->voltage_mV >= 3800) - curr_capacity = 90; - else if (di->voltage_mV >= 3900) - curr_capacity = 100; - } - - /* if we disabled charging to check capacity, - * enable it again after we read the - * correct voltage. - */ - if (charging_disabled) { - if (charger_source == POWER_SUPPLY_TYPE_MAINS) - twl6030_start_ac_charger(di); - else if (charger_source == POWER_SUPPLY_TYPE_USB) - twl6030_start_usb_charger(di); - } - /* FG_REG_01, 02, 03 is 24 bit unsigned sample counter value */ ret = twl_i2c_read(TWL6030_MODULE_GASGAUGE, (u8 *) &samples, FG_REG_01, 3); @@ -1776,13 +1719,6 @@ static int capacity_changed(struct twl6030_bci_device_info *di) if (!is_battery_present(di)) curr_capacity = 100; - /* Debouncing of voltage change. */ - if (di->capacity == -1) { - di->capacity = curr_capacity; - di->capacity_debounce_count = 0; - return 1; - } - if (curr_capacity != di->prev_capacity) { di->prev_capacity = curr_capacity; di->capacity_debounce_count = 0; @@ -2749,7 +2685,6 @@ static int __devinit twl6030_bci_battery_probe(struct platform_device *pdev) di->vac_priority = 2; di->capacity = -1; di->capacity_debounce_count = 0; - di->ac_next_refresh = jiffies - 1; platform_set_drvdata(pdev, di); /* calculate current max scale from sense */ |