Skip to content

Commit 8b5f3a2

Browse files
superm1alexdeucher
authored andcommitted
drm/amd/display: Fix default DC and AC levels
[Why] DC and AC levels are advertised in a percentage, not a luminance. [How] Scale DC and AC levels to supported values. Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4221 Reviewed-by: Alex Hung <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Wayne Lin <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 4b61b8a commit 8b5f3a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4925,9 +4925,9 @@ amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
49254925
amdgpu_acpi_get_backlight_caps(&caps);
49264926
if (caps.caps_valid && get_brightness_range(&caps, &min, &max)) {
49274927
if (power_supply_is_system_supplied() > 0)
4928-
props.brightness = caps.ac_level;
4928+
props.brightness = (max - min) * DIV_ROUND_CLOSEST(caps.ac_level, 100);
49294929
else
4930-
props.brightness = caps.dc_level;
4930+
props.brightness = (max - min) * DIV_ROUND_CLOSEST(caps.dc_level, 100);
49314931
/* min is zero, so max needs to be adjusted */
49324932
props.max_brightness = max - min;
49334933
drm_dbg(drm, "Backlight caps: min: %d, max: %d, ac %d, dc %d\n", min, max,

0 commit comments

Comments
 (0)