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

Commit 059ac8b9 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar Committed by Harry Yang
Browse files

qpnp-qnovo: fix ptrain done handler



Currently the handler skips calling the update function
but uses the final result from the votable not_ok_to_qnovo_votable.
Fix it by calling the update function so it gets a chance to vote on
not_ok_to_qnovo_votable.

Moreover do not return early from ptrain_done handler without setting
QNI_PT_VOTER's vote on pt_dis_votable. This is a self clearing bit and
unless QNI_PT_VOTER's bit is removed, the next restart may not trickle
down to hw.

Change-Id: I0a860287b638d20b6a4aa05c7bb25e9b81a980d2
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent 3546ee42
Loading
Loading
Loading
Loading
+4 −12
Original line number Original line Diff line number Diff line
@@ -1423,16 +1423,7 @@ static irqreturn_t handle_ptrain_done(int irq, void *data)
	struct qnovo *chip = data;
	struct qnovo *chip = data;
	union power_supply_propval pval = {0};
	union power_supply_propval pval = {0};


	/*
	qnovo_update_status(chip);
	 * In some cases (esp shutting down) the userspace would  disable by
	 * setting qnovo_enable=0. Also charger could be removed or there is
	 * an error (i.e. its not okay to run qnovo)-
	 * skip taking ESR measurement in such situations
	 */

	if (get_client_vote(chip->disable_votable, USER_VOTER)
		|| get_effective_result(chip->not_ok_to_qnovo_votable) > 0)
		return IRQ_HANDLED;


	/*
	/*
	 * hw resets pt_en bit once ptrain_done triggers.
	 * hw resets pt_en bit once ptrain_done triggers.
@@ -1443,13 +1434,14 @@ static irqreturn_t handle_ptrain_done(int irq, void *data)
	vote(chip->pt_dis_votable, QNI_PT_VOTER, true, 0);
	vote(chip->pt_dis_votable, QNI_PT_VOTER, true, 0);


	vote(chip->pt_dis_votable, ESR_VOTER, true, 0);
	vote(chip->pt_dis_votable, ESR_VOTER, true, 0);
	if (is_fg_available(chip))
	if (is_fg_available(chip)
		&& !get_client_vote(chip->disable_votable, USER_VOTER)
		&& !get_effective_result(chip->not_ok_to_qnovo_votable))
		power_supply_set_property(chip->bms_psy,
		power_supply_set_property(chip->bms_psy,
				POWER_SUPPLY_PROP_RESISTANCE,
				POWER_SUPPLY_PROP_RESISTANCE,
				&pval);
				&pval);


	vote(chip->pt_dis_votable, ESR_VOTER, false, 0);
	vote(chip->pt_dis_votable, ESR_VOTER, false, 0);
	qnovo_update_status(chip);
	kobject_uevent(&chip->dev->kobj, KOBJ_CHANGE);
	kobject_uevent(&chip->dev->kobj, KOBJ_CHANGE);
	return IRQ_HANDLED;
	return IRQ_HANDLED;
}
}