mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
pwm: rockchip: fix the scaler calculation in &rockchip_pwm_funcs.set_wave()
If the pc->clk_rate is the same as config->clk_rate, the scaler should
be set to 0. However, using the previous calculation method, the result
would incorrectly be 1.
Fixes: 1504b8ffcf ("pwm: rockchip: add dclk scale config for wave generator mode")
Change-Id: I876f7f530ab841b485b8d7f139adcf825955a160
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
This commit is contained in:
@@ -1652,7 +1652,7 @@ int rockchip_pwm_set_wave(struct pwm_device *pwm, struct rockchip_pwm_wave_confi
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pc->scaler = DIV_ROUND_CLOSEST_ULL(pc->clk_rate, config->clk_rate * 2);
|
||||
pc->scaler = DIV_ROUND_CLOSEST_ULL(pc->clk_rate, config->clk_rate) / 2;
|
||||
if (pc->scaler > 256) {
|
||||
dev_err(chip->dev, "Unsupported scale factor %d(max: 512) for PWM%d\n",
|
||||
pc->scaler * 2, pc->channel_id);
|
||||
|
||||
Reference in New Issue
Block a user