Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/ast: Use TX-chip register constants

Replace magic values with named constants when reading the TX chip
from VGACRD1.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240916082920.56234-3-tzimmermann@suse.de

+13 -11
+7 -6
drivers/gpu/drm/ast/ast_dp501.c
··· 444 444 445 445 void ast_init_3rdtx(struct ast_device *ast) 446 446 { 447 - u8 jreg; 447 + u8 vgacrd1; 448 448 449 449 if (IS_AST_GEN4(ast) || IS_AST_GEN5(ast)) { 450 - jreg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd1, 0xff); 451 - switch (jreg & 0x0e) { 452 - case 0x04: 450 + vgacrd1 = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd1, 451 + AST_IO_VGACRD1_TX_TYPE_MASK); 452 + switch (vgacrd1) { 453 + case AST_IO_VGACRD1_TX_SIL164_VBIOS: 453 454 ast_init_dvo(ast); 454 455 break; 455 - case 0x08: 456 + case AST_IO_VGACRD1_TX_DP501_VBIOS: 456 457 ast_launch_m68k(ast); 457 458 break; 458 - case 0x0c: 459 + case AST_IO_VGACRD1_TX_FW_EMBEDDED_FW: 459 460 ast_init_dvo(ast); 460 461 break; 461 462 default:
+5 -4
drivers/gpu/drm/ast/ast_main.c
··· 101 101 * the SOC scratch register #1 bits 11:8 (interestingly marked 102 102 * as "reserved" in the spec) 103 103 */ 104 - jreg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd1, 0xff); 104 + jreg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd1, 105 + AST_IO_VGACRD1_TX_TYPE_MASK); 105 106 switch (jreg) { 106 - case 0x04: 107 + case AST_IO_VGACRD1_TX_SIL164_VBIOS: 107 108 ast->tx_chip = AST_TX_SIL164; 108 109 break; 109 - case 0x08: 110 + case AST_IO_VGACRD1_TX_DP501_VBIOS: 110 111 ast->dp501_fw_addr = drmm_kzalloc(dev, 32*1024, GFP_KERNEL); 111 112 if (ast->dp501_fw_addr) { 112 113 /* backup firmware */ ··· 117 116 } 118 117 } 119 118 fallthrough; 120 - case 0x0c: 119 + case AST_IO_VGACRD1_TX_FW_EMBEDDED_FW: 121 120 ast->tx_chip = AST_TX_DP501; 122 121 } 123 122 } else if (IS_AST_GEN7(ast)) {
+1 -1
drivers/gpu/drm/ast/ast_reg.h
··· 46 46 #define AST_IO_VGACRD1_TX_CH7003_VBIOS 0x06 47 47 #define AST_IO_VGACRD1_TX_DP501_VBIOS 0x08 48 48 #define AST_IO_VGACRD1_TX_ANX9807_VBIOS 0x0a 49 - #define AST_IO_VGACRD1_TX_FW_EMBEDDED_FW 0x0c 49 + #define AST_IO_VGACRD1_TX_FW_EMBEDDED_FW 0x0c /* special case of DP501 */ 50 50 #define AST_IO_VGACRD1_TX_ASTDP 0x0e 51 51 52 52 #define AST_IO_VGACRD7_EDID_VALID_FLAG BIT(0)