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

drm/ast: Store CRTC memory request threshold in device quirks

Store each hardware's CRTC memory threshold in the specific instance
of struct ast_device_quirks. Removes the calls to IS_AST_GENn() from
ast_set_crtthd_reg().

The values stored in the registers appear to be plain limits. Hence
write them in the driver in decimal format instead of hexadecimal.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/20251007150343.273718-4-tzimmermann@suse.de

+24 -14
+2
drivers/gpu/drm/ast/ast_2000.c
··· 212 212 } 213 213 214 214 static const struct ast_device_quirks ast_2000_device_quirks = { 215 + .crtc_mem_req_threshold_low = 31, 216 + .crtc_mem_req_threshold_high = 47, 215 217 }; 216 218 217 219 struct drm_device *ast_2000_device_create(struct pci_dev *pdev,
+2
drivers/gpu/drm/ast/ast_2100.c
··· 433 433 } 434 434 435 435 static const struct ast_device_quirks ast_2100_device_quirks = { 436 + .crtc_mem_req_threshold_low = 47, 437 + .crtc_mem_req_threshold_high = 63, 436 438 }; 437 439 438 440 struct drm_device *ast_2100_device_create(struct pci_dev *pdev,
+2
drivers/gpu/drm/ast/ast_2200.c
··· 44 44 } 45 45 46 46 static const struct ast_device_quirks ast_2200_device_quirks = { 47 + .crtc_mem_req_threshold_low = 47, 48 + .crtc_mem_req_threshold_high = 63, 47 49 }; 48 50 49 51 struct drm_device *ast_2200_device_create(struct pci_dev *pdev,
+2
drivers/gpu/drm/ast/ast_2300.c
··· 1408 1408 } 1409 1409 1410 1410 static const struct ast_device_quirks ast_2300_device_quirks = { 1411 + .crtc_mem_req_threshold_low = 96, 1412 + .crtc_mem_req_threshold_high = 120, 1411 1413 }; 1412 1414 1413 1415 struct drm_device *ast_2300_device_create(struct pci_dev *pdev,
+2
drivers/gpu/drm/ast/ast_2400.c
··· 45 45 } 46 46 47 47 static const struct ast_device_quirks ast_2400_device_quirks = { 48 + .crtc_mem_req_threshold_low = 96, 49 + .crtc_mem_req_threshold_high = 120, 48 50 }; 49 51 50 52 struct drm_device *ast_2400_device_create(struct pci_dev *pdev,
+2
drivers/gpu/drm/ast/ast_2500.c
··· 619 619 } 620 620 621 621 static const struct ast_device_quirks ast_2500_device_quirks = { 622 + .crtc_mem_req_threshold_low = 96, 623 + .crtc_mem_req_threshold_high = 120, 622 624 }; 623 625 624 626 struct drm_device *ast_2500_device_create(struct pci_dev *pdev,
+2
drivers/gpu/drm/ast/ast_2600.c
··· 60 60 } 61 61 62 62 static const struct ast_device_quirks ast_2600_device_quirks = { 63 + .crtc_mem_req_threshold_low = 160, 64 + .crtc_mem_req_threshold_high = 224, 63 65 }; 64 66 65 67 struct drm_device *ast_2600_device_create(struct pci_dev *pdev,
+5
drivers/gpu/drm/ast/ast_drv.h
··· 165 165 */ 166 166 167 167 struct ast_device_quirks { 168 + /* 169 + * CRTC memory request threshold 170 + */ 171 + unsigned char crtc_mem_req_threshold_low; 172 + unsigned char crtc_mem_req_threshold_high; 168 173 }; 169 174 170 175 struct ast_device {
+5 -14
drivers/gpu/drm/ast/ast_mode.c
··· 410 410 411 411 static void ast_set_crtthd_reg(struct ast_device *ast) 412 412 { 413 - /* Set Threshold */ 414 - if (IS_AST_GEN7(ast)) { 415 - ast_set_index_reg(ast, AST_IO_VGACRI, 0xa7, 0xe0); 416 - ast_set_index_reg(ast, AST_IO_VGACRI, 0xa6, 0xa0); 417 - } else if (IS_AST_GEN6(ast) || IS_AST_GEN5(ast) || IS_AST_GEN4(ast)) { 418 - ast_set_index_reg(ast, AST_IO_VGACRI, 0xa7, 0x78); 419 - ast_set_index_reg(ast, AST_IO_VGACRI, 0xa6, 0x60); 420 - } else if (IS_AST_GEN3(ast) || IS_AST_GEN2(ast)) { 421 - ast_set_index_reg(ast, AST_IO_VGACRI, 0xa7, 0x3f); 422 - ast_set_index_reg(ast, AST_IO_VGACRI, 0xa6, 0x2f); 423 - } else { 424 - ast_set_index_reg(ast, AST_IO_VGACRI, 0xa7, 0x2f); 425 - ast_set_index_reg(ast, AST_IO_VGACRI, 0xa6, 0x1f); 426 - } 413 + u8 vgacra6 = ast->quirks->crtc_mem_req_threshold_low; 414 + u8 vgacra7 = ast->quirks->crtc_mem_req_threshold_high; 415 + 416 + ast_set_index_reg(ast, AST_IO_VGACRI, 0xa7, vgacra7); 417 + ast_set_index_reg(ast, AST_IO_VGACRI, 0xa6, vgacra6); 427 418 } 428 419 429 420 static void ast_set_sync_reg(struct ast_device *ast,