diff options
author | Graeme Gregory <gg@slimlogic.co.uk> | 2011-12-07 10:48:06 +0200 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 13:00:16 +0200 |
commit | b30d43bf55b3b563c9f1401d383706a6ea654ee9 (patch) | |
tree | d9f9b24e6129a6dd97265561546b720ef7474698 | |
parent | b96371d7d9c226303de8cbea3b83e03d8b4383a3 (diff) | |
download | kernel_samsung_tuna-b30d43bf55b3b563c9f1401d383706a6ea654ee9.zip kernel_samsung_tuna-b30d43bf55b3b563c9f1401d383706a6ea654ee9.tar.gz kernel_samsung_tuna-b30d43bf55b3b563c9f1401d383706a6ea654ee9.tar.bz2 |
POWER: TWL6030_BCI: Watchdog timer handling
This patch added handling for charger watchdog during
battery charging process.
Change-Id: Ica69bbf56159501ac14b341b42e39ba066271a81
Signed-off-by: Volodymyr Riazantsev <v.riazantsev@ti.com>
-rw-r--r-- | drivers/power/twl6030_bci_battery.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/power/twl6030_bci_battery.c b/drivers/power/twl6030_bci_battery.c index 7ed93d9..db94cde 100644 --- a/drivers/power/twl6030_bci_battery.c +++ b/drivers/power/twl6030_bci_battery.c @@ -1083,6 +1083,15 @@ static int capacity_changed(struct twl6030_bci_device_info *di) } +static int twl6030_set_watchdog(struct twl6030_bci_device_info *di, int val) +{ + di->watchdog_duration = val; + + dev_dbg(di->dev, "Watchdog reset %d", val); + + return twl_i2c_write_u8(TWL6030_MODULE_CHARGER, val, CONTROLLER_WDG); + +} static void twl6030_bci_battery_work(struct work_struct *work) { @@ -1095,6 +1104,10 @@ static void twl6030_bci_battery_work(struct work_struct *work) req.channels = (1 << 1) | (1 << 7) | (1 << 8); req.method = TWL6030_GPADC_SW2; + /* Kick the charger watchdog */ + if (di->charge_status == POWER_SUPPLY_STATUS_CHARGING) + twl6030_set_watchdog(di, di->watchdog_duration); + req.active = 0; req.func_cb = NULL; ret = twl6030_gpadc_conversion(&req); @@ -1444,8 +1457,7 @@ static ssize_t set_watchdog(struct device *dev, if ((strict_strtol(buf, 10, &val) < 0) || (val < 1) || (val > 127)) return -EINVAL; - di->watchdog_duration = val; - ret = twl_i2c_write_u8(TWL6030_MODULE_CHARGER, val, CONTROLLER_WDG); + ret = twl6030_set_watchdog(di, val); if (ret) return -EIO; @@ -2028,8 +2040,10 @@ static int __devinit twl6030_bci_battery_probe(struct platform_device *pdev) di->stat1 = controller_stat; di->charger_outcurrentmA = di->platform_data->max_charger_currentmA; - di->watchdog_duration = 32; di->voltage_mV = twl6030_get_gpadc_conversion(7); + + twl6030_set_watchdog(di, 32); + dev_info(&pdev->dev, "Battery Voltage at Bootup is %d mV\n", di->voltage_mV); |