drm/amd/display: fix ABM disablement

commit b9f46f0b98784e40288ee393f863f553fde062fa upstream.

On recent versions of DMUB firmware, if we want to completely disable
ABM we have to pass ABM_LEVEL_IMMEDIATE_DISABLE as the requested ABM
level to DMUB. Otherwise, LCD eDP displays are unable to reach their
maximum brightness levels. So, to fix this whenever the user requests an
ABM level of 0 pass ABM_LEVEL_IMMEDIATE_DISABLE to DMUB instead. Also,
to keep the user's experience consistent map ABM_LEVEL_IMMEDIATE_DISABLE
to 0 when a user tries to read the requested ABM level.

Cc: stable@vger.kernel.org # 6.1+
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Hamza Mahfooz 2023-11-22 14:50:34 -05:00 committed by Greg Kroah-Hartman
parent 859a3a9f1e
commit 7cfc3884a8
1 changed files with 5 additions and 3 deletions

View File

@ -6149,7 +6149,7 @@ int amdgpu_dm_connector_atomic_set_property(struct drm_connector *connector,
dm_new_state->underscan_enable = val; dm_new_state->underscan_enable = val;
ret = 0; ret = 0;
} else if (property == adev->mode_info.abm_level_property) { } else if (property == adev->mode_info.abm_level_property) {
dm_new_state->abm_level = val; dm_new_state->abm_level = val ?: ABM_LEVEL_IMMEDIATE_DISABLE;
ret = 0; ret = 0;
} }
@ -6194,7 +6194,8 @@ int amdgpu_dm_connector_atomic_get_property(struct drm_connector *connector,
*val = dm_state->underscan_enable; *val = dm_state->underscan_enable;
ret = 0; ret = 0;
} else if (property == adev->mode_info.abm_level_property) { } else if (property == adev->mode_info.abm_level_property) {
*val = dm_state->abm_level; *val = (dm_state->abm_level != ABM_LEVEL_IMMEDIATE_DISABLE) ?
dm_state->abm_level : 0;
ret = 0; ret = 0;
} }
@ -6274,7 +6275,8 @@ void amdgpu_dm_connector_funcs_reset(struct drm_connector *connector)
state->pbn = 0; state->pbn = 0;
if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) if (connector->connector_type == DRM_MODE_CONNECTOR_eDP)
state->abm_level = amdgpu_dm_abm_level; state->abm_level = amdgpu_dm_abm_level ?:
ABM_LEVEL_IMMEDIATE_DISABLE;
__drm_atomic_helper_connector_reset(connector, &state->base); __drm_atomic_helper_connector_reset(connector, &state->base);
} }