Skip to content

Commit

Permalink
max17042_battery: Support CHARGE_COUNTER power supply attribute
Browse files Browse the repository at this point in the history
This patch adds the support for CHARGE_COUNTER power supply attribute
to max17042/47 driver.

Note:QH(Charge Counter) register is not documented in max17042 the Spec.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
  • Loading branch information
Ramakrishna Pallala authored and Anton Vorontsov committed Jun 19, 2012
1 parent 19dd6bc commit 5fc55bc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/power/max17042_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ static enum power_supply_property max17042_battery_props[] = {
POWER_SUPPLY_PROP_VOLTAGE_OCV,
POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_CHARGE_FULL,
POWER_SUPPLY_PROP_CHARGE_COUNTER,
POWER_SUPPLY_PROP_TEMP,
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CURRENT_AVG,
Expand Down Expand Up @@ -199,6 +200,13 @@ static int max17042_get_property(struct power_supply *psy,
if (ret < 0)
return ret;

val->intval = ret * 1000 / 2;
break;
case POWER_SUPPLY_PROP_CHARGE_COUNTER:
ret = max17042_read_reg(chip->client, MAX17042_QH);
if (ret < 0)
return ret;

val->intval = ret * 1000 / 2;
break;
case POWER_SUPPLY_PROP_TEMP:
Expand Down

0 comments on commit 5fc55bc

Please sign in to comment.