This patch adds support for Charge Full by Design attribute to battery power 
supply class.
Now energy full is calculated based on charge full by design instead of charge 
full attribute.

Signed-off-by: Ramakrishna Pallala <[email protected]>
---
 drivers/power/intel_mdf_battery.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/power/intel_mdf_battery.c 
b/drivers/power/intel_mdf_battery.c
index 5ad78c2..0d23ae0 100644
--- a/drivers/power/intel_mdf_battery.c
+++ b/drivers/power/intel_mdf_battery.c
@@ -392,6 +392,7 @@ struct msic_batt_props {
        unsigned int vol_max_des;
        unsigned int vol_now;
        unsigned int cur_now;
+       unsigned int charge_full_des;   /* in mAh */
        unsigned int charge_full;       /* in mAh */
        unsigned int charge_now;        /* in mAh */
        unsigned int charge_ctr;        /* Coloumb counter raw value */
@@ -512,6 +513,7 @@ static enum power_supply_property msic_battery_props[] = {
        POWER_SUPPLY_PROP_CURRENT_NOW,
        POWER_SUPPLY_PROP_CHARGE_NOW,
        POWER_SUPPLY_PROP_CHARGE_COUNTER,
+       POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
        POWER_SUPPLY_PROP_CHARGE_FULL,
        POWER_SUPPLY_PROP_CHARGE_AVG,
        POWER_SUPPLY_PROP_ENERGY_FULL,
@@ -1154,6 +1156,9 @@ static int msic_battery_get_property(struct power_supply 
*psy,
                mbi->batt_props.charge_ctr = msic_read_coloumb_ctr();
                val->intval =  mbi->batt_props.charge_ctr;
                break;
+       case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
+               val->intval = mbi->batt_props.charge_full_des * 1000;
+               break;
        case POWER_SUPPLY_PROP_CHARGE_FULL:
                val->intval = mbi->batt_props.charge_full * 1000;
                break;
@@ -2276,6 +2281,7 @@ static void init_batt_props(struct msic_power_module_info 
*mbi)
        mbi->batt_props.vol_max_des =  sfi_table->voltage_max;
        mbi->batt_props.vol_now = 0x0;
        mbi->batt_props.cur_now = 0x0;
+       mbi->batt_props.charge_full_des = CHARGE_FULL_IN_MAH;
        mbi->batt_props.charge_full = CHARGE_FULL_IN_MAH;
        mbi->batt_props.charge_now = 0x0;
        mbi->batt_props.charge_ctr = 0x0;
@@ -2286,7 +2292,7 @@ static void init_batt_props(struct msic_power_module_info 
*mbi)
 
        mbi->batt_props.energy_now = 0x0;
        mbi->batt_props.energy_full = (mbi->batt_props.vol_max_des *
-                                       mbi->batt_props.charge_full) / 1000;
+                                       mbi->batt_props.charge_full_des) / 1000;
 
        memcpy(mbi->batt_props.vender, sfi_table->batt_id.manufac,
                                sizeof(sfi_table->batt_id.manufac));
-- 
1.7.2.3

Attachment: 0001-Chareg-Full-Design-attribute.patch
Description: 0001-Chareg-Full-Design-attribute.patch

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to