power: pm8921-charger: warn if the battery is hot
If the battery is more than 680 deciDegCelcius (68 degC) print a warning
that the device might be reset.
Change-Id: I350a14c3a5c27ec55b22cf35bc0021ca147d7d0b
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
diff --git a/drivers/power/pm8921-charger.c b/drivers/power/pm8921-charger.c
index fbb7c1a..1e85628 100644
--- a/drivers/power/pm8921-charger.c
+++ b/drivers/power/pm8921-charger.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1066,6 +1066,7 @@
return batt_state;
}
+#define MAX_TOLERABLE_BATT_TEMP_DDC 680
static int get_prop_batt_temp(struct pm8921_chg_chip *chip)
{
int rc;
@@ -1079,6 +1080,10 @@
}
pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical,
result.measurement);
+ if (result.physical > MAX_TOLERABLE_BATT_TEMP_DDC)
+ pr_err("BATT_TEMP= %d > 68degC, device will be shutdown\n",
+ (int) result.physical);
+
return (int)result.physical;
}