power: supply: core: add capacity error margin property
authorSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 13 May 2020 18:55:58 +0000 (20:55 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 28 May 2020 17:25:31 +0000 (19:25 +0200)
Add a property for reporting the error margin expected
by fuel gauge chips.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Documentation/ABI/testing/sysfs-class-power
drivers/power/supply/power_supply_sysfs.c
include/linux/power_supply.h

index bf3b48f..2f89655 100644 (file)
@@ -74,6 +74,21 @@ Description:
                Access: Read, Write
                Valid values: 0 - 100 (percent)
 
+What:          /sys/class/power_supply/<supply_name>/capacity_error_margin
+Date:          April 2019
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Battery capacity measurement becomes unreliable without
+               recalibration. This values provides the maximum error
+               margin expected to exist by the fuel gauge in percent.
+               Values close to 0% will be returned after (re-)calibration
+               has happened. Over time the error margin will increase.
+               100% means, that the capacity related values are basically
+               completely useless.
+
+               Access: Read
+               Valid values: 0 - 100 (percent)
+
 What:          /sys/class/power_supply/<supply_name>/capacity_level
 Date:          June 2009
 Contact:       linux-pm@vger.kernel.org
index d21b4e0..e664774 100644 (file)
@@ -178,6 +178,7 @@ static struct power_supply_attr power_supply_attrs[] = {
        POWER_SUPPLY_ATTR(CAPACITY),
        POWER_SUPPLY_ATTR(CAPACITY_ALERT_MIN),
        POWER_SUPPLY_ATTR(CAPACITY_ALERT_MAX),
+       POWER_SUPPLY_ATTR(CAPACITY_ERROR_MARGIN),
        POWER_SUPPLY_ENUM_ATTR(CAPACITY_LEVEL),
        POWER_SUPPLY_ATTR(TEMP),
        POWER_SUPPLY_ATTR(TEMP_MAX),
index 1f60731..453a85f 100644 (file)
@@ -139,6 +139,7 @@ enum power_supply_property {
        POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
        POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN, /* in percents! */
        POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */
+       POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN, /* in percents! */
        POWER_SUPPLY_PROP_CAPACITY_LEVEL,
        POWER_SUPPLY_PROP_TEMP,
        POWER_SUPPLY_PROP_TEMP_MAX,