Skip to content

Commit f93d666

Browse files
author
Thomas Zimmermann
committed
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 <[email protected]> Reviewed-by: Jocelyn Falempe <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 6e4f0d3 commit f93d666

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

drivers/gpu/drm/ast/ast_dp501.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,19 @@ static void ast_init_analog(struct ast_device *ast)
444444

445445
void ast_init_3rdtx(struct ast_device *ast)
446446
{
447-
u8 jreg;
447+
u8 vgacrd1;
448448

449449
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:
453454
ast_init_dvo(ast);
454455
break;
455-
case 0x08:
456+
case AST_IO_VGACRD1_TX_DP501_VBIOS:
456457
ast_launch_m68k(ast);
457458
break;
458-
case 0x0c:
459+
case AST_IO_VGACRD1_TX_FW_EMBEDDED_FW:
459460
ast_init_dvo(ast);
460461
break;
461462
default:

drivers/gpu/drm/ast/ast_main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,13 @@ static void ast_detect_tx_chip(struct ast_device *ast, bool need_post)
101101
* the SOC scratch register #1 bits 11:8 (interestingly marked
102102
* as "reserved" in the spec)
103103
*/
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);
105106
switch (jreg) {
106-
case 0x04:
107+
case AST_IO_VGACRD1_TX_SIL164_VBIOS:
107108
ast->tx_chip = AST_TX_SIL164;
108109
break;
109-
case 0x08:
110+
case AST_IO_VGACRD1_TX_DP501_VBIOS:
110111
ast->dp501_fw_addr = drmm_kzalloc(dev, 32*1024, GFP_KERNEL);
111112
if (ast->dp501_fw_addr) {
112113
/* backup firmware */
@@ -116,7 +117,7 @@ static void ast_detect_tx_chip(struct ast_device *ast, bool need_post)
116117
}
117118
}
118119
fallthrough;
119-
case 0x0c:
120+
case AST_IO_VGACRD1_TX_FW_EMBEDDED_FW:
120121
ast->tx_chip = AST_TX_DP501;
121122
}
122123
} else if (IS_AST_GEN7(ast)) {

drivers/gpu/drm/ast/ast_reg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#define AST_IO_VGACRD1_TX_CH7003_VBIOS 0x06
4747
#define AST_IO_VGACRD1_TX_DP501_VBIOS 0x08
4848
#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 */
5050
#define AST_IO_VGACRD1_TX_ASTDP 0x0e
5151

5252
#define AST_IO_VGACRD7_EDID_VALID_FLAG BIT(0)

0 commit comments

Comments
 (0)