The register initialization code contains special cases for G200ER and G200EW3 hardware. Move this to per-model code. Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> Reviewed-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx> Tested-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx> Acked-by: Sam Ravnborg <sam@xxxxxxxxxxxx> --- drivers/gpu/drm/mgag200/mgag200_g200er.c | 2 ++ drivers/gpu/drm/mgag200/mgag200_g200ew3.c | 9 ++++++++- drivers/gpu/drm/mgag200/mgag200_mode.c | 6 ------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_g200er.c b/drivers/gpu/drm/mgag200/mgag200_g200er.c index 7bee20459ab6..8ff050906e1c 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200er.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200er.c @@ -27,6 +27,8 @@ static void mgag200_g200er_init_registers(struct mga_device *mdev) WREG_DAC(0x90, 0); /* G200ER specific */ mgag200_init_registers(mdev); + + WREG_ECRT(0x24, 0x5); /* G200ER specific */ } /* diff --git a/drivers/gpu/drm/mgag200/mgag200_g200ew3.c b/drivers/gpu/drm/mgag200/mgag200_g200ew3.c index d86284c0eb4d..a4ecdd3784a3 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200ew3.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200ew3.c @@ -6,6 +6,13 @@ #include "mgag200_drv.h" +static void mgag200_g200ew3_init_registers(struct mga_device *mdev) +{ + mgag200_g200wb_init_registers(mdev); // same as G200WB + + WREG_ECRT(0x34, 0x5); // G200EW3 specific +} + /* * DRM device */ @@ -50,7 +57,7 @@ struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev, if (ret) return ERR_PTR(ret); - mgag200_g200wb_init_registers(mdev); // same as G200WB + mgag200_g200ew3_init_registers(mdev); vram_available = mgag200_g200ew3_device_probe_vram(mdev); diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index ba5661cc6686..11a88ef9d664 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -287,12 +287,6 @@ void mgag200_init_registers(struct mga_device *mdev) MGAREG_CRTC11_VINTCLR); WREG_CRT(0x11, crtc11); - if (mdev->type == G200_ER) - WREG_ECRT(0x24, 0x5); - - if (mdev->type == G200_EW3) - WREG_ECRT(0x34, 0x5); - misc = RREG8(MGA_MISC_IN); misc |= MGAREG_MISC_IOADSEL; WREG8(MGA_MISC_OUT, misc); -- 2.37.1