Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309673
b: refs/heads/master
c: a2ebfe2
h: refs/heads/master
i:
  309671: 6f6d1f9
v: v3
  • Loading branch information
Ramakrishna Pallala authored and Anton Vorontsov committed May 5, 2012
1 parent f126517 commit ad19092
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 48e41c70c10f10541d922fc67e7952f06ad59d9a
refs/heads/master: a2ebfe2fc6e088a70d06cd15a5bc9bcb621cc195
2 changes: 2 additions & 0 deletions trunk/Documentation/power/power_supply_class.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ are already charged or discharging, 'n/a' can be displayed (or
HEALTH - represents health of the battery, values corresponds to
POWER_SUPPLY_HEALTH_*, defined in battery.h.

VOLTAGE_OCV - open circuit voltage of the battery.

VOLTAGE_MAX_DESIGN, VOLTAGE_MIN_DESIGN - design values for maximal and
minimal power supply voltages. Maximal/minimal means values of voltages
when battery considered "full"/"empty" at normal conditions. Yes, there is
Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/power/max17042_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static enum power_supply_property max17042_battery_props[] = {
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_VOLTAGE_AVG,
POWER_SUPPLY_PROP_VOLTAGE_OCV,
POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_CHARGE_FULL,
POWER_SUPPLY_PROP_TEMP,
Expand Down Expand Up @@ -170,6 +171,13 @@ static int max17042_get_property(struct power_supply *psy,
if (ret < 0)
return ret;

val->intval = ret * 625 / 8;
break;
case POWER_SUPPLY_PROP_VOLTAGE_OCV:
ret = max17042_read_reg(chip->client, MAX17042_OCVInternal);
if (ret < 0)
return ret;

val->intval = ret * 625 / 8;
break;
case POWER_SUPPLY_PROP_CAPACITY:
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/power/power_supply_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ static struct device_attribute power_supply_attrs[] = {
POWER_SUPPLY_ATTR(voltage_min_design),
POWER_SUPPLY_ATTR(voltage_now),
POWER_SUPPLY_ATTR(voltage_avg),
POWER_SUPPLY_ATTR(voltage_ocv),
POWER_SUPPLY_ATTR(current_max),
POWER_SUPPLY_ATTR(current_now),
POWER_SUPPLY_ATTR(current_avg),
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/power_supply.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ enum power_supply_property {
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_VOLTAGE_AVG,
POWER_SUPPLY_PROP_VOLTAGE_OCV,
POWER_SUPPLY_PROP_CURRENT_MAX,
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CURRENT_AVG,
Expand Down Expand Up @@ -261,6 +262,7 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
case POWER_SUPPLY_PROP_VOLTAGE_AVG:
case POWER_SUPPLY_PROP_VOLTAGE_OCV:
case POWER_SUPPLY_PROP_POWER_NOW:
return 1;
default:
Expand Down

0 comments on commit ad19092

Please sign in to comment.