power: supply: core: Add one field to present the battery internal resistance
authorBaolin Wang <baolin.wang@linaro.org>
Mon, 5 Nov 2018 07:39:07 +0000 (15:39 +0800)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Fri, 9 Nov 2018 21:55:46 +0000 (22:55 +0100)
Add one field for 'struct power_supply_battery_info' to present the battery
factory internal resistance.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/power_supply_core.c
include/linux/power_supply.h

index e853618..307e099 100644 (file)
@@ -579,6 +579,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
        info->charge_term_current_ua         = -EINVAL;
        info->constant_charge_current_max_ua = -EINVAL;
        info->constant_charge_voltage_max_uv = -EINVAL;
+       info->factory_internal_resistance_uohm  = -EINVAL;
 
        if (!psy->of_node) {
                dev_warn(&psy->dev, "%s currently only supports devicetree\n",
@@ -616,6 +617,8 @@ int power_supply_get_battery_info(struct power_supply *psy,
                             &info->constant_charge_current_max_ua);
        of_property_read_u32(battery_np, "constant_charge_voltage_max_microvolt",
                             &info->constant_charge_voltage_max_uv);
+       of_property_read_u32(battery_np, "factory-internal-resistance-micro-ohms",
+                            &info->factory_internal_resistance_uohm);
 
        return 0;
 }
index f807691..d089566 100644 (file)
@@ -326,6 +326,7 @@ struct power_supply_battery_info {
        int charge_term_current_ua;         /* microAmps */
        int constant_charge_current_max_ua; /* microAmps */
        int constant_charge_voltage_max_uv; /* microVolts */
+       int factory_internal_resistance_uohm;   /* microOhms */
 };
 
 extern struct atomic_notifier_head power_supply_notifier;