Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/mgag200: Store vidrst flag in device info

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@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220601112522.5774-10-tzimmermann@suse.de

+24 -17
+5 -1
drivers/gpu/drm/mgag200/mgag200_drv.h
··· 200 200 */ 201 201 unsigned long max_mem_bandwidth; 202 202 203 + /* HW has external source (e.g., BMC) to synchronize with */ 204 + bool has_vidrst:1; 205 + 203 206 /* 204 207 * HW does not handle 'startadd' register correctly. Always set 205 208 * it's value to 0. ··· 211 208 }; 212 209 213 210 #define MGAG200_DEVICE_INFO_INIT(_max_hdisplay, _max_vdisplay, _max_mem_bandwidth, \ 214 - _bug_no_startadd) \ 211 + _has_vidrst, _bug_no_startadd) \ 215 212 { \ 216 213 .max_hdisplay = (_max_hdisplay), \ 217 214 .max_vdisplay = (_max_vdisplay), \ 218 215 .max_mem_bandwidth = (_max_mem_bandwidth), \ 216 + .has_vidrst = (_has_vidrst), \ 219 217 .bug_no_startadd = (_bug_no_startadd), \ 220 218 } 221 219
+1 -1
drivers/gpu/drm/mgag200/mgag200_g200.c
··· 34 34 */ 35 35 36 36 static const struct mgag200_device_info mgag200_g200_device_info = 37 - MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false); 37 + MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false, false); 38 38 39 39 static void mgag200_g200_interpret_bios(struct mgag200_g200_device *g200, 40 40 const unsigned char *bios, size_t size)
+1 -1
drivers/gpu/drm/mgag200/mgag200_g200eh.c
··· 11 11 */ 12 12 13 13 static const struct mgag200_device_info mgag200_g200eh_device_info = 14 - MGAG200_DEVICE_INFO_INIT(2048, 2048, 37500, false); 14 + MGAG200_DEVICE_INFO_INIT(2048, 2048, 37500, false, false); 15 15 16 16 struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv, 17 17 enum mga_type type)
+1 -1
drivers/gpu/drm/mgag200/mgag200_g200eh3.c
··· 11 11 */ 12 12 13 13 static const struct mgag200_device_info mgag200_g200eh3_device_info = 14 - MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false); 14 + MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false, false); 15 15 16 16 struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev, 17 17 const struct drm_driver *drv,
+1 -1
drivers/gpu/drm/mgag200/mgag200_g200er.c
··· 11 11 */ 12 12 13 13 static const struct mgag200_device_info mgag200_g200er_device_info = 14 - MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false); 14 + MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false, false); 15 15 16 16 struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const struct drm_driver *drv, 17 17 enum mga_type type)
+1 -1
drivers/gpu/drm/mgag200/mgag200_g200ev.c
··· 11 11 */ 12 12 13 13 static const struct mgag200_device_info mgag200_g200ev_device_info = 14 - MGAG200_DEVICE_INFO_INIT(2048, 2048, 32700, false); 14 + MGAG200_DEVICE_INFO_INIT(2048, 2048, 32700, false, false); 15 15 16 16 struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const struct drm_driver *drv, 17 17 enum mga_type type)
+1 -1
drivers/gpu/drm/mgag200/mgag200_g200ew3.c
··· 11 11 */ 12 12 13 13 static const struct mgag200_device_info mgag200_g200ew3_device_info = 14 - MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false); 14 + MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, true, false); 15 15 16 16 static resource_size_t mgag200_g200ew3_device_probe_vram(struct mga_device *mdev) 17 17 {
+6 -6
drivers/gpu/drm/mgag200/mgag200_g200se.c
··· 33 33 */ 34 34 35 35 static const struct mgag200_device_info mgag200_g200se_a_01_device_info = 36 - MGAG200_DEVICE_INFO_INIT(1600, 1200, 24400, true); 36 + MGAG200_DEVICE_INFO_INIT(1600, 1200, 24400, false, true); 37 37 38 38 static const struct mgag200_device_info mgag200_g200se_a_02_device_info = 39 - MGAG200_DEVICE_INFO_INIT(1920, 1200, 30100, true); 39 + MGAG200_DEVICE_INFO_INIT(1920, 1200, 30100, false, true); 40 40 41 41 static const struct mgag200_device_info mgag200_g200se_a_03_device_info = 42 - MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false); 42 + MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false, false); 43 43 44 44 static const struct mgag200_device_info mgag200_g200se_b_01_device_info = 45 - MGAG200_DEVICE_INFO_INIT(1600, 1200, 24400, false); 45 + MGAG200_DEVICE_INFO_INIT(1600, 1200, 24400, false, false); 46 46 47 47 static const struct mgag200_device_info mgag200_g200se_b_02_device_info = 48 - MGAG200_DEVICE_INFO_INIT(1920, 1200, 30100, false); 48 + MGAG200_DEVICE_INFO_INIT(1920, 1200, 30100, false, false); 49 49 50 50 static const struct mgag200_device_info mgag200_g200se_b_03_device_info = 51 - MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false); 51 + MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false, false); 52 52 53 53 static int mgag200_g200se_init_unique_rev_id(struct mgag200_g200se_device *g200se) 54 54 {
+1 -1
drivers/gpu/drm/mgag200/mgag200_g200wb.c
··· 11 11 */ 12 12 13 13 static const struct mgag200_device_info mgag200_g200wb_device_info = 14 - MGAG200_DEVICE_INFO_INIT(1280, 1024, 31877, false); 14 + MGAG200_DEVICE_INFO_INIT(1280, 1024, 31877, true, false); 15 15 16 16 struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const struct drm_driver *drv, 17 17 enum mga_type type)
+4 -3
drivers/gpu/drm/mgag200/mgag200_mode.c
··· 377 377 static void mgag200_set_mode_regs(struct mga_device *mdev, 378 378 const struct drm_display_mode *mode) 379 379 { 380 + const struct mgag200_device_info *info = mdev->info; 380 381 unsigned int hdisplay, hsyncstart, hsyncend, htotal; 381 382 unsigned int vdisplay, vsyncstart, vsyncend, vtotal; 382 383 u8 misc, crtcext1, crtcext2, crtcext5; ··· 412 411 ((hdisplay & 0x100) >> 7) | 413 412 ((hsyncstart & 0x100) >> 6) | 414 413 (htotal & 0x40); 415 - if (mdev->type == G200_WB || mdev->type == G200_EW3) 416 - crtcext1 |= BIT(7) | /* vrsten */ 417 - BIT(3); /* hrsten */ 414 + if (info->has_vidrst) 415 + crtcext1 |= MGAREG_CRTCEXT1_VRSTEN | 416 + MGAREG_CRTCEXT1_HRSTEN; 418 417 419 418 crtcext2 = ((vtotal & 0xc00) >> 10) | 420 419 ((vdisplay & 0x400) >> 8) |
+2
drivers/gpu/drm/mgag200/mgag200_reg.h
··· 252 252 253 253 #define MGAREG_CRTCEXT0_OFFSET_MASK GENMASK(5, 4) 254 254 255 + #define MGAREG_CRTCEXT1_VRSTEN BIT(7) 255 256 #define MGAREG_CRTCEXT1_VSYNCOFF BIT(5) 256 257 #define MGAREG_CRTCEXT1_HSYNCOFF BIT(4) 258 + #define MGAREG_CRTCEXT1_HRSTEN BIT(3) 257 259 258 260 #define MGAREG_CRTCEXT3_MGAMODE BIT(7) 259 261