Commit 0ad3e64e authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu/display: handle aux backlight in backlight_get_brightness

Need to fetch it via aux.
Reviewed-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
parent dfd8b7fb
...@@ -3258,11 +3258,27 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) ...@@ -3258,11 +3258,27 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd) static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
{ {
struct amdgpu_display_manager *dm = bl_get_data(bd); struct amdgpu_display_manager *dm = bl_get_data(bd);
int ret = dc_link_get_backlight_level(dm->backlight_link); struct amdgpu_dm_backlight_caps caps;
amdgpu_dm_update_backlight_caps(dm);
caps = dm->backlight_caps;
if (ret == DC_ERROR_UNEXPECTED) if (caps.aux_support) {
return bd->props.brightness; struct dc_link *link = (struct dc_link *)dm->backlight_link;
return convert_brightness_to_user(&dm->backlight_caps, ret); u32 avg, peak;
bool rc;
rc = dc_link_get_backlight_level_nits(link, &avg, &peak);
if (!rc)
return bd->props.brightness;
return convert_brightness_to_user(&caps, avg);
} else {
int ret = dc_link_get_backlight_level(dm->backlight_link);
if (ret == DC_ERROR_UNEXPECTED)
return bd->props.brightness;
return convert_brightness_to_user(&caps, ret);
}
} }
static const struct backlight_ops amdgpu_dm_backlight_ops = { static const struct backlight_ops amdgpu_dm_backlight_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment