Add some debugging messages for unresponsive batteries

BUG=none
BRANCH=none
TEST=none

Change-Id: Id56c2b180c670115819dd29c85ecc3d0e96bd26f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57812
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Bill Richardson
2013-06-06 10:15:49 -07:00
committed by ChromeBot
parent 124b2f1492
commit c848e32161

View File

@@ -176,6 +176,7 @@ static int state_common(struct power_state_context *ctx)
rv = battery_temperature(&batt->temperature);
if (rv) {
CPRINTF("[%T Can't communicate with battery!]\n");
/* Check low battery condition and retry */
if (curr->ac && ctx->battery_present == 1 &&
!(curr->error & F_CHARGER_MASK)) {
@@ -185,12 +186,16 @@ static int state_common(struct power_state_context *ctx)
* battery pack with minimum current and maximum
* voltage for 30 seconds.
*/
CPRINTF("[%T Trickle charge battery at %dmV, %dmA]\n",
ctx->battery->voltage_max,
ctx->charger->current_min);
charger_set_voltage(ctx->battery->voltage_max);
charger_set_current(ctx->charger->current_min);
for (d = 0; d < 30; d++) {
sleep(1);
rv = battery_temperature(&batt->temperature);
if (rv == 0) {
CPRINTF("[%T Battery is responding]\n");
ctx->battery_present = 1;
break;
}
@@ -198,8 +203,10 @@ static int state_common(struct power_state_context *ctx)
}
/* Set error if battery is still unresponsive */
if (rv)
if (rv) {
CPRINTF("[%T Battery still not responding]\n");
curr->error |= F_BATTERY_TEMPERATURE;
}
} else {
ctx->battery_present = 1;
}