Commit 9605902
fw/services/common/light: fix dynamic backlight integer underflow
When user max intensity is set below 10% (the hardcoded low_intensity
threshold), the dynamic backlight calculation would cause an integer
underflow. The subtraction (user_max_intensity - low_intensity) wraps
around in unsigned arithmetic, producing a very large value that results
in brightness exceeding BACKLIGHT_BRIGHTNESS_MAX (appearing as >100%).
Fix by clamping user_max_intensity to low_intensity minimum before
performing the calculation.
Fixes backlight showing 187% when max intensity set to LOW (5%) on
Obelix PVT 4.9.110.
Signed-off-by: Joshua Jun <joshuajun@proton.me>1 parent 4402b11 commit 9605902
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
118 | 124 | | |
119 | 125 | | |
120 | 126 | | |
| |||
0 commit comments