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: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This commit is contained in:
Abhijeet Dharmapurikar 2017-08-08 13:11:29 -07:00
parent e243bb8502
commit 5c1894c01d

View file

@ -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) {