max17048: update temp change promptly
Hyongbin Kim [Mon, 14 Oct 2013 05:48:55 +0000 (14:48 +0900)]
When battery temperature is changed over 1.5C or over hot/cold threshold,
update power supply for sending event to framwork.

Bug 1386890

Change-Id: I72ecda41b339a07a467ca31950643fb45b21b7d9
Signed-off-by: Hyongbin Kim <hyongbink@nvidia.com>
Reviewed-on: http://git-master/r/298845
(cherry picked from commit 1aa792d601dcc436e05d8d10033b714ee129a474)
Reviewed-on: http://git-master/r/301644
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>

drivers/power/max17048_battery.c

index b76a998..9eb9b9a 100644 (file)
@@ -452,6 +452,7 @@ static void max17048_work(struct work_struct *work)
                                __func__, chip->temperature / 1000);
                chip->lasttime_temperature = chip->temperature;
                max17048_update_rcomp(chip, chip->temperature);
+               power_supply_changed(&chip->battery);
        }
 
        max17048_get_vcell(chip->client);
@@ -463,10 +464,12 @@ static void max17048_work(struct work_struct *work)
                chip->health = POWER_SUPPLY_HEALTH_OVERHEAT;
                dev_info(&chip->client->dev, "%s: BATTERY HOT, Temp %ldC\n",
                                __func__, chip->temperature / 1000);
+               power_supply_changed(&chip->battery);
        } else if (chip->temperature < MAX17048_BATTERY_COLD) {
                dev_info(&chip->client->dev, "%s: BATTERY COLD, Temp %ldC\n",
                                __func__, chip->temperature / 1000);
                chip->health = POWER_SUPPLY_HEALTH_COLD;
+               power_supply_changed(&chip->battery);
        }
 
        if (chip->soc != chip->lasttime_soc ||