]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
power: lc709203f:move soc scaling to work thread
authorVenkat Reddy Talla <vreddytalla@nvidia.com>
Wed, 5 Feb 2014 07:22:02 +0000 (12:52 +0530)
committerLaxman Dewangan <ldewangan@nvidia.com>
Thu, 6 Feb 2014 12:54:44 +0000 (04:54 -0800)
Based on battery soc value battery health
and other battery information passed to framework layer,
to sync with battery information such as health and capacity
level moving get_scaled_soc api to work thread.

Change-Id: I9aad0a7ade95973773629da84855c89d4acc170d
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-on: http://git-master/r/363680
(cherry picked from commit 45c06515b2eff991c5e91df8e863ccb2f0a672a6)
Reviewed-on: http://git-master/r/364208
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
drivers/power/lc709203f_battery.c

index 66baf14decb0c272667ca28c747406e1a0a35cb2..234dd0ec04f253c45b7bcbcd6f52a34bdd3ea674 100644 (file)
@@ -143,7 +143,9 @@ static void lc709203f_work(struct work_struct *work)
        if (val < 0)
                dev_err(&chip->client->dev, "%s: err %d\n", __func__, val);
        else
-               chip->soc = val;
+               chip->soc = battery_gauge_get_scaled_soc(chip->bg_dev,
+                       val * 100, chip->pdata->threshold_soc);
+
        if (chip->soc >= LC709203F_BATTERY_FULL && chip->charge_complete != 1)
                chip->soc = LC709203F_BATTERY_FULL-1;
 
@@ -209,7 +211,6 @@ static int lc709203f_get_property(struct power_supply *psy,
        struct lc709203f_chip *chip = container_of(psy,
                                struct lc709203f_chip, battery);
        int temperature;
-       int soc;
 
        switch (psp) {
        case POWER_SUPPLY_PROP_TECHNOLOGY:
@@ -222,16 +223,14 @@ static int lc709203f_get_property(struct power_supply *psy,
                val->intval = chip->vcell;
                break;
        case POWER_SUPPLY_PROP_CAPACITY:
-               soc = battery_gauge_get_scaled_soc(chip->bg_dev,
-                               chip->soc * 100, chip->pdata->threshold_soc);
-               val->intval = soc;
-               if (soc == 15)
+               val->intval = chip->soc;
+               if (chip->soc == 15)
                        dev_warn(&chip->client->dev,
                        "\nSystem Running low on battery - 15 percent\n");
-               if (soc == 10)
+               if (chip->soc == 10)
                        dev_warn(&chip->client->dev,
                        "\nSystem Running low on battery - 10 percent\n");
-               if (soc == 5)
+               if (chip->soc == 5)
                        dev_warn(&chip->client->dev,
                        "\nSystem Running low on battery - 5 percent\n");
                break;