Files
linux/drivers/pwm/pwm-stm32.c
Uwe Kleine-König 131486fb2c pwm: stm32: Fix for settings using period > UINT32_MAX
[ Upstream commit d44d635635 ]

stm32_pwm_config() took the duty_cycle and period values with the type
int, however stm32_pwm_apply() passed u64 values there. Expand the
function parameters to u64 to not discard relevant bits and adapt the
calculations to the wider type.

To ensure the calculations won't overflow, check in .probe() the input
clk doesn't run faster than 1 GHz.

Link: https://lore.kernel.org/r/06b4a650a608d0887d934c1b2b8919e0f78e4db2.1710711976.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Stable-dep-of: c45fcf46ca ("pwm: stm32: Refuse too small period requests")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-05 09:37:49 +02:00

20 KiB