]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
leds: rgb: leds-qcom-lpg: Fix calculation of best period Hi-Res PWMs
authorAbel Vesa <abel.vesa@linaro.org>
Wed, 5 Mar 2025 13:09:06 +0000 (15:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:18:12 +0000 (10:18 +0200)
commit8ce7c140c844e9ec77658b3b95a9f985e1e0010a
tree7ae03472dc190433627e59d695bfde2d900edb72
parent77117de8b2d917c5495f5d64b7c90fe8818d8b0d
leds: rgb: leds-qcom-lpg: Fix calculation of best period Hi-Res PWMs

commit 2528eec7da0ec58fcae6d12cfa79a622c933d86b upstream.

When determining the actual best period by looping through all
possible PWM configs, the resolution currently used is based on
bit shift value which is off-by-one above the possible maximum
PWM value allowed.

So subtract one from the resolution before determining the best
period so that the maximum duty cycle requested by the PWM user
won't result in a value above the maximum allowed by the selected
resolution.

Cc: stable@vger.kernel.org # 6.4
Fixes: b00d2ed37617 ("leds: rgb: leds-qcom-lpg: Add support for high resolution PWM")
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Link: https://lore.kernel.org/r/20250305-leds-qcom-lpg-fix-max-pwm-on-hi-res-v4-3-bfe124a53a9f@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/leds/rgb/leds-qcom-lpg.c