Skip to content

Commit 81f4d4b

Browse files
superm1alexdeucher
authored andcommitted
drm/amd/display: Don't change brightness for disabled connectors
[WHY] When a laptop lid is closed the connector is disabled but userspace can still try to change brightness. This doesn't work because the panel is turned off. It will eventually time out, but there is a lot of stutter along the way. [How] Iterate all connectors to check whether the matching one for the backlight index is enabled. Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4675 Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Ray Wu <ray.wu@amd.com> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit f6eeab3) Cc: stable@vger.kernel.org
1 parent 3ce62c1 commit 81f4d4b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5052,6 +5052,21 @@ static void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
50525052
struct dc_link *link;
50535053
u32 brightness;
50545054
bool rc, reallow_idle = false;
5055+
struct drm_connector *connector;
5056+
5057+
list_for_each_entry(connector, &dm->ddev->mode_config.connector_list, head) {
5058+
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
5059+
5060+
if (aconnector->bl_idx != bl_idx)
5061+
continue;
5062+
5063+
/* if connector is off, save the brightness for next time it's on */
5064+
if (!aconnector->base.encoder) {
5065+
dm->brightness[bl_idx] = user_brightness;
5066+
dm->actual_brightness[bl_idx] = 0;
5067+
return;
5068+
}
5069+
}
50555070

50565071
amdgpu_dm_update_backlight_caps(dm, bl_idx);
50575072
caps = &dm->backlight_caps[bl_idx];

0 commit comments

Comments
 (0)