drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
When the laptop is plugged into AC or DC 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.
Signed-off-by: Yuanzhi Wang <wangyuanzhi@uniontech.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 ++++++++-
1 file changed, 8 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..93f1567028c5 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,13 @@ 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 greater than ACPI brightness
+ %d\n", old_brightness, req.backlight_level);
+ else
+ backlight_device_set_brightness(atif->bd,
+ req.backlight_level);
}
}
--
2.20.1
On 2/27/23 01:39, Yuanzhi Wang wrote: > When the laptop is plugged into AC or DC 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. > Do you have a matching bug report with more information included? Some relevant details I think we need: kernel version laptop model BIOS version if it's the latest BIOS some sample numbers that this new warning/behavior catches acpidump At least as described this sounds like a BIOS bug. > Signed-off-by: Yuanzhi Wang <wangyuanzhi@uniontech.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 ++++++++- > 1 file changed, 8 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..93f1567028c5 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,13 @@ 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 greater than ACPI brightness > + %d\n", old_brightness, req.backlight_level); > + else > + backlight_device_set_brightness(atif->bd, > + req.backlight_level); > } > } >
Hello, I have fixed compilation errors. The lenovo ThinkBook 14 G3 ACL notebook bios reports very small brightness value, 3 eg. On 2023/2/27 22:20, Mario Limonciello wrote: > On 2/27/23 01:39, Yuanzhi Wang wrote: >> When the laptop is plugged into AC or DC 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. >> > > Do you have a matching bug report with more information included? > > Some relevant details I think we need: > kernel version > laptop model > BIOS version > if it's the latest BIOS > some sample numbers that this new warning/behavior catches > acpidump > > At least as described this sounds like a BIOS bug. > >> Signed-off-by: Yuanzhi Wang <wangyuanzhi@uniontech.com> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 9 ++++++++- >> 1 file changed, 8 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..93f1567028c5 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,13 @@ 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 greater than ACPI >> brightness >> + %d\n", old_brightness, req.backlight_level); >> + else >> + backlight_device_set_brightness(atif->bd, >> + req.backlight_level); >> } >> } > >
Hi Yuanzhi, Thank you for the patch! Yet something to improve: [auto build test ERROR on drm-misc/drm-misc-next] [also build test ERROR on linus/master v6.2 next-20230227] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Yuanzhi-Wang/amdgpu-add-a-filter-condition-when-set-brightness/20230227-154108 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230227073953.326-1-wangyuanzhi%40uniontech.com patch subject: [PATCH] amdgpu: add a filter condition when set brightness config: loongarch-randconfig-r036-20230226 (https://download.01.org/0day-ci/archive/20230227/202302272122.p3DfX4S8-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/95d9579e31d0b601aa1422cf767ca5138d3efcee git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Yuanzhi-Wang/amdgpu-add-a-filter-condition-when-set-brightness/20230227-154108 git checkout 95d9579e31d0b601aa1422cf767ca5138d3efcee # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch SHELL=/bin/bash drivers/gpu/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202302272122.p3DfX4S8-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c: In function 'amdgpu_atif_handler': drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:50: warning: missing terminating " character 449 | DRM_WARN("old brightness %d is greater than ACPI brightness | ^ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:450:53: warning: missing terminating " character 450 | %d\n", old_brightness, req.backlight_level); | ^ >> cc1: error: unterminated argument list invoking macro "DRM_WARN" >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: 'DRM_WARN' undeclared (first use in this function) 449 | DRM_WARN("old brightness %d is greater than ACPI brightness | ^~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: note: each undeclared identifier is reported only once for each function it appears in >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:49: error: expected ';' at end of input 449 | DRM_WARN("old brightness %d is greater than ACPI brightness | ^ | ; ...... drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:448:33: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers 448 | if (old_brightness > req.backlight_level) | ^~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:448:33: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: expected declaration or statement at end of input 449 | DRM_WARN("old brightness %d is greater than ACPI brightness | ^~~~~~~~ >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: expected declaration or statement at end of input >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: expected declaration or statement at end of input >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: expected declaration or statement at end of input drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c: At top level: drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:404:12: warning: 'amdgpu_atif_handler' defined but not used [-Wunused-function] 404 | static int amdgpu_atif_handler(struct amdgpu_device *adev, | ^~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:308:12: warning: 'amdgpu_atif_query_backlight_caps' defined but not used [-Wunused-function] 308 | static int amdgpu_atif_query_backlight_caps(struct amdgpu_atif *atif) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:240:12: warning: 'amdgpu_atif_get_notification_params' defined but not used [-Wunused-function] 240 | static int amdgpu_atif_get_notification_params(struct amdgpu_atif *atif) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:195:12: warning: 'amdgpu_atif_verify_interface' defined but not used [-Wunused-function] 195 | static int amdgpu_atif_verify_interface(struct amdgpu_atif *atif) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:36, from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:30, from drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26, from drivers/gpu/drm/amd/amdgpu/amdgpu.h:64, from drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:35: drivers/gpu/drm/amd/amdgpu/../display/dc/dc_hdmi_types.h:53:22: warning: 'dp_hdmi_dongle_signature_str' defined but not used [-Wunused-const-variable=] 53 | static const uint8_t dp_hdmi_dongle_signature_str[] = "DP-HDMI ADAPTOR"; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
Hi Yuanzhi, Thank you for the patch! Yet something to improve: [auto build test ERROR on drm-misc/drm-misc-next] [also build test ERROR on linus/master v6.2 next-20230227] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Yuanzhi-Wang/amdgpu-add-a-filter-condition-when-set-brightness/20230227-154108 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230227073953.326-1-wangyuanzhi%40uniontech.com patch subject: [PATCH] amdgpu: add a filter condition when set brightness config: arm64-randconfig-r012-20230226 (https://download.01.org/0day-ci/archive/20230227/202302272051.KDJqRyl5-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db89896bbbd2251fff457699635acbbedeead27f) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/95d9579e31d0b601aa1422cf767ca5138d3efcee git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Yuanzhi-Wang/amdgpu-add-a-filter-condition-when-set-brightness/20230227-154108 git checkout 95d9579e31d0b601aa1422cf767ca5138d3efcee # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202302272051.KDJqRyl5-lkp@intel.com/ All error/warnings (new ones prefixed by >>): >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:15: warning: missing terminating '"' character [-Winvalid-pp-token] DRM_WARN("old brightness %d is greater than ACPI brightness ^ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:450:11: warning: missing terminating '"' character [-Winvalid-pp-token] %d\n", old_brightness, req.backlight_level); ^ >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:6: error: unterminated function-like macro invocation DRM_WARN("old brightness %d is greater than ACPI brightness ^ include/drm/drm_print.h:543:9: note: macro 'DRM_WARN' defined here #define DRM_WARN(fmt, ...) \ ^ >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1105:28: error: expected expression #endif /* CONFIG_SUSPEND */ ^ >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1105:28: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation] drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:448:5: note: previous statement is here if (old_brightness > req.backlight_level) ^ >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1105:28: error: expected '}' #endif /* CONFIG_SUSPEND */ ^ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:439:18: note: to match this '{' if (atif->bd) { ^ >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1105:28: error: expected '}' #endif /* CONFIG_SUSPEND */ ^ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:438:59: note: to match this '{' if (req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) { ^ >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1105:28: error: expected '}' #endif /* CONFIG_SUSPEND */ ^ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:427:38: note: to match this '{' if (atif->functions.sbios_requests) { ^ >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1105:28: error: expected '}' #endif /* CONFIG_SUSPEND */ ^ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:406:1: note: to match this '{' { ^ 3 warnings and 6 errors generated. vim +449 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c 391 392 /** 393 * amdgpu_atif_handler - handle ATIF notify requests 394 * 395 * @adev: amdgpu_device pointer 396 * @event: atif sbios request struct 397 * 398 * Checks the acpi event and if it matches an atif event, 399 * handles it. 400 * 401 * Returns: 402 * NOTIFY_BAD or NOTIFY_DONE, depending on the event. 403 */ 404 static int amdgpu_atif_handler(struct amdgpu_device *adev, 405 struct acpi_bus_event *event) 406 { 407 struct amdgpu_atif *atif = &amdgpu_acpi_priv.atif; 408 int count; 409 int old_brightness; 410 411 DRM_DEBUG_DRIVER("event, device_class = %s, type = %#x\n", 412 event->device_class, event->type); 413 414 if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0) 415 return NOTIFY_DONE; 416 417 /* Is this actually our event? */ 418 if (!atif->notification_cfg.enabled || 419 event->type != atif->notification_cfg.command_code) { 420 /* These events will generate keypresses otherwise */ 421 if (event->type == ACPI_VIDEO_NOTIFY_PROBE) 422 return NOTIFY_BAD; 423 else 424 return NOTIFY_DONE; 425 } 426 427 if (atif->functions.sbios_requests) { 428 struct atif_sbios_requests req; 429 430 /* Check pending SBIOS requests */ 431 count = amdgpu_atif_get_sbios_requests(atif, &req); 432 433 if (count <= 0) 434 return NOTIFY_BAD; 435 436 DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count); 437 438 if (req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) { 439 if (atif->bd) { 440 DRM_DEBUG_DRIVER("Changing brightness to %d\n", 441 req.backlight_level); 442 /* 443 * XXX backlight_device_set_brightness() is 444 * hardwired to post BACKLIGHT_UPDATE_SYSFS. 445 * It probably should accept 'reason' parameter. 446 */ 447 old_brightness = backlight_get_brightness(atif->bd); 448 if (old_brightness > req.backlight_level) > 449 DRM_WARN("old brightness %d is greater than ACPI brightness 450 %d\n", old_brightness, req.backlight_level); 451 else 452 backlight_device_set_brightness(atif->bd, 453 req.backlight_level); 454 } 455 } 456 457 if (req.pending & ATIF_DGPU_DISPLAY_EVENT) { 458 if (adev->flags & AMD_IS_PX) { 459 pm_runtime_get_sync(adev_to_drm(adev)->dev); 460 /* Just fire off a uevent and let userspace tell us what to do */ 461 drm_helper_hpd_irq_event(adev_to_drm(adev)); 462 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); 463 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); 464 } 465 } 466 /* TODO: check other events */ 467 } 468 469 /* We've handled the event, stop the notifier chain. The ACPI interface 470 * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to 471 * userspace if the event was generated only to signal a SBIOS 472 * request. 473 */ 474 return NOTIFY_BAD; 475 } 476 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
Hi Yuanzhi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on drm-misc/drm-misc-next] [also build test WARNING on linus/master v6.2 next-20230227] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Yuanzhi-Wang/amdgpu-add-a-filter-condition-when-set-brightness/20230227-154108 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230227073953.326-1-wangyuanzhi%40uniontech.com patch subject: [PATCH] amdgpu: add a filter condition when set brightness config: loongarch-randconfig-r036-20230226 (https://download.01.org/0day-ci/archive/20230227/202302271822.ZZYRdzTn-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/95d9579e31d0b601aa1422cf767ca5138d3efcee git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Yuanzhi-Wang/amdgpu-add-a-filter-condition-when-set-brightness/20230227-154108 git checkout 95d9579e31d0b601aa1422cf767ca5138d3efcee # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202302271822.ZZYRdzTn-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c: In function 'amdgpu_atif_handler': >> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:50: warning: missing terminating " character 449 | DRM_WARN("old brightness %d is greater than ACPI brightness | ^ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:450:53: warning: missing terminating " character 450 | %d\n", old_brightness, req.backlight_level); | ^ cc1: error: unterminated argument list invoking macro "DRM_WARN" drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: 'DRM_WARN' undeclared (first use in this function) 449 | DRM_WARN("old brightness %d is greater than ACPI brightness | ^~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:49: error: expected ';' at end of input 449 | DRM_WARN("old brightness %d is greater than ACPI brightness | ^ | ; ...... drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:448:33: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers 448 | if (old_brightness > req.backlight_level) | ^~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:448:33: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: expected declaration or statement at end of input 449 | DRM_WARN("old brightness %d is greater than ACPI brightness | ^~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: expected declaration or statement at end of input drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: expected declaration or statement at end of input drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:449:41: error: expected declaration or statement at end of input drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c: At top level: drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:404:12: warning: 'amdgpu_atif_handler' defined but not used [-Wunused-function] 404 | static int amdgpu_atif_handler(struct amdgpu_device *adev, | ^~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:308:12: warning: 'amdgpu_atif_query_backlight_caps' defined but not used [-Wunused-function] 308 | static int amdgpu_atif_query_backlight_caps(struct amdgpu_atif *atif) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:240:12: warning: 'amdgpu_atif_get_notification_params' defined but not used [-Wunused-function] 240 | static int amdgpu_atif_get_notification_params(struct amdgpu_atif *atif) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:195:12: warning: 'amdgpu_atif_verify_interface' defined but not used [-Wunused-function] 195 | static int amdgpu_atif_verify_interface(struct amdgpu_atif *atif) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:36, from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:30, from drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26, from drivers/gpu/drm/amd/amdgpu/amdgpu.h:64, from drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:35: drivers/gpu/drm/amd/amdgpu/../display/dc/dc_hdmi_types.h:53:22: warning: 'dp_hdmi_dongle_signature_str' defined but not used [-Wunused-const-variable=] 53 | static const uint8_t dp_hdmi_dongle_signature_str[] = "DP-HDMI ADAPTOR"; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +449 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c 391 392 /** 393 * amdgpu_atif_handler - handle ATIF notify requests 394 * 395 * @adev: amdgpu_device pointer 396 * @event: atif sbios request struct 397 * 398 * Checks the acpi event and if it matches an atif event, 399 * handles it. 400 * 401 * Returns: 402 * NOTIFY_BAD or NOTIFY_DONE, depending on the event. 403 */ 404 static int amdgpu_atif_handler(struct amdgpu_device *adev, 405 struct acpi_bus_event *event) 406 { 407 struct amdgpu_atif *atif = &amdgpu_acpi_priv.atif; 408 int count; 409 int old_brightness; 410 411 DRM_DEBUG_DRIVER("event, device_class = %s, type = %#x\n", 412 event->device_class, event->type); 413 414 if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0) 415 return NOTIFY_DONE; 416 417 /* Is this actually our event? */ 418 if (!atif->notification_cfg.enabled || 419 event->type != atif->notification_cfg.command_code) { 420 /* These events will generate keypresses otherwise */ 421 if (event->type == ACPI_VIDEO_NOTIFY_PROBE) 422 return NOTIFY_BAD; 423 else 424 return NOTIFY_DONE; 425 } 426 427 if (atif->functions.sbios_requests) { 428 struct atif_sbios_requests req; 429 430 /* Check pending SBIOS requests */ 431 count = amdgpu_atif_get_sbios_requests(atif, &req); 432 433 if (count <= 0) 434 return NOTIFY_BAD; 435 436 DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count); 437 438 if (req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) { 439 if (atif->bd) { 440 DRM_DEBUG_DRIVER("Changing brightness to %d\n", 441 req.backlight_level); 442 /* 443 * XXX backlight_device_set_brightness() is 444 * hardwired to post BACKLIGHT_UPDATE_SYSFS. 445 * It probably should accept 'reason' parameter. 446 */ 447 old_brightness = backlight_get_brightness(atif->bd); 448 if (old_brightness > req.backlight_level) > 449 DRM_WARN("old brightness %d is greater than ACPI brightness 450 %d\n", old_brightness, req.backlight_level); 451 else 452 backlight_device_set_brightness(atif->bd, 453 req.backlight_level); 454 } 455 } 456 457 if (req.pending & ATIF_DGPU_DISPLAY_EVENT) { 458 if (adev->flags & AMD_IS_PX) { 459 pm_runtime_get_sync(adev_to_drm(adev)->dev); 460 /* Just fire off a uevent and let userspace tell us what to do */ 461 drm_helper_hpd_irq_event(adev_to_drm(adev)); 462 pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); 463 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); 464 } 465 } 466 /* TODO: check other events */ 467 } 468 469 /* We've handled the event, stop the notifier chain. The ACPI interface 470 * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to 471 * userspace if the event was generated only to signal a SBIOS 472 * request. 473 */ 474 return NOTIFY_BAD; 475 } 476 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
© 2016 - 2025 Red Hat, Inc.