Hi Mathew,

Same as your other patch, a similar change has already been merged into asdn DC 3.2.400 release.     commit: drm/amd/display: map PWM brightness through custom backlight curve

Please give it a try, and if you still see any other issues, feel free to send an updated patch.

Thanks,
Ray

On 9/17/2026 3:11 AM, Matthew Schwartz wrote:
The power module takes the backlight level in millipercent, but DM
rounds the 16-bit level to a whole percent before multiplying by 1000,
collapsing the range to 101 steps. It also divides the absolute level,
which already includes the panel minimum, by the min to max span, so
panels with a nonzero minimum PWM overshoot the top of the range.

Scale the offset from the minimum to millipercent directly so the full
resolution reaches the power module and the minimum is only added once.

Fixes: 3c108046e1d6 ("drm/amd/display: Add power module on Linux")
Signed-off-by: Matthew Schwartz <[email protected]>
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
index 45e1732a5b04..079277d47b3f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
@@ -326,7 +326,8 @@ void amdgpu_dm_backlight_set_level(struct 
amdgpu_display_manager *dm,
        } else {
                /* power module uses millipercent */
                get_brightness_range(caps, &min, &max);
-               brightness = DIV_ROUND_CLOSEST(brightness * 100, (max - min)) * 
1000;
+               brightness = DIV_ROUND_CLOSEST_ULL((u64)(brightness - min) * 
100000,
+                                                  max - min);
                rc = mod_power_set_backlight_percent(dm->power_module, stream,
                                                     brightness, 0, false);
        }

Reply via email to