drm/ast: Add support_wuxga flag to struct ast_device

Detect support for 1920x1200 (WUXGA) 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.

v2:
- move shared detection code into helper (Jocelyn)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250131092257.115596-7-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann
2025-01-31 10:21:06 +01:00
parent 7a74caabe1
commit 454bdaccca
4 changed files with 32 additions and 5 deletions
+1
View File
@@ -207,6 +207,7 @@ struct ast_device {
bool support_wsxga_p; /* 1680x1050 */
bool support_fullhd; /* 1920x1080 */
bool support_wuxga; /* 1920x1200 */
u8 *dp501_fw_addr;
const struct firmware *dp501_fw; /* dp501 fw */
+27
View File
@@ -49,14 +49,31 @@ static bool __ast_2100_detect_wsxga_p(struct ast_device *ast)
return false;
}
/* Try to detect WUXGA on Gen2+ */
static bool __ast_2100_detect_wuxga(struct ast_device *ast)
{
u8 vgacrd1;
if (ast->support_fullhd) {
vgacrd1 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd1);
if (!(vgacrd1 & AST_IO_VGACRD1_SUPPORTS_WUXGA))
return true;
}
return false;
}
static void ast_detect_widescreen(struct ast_device *ast)
{
ast->support_wsxga_p = false;
ast->support_fullhd = false;
ast->support_wuxga = false;
if (AST_GEN(ast) >= 7) {
ast->support_wsxga_p = true;
ast->support_fullhd = true;
if (__ast_2100_detect_wuxga(ast))
ast->support_wuxga = true;
} else if (AST_GEN(ast) >= 6) {
if (__ast_2100_detect_wsxga_p(ast))
ast->support_wsxga_p = true;
@@ -64,6 +81,8 @@ static void ast_detect_widescreen(struct ast_device *ast)
ast->support_wsxga_p = true;
if (ast->support_wsxga_p)
ast->support_fullhd = true;
if (__ast_2100_detect_wuxga(ast))
ast->support_wuxga = true;
} else if (AST_GEN(ast) >= 5) {
if (__ast_2100_detect_wsxga_p(ast))
ast->support_wsxga_p = true;
@@ -71,6 +90,8 @@ static void ast_detect_widescreen(struct ast_device *ast)
ast->support_wsxga_p = true;
if (ast->support_wsxga_p)
ast->support_fullhd = true;
if (__ast_2100_detect_wuxga(ast))
ast->support_wuxga = true;
} else if (AST_GEN(ast) >= 4) {
if (__ast_2100_detect_wsxga_p(ast))
ast->support_wsxga_p = true;
@@ -78,6 +99,8 @@ static void ast_detect_widescreen(struct ast_device *ast)
ast->support_wsxga_p = true;
if (ast->support_wsxga_p)
ast->support_fullhd = true;
if (__ast_2100_detect_wuxga(ast))
ast->support_wuxga = true;
} else if (AST_GEN(ast) >= 3) {
if (__ast_2100_detect_wsxga_p(ast))
ast->support_wsxga_p = true;
@@ -85,6 +108,8 @@ static void ast_detect_widescreen(struct ast_device *ast)
if (ast->chip == AST2200)
ast->support_fullhd = true;
}
if (__ast_2100_detect_wuxga(ast))
ast->support_wuxga = true;
} else if (AST_GEN(ast) >= 2) {
if (__ast_2100_detect_wsxga_p(ast))
ast->support_wsxga_p = true;
@@ -92,6 +117,8 @@ static void ast_detect_widescreen(struct ast_device *ast)
if (ast->chip == AST2100)
ast->support_fullhd = true;
}
if (__ast_2100_detect_wuxga(ast))
ast->support_wuxga = true;
}
}
+3 -5
View File
@@ -1022,7 +1022,6 @@ ast_crtc_helper_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode
{
struct ast_device *ast = to_ast_device(crtc->dev);
enum drm_mode_status status;
uint32_t jtemp;
if (ast->support_wsxga_p) {
if ((mode->hdisplay == 1680) && (mode->vdisplay == 1050))
@@ -1041,11 +1040,10 @@ ast_crtc_helper_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode
return MODE_OK;
if ((mode->hdisplay == 1920) && (mode->vdisplay == 1200)) {
jtemp = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd1, 0xff);
if (jtemp & 0x01)
return MODE_NOMODE;
else
if (ast->support_wuxga)
return MODE_OK;
else
return MODE_NOMODE;
}
}
}
+1
View File
@@ -55,6 +55,7 @@
#define AST_IO_VGACRD1_TX_ANX9807_VBIOS 0x0a
#define AST_IO_VGACRD1_TX_FW_EMBEDDED_FW 0x0c /* special case of DP501 */
#define AST_IO_VGACRD1_TX_ASTDP 0x0e
#define AST_IO_VGACRD1_SUPPORTS_WUXGA BIT(0)
#define AST_IO_VGACRD7_EDID_VALID_FLAG BIT(0)
#define AST_IO_VGACRDC_LINK_SUCCESS BIT(0)