]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pwm: lp3943: Fix duty calculation in case period was clamped
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 8 Apr 2022 15:22:38 +0000 (17:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 14:53:56 +0000 (16:53 +0200)
commit82036c4169d912dfb941f93494c47201ba9e5568
treec7e7cf7bc6f5dad211db61535d17ec35cab76c54
parent8f83ffad572e89fe9faa619a5cc35fddb69c6bef
pwm: lp3943: Fix duty calculation in case period was clamped

[ Upstream commit 5e3b07ca5cc78cd4a987e78446849e41288d87cb ]

The hardware only supports periods <= 1.6 ms and if a bigger period is
requested it is clamped to 1.6 ms. In this case duty_cycle might be bigger
than 1.6 ms and then the duty cycle register is written with a value
bigger than LP3943_MAX_DUTY. So clamp duty_cycle accordingly.

Fixes: af66b3c0934e ("pwm: Add LP3943 PWM driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pwm/pwm-lp3943.c