[PATCH 06/15] drm/ast: Add support_wuxga flag to struct ast_device
Jocelyn Falempe
jfalempe at redhat.com
Mon Jan 27 14:32:05 UTC 2025
On 24/01/2025 08:57, Thomas Zimmermann wrote:
> 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.
I think adding a small helper would help here too:
static bool ast_vgacrd1_support_wuxga(struct ast_device *ast) {
u8 vgacrd1;
vgacrd1 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd1);
return !(vgacrd1 & AST_IO_VGACRD1_SUPPORTS_WUXGA);
}
Best regards,
--
Jocelyn
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
> drivers/gpu/drm/ast/ast_drv.h | 1 +
> drivers/gpu/drm/ast/ast_main.c | 31 ++++++++++++++++++++++++++++++-
> drivers/gpu/drm/ast/ast_mode.c | 8 +++-----
> drivers/gpu/drm/ast/ast_reg.h | 1 +
> 4 files changed, 35 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
> index 01ef0c0d5db7d..4e3a88f8a85ca 100644
> --- a/drivers/gpu/drm/ast/ast_drv.h
> +++ b/drivers/gpu/drm/ast/ast_drv.h
> @@ -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 */
> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> index e6237ba92cce3..1de6f1129e165 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -38,14 +38,18 @@
>
> static void ast_detect_widescreen(struct ast_device *ast)
> {
> - u8 vgacrd0;
> + u8 vgacrd0, vgacrd1;
>
> 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;
> + vgacrd1 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd1);
> + if (!(vgacrd1 & AST_IO_VGACRD1_SUPPORTS_WUXGA))
> + ast->support_wuxga = 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))
> @@ -56,6 +60,11 @@ 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->support_fullhd) {
> + vgacrd1 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd1);
> + if (!(vgacrd1 & AST_IO_VGACRD1_SUPPORTS_WUXGA))
> + ast->support_wuxga = 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))
> @@ -66,6 +75,11 @@ 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->support_fullhd) {
> + vgacrd1 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd1);
> + if (!(vgacrd1 & AST_IO_VGACRD1_SUPPORTS_WUXGA))
> + ast->support_wuxga = 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))
> @@ -76,6 +90,11 @@ 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->support_fullhd) {
> + vgacrd1 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd1);
> + if (!(vgacrd1 & AST_IO_VGACRD1_SUPPORTS_WUXGA))
> + ast->support_wuxga = 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))
> @@ -86,6 +105,11 @@ static void ast_detect_widescreen(struct ast_device *ast)
> if (ast->chip == AST2200)
> ast->support_fullhd = true;
> }
> + if (ast->support_fullhd) {
> + vgacrd1 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd1);
> + if (!(vgacrd1 & AST_IO_VGACRD1_SUPPORTS_WUXGA))
> + ast->support_wuxga = 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))
> @@ -96,6 +120,11 @@ static void ast_detect_widescreen(struct ast_device *ast)
> if (ast->chip == AST2100)
> ast->support_fullhd = true;
> }
> + if (ast->support_fullhd) {
> + vgacrd1 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd1);
> + if (!(vgacrd1 & AST_IO_VGACRD1_SUPPORTS_WUXGA))
> + ast->support_wuxga = true;
> + }
> }
> }
>
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index 594a58401cf66..fca625518a873 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -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;
> }
> }
> }
> diff --git a/drivers/gpu/drm/ast/ast_reg.h b/drivers/gpu/drm/ast/ast_reg.h
> index b4ff38949a565..9db0d584652a4 100644
> --- a/drivers/gpu/drm/ast/ast_reg.h
> +++ b/drivers/gpu/drm/ast/ast_reg.h
> @@ -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)
More information about the dri-devel
mailing list