drm/ast: Add support_fullhd flag to struct ast_device
authorThomas Zimmermann <tzimmermann@suse.de>
Fri, 31 Jan 2025 09:21:05 +0000 (10:21 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 3 Feb 2025 13:01:06 +0000 (14:01 +0100)
Detect support for 1920x1080 (FullHD) in ast_detect_widescreen(). The
flag is cleared by default. The test logic has been taken from existing
code in ast_crtc_helper_mode_valid(). The code in that function is being
replaced by the new flag.

For Gen3, a new branch duplicates the Gen2 logic and adds a test for
AST2200. Gen2 adds a test for AST2100.

v2:
- use fullhd flag for setting max width/height

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250131092257.115596-6-tzimmermann@suse.de
drivers/gpu/drm/ast/ast_drv.h
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/ast/ast_mode.c

index ec5b204be1dae048046ecac8b529f80bdb58474a..01ef0c0d5db7d7989daee29215c5bb073a394681 100644 (file)
@@ -206,6 +206,7 @@ struct ast_device {
        } output;
 
        bool support_wsxga_p; /* 1680x1050 */
+       bool support_fullhd; /* 1920x1080 */
 
        u8 *dp501_fw_addr;
        const struct firmware *dp501_fw;        /* dp501 fw */
index 93ae9a275c9604111e3e58afd9d0b0e0187def6a..6e964a0714b4bdd78557e70c3a30fde486dcec7c 100644 (file)
@@ -52,27 +52,46 @@ static bool __ast_2100_detect_wsxga_p(struct ast_device *ast)
 static void ast_detect_widescreen(struct ast_device *ast)
 {
        ast->support_wsxga_p = false;
+       ast->support_fullhd = false;
 
        if (AST_GEN(ast) >= 7) {
                ast->support_wsxga_p = true;
+               ast->support_fullhd = true;
        } else if (AST_GEN(ast) >= 6) {
                if (__ast_2100_detect_wsxga_p(ast))
                        ast->support_wsxga_p = true;
                else if (ast->chip == AST2510)
                        ast->support_wsxga_p = true;
+               if (ast->support_wsxga_p)
+                       ast->support_fullhd = true;
        } else if (AST_GEN(ast) >= 5) {
                if (__ast_2100_detect_wsxga_p(ast))
                        ast->support_wsxga_p = true;
                else if (ast->chip == AST1400)
                        ast->support_wsxga_p = true;
+               if (ast->support_wsxga_p)
+                       ast->support_fullhd = true;
        } else if (AST_GEN(ast) >= 4) {
                if (__ast_2100_detect_wsxga_p(ast))
                        ast->support_wsxga_p = true;
                else if (ast->chip == AST1300)
                        ast->support_wsxga_p = true;
+               if (ast->support_wsxga_p)
+                       ast->support_fullhd = true;
+       } else if (AST_GEN(ast) >= 3) {
+               if (__ast_2100_detect_wsxga_p(ast))
+                       ast->support_wsxga_p = true;
+               if (ast->support_wsxga_p) {
+                       if (ast->chip == AST2200)
+                               ast->support_fullhd = true;
+               }
        } else if (AST_GEN(ast) >= 2) {
                if (__ast_2100_detect_wsxga_p(ast))
                        ast->support_wsxga_p = true;
+               if (ast->support_wsxga_p) {
+                       if (ast->chip == AST2100)
+                               ast->support_fullhd = true;
+               }
        }
 }
 
index d1b3136b37693a4acba2ce17095891d224066ac4..dda2c4fb0a48b02722195a75d6c2dcae7db2a028 100644 (file)
@@ -1036,10 +1036,7 @@ ast_crtc_helper_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode
                if ((mode->hdisplay == 1600) && (mode->vdisplay == 900))
                        return MODE_OK;
 
-               if ((ast->chip == AST2100) || // GEN2, but not AST1100 (?)
-                   (ast->chip == AST2200) || // GEN3, but not AST2150 (?)
-                   IS_AST_GEN4(ast) || IS_AST_GEN5(ast) ||
-                   IS_AST_GEN6(ast) || IS_AST_GEN7(ast)) {
+               if (ast->support_fullhd) {
                        if ((mode->hdisplay == 1920) && (mode->vdisplay == 1080))
                                return MODE_OK;
 
@@ -1371,12 +1368,7 @@ int ast_mode_config_init(struct ast_device *ast)
        dev->mode_config.min_height = 0;
        dev->mode_config.preferred_depth = 24;
 
-       if (ast->chip == AST2100 || // GEN2, but not AST1100 (?)
-           ast->chip == AST2200 || // GEN3, but not AST2150 (?)
-           IS_AST_GEN7(ast) ||
-           IS_AST_GEN6(ast) ||
-           IS_AST_GEN5(ast) ||
-           IS_AST_GEN4(ast)) {
+       if (ast->support_fullhd) {
                dev->mode_config.max_width = 1920;
                dev->mode_config.max_height = 2048;
        } else {