]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/mgag200: Add dedicted variable for <linecomp> field
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 18 Jul 2024 10:44:15 +0000 (12:44 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Fri, 19 Jul 2024 08:40:21 +0000 (10:40 +0200)
Replace the line-compare value of <vdispend> with a dedicated variable
<linecomp>. Improves readability and prepares for vblank support.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240718104551.575912-6-tzimmermann@suse.de
drivers/gpu/drm/mgag200/mgag200_mode.c

index 89bb869b309002ec8e91808c032c451e74e27ca6..ff90f29b0612b4e90bb0fa9af175de8e90eadf64 100644 (file)
@@ -206,6 +206,7 @@ void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mod
 {
        unsigned int hdispend, hsyncstr, hsyncend, htotal, hblkstr, hblkend;
        unsigned int vdispend, vsyncstr, vsyncend, vtotal, vblkstr, vblkend;
+       unsigned int linecomp;
        u8 misc, crtcext1, crtcext2, crtcext5;
 
        hdispend = mode->crtc_hdisplay / 8 - 1;
@@ -225,6 +226,8 @@ void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mod
        vblkstr = mode->crtc_vblank_start;
        vblkend = vtotal + 1;
 
+       linecomp = vdispend;
+
        misc = RREG8(MGA_MISC_IN);
 
        if (mode->flags & DRM_MODE_FLAG_NHSYNC)
@@ -249,7 +252,7 @@ void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mod
                   ((vdispend & 0x400) >> 8) |
                   ((vblkstr & 0xc00) >> 7) |
                   ((vsyncstr & 0xc00) >> 5) |
-                  ((vdispend & 0x400) >> 3);
+                  ((linecomp & 0x400) >> 3);
        crtcext5 = 0x00;
 
        WREG_CRT(0x00, htotal - 4);
@@ -263,12 +266,12 @@ void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mod
                       ((vdispend & 0x100) >> 7) |
                       ((vsyncstr & 0x100) >> 6) |
                       ((vblkstr & 0x100) >> 5) |
-                      ((vdispend & 0x100) >> 4) | /* linecomp */
+                      ((linecomp & 0x100) >> 4) |
                       ((vtotal & 0x200) >> 4) |
                       ((vdispend & 0x200) >> 3) |
                       ((vsyncstr & 0x200) >> 2));
        WREG_CRT(0x09, ((vblkstr & 0x200) >> 4) |
-                      ((vdispend & 0x200) >> 3));
+                      ((linecomp & 0x200) >> 3));
        WREG_CRT(0x10, vsyncstr & 0xff);
        WREG_CRT(0x11, (vsyncend & 0x0f) | 0x20);
        WREG_CRT(0x12, vdispend & 0xff);
@@ -276,7 +279,7 @@ void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mod
        WREG_CRT(0x15, vblkstr & 0xff);
        WREG_CRT(0x16, vblkend & 0xff);
        WREG_CRT(0x17, 0xc3);
-       WREG_CRT(0x18, vdispend & 0xff);
+       WREG_CRT(0x18, linecomp & 0xff);
 
        WREG_ECRT(0x01, crtcext1);
        WREG_ECRT(0x02, crtcext2);