From 59a2773e7158e9e787a80a51aa19783f8088e5f3 Mon Sep 17 00:00:00 2001 From: Arun Murthy Date: Wed, 22 Jun 2011 14:58:53 +0530 Subject: power: ab5500-btemp: do not measure temp if battery is unknown Since the battery is unknown, do not measure the battery temp it might provide some value maybe too high or low leading to system reboot ST-Ericsson Linux next: Not Tested ST-Ericsson ID: WP332221 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I70b4cc959bfd2792a25379cc17a25dada4b1c051 Signed-off-by: Arun Murthy Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/25661 Reviewed-by: Srinidhi KASAGAR --- drivers/power/ab5500_btemp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/power/ab5500_btemp.c b/drivers/power/ab5500_btemp.c index 8b6ff82a86b..04ad6bbb7ac 100644 --- a/drivers/power/ab5500_btemp.c +++ b/drivers/power/ab5500_btemp.c @@ -536,7 +536,15 @@ static int ab5500_btemp_get_property(struct power_supply *psy, val->intval = di->bat->bat_type[di->bat->batt_id].name; break; case POWER_SUPPLY_PROP_TEMP: - val->intval = di->bat_temp * 10; + if (di->bat->batt_id == BATTERY_UNKNOWN) + /* + * In case the battery is not identified, its assumed that + * we are using the power supply and since no monitoring is + * done for the same, a nominal temp is hardocded. + */ + val->intval = 250; + else + val->intval = di->bat_temp * 10; break; default: return -EINVAL; -- cgit v1.2.3