Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: Fix AMDGPU_MAX_BL_LEVEL value

[Why]
commit 16dc8bc27c2a ("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: 16dc8bc27c2a ("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>

authored by

Mario Limonciello and committed by
Alex Deucher
5b852044 518f13f8

+5 -5
+5 -5
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 4752 4752 return 1; 4753 4753 } 4754 4754 4755 - /* Rescale from [min..max] to [0..AMDGPU_MAX_BL_LEVEL] */ 4755 + /* Rescale from [min..max] to [0..MAX_BACKLIGHT_LEVEL] */ 4756 4756 static inline u32 scale_input_to_fw(int min, int max, u64 input) 4757 4757 { 4758 - return DIV_ROUND_CLOSEST_ULL(input * AMDGPU_MAX_BL_LEVEL, max - min); 4758 + return DIV_ROUND_CLOSEST_ULL(input * MAX_BACKLIGHT_LEVEL, max - min); 4759 4759 } 4760 4760 4761 - /* Rescale from [0..AMDGPU_MAX_BL_LEVEL] to [min..max] */ 4761 + /* Rescale from [0..MAX_BACKLIGHT_LEVEL] to [min..max] */ 4762 4762 static inline u32 scale_fw_to_input(int min, int max, u64 input) 4763 4763 { 4764 - return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), AMDGPU_MAX_BL_LEVEL); 4764 + return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), MAX_BACKLIGHT_LEVEL); 4765 4765 } 4766 4766 4767 4767 static void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *caps, ··· 4981 4981 drm_dbg(drm, "Backlight caps: min: %d, max: %d, ac %d, dc %d\n", min, max, 4982 4982 caps->ac_level, caps->dc_level); 4983 4983 } else 4984 - props.brightness = props.max_brightness = AMDGPU_MAX_BL_LEVEL; 4984 + props.brightness = props.max_brightness = MAX_BACKLIGHT_LEVEL; 4985 4985 4986 4986 if (caps->data_points && !(amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE)) 4987 4987 drm_info(drm, "Using custom brightness curve\n");