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

Commit aa55a507 authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

power: qpnp-vm-bms: Process suspended data only if we are not charging



If we have suspended while charging we will always be woken up
the fifo done irq. Hence, read suspended BMS data only if we are
not charging.

Change-Id: I91de0f0aa2f17bafaf1033dea22260115cbd92bc
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent edd32d79
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -2899,17 +2899,21 @@ static int bms_resume(struct device *dev)
	struct qpnp_bms_chip *chip = dev_get_drvdata(dev);

	if (!chip->charging_while_suspended) {
		enable_bms_irq(&chip->fsm_state_change_irq);
		enable_irq_wake(chip->fsm_state_change_irq.irq);

		if (chip->dt.cfg_force_s3_on_suspend) {
			pr_debug("Unforcing S3 state, setting AUTO state\n");
			set_auto_fsm_state(chip);
		}
	}

		/*
		 * if we were charging while suspended, we will
		 * be woken up by the fifo done interrupt and no
		 * additional processing is needed
		 */
		process_suspended_data(chip);

		enable_bms_irq(&chip->fsm_state_change_irq);
		enable_irq_wake(chip->fsm_state_change_irq.irq);
	}

	/* start the soc_monitor */
	bms_stay_awake(&chip->vbms_soc_wake_source);
	schedule_delayed_work(&chip->monitor_soc_work, 0);