aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-stm32.c
diff options
context:
space:
mode:
authorNylon Chen <[email protected]>2025-05-29 03:53:41 +0000
committerUwe Kleine-König <[email protected]>2025-07-07 06:39:34 +0000
commit6df3aac763fa995260ab0545c1e54f0c21b2feb8 (patch)
tree53f814139e0f97136b54f6b5d70dc1f6d5c09ed3 /drivers/pwm/pwm-stm32.c
parentpwm: sifive: Fix PWM algorithm and clarify inverted compare behavior (diff)
downloadkernel-6df3aac763fa995260ab0545c1e54f0c21b2feb8.tar.gz
kernel-6df3aac763fa995260ab0545c1e54f0c21b2feb8.zip
pwm: sifive: Fix rounding and idempotency issues in apply and get_state
This fix ensures consistent rounding and avoids mismatches between applied and reported PWM values that could trigger false idempotency failures in debug checks This change ensures: - real_period is now calculated using DIV_ROUND_UP_ULL() to avoid underestimation. - duty_cycle is rounded up to match the fractional computation in apply() - apply() truncates the result to compensate for get_state's rounding up logic These fixes resolve issues like: .apply is supposed to round down duty_cycle (requested: 360/504000, applied: 361/504124) .apply is not idempotent (ena=1 pol=0 1739692/4032985) -> (ena=1 pol=0 1739630/4032985) Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Co-developed-by: Zong Li <[email protected]> Signed-off-by: Zong Li <[email protected]> Signed-off-by: Nylon Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
Diffstat (limited to 'drivers/pwm/pwm-stm32.c')
0 files changed, 0 insertions, 0 deletions