[PATCH] drm/amd/display: Don't register panel_power_savings on OLED panels

Harry Wentland harry.wentland at amd.com
Mon May 13 11:06:46 UTC 2024


On 2024-05-09 13:05, Mario Limonciello wrote:
> OLED panels don't support the ABM, they shouldn't offer the
> panel_power_savings attribute to the user. Check whether aux BL
> control support was enabled to decide whether to offer it.
> 
> Reported-by: Gergo Koteles <soyer at irl.hu>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3359
> Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>

Reviewed-by: Harry Wentland <harry.wentland at amd.com>

Harry

> ---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 29 ++++++++++++++++---
>   1 file changed, 25 insertions(+), 4 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 3054bf79fc99..ce2ec857b8a6 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -6532,12 +6532,34 @@ static const struct attribute_group amdgpu_group = {
>   	.attrs = amdgpu_attrs
>   };
>   
> +static bool
> +amdgpu_dm_should_create_sysfs(struct amdgpu_dm_connector *amdgpu_dm_connector)
> +{
> +	if (amdgpu_dm_abm_level >= 0)
> +		return false;
> +
> +	if (amdgpu_dm_connector->base.connector_type != DRM_MODE_CONNECTOR_eDP)
> +		return false;
> +
> +	/* check for OLED panels */
> +	if (amdgpu_dm_connector->bl_idx >= 0) {
> +		struct drm_device *drm = amdgpu_dm_connector->base.dev;
> +		struct amdgpu_display_manager *dm = &drm_to_adev(drm)->dm;
> +		struct amdgpu_dm_backlight_caps *caps;
> +
> +		caps = &dm->backlight_caps[amdgpu_dm_connector->bl_idx];
> +		if (caps->aux_support)
> +			return false;
> +	}
> +
> +	return true;
> +}
> +
>   static void amdgpu_dm_connector_unregister(struct drm_connector *connector)
>   {
>   	struct amdgpu_dm_connector *amdgpu_dm_connector = to_amdgpu_dm_connector(connector);
>   
> -	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP &&
> -	    amdgpu_dm_abm_level < 0)
> +	if (amdgpu_dm_should_create_sysfs(amdgpu_dm_connector))
>   		sysfs_remove_group(&connector->kdev->kobj, &amdgpu_group);
>   
>   	drm_dp_aux_unregister(&amdgpu_dm_connector->dm_dp_aux.aux);
> @@ -6644,8 +6666,7 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
>   		to_amdgpu_dm_connector(connector);
>   	int r;
>   
> -	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP &&
> -	    amdgpu_dm_abm_level < 0) {
> +	if (amdgpu_dm_should_create_sysfs(amdgpu_dm_connector)) {
>   		r = sysfs_create_group(&connector->kdev->kobj,
>   				       &amdgpu_group);
>   		if (r)


More information about the amd-gfx mailing list