[PATCH 02/15] drm/ast: Align naming in widescreen detection code to manual

Jocelyn Falempe jfalempe at redhat.com
Mon Jan 27 14:18:57 UTC 2025


On 24/01/2025 08:57, Thomas Zimmermann wrote:
> Rename variables and register constants to align with the programming
> manual. Add new constants where necessary.

Thanks, it looks good to me.

Reviewed-by: Jocelyn Falempe <jfalempe at redhat.com>

> 
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
>   drivers/gpu/drm/ast/ast_drv.c  |  2 +-
>   drivers/gpu/drm/ast/ast_main.c |  8 ++++----
>   drivers/gpu/drm/ast/ast_post.c |  2 +-
>   drivers/gpu/drm/ast/ast_reg.h  | 11 ++++++-----
>   4 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index cddd69972e89d..6fbf62a99c48d 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -170,7 +170,7 @@ static int ast_detect_chip(struct pci_dev *pdev,
>   
>   			/* Patch AST2500/AST2510 */
>   			if ((pdev->revision & 0xf0) == 0x40) {
> -				if (!(vgacrd0 & AST_VRAM_INIT_STATUS_MASK))
> +				if (!(vgacrd0 & AST_IO_VGACRD0_VRAM_INIT_STATUS_MASK))
>   					ast_patch_ahb_2500(regs);
>   			}
>   
> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> index ba69280b33e78..2a813f0128eb8 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -38,7 +38,7 @@
>   
>   static void ast_detect_widescreen(struct ast_device *ast)
>   {
> -	u8 jreg;
> +	u8 vgacrd0;
>   
>   	/* Check if we support wide screen */
>   	switch (AST_GEN(ast)) {
> @@ -46,10 +46,10 @@ static void ast_detect_widescreen(struct ast_device *ast)
>   		ast->support_wide_screen = false;
>   		break;
>   	default:
> -		jreg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd0, 0xff);
> -		if (!(jreg & 0x80))
> +		vgacrd0 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd0);
> +		if (!(vgacrd0 & AST_IO_VGACRD0_VRAM_INIT_BY_BMC))
>   			ast->support_wide_screen = true;
> -		else if (jreg & 0x01)
> +		else if (vgacrd0 & AST_IO_VGACRD0_IKVM_WIDESCREEN)
>   			ast->support_wide_screen = true;
>   		else {
>   			ast->support_wide_screen = false;
> diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
> index 0daa8e52a092a..91e85e457bdf3 100644
> --- a/drivers/gpu/drm/ast/ast_post.c
> +++ b/drivers/gpu/drm/ast/ast_post.c
> @@ -2062,7 +2062,7 @@ void ast_post_chip_2500(struct ast_device *ast)
>   	u8 reg;
>   
>   	reg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd0, 0xff);
> -	if ((reg & AST_VRAM_INIT_STATUS_MASK) == 0) {/* vga only */
> +	if ((reg & AST_IO_VGACRD0_VRAM_INIT_STATUS_MASK) == 0) {/* vga only */
>   		/* Clear bus lock condition */
>   		ast_patch_ahb_2500(ast->regs);
>   
> diff --git a/drivers/gpu/drm/ast/ast_reg.h b/drivers/gpu/drm/ast/ast_reg.h
> index 0745d58e5b450..b4ff38949a565 100644
> --- a/drivers/gpu/drm/ast/ast_reg.h
> +++ b/drivers/gpu/drm/ast/ast_reg.h
> @@ -38,6 +38,12 @@
>   #define AST_IO_VGACRCB_HWC_16BPP	BIT(0) /* set: ARGB4444, cleared: 2bpp palette */
>   #define AST_IO_VGACRCB_HWC_ENABLED	BIT(1)
>   
> +/* mirrors SCU100[7:0] */
> +#define AST_IO_VGACRD0_VRAM_INIT_STATUS_MASK	GENMASK(7, 6)
> +#define AST_IO_VGACRD0_VRAM_INIT_BY_BMC		BIT(7)
> +#define AST_IO_VGACRD0_VRAM_INIT_READY		BIT(6)
> +#define AST_IO_VGACRD0_IKVM_WIDESCREEN		BIT(0)
> +
>   #define AST_IO_VGACRD1_MCU_FW_EXECUTING		BIT(5)
>   /* Display Transmitter Type */
>   #define AST_IO_VGACRD1_TX_TYPE_MASK		GENMASK(3, 1)
> @@ -61,11 +67,6 @@
>   #define AST_IO_VGAIR1_R			(0x5A)
>   #define AST_IO_VGAIR1_VREFRESH		BIT(3)
>   
> -
> -#define AST_VRAM_INIT_STATUS_MASK	GENMASK(7, 6)
> -//#define AST_VRAM_INIT_BY_BMC		BIT(7)
> -//#define AST_VRAM_INIT_READY		BIT(6)
> -
>   /*
>    * AST DisplayPort
>    */



More information about the dri-devel mailing list