OSDN Git Service

power_supply: add DIE_HEALTH and CONNECTOR_HEALTH properties
authorNicholas Troast <ntroast@codeaurora.org>
Wed, 8 Feb 2017 18:41:06 +0000 (10:41 -0800)
committerAshay Jaiswal <ashayj@codeaurora.org>
Fri, 10 Feb 2017 07:22:13 +0000 (12:52 +0530)
The DIE_HEALTH and CONNECTOR_HEALTH properties are used to show the
output of the thermal regulation TEMP_RANGE.

Change-Id: Ice3f159b7775084bdd0099047d4660a1e5edce98
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
drivers/power/power_supply_sysfs.c
include/linux/power_supply.h

index 55ab617..8f5a859 100644 (file)
@@ -60,7 +60,7 @@ static ssize_t power_supply_show_property(struct device *dev,
                "Unknown", "Good", "Overheat", "Dead", "Over voltage",
                "Unspecified failure", "Cold", "Watchdog timer expire",
                "Safety timer expire",
-               "Warm", "Cool"
+               "Warm", "Cool", "Hot"
        };
        static char *technology_text[] = {
                "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
@@ -122,6 +122,10 @@ static ssize_t power_supply_show_property(struct device *dev,
                return sprintf(buf, "%s\n", typec_text[value.intval]);
        else if (off == POWER_SUPPLY_PROP_TYPEC_POWER_ROLE)
                return sprintf(buf, "%s\n", typec_pr_text[value.intval]);
+       else if (off == POWER_SUPPLY_PROP_DIE_HEALTH)
+               return sprintf(buf, "%s\n", health_text[value.intval]);
+       else if (off == POWER_SUPPLY_PROP_CONNECTOR_HEALTH)
+               return sprintf(buf, "%s\n", health_text[value.intval]);
        else if (off >= POWER_SUPPLY_PROP_MODEL_NAME)
                return sprintf(buf, "%s\n", value.strval);
 
@@ -283,6 +287,8 @@ static struct device_attribute power_supply_attrs[] = {
        POWER_SUPPLY_ATTR(icl_reduction),
        POWER_SUPPLY_ATTR(parallel_mode),
        POWER_SUPPLY_ATTR(connector_therm_zone),
+       POWER_SUPPLY_ATTR(die_health),
+       POWER_SUPPLY_ATTR(connector_health),
        /* Local extensions of type int64_t */
        POWER_SUPPLY_ATTR(charge_counter_ext),
        /* Properties of type `const char *' */
index 64f5c4c..fe529be 100644 (file)
@@ -61,6 +61,7 @@ enum {
        POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
        POWER_SUPPLY_HEALTH_WARM,
        POWER_SUPPLY_HEALTH_COOL,
+       POWER_SUPPLY_HEALTH_HOT,
 };
 
 enum {
@@ -238,6 +239,8 @@ enum power_supply_property {
        POWER_SUPPLY_PROP_ICL_REDUCTION,
        POWER_SUPPLY_PROP_PARALLEL_MODE,
        POWER_SUPPLY_PROP_CONNECTOR_THERM_ZONE,
+       POWER_SUPPLY_PROP_DIE_HEALTH,
+       POWER_SUPPLY_PROP_CONNECTOR_HEALTH,
        /* Local extensions of type int64_t */
        POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT,
        /* Properties of type `const char *' */