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

Commit 243bc4bb authored by Fenglin Wu's avatar Fenglin Wu Committed by Subbaraman Narayanamurthy
Browse files

pwm: qti-lpg: Write PWM_SYNC before enabling PWM



Update PWM_VALUE_SYNC to make sure PWM_VALUE will be updated everytime
before enabling PWM channel.

CRs-Fixed: 2360456
Change-Id: I02e0e98fc500fca6ba85d4ab39cbf955c15b4fc7
Signed-off-by: default avatarFenglin Wu <fenglinw@codeaurora.org>
parent 93a396a8
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -867,6 +867,19 @@ static int qpnp_lpg_pwm_enable(struct pwm_chip *pwm_chip,
		return -ENODEV;
	}

	/*
	 * Update PWM_VALUE_SYNC to make sure PWM_VALUE
	 * will be updated everytime before enabling.
	 */
	if (lpg->src_sel == PWM_VALUE) {
		rc = qpnp_lpg_write(lpg, REG_LPG_PWM_SYNC, LPG_PWM_VALUE_SYNC);
		if (rc < 0) {
			dev_err(lpg->chip->dev, "Write LPG_PWM_SYNC failed, rc=%d\n",
					rc);
			return rc;
		}
	}

	rc = qpnp_lpg_set_glitch_removal(lpg, true);
	if (rc < 0) {
		dev_err(lpg->chip->dev, "Enable glitch-removal failed, rc=%d\n",