summaryrefslogtreecommitdiff
path: root/drivers/power/bq27x00_battery.c
diff options
context:
space:
mode:
authormattis fjallstrom <mattis@acm.org>2015-12-22 09:08:51 -0800
committermattis fjallstrom <mattis@acm.org>2015-12-22 09:11:17 -0800
commitd5e9b490da6d4444025a9315a89ad6d8ec70f50b (patch)
tree27defa50c232d02ad0aa7cc1ef3d6dfb86744bef /drivers/power/bq27x00_battery.c
parentf3fe6c93fcb0efee43eb00bba5112696806b65c3 (diff)
downloadolio-linux-3.10-d5e9b490da6d4444025a9315a89ad6d8ec70f50b.tar.xz
olio-linux-3.10-d5e9b490da6d4444025a9315a89ad6d8ec70f50b.zip
Adding current parameter to request_current, currently requesting 100mA when battery is full and 390 otherwise. Also bugfixes and clean-up.
Change-Id: Id4c3c6008ea12bfdcdd1145d32ff9d8ef7784d66
Diffstat (limited to 'drivers/power/bq27x00_battery.c')
-rw-r--r--drivers/power/bq27x00_battery.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index ed6846f6133..e0ab81f4cc3 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -50,9 +50,9 @@
#include "../staging/triune/ts81001.h"
#endif /* CONFIG_OLIO_TS81001 */
-
#ifdef OLIODEBUG
-#define do { olio_debug(format, ...) printk("OLIO %s: ", __FUNCTION__); \
+#define olio_debug(format, ...) do { \
+ printk("OLIO %s: ", __FUNCTION__); \
printk(format, ##__VA_ARGS__); } while(0)
#else
#define olio_debug(format, ...)
@@ -974,9 +974,11 @@ static void bq27x00_update(struct bq27x00_device_info *di)
bool is_bq274xx = di->chip == BQ274XX;
bool is_bq276xx = di->chip == BQ276XX;
+ olio_debug ("entered\n");
+
cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, !is_bq27500);
- printk ("%s OLIO Cache flags read from bq is 0x%x\n", __FUNCTION__, cache.flags);
+ printk ("Cache flags read from bq is 0x%x\n", cache.flags);
if (cache.flags >= 0) {
if (is_bq27200 && (cache.flags & BQ27200_FLAG_CI)) {
@@ -1210,13 +1212,11 @@ static int bq27x00_charger_status(struct bq27x00_device_info *di) {
olio_debug("Got client data for dev %s\n", dev_name(ts81001->dev));
-#ifdef CHG_FLAGS_WORKING
- if(di->cache.flags & BQ27XXX_FLAG_CHG) {
-#endif
- ts81001->ops->request_charge(ts81001);
-#ifdef CHG_FLAGS_WORKING
+ if(di->cache.flags & BQ27XXX_FLAG_FC) {
+ ts81001->ops->request_charge(ts81001, 100);
+ } else {
+ ts81001->ops->request_charge(ts81001, 390);
}
-#endif
state = ts81001->ops->get_status(ts81001);
@@ -1509,6 +1509,7 @@ static int __init bq27x00_powersupply_init(struct bq27x00_device_info *di)
}
ret = enable_irq_wake(di->irq);
+
if (ret) {
dev_err(di->dev, "failed to enable irq: %d, as wake\n", di->irq);
return ret;