diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2020-07-07 11:24:05 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2020-07-14 10:06:14 +0300 |
commit | da568d5e352c95c6278ddc2778cbd36b5ea65b09 (patch) | |
tree | abc88e1cee4639c370056ca4fe4200f22d7b66bf | |
parent | 02cd2d3144653e6e2a0c7ccaa73311e48e2dc686 (diff) | |
download | linux-da568d5e352c95c6278ddc2778cbd36b5ea65b09.tar.xz |
drm/mgag200: Don't write-protect CRTC 0-7 while in mga_crtc_prepare()
The prepare function write-protects several registers that it doesn't
even touch. Removed the related code.
The code for unprotecting registers also clears VINT interrupts. Both
is now done once during initialization.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200707082411.6583-2-tzimmermann@suse.de
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_drv.h | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_mode.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_reg.h | 5 |
3 files changed, 18 insertions, 9 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index 270c2f9a6766..3817520bfefc 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -60,6 +60,12 @@ WREG8(MGAREG_SEQ_DATA, v); \ } while (0) \ +#define RREG_CRT(reg, v) \ + do { \ + WREG8(MGAREG_CRTC_INDEX, reg); \ + v = RREG8(MGAREG_CRTC_DATA); \ + } while (0) \ + #define WREG_CRT(reg, v) \ do { \ WREG8(MGAREG_CRTC_INDEX, reg); \ diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index f16bd278ab7e..9037057d3b3a 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -988,7 +988,7 @@ static void mgag200_set_dac_regs(struct mga_device *mdev) static void mgag200_init_regs(struct mga_device *mdev) { - u8 crtcext3, crtcext4, misc; + u8 crtc11, crtcext3, crtcext4, misc; mgag200_set_pci_regs(mdev); mgag200_set_dac_regs(mdev); @@ -1012,6 +1012,12 @@ static void mgag200_init_regs(struct mga_device *mdev) WREG_ECRT(0x03, crtcext3); WREG_ECRT(0x04, crtcext4); + RREG_CRT(0x11, crtc11); + crtc11 &= ~(MGAREG_CRTC11_CRTCPROTECT | + MGAREG_CRTC11_VINTEN | + MGAREG_CRTC11_VINTCLR); + WREG_CRT(0x11, crtc11); + if (mdev->type == G200_ER) WREG_ECRT(0x24, 0x5); @@ -1337,12 +1343,6 @@ static void mga_crtc_prepare(struct drm_crtc *crtc) struct mga_device *mdev = to_mga_device(dev); u8 tmp; - /* mga_resume(crtc);*/ - - WREG8(MGAREG_CRTC_INDEX, 0x11); - tmp = RREG8(MGAREG_CRTC_DATA); - WREG_CRT(0x11, tmp | 0x80); - if (mdev->type == G200_SE_A || mdev->type == G200_SE_B) { WREG_SEQ(0, 1); msleep(50); @@ -1359,8 +1359,6 @@ static void mga_crtc_prepare(struct drm_crtc *crtc) if (mdev->type == G200_WB || mdev->type == G200_EW3) mga_g200wb_prepare(crtc); - - WREG_CRT(17, 0); } /* diff --git a/drivers/gpu/drm/mgag200/mgag200_reg.h b/drivers/gpu/drm/mgag200/mgag200_reg.h index 29f7194faadc..fb5da410804c 100644 --- a/drivers/gpu/drm/mgag200/mgag200_reg.h +++ b/drivers/gpu/drm/mgag200/mgag200_reg.h @@ -240,6 +240,11 @@ #define MGAREG_CRTC_INDEX 0x1fd4 #define MGAREG_CRTC_DATA 0x1fd5 + +#define MGAREG_CRTC11_VINTCLR BIT(4) +#define MGAREG_CRTC11_VINTEN BIT(5) +#define MGAREG_CRTC11_CRTCPROTECT BIT(7) + #define MGAREG_CRTCEXT_INDEX 0x1fde #define MGAREG_CRTCEXT_DATA 0x1fdf |