@@ -25,6 +25,7 @@ config DRM_AMDGPU
select DRM_BUDDY
select DRM_SUBALLOC_HELPER
select DRM_EXEC
+ select DRM_PANEL_BACKLIGHT_QUIRKS
# amdgpu depends on ACPI_VIDEO when ACPI is enabled, for select to work
# ACPI_VIDEO's dependencies must also be selected.
select INPUT if ACPI
@@ -93,6 +93,7 @@
#include <drm/drm_fourcc.h>
#include <drm/drm_edid.h>
#include <drm/drm_eld.h>
+#include <drm/drm_utils.h>
#include <drm/drm_vblank.h>
#include <drm/drm_audio_component.h>
#include <drm/drm_gem_atomic_helper.h>
@@ -3329,6 +3330,31 @@ static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
.atomic_commit_setup = drm_dp_mst_atomic_setup_commit,
};
+static void amdgpu_dm_apply_backlight_quirks(struct amdgpu_dm_connector *aconnector,
+ struct amdgpu_dm_backlight_caps *caps)
+{
+ const struct drm_panel_backlight_quirk *quirk;
+ const struct drm_edid *edid;
+
+ edid = drm_edid_alloc(aconnector->edid, EDID_LENGTH * (aconnector->edid->extensions + 1));
+ if (!edid)
+ return;
+
+ quirk = drm_get_panel_backlight_quirk(edid);
+
+ drm_edid_free(edid);
+
+ if (!quirk)
+ return;
+
+ if (quirk->overrides.pwm_min_brightness &&
+ caps->min_input_signal != quirk->pwm_min_brightness) {
+ drm_info(aconnector->base.dev,
+ "Quirk: backlight min_input_signal=%d\n", quirk->pwm_min_brightness);
+ caps->min_input_signal = quirk->pwm_min_brightness;
+ }
+}
+
static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
{
struct amdgpu_dm_backlight_caps *caps;
@@ -3369,6 +3395,8 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
caps->aux_min_input_signal = 0;
caps->aux_max_input_signal = 512;
}
+
+ amdgpu_dm_apply_backlight_quirks(aconnector, caps);
}
void amdgpu_dm_update_connector_after_detect(
Not all platforms provide correct PWM backlight capabilities through ATIF. Use the generic drm backlight quirk infrastructure to override the capabilities where necessary. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- drivers/gpu/drm/amd/amdgpu/Kconfig | 1 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 28 +++++++++++++++++++++++ 2 files changed, 29 insertions(+)