[PATCH 05/15] drm/ast: Add support_fullhd flag to struct ast_device
Thomas Zimmermann
tzimmermann at suse.de
Fri Jan 24 07:57:43 UTC 2025
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.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
drivers/gpu/drm/ast/ast_drv.h | 1 +
drivers/gpu/drm/ast/ast_main.c | 22 ++++++++++++++++++++++
drivers/gpu/drm/ast/ast_mode.c | 5 +----
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index ec5b204be1dae..01ef0c0d5db7d 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -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 */
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index e1cfb2a1a5448..e6237ba92cce3 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -41,9 +41,11 @@ static void ast_detect_widescreen(struct ast_device *ast)
u8 vgacrd0;
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) {
vgacrd0 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd0);
if (!(vgacrd0 & AST_IO_VGACRD0_VRAM_INIT_BY_BMC))
@@ -52,6 +54,8 @@ static void ast_detect_widescreen(struct ast_device *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) {
vgacrd0 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd0);
if (!(vgacrd0 & AST_IO_VGACRD0_VRAM_INIT_BY_BMC))
@@ -60,6 +64,8 @@ static void ast_detect_widescreen(struct ast_device *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) {
vgacrd0 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd0);
if (!(vgacrd0 & AST_IO_VGACRD0_VRAM_INIT_BY_BMC))
@@ -68,12 +74,28 @@ static void ast_detect_widescreen(struct ast_device *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) {
+ vgacrd0 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd0);
+ if (!(vgacrd0 & AST_IO_VGACRD0_VRAM_INIT_BY_BMC))
+ ast->support_wsxga_p = true;
+ else if (vgacrd0 & AST_IO_VGACRD0_IKVM_WIDESCREEN)
+ ast->support_wsxga_p = true;
+ if (ast->support_wsxga_p) {
+ if (ast->chip == AST2200)
+ ast->support_fullhd = true;
+ }
} else if (AST_GEN(ast) >= 2) {
vgacrd0 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd0);
if (!(vgacrd0 & AST_IO_VGACRD0_VRAM_INIT_BY_BMC))
ast->support_wsxga_p = true;
else if (vgacrd0 & AST_IO_VGACRD0_IKVM_WIDESCREEN)
ast->support_wsxga_p = true;
+ if (ast->support_wsxga_p) {
+ if (ast->chip == AST2100)
+ ast->support_fullhd = true;
+ }
}
}
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index d1b3136b37693..594a58401cf66 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -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;
--
2.47.1
More information about the dri-devel
mailing list