[PATCH] amdgpu_acpi: add backlight control for the DC case
Alex Deucher
alexdeucher at gmail.com
Tue May 5 15:19:08 UTC 2020
Applied. Thanks!
Alex
On Tue, May 5, 2020 at 9:27 AM Andriy Gapon <avg at freebsd.org> wrote:
>
> This uses backlight_device_set_brightness() to set the brightness
> level requested via ATIF.
>
> Signed-off-by: Andriy Gapon <avg at FreeBSD.org>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 1e41367ef74ee..a8157a5154243 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -444,7 +444,6 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev,
>
> DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count);
>
> - /* todo: add DC handling */
> if ((req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) &&
> !amdgpu_device_has_dc_support(adev)) {
> struct amdgpu_encoder *enc = atif->encoder_for_bl;
> @@ -463,6 +462,25 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev,
> #endif
> }
> }
> +#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
> + if ((req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) &&
> + amdgpu_device_has_dc_support(adev)) {
> + struct amdgpu_display_manager *dm = &adev->dm;
> + struct backlight_device *bd = dm->backlight_dev;
> +
> + if (bd) {
> + DRM_DEBUG_DRIVER("Changing brightness to %d\n",
> + req.backlight_level);
> +
> + /*
> + * XXX backlight_device_set_brightness() is
> + * hardwired to post BACKLIGHT_UPDATE_SYSFS.
> + * It probably should accept 'reason' parameter.
> + */
> + backlight_device_set_brightness(bd, req.backlight_level);
> + }
> + }
> +#endif
> if (req.pending & ATIF_DGPU_DISPLAY_EVENT) {
> if (adev->flags & AMD_IS_PX) {
> pm_runtime_get_sync(adev->ddev->dev);
> --
> 2.22.0
>
More information about the amd-gfx
mailing list