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

Commit 2eb5383a authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

power: qpnp-qg: Expose CHARGE_COUNTER_SHADOW power supply property



CHARGE_COUNTER_SHADOW reports the continuous accumulated charge.

Change-Id: Idb482dd63d4939be5b19594385c642a61531e666
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent bdf17c96
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ struct qpnp_qg {
	int			max_fcc_limit_ma;
	int			bsoc_bass_entry;
	int			qg_v_ibat;
	int			qg_charge_counter;
	u32			fifo_done_count;
	u32			wa_flags;
	u32			seq_no;
+8 −0
Original line number Diff line number Diff line
@@ -1220,6 +1220,9 @@ static void process_udata_work(struct work_struct *work)
	if (chip->udata.param[QG_V_IBAT].valid)
		chip->qg_v_ibat = chip->udata.param[QG_V_IBAT].data;

	if (chip->udata.param[QG_CHARGE_COUNTER].valid)
		chip->qg_charge_counter = chip->udata.param[QG_CHARGE_COUNTER].data;

	if (chip->udata.param[QG_SOC].valid ||
			chip->udata.param[QG_SYS_SOC].valid) {

@@ -2207,6 +2210,9 @@ static int qg_psy_get_property(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CHARGE_COUNTER:
		rc = qg_get_charge_counter(chip, &pval->intval);
		break;
	case POWER_SUPPLY_PROP_CHARGE_COUNTER_SHADOW:
		pval->intval = chip->qg_charge_counter;
		break;
	case POWER_SUPPLY_PROP_CHARGE_FULL:
		if (!chip->dt.cl_disable && chip->dt.cl_feedback_on)
			rc = qg_get_learned_capacity(chip, &temp);
@@ -2306,6 +2312,7 @@ static enum power_supply_property qg_psy_props[] = {
	POWER_SUPPLY_PROP_VOLTAGE_OCV,
	POWER_SUPPLY_PROP_CURRENT_NOW,
	POWER_SUPPLY_PROP_CHARGE_COUNTER,
	POWER_SUPPLY_PROP_CHARGE_COUNTER_SHADOW,
	POWER_SUPPLY_PROP_RESISTANCE,
	POWER_SUPPLY_PROP_RESISTANCE_ID,
	POWER_SUPPLY_PROP_RESISTANCE_NOW,
@@ -4719,6 +4726,7 @@ static int qpnp_qg_probe(struct platform_device *pdev)
	chip->esr_actual = -EINVAL;
	chip->esr_nominal = -EINVAL;
	chip->batt_age_level = -EINVAL;
	chip->qg_charge_counter = -EINVAL;

	chip->qg_version = (u8)of_device_get_match_data(&pdev->dev);