Skip to content

Commit 9489b7f

Browse files
committed
drm/amd/display: Fix AMDGPU_MAX_BL_LEVEL value
JIRA: https://issues.redhat.com/browse/RHEL-75958 commit 650d623737eddcffc9e56a4e7fd9e2b714938ee2 Author: Mario Limonciello <mario.limonciello@amd.com> Date: Mon Jun 23 12:11:13 2025 -0500 drm/amd/display: Fix AMDGPU_MAX_BL_LEVEL value commit 66abb99 upstream. [Why] commit 16dc8bc ("drm/amd/display: Export full brightness range to userspace") adjusted the brightness range to scale to larger values, but missed updating AMDGPU_MAX_BL_LEVEL which is needed to make sure that scaling works properly with custom brightness curves. [How] As the change for max brightness of 0xFFFF only applies to devices supporting DC, use existing DC define MAX_BACKLIGHT_LEVEL. Fixes: 16dc8bc ("drm/amd/display: Export full brightness range to userspace") Acked-by: Alex Deucher <alexander.deucher@amd.com> Link: https://lore.kernel.org/r/20250623171114.1156451-1-mario.limonciello@amd.com Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 5b85204) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: José Expósito <jexposit@redhat.com>
1 parent 26a3ca7 commit 9489b7f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4655,16 +4655,16 @@ static int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps,
46554655
return 1;
46564656
}
46574657

4658-
/* Rescale from [min..max] to [0..AMDGPU_MAX_BL_LEVEL] */
4658+
/* Rescale from [min..max] to [0..MAX_BACKLIGHT_LEVEL] */
46594659
static inline u32 scale_input_to_fw(int min, int max, u64 input)
46604660
{
4661-
return DIV_ROUND_CLOSEST_ULL(input * AMDGPU_MAX_BL_LEVEL, max - min);
4661+
return DIV_ROUND_CLOSEST_ULL(input * MAX_BACKLIGHT_LEVEL, max - min);
46624662
}
46634663

4664-
/* Rescale from [0..AMDGPU_MAX_BL_LEVEL] to [min..max] */
4664+
/* Rescale from [0..MAX_BACKLIGHT_LEVEL] to [min..max] */
46654665
static inline u32 scale_fw_to_input(int min, int max, u64 input)
46664666
{
4667-
return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), AMDGPU_MAX_BL_LEVEL);
4667+
return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), MAX_BACKLIGHT_LEVEL);
46684668
}
46694669

46704670
static void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *caps,
@@ -4884,7 +4884,7 @@ amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
48844884
drm_dbg(drm, "Backlight caps: min: %d, max: %d, ac %d, dc %d\n", min, max,
48854885
caps->ac_level, caps->dc_level);
48864886
} else
4887-
props.brightness = props.max_brightness = AMDGPU_MAX_BL_LEVEL;
4887+
props.brightness = props.max_brightness = MAX_BACKLIGHT_LEVEL;
48884888

48894889
if (caps->data_points && !(amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE))
48904890
drm_info(drm, "Using custom brightness curve\n");

0 commit comments

Comments
 (0)