diff options
author | Ramakrishna Pallala <ramakrishna.pallala@intel.com> | 2012-05-07 10:25:58 +0530 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2012-06-19 16:48:08 -0700 |
commit | 5fc55bc8225d5a5c13b978e3e3dbf51e6cd6a333 (patch) | |
tree | c0e8412fa7b3e9c2272aa888f0b80a48ffecfa20 /drivers/power | |
parent | 19dd6bcd1136d254c1f12b0f69e827c3e1679b43 (diff) | |
download | linux-3.10-5fc55bc8225d5a5c13b978e3e3dbf51e6cd6a333.tar.gz linux-3.10-5fc55bc8225d5a5c13b978e3e3dbf51e6cd6a333.tar.bz2 linux-3.10-5fc55bc8225d5a5c13b978e3e3dbf51e6cd6a333.zip |
max17042_battery: Support CHARGE_COUNTER power supply attribute
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>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/max17042_battery.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c index 140788b309f..74abc6c755b 100644 --- a/drivers/power/max17042_battery.c +++ b/drivers/power/max17042_battery.c @@ -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, @@ -201,6 +202,13 @@ static int max17042_get_property(struct power_supply *psy, 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: ret = max17042_read_reg(chip->client, MAX17042_TEMP); if (ret < 0) |