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

drm/amd/display: Revert "drm/amd/display: Fix AMDGPU_MAX_BL_LEVEL value"

This reverts commit 66abb996999de0d440a02583a6e70c2c24deab45.
This broke custom brightness curves but it wasn't obvious because
of other related changes. Custom brightness curves are always
from a 0-255 input signal. The correct fix was to fix the default
value which was done by [1].

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4412
Link: https://lore.kernel.org/amd-gfx/0f094c4b-d2a3-42cd-824c-dc2858a5618d@kernel.org/T/#m69f875a7e69aa22df3370b3e3a9e69f4a61fdaf2
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Roman Li <roman.li@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 6ec8a5cbec751625133461600d0d4950ffd3a214)
Cc: stable@vger.kernel.org

authored by

Mario Limonciello and committed by
Alex Deucher
8e6a18cb 1bcf63a4

+4 -4
+4 -4
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 4756 4756 return 1; 4757 4757 } 4758 4758 4759 - /* Rescale from [min..max] to [0..MAX_BACKLIGHT_LEVEL] */ 4759 + /* Rescale from [min..max] to [0..AMDGPU_MAX_BL_LEVEL] */ 4760 4760 static inline u32 scale_input_to_fw(int min, int max, u64 input) 4761 4761 { 4762 - return DIV_ROUND_CLOSEST_ULL(input * MAX_BACKLIGHT_LEVEL, max - min); 4762 + return DIV_ROUND_CLOSEST_ULL(input * AMDGPU_MAX_BL_LEVEL, max - min); 4763 4763 } 4764 4764 4765 - /* Rescale from [0..MAX_BACKLIGHT_LEVEL] to [min..max] */ 4765 + /* Rescale from [0..AMDGPU_MAX_BL_LEVEL] to [min..max] */ 4766 4766 static inline u32 scale_fw_to_input(int min, int max, u64 input) 4767 4767 { 4768 - return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), MAX_BACKLIGHT_LEVEL); 4768 + return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), AMDGPU_MAX_BL_LEVEL); 4769 4769 } 4770 4770 4771 4771 static void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *caps,