Skip to content

Commit e42de47

Browse files
committed
drm/amd/display: Only read ACPI backlight caps once
JIRA: https://issues.redhat.com/browse/RHEL-75958 commit cd711c87c2862be5e71eee79901f94e1c943f9fc Author: Mario Limonciello <mario.limonciello@amd.com> Date: Thu May 29 11:33:44 2025 -0500 drm/amd/display: Only read ACPI backlight caps once commit ffcaed1 upstream. [WHY] Backlight caps are read already in amdgpu_dm_update_backlight_caps(). They may be updated by update_connector_ext_caps(). Reading again when registering backlight device may cause wrong values to be used. [HOW] Use backlight caps already registered to the dm. Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Roman Li <roman.li@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 148144f) 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 e7a6a3f commit e42de47

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4832,7 +4832,7 @@ amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
48324832
struct drm_device *drm = aconnector->base.dev;
48334833
struct amdgpu_display_manager *dm = &drm_to_adev(drm)->dm;
48344834
struct backlight_properties props = { 0 };
4835-
struct amdgpu_dm_backlight_caps caps = { 0 };
4835+
struct amdgpu_dm_backlight_caps *caps;
48364836
char bl_name[16];
48374837
int min, max;
48384838

@@ -4846,20 +4846,20 @@ amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
48464846
return;
48474847
}
48484848

4849-
amdgpu_acpi_get_backlight_caps(&caps);
4850-
if (caps.caps_valid && get_brightness_range(&caps, &min, &max)) {
4849+
caps = &dm->backlight_caps[aconnector->bl_idx];
4850+
if (get_brightness_range(caps, &min, &max)) {
48514851
if (power_supply_is_system_supplied() > 0)
4852-
props.brightness = (max - min) * DIV_ROUND_CLOSEST(caps.ac_level, 100);
4852+
props.brightness = (max - min) * DIV_ROUND_CLOSEST(caps->ac_level, 100);
48534853
else
4854-
props.brightness = (max - min) * DIV_ROUND_CLOSEST(caps.dc_level, 100);
4854+
props.brightness = (max - min) * DIV_ROUND_CLOSEST(caps->dc_level, 100);
48554855
/* min is zero, so max needs to be adjusted */
48564856
props.max_brightness = max - min;
48574857
drm_dbg(drm, "Backlight caps: min: %d, max: %d, ac %d, dc %d\n", min, max,
4858-
caps.ac_level, caps.dc_level);
4858+
caps->ac_level, caps->dc_level);
48594859
} else
48604860
props.brightness = AMDGPU_MAX_BL_LEVEL;
48614861

4862-
if (caps.data_points && !(amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE))
4862+
if (caps->data_points && !(amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE))
48634863
drm_info(drm, "Using custom brightness curve\n");
48644864
props.max_brightness = AMDGPU_MAX_BL_LEVEL;
48654865
props.type = BACKLIGHT_RAW;

0 commit comments

Comments
 (0)