Skip to content

Commit

Permalink
drm/mgag200: Use hexadecimal register indeces
Browse files Browse the repository at this point in the history
In mgag200_set_mode_regs(), use hexadecimal indices for accessing
registers. Aligns the code with the register indices in the Matrox
programming manuals. Also convert to lower-case hexadecimal values.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240718104551.575912-2-tzimmermann@suse.de
  • Loading branch information
Thomas Zimmermann committed Jul 19, 2024
1 parent 0c977ff commit 754c912
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions drivers/gpu/drm/mgag200/mgag200_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,31 +249,31 @@ void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mod
((vdisplay & 0x400) >> 3);
crtcext5 = 0x00;

WREG_CRT(0, htotal - 4);
WREG_CRT(1, hdisplay);
WREG_CRT(2, hdisplay);
WREG_CRT(3, (htotal & 0x1F) | 0x80);
WREG_CRT(4, hsyncstart);
WREG_CRT(5, ((htotal & 0x20) << 2) | (hsyncend & 0x1F));
WREG_CRT(6, vtotal & 0xFF);
WREG_CRT(7, ((vtotal & 0x100) >> 8) |
((vdisplay & 0x100) >> 7) |
((vsyncstart & 0x100) >> 6) |
((vdisplay & 0x100) >> 5) |
((vdisplay & 0x100) >> 4) | /* linecomp */
((vtotal & 0x200) >> 4) |
((vdisplay & 0x200) >> 3) |
((vsyncstart & 0x200) >> 2));
WREG_CRT(9, ((vdisplay & 0x200) >> 4) |
((vdisplay & 0x200) >> 3));
WREG_CRT(16, vsyncstart & 0xFF);
WREG_CRT(17, (vsyncend & 0x0F) | 0x20);
WREG_CRT(18, vdisplay & 0xFF);
WREG_CRT(20, 0);
WREG_CRT(21, vdisplay & 0xFF);
WREG_CRT(22, (vtotal + 1) & 0xFF);
WREG_CRT(23, 0xc3);
WREG_CRT(24, vdisplay & 0xFF);
WREG_CRT(0x00, htotal - 4);
WREG_CRT(0x01, hdisplay);
WREG_CRT(0x02, hdisplay);
WREG_CRT(0x03, (htotal & 0x1f) | 0x80);
WREG_CRT(0x04, hsyncstart);
WREG_CRT(0x05, ((htotal & 0x20) << 2) | (hsyncend & 0x1f));
WREG_CRT(0x06, vtotal & 0xff);
WREG_CRT(0x07, ((vtotal & 0x100) >> 8) |
((vdisplay & 0x100) >> 7) |
((vsyncstart & 0x100) >> 6) |
((vdisplay & 0x100) >> 5) |
((vdisplay & 0x100) >> 4) | /* linecomp */
((vtotal & 0x200) >> 4) |
((vdisplay & 0x200) >> 3) |
((vsyncstart & 0x200) >> 2));
WREG_CRT(0x09, ((vdisplay & 0x200) >> 4) |
((vdisplay & 0x200) >> 3));
WREG_CRT(0x10, vsyncstart & 0xff);
WREG_CRT(0x11, (vsyncend & 0x0f) | 0x20);
WREG_CRT(0x12, vdisplay & 0xff);
WREG_CRT(0x14, 0);
WREG_CRT(0x15, vdisplay & 0xff);
WREG_CRT(0x16, (vtotal + 1) & 0xff);
WREG_CRT(0x17, 0xc3);
WREG_CRT(0x18, vdisplay & 0xff);

WREG_ECRT(0x01, crtcext1);
WREG_ECRT(0x02, crtcext2);
Expand Down

0 comments on commit 754c912

Please sign in to comment.