diff options
Diffstat (limited to 'drivers/power/bq27x00_battery.c')
| -rw-r--r-- | drivers/power/bq27x00_battery.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c index e0ab81f4cc3..144e36bf07d 100644 --- a/drivers/power/bq27x00_battery.c +++ b/drivers/power/bq27x00_battery.c @@ -438,6 +438,8 @@ module_param(poll_interval, uint, 0644); MODULE_PARM_DESC(poll_interval, "battery poll interval in seconds - " \ "0 disables polling"); +static volatile int mA_now; + /* * Forward Declarations */ @@ -978,7 +980,7 @@ static void bq27x00_update(struct bq27x00_device_info *di) cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, !is_bq27500); - printk ("Cache flags read from bq is 0x%x\n", cache.flags); + olio_debug ("Cache flags read from bq is 0x%x\n", cache.flags); if (cache.flags >= 0) { if (is_bq27200 && (cache.flags & BQ27200_FLAG_CI)) { @@ -1195,11 +1197,13 @@ static int bq27x00_battery_current(struct bq27x00_device_info *di, #ifdef CONFIG_OLIO_TS81001 -static int bq27x00_charger_status(struct bq27x00_device_info *di) { +static int bq27x00_charger_status(struct bq27x00_device_info *di, + union power_supply_propval *val) { struct device * bq = di->dev; struct bq27x00_platform_data * pdata = bq->platform_data; struct ts81001 * ts81001; ts81001_state_t state; + int curr; olio_debug("entered\n"); @@ -1212,12 +1216,22 @@ static int bq27x00_charger_status(struct bq27x00_device_info *di) { olio_debug("Got client data for dev %s\n", dev_name(ts81001->dev)); +#if 0 + /* Test 1 */ if(di->cache.flags & BQ27XXX_FLAG_FC) { ts81001->ops->request_charge(ts81001, 100); } else { ts81001->ops->request_charge(ts81001, 390); } + /* Test 2 */ + printk ("OLIO %s mA_now == %d \n", __FUNCTION__, mA_now); + + if (mA_now < 0) { + ts81001->ops->request_charge(ts81001, 100); + } +#endif + state = ts81001->ops->get_status(ts81001); olio_debug("Got status\n"); @@ -1257,7 +1271,7 @@ static int bq27x00_battery_status(struct bq27x00_device_info *di, status = POWER_SUPPLY_STATUS_DISCHARGING; } else { #ifdef CONFIG_OLIO_TS81001 - status = bq27x00_charger_status (di); + status = bq27x00_charger_status (di, val); if(status == POWER_SUPPLY_STATUS_CHARGING && di->cache.flags & BQ27XXX_FLAG_FC) { @@ -1371,6 +1385,7 @@ static int bq27x00_battery_get_property(struct power_supply *psy, break; case POWER_SUPPLY_PROP_CURRENT_NOW: ret = bq27x00_battery_current(di, val); + mA_now = val->intval; break; case POWER_SUPPLY_PROP_CAPACITY: ret = bq27x00_simple_value(di->cache.capacity, val); |