Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fc55bc8 authored by Ramakrishna Pallala's avatar Ramakrishna Pallala Committed by Anton Vorontsov
Browse files

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: default avatarRamakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
parent 19dd6bcd
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -113,6 +113,7 @@ static enum power_supply_property max17042_battery_props[] = {
	POWER_SUPPLY_PROP_VOLTAGE_OCV,
	POWER_SUPPLY_PROP_VOLTAGE_OCV,
	POWER_SUPPLY_PROP_CAPACITY,
	POWER_SUPPLY_PROP_CAPACITY,
	POWER_SUPPLY_PROP_CHARGE_FULL,
	POWER_SUPPLY_PROP_CHARGE_FULL,
	POWER_SUPPLY_PROP_CHARGE_COUNTER,
	POWER_SUPPLY_PROP_TEMP,
	POWER_SUPPLY_PROP_TEMP,
	POWER_SUPPLY_PROP_CURRENT_NOW,
	POWER_SUPPLY_PROP_CURRENT_NOW,
	POWER_SUPPLY_PROP_CURRENT_AVG,
	POWER_SUPPLY_PROP_CURRENT_AVG,
@@ -199,6 +200,13 @@ static int max17042_get_property(struct power_supply *psy,
		if (ret < 0)
		if (ret < 0)
			return ret;
			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;
		val->intval = ret * 1000 / 2;
		break;
		break;
	case POWER_SUPPLY_PROP_TEMP:
	case POWER_SUPPLY_PROP_TEMP: