power: ds2781: Reduce wakeups from suspend
authorGreg Meiste <w30289@motorola.com>
Fri, 15 Oct 2010 19:22:00 +0000 (14:22 -0500)
committerRebecca Schultz Zavin <rebecca@android.com>
Tue, 19 Oct 2010 17:46:28 +0000 (10:46 -0700)
Increase SLOW_POLL to 20 minutes to improve current drain.  However,
if temperature is over TEMP_HOT, remain at fast poll rate.

Change-Id: I9361a98b1a57f415cacf05008444e47adca13dc8
Signed-off-by: Greg Meiste <w30289@motorola.com>
drivers/power/ds2781_battery.c

index 3b2408c8e02ac0c34d4f43aa350d797d6adaaaa2..985159ca9125b81f9669dd09655ec1fd6e9a0398 100644 (file)
@@ -70,7 +70,7 @@ struct battery_status {
  * power, sample every SLOW_POLL seconds
  */
 #define FAST_POLL      (1 * 60)
-#define SLOW_POLL      (10 * 60)
+#define SLOW_POLL      (20 * 60)
 
 static DEFINE_MUTEX(battery_log_lock);
 static struct battery_status battery_log[BATTERY_LOG_MAX];
@@ -444,7 +444,8 @@ static int ds2781_suspend(struct device *dev)
        struct ds2781_device_info *di = dev_get_drvdata(dev);
 
        /* If on battery, reduce update rate until next resume. */
-       if (!di->status.charge_source) {
+       if ((!di->status.charge_source) &&
+           (di->status.temp_C < TEMP_HOT)) {
                ds2781_program_alarm(di, SLOW_POLL);
                di->slow_poll = 1;
        }