qpnp-qnovo: skip taking ESR measurement when disabled

Currently when ptrain_done interrupt is handled, the driver invariably
issues a ESR measurement. This is not required if qnovo is disabled.

Change-Id: I8c81dadc38da69ba7248905af2d772f7ce918239
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This commit is contained in:
Abhijeet Dharmapurikar 2017-08-03 15:22:14 -07:00 committed by Nicholas Troast
parent c4205fe6be
commit fbd4949949

View file

@ -1395,6 +1395,17 @@ static irqreturn_t handle_ptrain_done(int irq, void *data)
struct qnovo *chip = data;
union power_supply_propval pval = {0};
/*
* 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.
* vote on behalf of QNI to disable it such that