lkml.org 
[lkml]   [2023]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] amdgpu: add a filter condition when set brightness
Date
There is a lenovo ThinkBook 14 G3 ACL notebook, when
the laptop is plugged into AC power supply, the
brightness obtained ACPI may be smaller than current
brightness.As a result the screen becomes dark,this is
not what people want. So we should add So we should
filter out very small brightness values obtained from ACPI

Signed-off-by: Yuanzhi Wang <wangyuanzhi@uniontech.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index d4196fcb85a0..20e7a178765d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -406,6 +406,7 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev,
{
struct amdgpu_atif *atif = &amdgpu_acpi_priv.atif;
int count;
+ int old_brightness;

DRM_DEBUG_DRIVER("event, device_class = %s, type = %#x\n",
event->device_class, event->type);
@@ -443,7 +444,14 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev,
* hardwired to post BACKLIGHT_UPDATE_SYSFS.
* It probably should accept 'reason' parameter.
*/
- backlight_device_set_brightness(atif->bd, req.backlight_level);
+ old_brightness = backlight_get_brightness(atif->bd);
+ if (old_brightness > req.backlight_level)
+ DRM_WARN(
+ "Old brightness %d is larger than ACPI brightness %d\n",
+ old_brightness, req.backlight_level);
+ else
+ backlight_device_set_brightness(atif->bd,
+ req.backlight_level);
}
}

--
2.20.1
\
 
 \ /
  Last update: 2023-03-27 00:38    [W:0.024 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site