From 2fc978c8b7b8cbd66a578b02a43e365d1ad3746c Mon Sep 17 00:00:00 2001 From: Fenglin Wu Date: Tue, 25 Apr 2017 20:51:06 +0800 Subject: power_supply: Add REAL_TYPE power_supply_property Add REAL_TYPE power_supply property to record the real time charger type. Change-Id: I5fb2e3e3e782bcac0f8dd6071a830bcf370ebbd4 Signed-off-by: Fenglin Wu --- drivers/power/power_supply_sysfs.c | 4 +++- include/linux/power_supply.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index 723b9eaf658a..8d7322a325de 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c @@ -114,7 +114,8 @@ static ssize_t power_supply_show_property(struct device *dev, return sprintf(buf, "%s\n", technology_text[value.intval]); else if (off == POWER_SUPPLY_PROP_CAPACITY_LEVEL) return sprintf(buf, "%s\n", capacity_level_text[value.intval]); - else if (off == POWER_SUPPLY_PROP_TYPE) + else if (off == POWER_SUPPLY_PROP_TYPE || + off == POWER_SUPPLY_PROP_REAL_TYPE) return sprintf(buf, "%s\n", type_text[value.intval]); else if (off == POWER_SUPPLY_PROP_SCOPE) return sprintf(buf, "%s\n", scope_text[value.intval]); @@ -294,6 +295,7 @@ static struct device_attribute power_supply_attrs[] = { POWER_SUPPLY_ATTR(connector_health), POWER_SUPPLY_ATTR(ctm_current_max), POWER_SUPPLY_ATTR(hw_current_max), + POWER_SUPPLY_ATTR(real_type), /* Local extensions of type int64_t */ POWER_SUPPLY_ATTR(charge_counter_ext), /* Properties of type `const char *' */ diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 7488bb993d7a..aa8edf9928eb 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -247,6 +247,7 @@ enum power_supply_property { POWER_SUPPLY_PROP_CONNECTOR_HEALTH, POWER_SUPPLY_PROP_CTM_CURRENT_MAX, POWER_SUPPLY_PROP_HW_CURRENT_MAX, + POWER_SUPPLY_PROP_REAL_TYPE, /* Local extensions of type int64_t */ POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT, /* Properties of type `const char *' */ -- cgit v1.2.3