mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
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
This commit is contained in:
parent
2f9d9041ad
commit
d251db1f31
|
|
@ -621,6 +621,7 @@ static void ast_2500_detect_widescreen(struct ast_device *ast)
|
|||
static const struct ast_device_quirks ast_2500_device_quirks = {
|
||||
.crtc_mem_req_threshold_low = 96,
|
||||
.crtc_mem_req_threshold_high = 120,
|
||||
.crtc_hsync_precatch_needed = true,
|
||||
};
|
||||
|
||||
struct drm_device *ast_2500_device_create(struct pci_dev *pdev,
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ static void ast_2600_detect_widescreen(struct ast_device *ast)
|
|||
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,
|
||||
};
|
||||
|
||||
struct drm_device *ast_2600_device_create(struct pci_dev *pdev,
|
||||
|
|
|
|||
|
|
@ -170,6 +170,12 @@ struct ast_device_quirks {
|
|||
*/
|
||||
unsigned char crtc_mem_req_threshold_low;
|
||||
unsigned char crtc_mem_req_threshold_high;
|
||||
|
||||
/*
|
||||
* Adjust hsync values to load next scanline early. Signalled
|
||||
* by AST2500PreCatchCRT in VBIOS mode flags.
|
||||
*/
|
||||
bool crtc_hsync_precatch_needed;
|
||||
};
|
||||
|
||||
struct ast_device {
|
||||
|
|
|
|||
|
|
@ -241,16 +241,15 @@ static void ast_set_std_reg(struct ast_device *ast,
|
|||
ast_set_index_reg(ast, AST_IO_VGAGRI, i, stdtable->gr[i]);
|
||||
}
|
||||
|
||||
static void ast_set_crtc_reg(struct ast_device *ast,
|
||||
struct drm_display_mode *mode,
|
||||
static void ast_set_crtc_reg(struct ast_device *ast, struct drm_display_mode *mode,
|
||||
const struct ast_vbios_enhtable *vmode)
|
||||
{
|
||||
u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0;
|
||||
u16 temp, precache = 0;
|
||||
u16 temp;
|
||||
unsigned char crtc_hsync_precatch = 0;
|
||||
|
||||
if ((IS_AST_GEN6(ast) || IS_AST_GEN7(ast)) &&
|
||||
(vmode->flags & AST2500PreCatchCRT))
|
||||
precache = 40;
|
||||
if (ast->quirks->crtc_hsync_precatch_needed && (vmode->flags & AST2500PreCatchCRT))
|
||||
crtc_hsync_precatch = 40;
|
||||
|
||||
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x11, 0x7f, 0x00);
|
||||
|
||||
|
|
@ -276,12 +275,12 @@ static void ast_set_crtc_reg(struct ast_device *ast,
|
|||
jregAD |= 0x01; /* HBE D[5] */
|
||||
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x03, 0xE0, (temp & 0x1f));
|
||||
|
||||
temp = ((mode->crtc_hsync_start-precache) >> 3) - 1;
|
||||
temp = ((mode->crtc_hsync_start - crtc_hsync_precatch) >> 3) - 1;
|
||||
if (temp & 0x100)
|
||||
jregAC |= 0x40; /* HRS D[5] */
|
||||
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x04, 0x00, temp);
|
||||
|
||||
temp = (((mode->crtc_hsync_end-precache) >> 3) - 1) & 0x3f;
|
||||
temp = (((mode->crtc_hsync_end - crtc_hsync_precatch) >> 3) - 1) & 0x3f;
|
||||
if (temp & 0x20)
|
||||
jregAD |= 0x04; /* HRE D[5] */
|
||||
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05));
|
||||
|
|
@ -348,7 +347,7 @@ static void ast_set_crtc_reg(struct ast_device *ast,
|
|||
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x09, 0xdf, jreg09);
|
||||
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xAE, 0x00, (jregAE | 0x80));
|
||||
|
||||
if (precache)
|
||||
if (crtc_hsync_precatch)
|
||||
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0x3f, 0x80);
|
||||
else
|
||||
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0x3f, 0x00);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user