linux/drivers/gpu/drm/amd
Alexander Monakov 37d0474542 drm/amd/display: use correct scale for actual_brightness
Documentation for sysfs backlight level interface requires that
values in both 'brightness' and 'actual_brightness' files are
interpreted to be in range from 0 to the value given in the
'max_brightness' file.

With amdgpu, max_brightness gives 255, and values written by the user
into 'brightness' are internally rescaled to a wider range. However,
reading from 'actual_brightness' gives the raw register value without
inverse rescaling. This causes issues for various userspace tools such
as PowerTop and systemd that expect the value to be in the correct
range.

Introduce a helper to retrieve internal backlight range. Use it to
reimplement 'convert_brightness' as 'convert_brightness_from_user' and
introduce 'convert_brightness_to_user'.

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=203905
Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1242
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2020-08-18 18:22:59 -04:00
..
acp drm: amd/acp: fix broken menu structure 2020-03-13 11:52:35 -04:00
amdgpu drm/amdgpu/jpeg: remove redundant check when it returns 2020-08-18 18:22:16 -04:00
amdkfd drm/amdkfd: Initialize SDMA activity counter to 0 2020-08-18 18:19:57 -04:00
display drm/amd/display: use correct scale for actual_brightness 2020-08-18 18:22:59 -04:00
include drm/amd/display: Add DSC_DBG_EN shift/mask for dcn3 2020-08-17 14:09:27 -04:00
pm drm/amdgpu/pm: only hide average power on SI and pre-RENOIR APUs 2020-08-18 18:22:40 -04:00