diff options
author | Nylon Chen <nylon.chen@sifive.com> | 2025-05-29 11:53:41 +0800 |
---|---|---|
committer | Uwe Kleine-König <ukleinek@kernel.org> | 2025-07-07 08:39:34 +0200 |
commit | 6df3aac763fa995260ab0545c1e54f0c21b2feb8 (patch) | |
tree | 53f814139e0f97136b54f6b5d70dc1f6d5c09ed3 /tools/perf/scripts/python/gecko.py | |
parent | 7dbc4432ea6bf9d709391eb57f1e9fb44e99845a (diff) |
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 <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505080303.dBfU5YMS-lkp@intel.com/
Co-developed-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
Link: https://lore.kernel.org/r/20250529035341.51736-4-nylon.chen@sifive.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/gecko.py')
0 files changed, 0 insertions, 0 deletions