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

drm/ast: Store precatch settings in struct ast_device_quirks

Add a precatch flag in struct ast_device_info and set it on AST2500
and AST2600. Remove calls to IS_AST_GENn() from ast_set_crtc_reg().

Also fix the coding style in several places.

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

+16 -9
+1
drivers/gpu/drm/ast/ast_2500.c
··· 621 621 static const struct ast_device_quirks ast_2500_device_quirks = { 622 622 .crtc_mem_req_threshold_low = 96, 623 623 .crtc_mem_req_threshold_high = 120, 624 + .crtc_hsync_precatch_needed = true, 624 625 }; 625 626 626 627 struct drm_device *ast_2500_device_create(struct pci_dev *pdev,
+1
drivers/gpu/drm/ast/ast_2600.c
··· 62 62 static const struct ast_device_quirks ast_2600_device_quirks = { 63 63 .crtc_mem_req_threshold_low = 160, 64 64 .crtc_mem_req_threshold_high = 224, 65 + .crtc_hsync_precatch_needed = true, 65 66 }; 66 67 67 68 struct drm_device *ast_2600_device_create(struct pci_dev *pdev,
+6
drivers/gpu/drm/ast/ast_drv.h
··· 170 170 */ 171 171 unsigned char crtc_mem_req_threshold_low; 172 172 unsigned char crtc_mem_req_threshold_high; 173 + 174 + /* 175 + * Adjust hsync values to load next scanline early. Signalled 176 + * by AST2500PreCatchCRT in VBIOS mode flags. 177 + */ 178 + bool crtc_hsync_precatch_needed; 173 179 }; 174 180 175 181 struct ast_device {
+8 -9
drivers/gpu/drm/ast/ast_mode.c
··· 241 241 ast_set_index_reg(ast, AST_IO_VGAGRI, i, stdtable->gr[i]); 242 242 } 243 243 244 - static void ast_set_crtc_reg(struct ast_device *ast, 245 - struct drm_display_mode *mode, 244 + static void ast_set_crtc_reg(struct ast_device *ast, struct drm_display_mode *mode, 246 245 const struct ast_vbios_enhtable *vmode) 247 246 { 248 247 u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0; 249 - u16 temp, precache = 0; 248 + u16 temp; 249 + unsigned char crtc_hsync_precatch = 0; 250 250 251 - if ((IS_AST_GEN6(ast) || IS_AST_GEN7(ast)) && 252 - (vmode->flags & AST2500PreCatchCRT)) 253 - precache = 40; 251 + if (ast->quirks->crtc_hsync_precatch_needed && (vmode->flags & AST2500PreCatchCRT)) 252 + crtc_hsync_precatch = 40; 254 253 255 254 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x11, 0x7f, 0x00); 256 255 ··· 275 276 jregAD |= 0x01; /* HBE D[5] */ 276 277 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x03, 0xE0, (temp & 0x1f)); 277 278 278 - temp = ((mode->crtc_hsync_start-precache) >> 3) - 1; 279 + temp = ((mode->crtc_hsync_start - crtc_hsync_precatch) >> 3) - 1; 279 280 if (temp & 0x100) 280 281 jregAC |= 0x40; /* HRS D[5] */ 281 282 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x04, 0x00, temp); 282 283 283 - temp = (((mode->crtc_hsync_end-precache) >> 3) - 1) & 0x3f; 284 + temp = (((mode->crtc_hsync_end - crtc_hsync_precatch) >> 3) - 1) & 0x3f; 284 285 if (temp & 0x20) 285 286 jregAD |= 0x04; /* HRE D[5] */ 286 287 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05)); ··· 347 348 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x09, 0xdf, jreg09); 348 349 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xAE, 0x00, (jregAE | 0x80)); 349 350 350 - if (precache) 351 + if (crtc_hsync_precatch) 351 352 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0x3f, 0x80); 352 353 else 353 354 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0x3f, 0x00);