[PATCH] drm/amd/display: Guard ACPI calls with CONFIG_ACPI

sunpeng.li at amd.com sunpeng.li at amd.com
Mon Jun 10 14:55:59 UTC 2024


From: Leo Li <sunpeng.li at amd.com>

To fix CONFIG_ACPI disabled build error.

Fixes: ec6f30c776ad ("drm/amd/display: Set default brightness according to ACPI")
Signed-off-by: Leo Li <sunpeng.li at amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index a2c098f1b07c..6b3634db4c15 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4572,7 +4572,9 @@ amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
 	struct drm_device *drm = aconnector->base.dev;
 	struct amdgpu_display_manager *dm = &drm_to_adev(drm)->dm;
 	struct backlight_properties props = { 0 };
+#if defined(CONFIG_ACPI)
 	struct amdgpu_dm_backlight_caps caps = { 0 };
+#endif
 	char bl_name[16];
 
 	if (aconnector->bl_idx == -1)
@@ -4585,6 +4587,7 @@ amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
 		return;
 	}
 
+#if defined(CONFIG_ACPI)
 	amdgpu_acpi_get_backlight_caps(&caps);
 	if (caps.caps_valid) {
 		if (power_supply_is_system_supplied() > 0)
@@ -4593,6 +4596,9 @@ amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
 			props.brightness = caps.dc_level;
 	} else
 		props.brightness = AMDGPU_MAX_BL_LEVEL;
+#else
+	props.brightness = AMDGPU_MAX_BL_LEVEL;
+#endif
 
 	props.max_brightness = AMDGPU_MAX_BL_LEVEL;
 	props.type = BACKLIGHT_RAW;
-- 
2.45.1



More information about the amd-gfx mailing list