On Mon, Jul 21, 2025 at 3:15 PM Limonciello, Mario <mario.limoncie...@amd.com> wrote: > > On 7/21/25 8:43 AM, Mario Limonciello wrote: > > From: Mario Limonciello <mario.limoncie...@amd.com> > > > > 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 > > Cc: sta...@vger.kernel.org > > Link: > > https://lore.kernel.org/amd-gfx/0f094c4b-d2a3-42cd-824c-dc2858a56...@kernel.org/T/#m69f875a7e69aa22df3370b3e3a9e69f4a61fdaf2 > > Signed-off-by: Mario Limonciello <mario.limoncie...@amd.com> > > --- > > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > index 8e1405e9025ba..f3e407f31de11 100644 > > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > @@ -4740,16 +4740,16 @@ static int get_brightness_range(const struct > > amdgpu_dm_backlight_caps *caps, > > return 1; > > } > > > > -/* Rescale from [min..max] to [0..MAX_BACKLIGHT_LEVEL] */ > > +/* Rescale from [min..max] to [0..AMDGPU_MAX_BL_LEVEL] */ > > static inline u32 scale_input_to_fw(int min, int max, u64 input) > > { > > - return DIV_ROUND_CLOSEST_ULL(input * MAX_BACKLIGHT_LEVEL, max - min); > > + return DIV_ROUND_CLOSEST_ULL(input * AMDGPU_MAX_BL_LEVEL, max - min); > > } > > > > -/* Rescale from [0..MAX_BACKLIGHT_LEVEL] to [min..max] */ > > +/* Rescale from [0..AMDGPU_MAX_BL_LEVEL] to [min..max] */ > > static inline u32 scale_fw_to_input(int min, int max, u64 input) > > { > > - return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), > > MAX_BACKLIGHT_LEVEL); > > + return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), > > AMDGPU_MAX_BL_LEVEL); > > } > > > > static void convert_custom_brightness(const struct > > amdgpu_dm_backlight_caps *caps, > > @@ -4977,7 +4977,7 @@ amdgpu_dm_register_backlight_device(struct > > amdgpu_dm_connector *aconnector) > > drm_dbg(drm, "Backlight caps: min: %d, max: %d, ac %d, dc > > %d\n", min, max, > > caps->ac_level, caps->dc_level); > > } else > > - props.brightness = props.max_brightness = MAX_BACKLIGHT_LEVEL; > > + props.brightness = props.max_brightness = AMDGPU_MAX_BL_LEVEL; > > This bottom hunk doesn't need to revert, that one is fine. The other > two need to be reverted though to fix this issue.
With that fixed, the patch is: Acked-by: Alex Deucher <alexander.deuc...@amd.com>