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

Commit 1d41107f authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar Committed by Harry Yang
Browse files

qpnp-qnovo: check ptrain_en in restart work



Sometimes we observe that the ptrain_en bit is reset back to 0 while
in restart work.

Set it again if so.

Change-Id: I15d46f96a8b751f0386677e3b6876eec8bba9a1f
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent 379c70e3
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1333,6 +1333,26 @@ static void ptrain_restart_work(struct work_struct *work)
				struct qnovo, ptrain_restart_work.work);
	u8 pt_t1, pt_t2;
	int rc;
	u8 pt_en;

	rc = qnovo_read(chip, QNOVO_PTRAIN_EN, &pt_en, 1);
	if (rc < 0) {
		dev_err(chip->dev, "Couldn't read QNOVO_PTRAIN_EN rc = %d\n",
				rc);
		goto clean_up;
	}

	if (!pt_en) {
		rc = qnovo_masked_write(chip, QNOVO_PTRAIN_EN,
				QNOVO_PTRAIN_EN_BIT, QNOVO_PTRAIN_EN_BIT);
		if (rc < 0) {
			dev_err(chip->dev, "Couldn't enable pulse train rc=%d\n",
					rc);
			goto clean_up;
		}
		/* sleep 20ms for the pulse trains to restart and settle */
		msleep(20);
	}

	rc = qnovo_read(chip, QNOVO_PTTIME_STS, &pt_t1, 1);
	if (rc < 0) {