drm/ast: Store HSync adjustment in device quirks

Add the add4 flag to struct ast_device_quirks and set it on AST2600.
Replaces a call to IS_AST_GEN7() in ast_set_crtc_reg().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>>
Link: https://lore.kernel.org/r/20251007150343.273718-6-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann 2025-10-07 16:54:46 +02:00
parent d251db1f31
commit b245bc23ff
3 changed files with 8 additions and 2 deletions

View File

@ -63,6 +63,7 @@ static const struct ast_device_quirks ast_2600_device_quirks = {
.crtc_mem_req_threshold_low = 160,
.crtc_mem_req_threshold_high = 224,
.crtc_hsync_precatch_needed = true,
.crtc_hsync_add4_needed = true,
};
struct drm_device *ast_2600_device_create(struct pci_dev *pdev,

View File

@ -176,6 +176,12 @@ struct ast_device_quirks {
* by AST2500PreCatchCRT in VBIOS mode flags.
*/
bool crtc_hsync_precatch_needed;
/*
* Workaround for modes with HSync Time that is not a multiple
* of 8 (e.g., 1920x1080@60Hz, HSync +44 pixels).
*/
bool crtc_hsync_add4_needed;
};
struct ast_device {

View File

@ -288,8 +288,7 @@ static void ast_set_crtc_reg(struct ast_device *ast, struct drm_display_mode *mo
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xAC, 0x00, jregAC);
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xAD, 0x00, jregAD);
// Workaround for HSync Time non octave pixels (1920x1080@60Hz HSync 44 pixels);
if (IS_AST_GEN7(ast) && (mode->crtc_vdisplay == 1080))
if (ast->quirks->crtc_hsync_add4_needed && mode->crtc_vdisplay == 1080)
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xFC, 0xFD, 0x02);
else
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xFC, 0xFD, 0x00);