aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c6
-rw-r--r--drivers/power/charger-manager.c38
2 files changed, 22 insertions, 22 deletions
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 60529e0b3d67..cf07e289b4ea 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -256,6 +256,11 @@ static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
256 }, 256 },
257}; 257};
258 258
259static struct platform_device rx51_battery_device = {
260 .name = "rx51-battery",
261 .id = -1,
262};
263
259static void rx51_charger_set_power(bool on) 264static void rx51_charger_set_power(bool on)
260{ 265{
261 gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on); 266 gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on);
@@ -277,6 +282,7 @@ static void __init rx51_charger_init(void)
277 WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO, 282 WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
278 GPIOF_OUT_INIT_HIGH, "isp1704_reset")); 283 GPIOF_OUT_INIT_HIGH, "isp1704_reset"));
279 284
285 platform_device_register(&rx51_battery_device);
280 platform_device_register(&rx51_charger_device); 286 platform_device_register(&rx51_charger_device);
281} 287}
282 288
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index adb3a4b59cb3..6ba047f5ac2c 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -239,44 +239,37 @@ static bool is_full_charged(struct charger_manager *cm)
239 int uV; 239 int uV;
240 240
241 /* If there is no battery, it cannot be charged */ 241 /* If there is no battery, it cannot be charged */
242 if (!is_batt_present(cm)) { 242 if (!is_batt_present(cm))
243 val.intval = 0; 243 return false;
244 goto out;
245 }
246 244
247 if (cm->fuel_gauge && desc->fullbatt_full_capacity > 0) { 245 if (cm->fuel_gauge && desc->fullbatt_full_capacity > 0) {
246 val.intval = 0;
247
248 /* Not full if capacity of fuel gauge isn't full */ 248 /* Not full if capacity of fuel gauge isn't full */
249 ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 249 ret = cm->fuel_gauge->get_property(cm->fuel_gauge,
250 POWER_SUPPLY_PROP_CHARGE_FULL, &val); 250 POWER_SUPPLY_PROP_CHARGE_FULL, &val);
251 if (!ret && val.intval > desc->fullbatt_full_capacity) { 251 if (!ret && val.intval > desc->fullbatt_full_capacity)
252 val.intval = 1; 252 return true;
253 goto out;
254 }
255 } 253 }
256 254
257 /* Full, if it's over the fullbatt voltage */ 255 /* Full, if it's over the fullbatt voltage */
258 if (desc->fullbatt_uV > 0) { 256 if (desc->fullbatt_uV > 0) {
259 ret = get_batt_uV(cm, &uV); 257 ret = get_batt_uV(cm, &uV);
260 if (!ret && uV >= desc->fullbatt_uV) { 258 if (!ret && uV >= desc->fullbatt_uV)
261 val.intval = 1; 259 return true;
262 goto out;
263 }
264 } 260 }
265 261
266 /* Full, if the capacity is more than fullbatt_soc */ 262 /* Full, if the capacity is more than fullbatt_soc */
267 if (cm->fuel_gauge && desc->fullbatt_soc > 0) { 263 if (cm->fuel_gauge && desc->fullbatt_soc > 0) {
264 val.intval = 0;
265
268 ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 266 ret = cm->fuel_gauge->get_property(cm->fuel_gauge,
269 POWER_SUPPLY_PROP_CAPACITY, &val); 267 POWER_SUPPLY_PROP_CAPACITY, &val);
270 if (!ret && val.intval >= desc->fullbatt_soc) { 268 if (!ret && val.intval >= desc->fullbatt_soc)
271 val.intval = 1; 269 return true;
272 goto out;
273 }
274 } 270 }
275 271
276 val.intval = 0; 272 return false;
277
278out:
279 return val.intval ? true : false;
280} 273}
281 274
282/** 275/**
@@ -489,8 +482,9 @@ static void fullbatt_vchk(struct work_struct *work)
489 return; 482 return;
490 } 483 }
491 484
492 diff = desc->fullbatt_uV; 485 diff = desc->fullbatt_uV - batt_uV;
493 diff -= batt_uV; 486 if (diff < 0)
487 return;
494 488
495 dev_info(cm->dev, "VBATT dropped %duV after full-batt.\n", diff); 489 dev_info(cm->dev, "VBATT dropped %duV after full-batt.\n", diff);
496 490