From: Anthony Koo <anthony....@amd.com>

[Why]
The PWL backlight curve is used by the firmware to convert between
brightness and linear PWM value.
Driver has a backlight LUT, but the firmware holds a PWL curve and
interpolates between points.

The calculations are incorrect leading to slightly off backlight values
being programmed.

[How]
Fix the PWL backlight curve threshold/offset calculations

Signed-off-by: Anthony Koo <anthony....@amd.com>
Reviewed-by: Josip Pavic <josip.pa...@amd.com>
Acked-by: Anson Jacob <anson.ja...@amd.com>
---
 drivers/gpu/drm/amd/display/modules/power/power_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c 
b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
index 3d4c66933f51..6270ecbd2438 100644
--- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
+++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
@@ -266,7 +266,7 @@ static void fill_backlight_transform_table_v_2_2(struct 
dmcu_iram_parameters par
         * format U4.10.
         */
        for (i = 1; i+1 < num_entries; i++) {
-               lut_index = (params.backlight_lut_array_size - 1) * i / 
(num_entries - 1);
+               lut_index = DIV_ROUNDUP((i * params.backlight_lut_array_size), 
num_entries);
                ASSERT(lut_index < params.backlight_lut_array_size);
 
                table->backlight_thresholds[i] = (big_endian) ?
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to