pwm: pwm-qti-lpg: Fix the order of configuring PWM value

The hardware expects the PWM MSB to be written before
LSB to avoid glitches in the output. Fix this.

Change-Id: Id7f794beed5c32f0e7578e8aa070dd7f5921a443
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
This commit is contained in:
Anirudh Ghayal 2019-05-09 15:42:10 +05:30 committed by Subbaraman Narayanamurthy
parent 854a936b96
commit e5020a4ad2

View file

@ -333,14 +333,6 @@ static int qpnp_lpg_set_pwm_config(struct qpnp_lpg_channel *lpg)
if (lpg->src_sel == LUT_PATTERN)
return 0;
val = lpg->pwm_config.pwm_value & LPG_PWM_VALUE_LSB_MASK;
rc = qpnp_lpg_write(lpg, REG_LPG_PWM_VALUE_LSB, val);
if (rc < 0) {
dev_err(lpg->chip->dev, "Write LPG_PWM_VALUE_LSB failed, rc=%d\n",
rc);
return rc;
}
val = lpg->pwm_config.pwm_value >> 8;
mask = LPG_PWM_VALUE_MSB_MASK;
rc = qpnp_lpg_masked_write(lpg, REG_LPG_PWM_VALUE_MSB, mask, val);
@ -350,6 +342,14 @@ static int qpnp_lpg_set_pwm_config(struct qpnp_lpg_channel *lpg)
return rc;
}
val = lpg->pwm_config.pwm_value & LPG_PWM_VALUE_LSB_MASK;
rc = qpnp_lpg_write(lpg, REG_LPG_PWM_VALUE_LSB, val);
if (rc < 0) {
dev_err(lpg->chip->dev, "Write LPG_PWM_VALUE_LSB failed, rc=%d\n",
rc);
return rc;
}
val = LPG_PWM_VALUE_SYNC;
rc = qpnp_lpg_write(lpg, REG_LPG_PWM_SYNC, val);
if (rc < 0) {