mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
pwm: rockchip: keep the mode fixed in capture mode although pwm is disabled
The PWM io input/output state is controlled by PWM mode configuration. In order to avoid the antagonistic drive state between the PWM pin and the external pin, keep the PWM mode fixed in capture mode although PWM is disabled. Change-Id: I6183987c9bef6f444726643f878c5384f63844d0 Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
This commit is contained in:
@@ -604,10 +604,18 @@ static int rockchip_pwm_enable_v1(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||
enable_conf |= PWM_CAPTURE;
|
||||
}
|
||||
|
||||
if (enable)
|
||||
if (enable) {
|
||||
val |= enable_conf;
|
||||
else
|
||||
val &= ~enable_conf;
|
||||
} else {
|
||||
/*
|
||||
* The PWM io input/output state is controlled by PWM mode
|
||||
* configuration. In order to avoid the antagonistic drive
|
||||
* state between the PWM pin and the external pin, keep the
|
||||
* PWM mode fixed in capture mode although PWM is disabled.
|
||||
*/
|
||||
if (pc->capture_en)
|
||||
val |= PWM_CAPTURE;
|
||||
}
|
||||
|
||||
writel_relaxed(val, pc->base + PWM_CTRL_V1);
|
||||
if (pc->data->vop_pwm)
|
||||
@@ -919,8 +927,13 @@ static void rockchip_pwm_set_capture_v4(struct pwm_chip *chip, struct pwm_device
|
||||
|
||||
pc->capture_cnt = 0;
|
||||
|
||||
writel_relaxed(enable ? PWM_MODE(CAPTURE_MODE) : PWM_MODE(CONTINUOUS_MODE),
|
||||
pc->base + CTRL_V4);
|
||||
/*
|
||||
* The PWM io input/output state is controlled by PWM mode
|
||||
* configuration. In order to avoid the antagonistic drive
|
||||
* state between the PWM pin and the external pin, keep the
|
||||
* PWM mode fixed in capture mode although PWM is disabled.
|
||||
*/
|
||||
writel_relaxed(PWM_MODE(CAPTURE_MODE), pc->base + CTRL_V4);
|
||||
writel_relaxed(CAP_LPR_INT_EN(enable) | CAP_HPR_INT_EN(enable) | PWM_IN_SEL(channel_sel),
|
||||
pc->base + INT_EN);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user