aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamakrishna Pallala <ramakrishna.pallala@intel.com>2014-08-27 14:14:08 -0400
committerSebastian Reichel <sre@kernel.org>2014-09-06 15:05:04 -0400
commita8adcc9012d8502e06ba7b3f966bad8f2c58edc3 (patch)
treeb48ccc27bb9d4cf11dea461a09ab424e18b7ebfb
parentb1022e247872dc87a6ffd6f9aa6a92e0b67cdf00 (diff)
power_supply: Add boot and calibration attributes
Usually PMIC's come with coulomb counting mechanism which can be used to implement a Fuel Gauginig solution in Software itself. One of key input to these SW Fuel Gauge solutioons is the boot up parameters like boot voltage and boot current. This patch adds the VOLTAGE_BOOT and CURRENT_BOOT power supply attributes to report bootup voltage and current. This patch also adds CALIBRATE power supply attribute which useful is for calibrating the battery/coulomb counter. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-rw-r--r--Documentation/power/power_supply_class.txt6
-rw-r--r--drivers/power/power_supply_sysfs.c3
-rw-r--r--include/linux/power_supply.h5
3 files changed, 14 insertions, 0 deletions
diff --git a/Documentation/power/power_supply_class.txt b/Documentation/power/power_supply_class.txt
index 48cff881cb8a..82dacc06e355 100644
--- a/Documentation/power/power_supply_class.txt
+++ b/Documentation/power/power_supply_class.txt
@@ -101,6 +101,10 @@ VOLTAGE_MAX, VOLTAGE_MIN - same as _DESIGN voltage values except that
101these ones should be used if hardware could only guess (measure and 101these ones should be used if hardware could only guess (measure and
102retain) the thresholds of a given power supply. 102retain) the thresholds of a given power supply.
103 103
104VOLTAGE_BOOT - Reports the voltage measured during boot
105
106CURRENT_BOOT - Reports the current measured during boot
107
104CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when 108CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when
105battery considered full/empty. 109battery considered full/empty.
106 110
@@ -123,6 +127,8 @@ the current drawn from a charging source.
123CHARGE_TERM_CURRENT - Charge termination current used to detect the end of charge 127CHARGE_TERM_CURRENT - Charge termination current used to detect the end of charge
124condition. 128condition.
125 129
130CALIBRATE - battery or coulomb counter calibration status
131
126CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger. 132CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger.
127CONSTANT_CHARGE_VOLTAGE_MAX - maximum charge voltage supported by the 133CONSTANT_CHARGE_VOLTAGE_MAX - maximum charge voltage supported by the
128power supply object. 134power supply object.
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index 750a20275664..7e4726d37211 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -149,9 +149,11 @@ static struct device_attribute power_supply_attrs[] = {
149 POWER_SUPPLY_ATTR(voltage_now), 149 POWER_SUPPLY_ATTR(voltage_now),
150 POWER_SUPPLY_ATTR(voltage_avg), 150 POWER_SUPPLY_ATTR(voltage_avg),
151 POWER_SUPPLY_ATTR(voltage_ocv), 151 POWER_SUPPLY_ATTR(voltage_ocv),
152 POWER_SUPPLY_ATTR(voltage_boot),
152 POWER_SUPPLY_ATTR(current_max), 153 POWER_SUPPLY_ATTR(current_max),
153 POWER_SUPPLY_ATTR(current_now), 154 POWER_SUPPLY_ATTR(current_now),
154 POWER_SUPPLY_ATTR(current_avg), 155 POWER_SUPPLY_ATTR(current_avg),
156 POWER_SUPPLY_ATTR(current_boot),
155 POWER_SUPPLY_ATTR(power_now), 157 POWER_SUPPLY_ATTR(power_now),
156 POWER_SUPPLY_ATTR(power_avg), 158 POWER_SUPPLY_ATTR(power_avg),
157 POWER_SUPPLY_ATTR(charge_full_design), 159 POWER_SUPPLY_ATTR(charge_full_design),
@@ -193,6 +195,7 @@ static struct device_attribute power_supply_attrs[] = {
193 POWER_SUPPLY_ATTR(type), 195 POWER_SUPPLY_ATTR(type),
194 POWER_SUPPLY_ATTR(scope), 196 POWER_SUPPLY_ATTR(scope),
195 POWER_SUPPLY_ATTR(charge_term_current), 197 POWER_SUPPLY_ATTR(charge_term_current),
198 POWER_SUPPLY_ATTR(calibrate),
196 /* Properties of type `const char *' */ 199 /* Properties of type `const char *' */
197 POWER_SUPPLY_ATTR(model_name), 200 POWER_SUPPLY_ATTR(model_name),
198 POWER_SUPPLY_ATTR(manufacturer), 201 POWER_SUPPLY_ATTR(manufacturer),
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f3dea41dbcd2..de59a28b1b5b 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -102,9 +102,11 @@ enum power_supply_property {
102 POWER_SUPPLY_PROP_VOLTAGE_NOW, 102 POWER_SUPPLY_PROP_VOLTAGE_NOW,
103 POWER_SUPPLY_PROP_VOLTAGE_AVG, 103 POWER_SUPPLY_PROP_VOLTAGE_AVG,
104 POWER_SUPPLY_PROP_VOLTAGE_OCV, 104 POWER_SUPPLY_PROP_VOLTAGE_OCV,
105 POWER_SUPPLY_PROP_VOLTAGE_BOOT,
105 POWER_SUPPLY_PROP_CURRENT_MAX, 106 POWER_SUPPLY_PROP_CURRENT_MAX,
106 POWER_SUPPLY_PROP_CURRENT_NOW, 107 POWER_SUPPLY_PROP_CURRENT_NOW,
107 POWER_SUPPLY_PROP_CURRENT_AVG, 108 POWER_SUPPLY_PROP_CURRENT_AVG,
109 POWER_SUPPLY_PROP_CURRENT_BOOT,
108 POWER_SUPPLY_PROP_POWER_NOW, 110 POWER_SUPPLY_PROP_POWER_NOW,
109 POWER_SUPPLY_PROP_POWER_AVG, 111 POWER_SUPPLY_PROP_POWER_AVG,
110 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, 112 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
@@ -146,6 +148,7 @@ enum power_supply_property {
146 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ 148 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
147 POWER_SUPPLY_PROP_SCOPE, 149 POWER_SUPPLY_PROP_SCOPE,
148 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT, 150 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
151 POWER_SUPPLY_PROP_CALIBRATE,
149 /* Properties of type `const char *' */ 152 /* Properties of type `const char *' */
150 POWER_SUPPLY_PROP_MODEL_NAME, 153 POWER_SUPPLY_PROP_MODEL_NAME,
151 POWER_SUPPLY_PROP_MANUFACTURER, 154 POWER_SUPPLY_PROP_MANUFACTURER,
@@ -291,6 +294,7 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
291 case POWER_SUPPLY_PROP_CURRENT_MAX: 294 case POWER_SUPPLY_PROP_CURRENT_MAX:
292 case POWER_SUPPLY_PROP_CURRENT_NOW: 295 case POWER_SUPPLY_PROP_CURRENT_NOW:
293 case POWER_SUPPLY_PROP_CURRENT_AVG: 296 case POWER_SUPPLY_PROP_CURRENT_AVG:
297 case POWER_SUPPLY_PROP_CURRENT_BOOT:
294 return 1; 298 return 1;
295 default: 299 default:
296 break; 300 break;
@@ -315,6 +319,7 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
315 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 319 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
316 case POWER_SUPPLY_PROP_VOLTAGE_AVG: 320 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
317 case POWER_SUPPLY_PROP_VOLTAGE_OCV: 321 case POWER_SUPPLY_PROP_VOLTAGE_OCV:
322 case POWER_SUPPLY_PROP_VOLTAGE_BOOT:
318 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 323 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
319 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX: 324 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
320 case POWER_SUPPLY_PROP_POWER_NOW: 325 case POWER_SUPPLY_PROP_POWER_NOW: