diff options
author | 2025-07-28 18:00:18 +0200 | |
---|---|---|
committer | 2025-07-29 17:46:29 +0200 | |
commit | f21d136caf8171f94159d975ea4620c164431bd9 (patch) | |
tree | 3943d3b87d044c7ae6c49927cc1a61e8130cf652 /drivers/net/wireless/intel/iwlwifi/mld/tests/utils.c | |
parent | pwm: mediatek: Handle hardware enable and clock enable separately (diff) | |
download | wireguard-linux-f21d136caf8171f94159d975ea4620c164431bd9.tar.xz wireguard-linux-f21d136caf8171f94159d975ea4620c164431bd9.zip |
pwm: mediatek: Fix duty and period setting
The period generated by the hardware is
(PWMDWIDTH + 1) << CLKDIV) / freq
according to my tests with a signal analyser and also the documentation.
The current algorithm doesn't consider the `+ 1` part and so configures
slightly too high periods. The same issue exists for the duty cycle
setting. So subtract 1 from both the register values for period and
duty cycle. If period is 0, bail out, if duty_cycle is 0, just disable
the PWM which results in a constant low output.
Fixes: caf065f8fd58 ("pwm: Add MediaTek PWM support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/6d1fa87a76f8020bfe3171529b8e19baffceab10.1753717973.git.u.kleine-koenig@baylibre.com
Cc: stable@vger.kernel.org
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mld/tests/utils.c')
0 files changed, 0 insertions, 0 deletions