]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm: panel-backlight-quirks: Add secondary DMI match
authorAntheas Kapenekakis <lkml@antheas.dev>
Fri, 29 Aug 2025 14:55:38 +0000 (16:55 +0200)
committerMario Limonciello (AMD) <superm1@kernel.org>
Wed, 3 Sep 2025 15:22:56 +0000 (10:22 -0500)
Using a single DMI match only allows matching per manufacturer.
Introduce a second optional match to allow matching make/model.
In addition, make DMI optional to allow matching only by EDID.

Tested-by: Philip Müller <philm@manjaro.org>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
Link: https://lore.kernel.org/r/20250829145541.512671-4-lkml@antheas.dev
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
drivers/gpu/drm/drm_panel_backlight_quirks.c

index 702726c20ccc3693752e51555dd61cee7aa16d31..3d386a96e50ea4f1a9e282a34310b0fd97428cd0 100644 (file)
@@ -8,11 +8,14 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_utils.h>
 
+struct drm_panel_match {
+       enum dmi_field field;
+       const char * const value;
+};
+
 struct drm_get_panel_backlight_quirk {
-       struct {
-               enum dmi_field field;
-               const char * const value;
-       } dmi_match;
+       struct drm_panel_match dmi_match;
+       struct drm_panel_match dmi_match_other;
        struct drm_edid_ident ident;
        struct drm_panel_backlight_quirk quirk;
 };
@@ -48,7 +51,13 @@ static bool drm_panel_min_backlight_quirk_matches(
        const struct drm_get_panel_backlight_quirk *quirk,
        const struct drm_edid *edid)
 {
-       if (!dmi_match(quirk->dmi_match.field, quirk->dmi_match.value))
+       if (quirk->dmi_match.field &&
+           !dmi_match(quirk->dmi_match.field, quirk->dmi_match.value))
+               return false;
+
+       if (quirk->dmi_match_other.field &&
+           !dmi_match(quirk->dmi_match_other.field,
+                      quirk->dmi_match_other.value))
                return false;
 
        if (quirk->ident.panel_id && !drm_edid_match(edid, &quirk->ident))