Set new vidrst flag in device info for models that synchronize with external sources (i.e., BMCs). In modesetting, set the corresponding bits from the device-info flag. Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> --- drivers/gpu/drm/mgag200/mgag200_drv.h | 6 +++++- drivers/gpu/drm/mgag200/mgag200_g200.c | 2 +- drivers/gpu/drm/mgag200/mgag200_g200eh.c | 2 +- drivers/gpu/drm/mgag200/mgag200_g200eh3.c | 2 +- drivers/gpu/drm/mgag200/mgag200_g200er.c | 2 +- drivers/gpu/drm/mgag200/mgag200_g200ev.c | 2 +- drivers/gpu/drm/mgag200/mgag200_g200ew3.c | 2 +- drivers/gpu/drm/mgag200/mgag200_g200se.c | 12 ++++++------ drivers/gpu/drm/mgag200/mgag200_g200wb.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 7 ++++--- drivers/gpu/drm/mgag200/mgag200_reg.h | 2 ++ 11 files changed, 24 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index f0fb13238f4f..1ceb19a987e2 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -200,6 +200,9 @@ struct mgag200_device_info { */ unsigned long max_mem_bandwidth; + /* HW has external source (e.g., BMC) to synchronize with */ + bool has_vidrst:1; + /* * HW does not handle 'startadd' register correctly. Always set * it's value to 0. @@ -208,11 +211,12 @@ struct mgag200_device_info { }; #define MGAG200_DEVICE_INFO_INIT(_max_hdisplay, _max_vdisplay, _max_mem_bandwidth, \ - _bug_no_startadd) \ + _has_vidrst, _bug_no_startadd) \ { \ .max_hdisplay = (_max_hdisplay), \ .max_vdisplay = (_max_vdisplay), \ .max_mem_bandwidth = (_max_mem_bandwidth), \ + .has_vidrst = (_has_vidrst), \ .bug_no_startadd = (_bug_no_startadd), \ } diff --git a/drivers/gpu/drm/mgag200/mgag200_g200.c b/drivers/gpu/drm/mgag200/mgag200_g200.c index 4ec1b18ab170..58ae5d067263 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200.c @@ -34,7 +34,7 @@ static int mgag200_g200_init_pci_options(struct pci_dev *pdev) */ static const struct mgag200_device_info mgag200_g200_device_info = - MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false); + MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false, false); static void mgag200_g200_interpret_bios(struct mgag200_g200_device *g200, const unsigned char *bios, size_t size) diff --git a/drivers/gpu/drm/mgag200/mgag200_g200eh.c b/drivers/gpu/drm/mgag200/mgag200_g200eh.c index a35ba2fdfc0e..ee38d918c727 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200eh.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200eh.c @@ -11,7 +11,7 @@ */ static const struct mgag200_device_info mgag200_g200eh_device_info = - MGAG200_DEVICE_INFO_INIT(2048, 2048, 37500, false); + MGAG200_DEVICE_INFO_INIT(2048, 2048, 37500, false, false); struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) diff --git a/drivers/gpu/drm/mgag200/mgag200_g200eh3.c b/drivers/gpu/drm/mgag200/mgag200_g200eh3.c index 649559be1482..4b69206296ee 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200eh3.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200eh3.c @@ -11,7 +11,7 @@ */ static const struct mgag200_device_info mgag200_g200eh3_device_info = - MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false); + MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false, false); struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev, const struct drm_driver *drv, diff --git a/drivers/gpu/drm/mgag200/mgag200_g200er.c b/drivers/gpu/drm/mgag200/mgag200_g200er.c index e661fad2f8b2..7e44fcc7bb59 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200er.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200er.c @@ -11,7 +11,7 @@ */ static const struct mgag200_device_info mgag200_g200er_device_info = - MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false); + MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false, false); struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) diff --git a/drivers/gpu/drm/mgag200/mgag200_g200ev.c b/drivers/gpu/drm/mgag200/mgag200_g200ev.c index 07a3862d69de..87a9497ab805 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200ev.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200ev.c @@ -11,7 +11,7 @@ */ static const struct mgag200_device_info mgag200_g200ev_device_info = - MGAG200_DEVICE_INFO_INIT(2048, 2048, 32700, false); + MGAG200_DEVICE_INFO_INIT(2048, 2048, 32700, false, false); struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) diff --git a/drivers/gpu/drm/mgag200/mgag200_g200ew3.c b/drivers/gpu/drm/mgag200/mgag200_g200ew3.c index 7f3987435085..61f944319bc9 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200ew3.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200ew3.c @@ -11,7 +11,7 @@ */ static const struct mgag200_device_info mgag200_g200ew3_device_info = - MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false); + MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, true, false); static resource_size_t mgag200_g200ew3_device_probe_vram(struct mga_device *mdev) { diff --git a/drivers/gpu/drm/mgag200/mgag200_g200se.c b/drivers/gpu/drm/mgag200/mgag200_g200se.c index 78120470b7be..0ccec9358529 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200se.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200se.c @@ -33,22 +33,22 @@ static int mgag200_g200se_init_pci_options(struct pci_dev *pdev) */ static const struct mgag200_device_info mgag200_g200se_a_01_device_info = - MGAG200_DEVICE_INFO_INIT(1600, 1200, 24400, true); + MGAG200_DEVICE_INFO_INIT(1600, 1200, 24400, false, true); static const struct mgag200_device_info mgag200_g200se_a_02_device_info = - MGAG200_DEVICE_INFO_INIT(1920, 1200, 30100, true); + MGAG200_DEVICE_INFO_INIT(1920, 1200, 30100, false, true); static const struct mgag200_device_info mgag200_g200se_a_03_device_info = - MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false); + MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false, false); static const struct mgag200_device_info mgag200_g200se_b_01_device_info = - MGAG200_DEVICE_INFO_INIT(1600, 1200, 24400, false); + MGAG200_DEVICE_INFO_INIT(1600, 1200, 24400, false, false); static const struct mgag200_device_info mgag200_g200se_b_02_device_info = - MGAG200_DEVICE_INFO_INIT(1920, 1200, 30100, false); + MGAG200_DEVICE_INFO_INIT(1920, 1200, 30100, false, false); static const struct mgag200_device_info mgag200_g200se_b_03_device_info = - MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false); + MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false, false); static int mgag200_g200se_init_unique_rev_id(struct mgag200_g200se_device *g200se) { diff --git a/drivers/gpu/drm/mgag200/mgag200_g200wb.c b/drivers/gpu/drm/mgag200/mgag200_g200wb.c index 0943ad2a9999..97002c08da41 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200wb.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200wb.c @@ -11,7 +11,7 @@ */ static const struct mgag200_device_info mgag200_g200wb_device_info = - MGAG200_DEVICE_INFO_INIT(1280, 1024, 31877, false); + MGAG200_DEVICE_INFO_INIT(1280, 1024, 31877, true, false); struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index aa85558faa1b..e339f50d6bc8 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -377,6 +377,7 @@ static void mgag200_init_regs(struct mga_device *mdev) static void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mode *mode) { + const struct mgag200_device_info *info = mdev->info; unsigned int hdisplay, hsyncstart, hsyncend, htotal; unsigned int vdisplay, vsyncstart, vsyncend, vtotal; u8 misc, crtcext1, crtcext2, crtcext5; @@ -411,9 +412,9 @@ static void mgag200_set_mode_regs(struct mga_device *mdev, ((hdisplay & 0x100) >> 7) | ((hsyncstart & 0x100) >> 6) | (htotal & 0x40); - if (mdev->type == G200_WB || mdev->type == G200_EW3) - crtcext1 |= BIT(7) | /* vrsten */ - BIT(3); /* hrsten */ + if (info->has_vidrst) + crtcext1 |= MGAREG_CRTCEXT1_VRSTEN | + MGAREG_CRTCEXT1_HRSTEN; crtcext2 = ((vtotal & 0xc00) >> 10) | ((vdisplay & 0x400) >> 8) | diff --git a/drivers/gpu/drm/mgag200/mgag200_reg.h b/drivers/gpu/drm/mgag200/mgag200_reg.h index 60e705283fe8..99a9ab7d9119 100644 --- a/drivers/gpu/drm/mgag200/mgag200_reg.h +++ b/drivers/gpu/drm/mgag200/mgag200_reg.h @@ -252,8 +252,10 @@ #define MGAREG_CRTCEXT0_OFFSET_MASK GENMASK(5, 4) +#define MGAREG_CRTCEXT1_VRSTEN BIT(7) #define MGAREG_CRTCEXT1_VSYNCOFF BIT(5) #define MGAREG_CRTCEXT1_HSYNCOFF BIT(4) +#define MGAREG_CRTCEXT1_HRSTEN BIT(3) #define MGAREG_CRTCEXT3_MGAMODE BIT(7) -- 2.36.1