Merge "pwm: pwm-qpnp: Fix the order of configuring PWM value"

This commit is contained in:
Linux Build Service Account 2019-05-17 06:09:27 -07:00 committed by Gerrit - the friendly Code Review server
commit 4efd54ad69

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, 2019 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -694,17 +694,6 @@ static int qpnp_lpg_save_pwm_value(struct qpnp_pwm_chip *chip)
if (pwm_config->pwm_value > max_pwm_value)
pwm_config->pwm_value = max_pwm_value;
value = pwm_config->pwm_value;
mask = QPNP_PWM_VALUE_LSB_MASK;
pr_debug("pwm_lsb value:%d\n", value & mask);
rc = qpnp_lpg_save_and_write(value, mask,
&chip->qpnp_lpg_registers[QPNP_PWM_VALUE_LSB],
SPMI_LPG_REG_ADDR(lpg_config->base_addr,
QPNP_PWM_VALUE_LSB), 1, chip);
if (rc)
return rc;
value = (pwm_config->pwm_value >> QPNP_PWM_VALUE_MSB_SHIFT) &
QPNP_PWM_VALUE_MSB_MASK;
@ -718,6 +707,17 @@ static int qpnp_lpg_save_pwm_value(struct qpnp_pwm_chip *chip)
if (rc)
return rc;
value = pwm_config->pwm_value;
mask = QPNP_PWM_VALUE_LSB_MASK;
pr_debug("pwm_lsb value:%d\n", value & mask);
rc = qpnp_lpg_save_and_write(value, mask,
&chip->qpnp_lpg_registers[QPNP_PWM_VALUE_LSB],
SPMI_LPG_REG_ADDR(lpg_config->base_addr,
QPNP_PWM_VALUE_LSB), 1, chip);
if (rc)
return rc;
if (chip->sub_type == QPNP_PWM_MODE_ONLY_SUB_TYPE ||
chip->sub_type == QPNP_LPG_S_CHAN_SUB_TYPE) {
value = QPNP_PWM_SYNC_VALUE & QPNP_PWM_SYNC_MASK;