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
This commit is contained in:
Thomas Zimmermann 2022-06-01 13:25:21 +02:00
parent 98da4b99a0
commit d1e40d8e4b
11 changed files with 24 additions and 17 deletions

View File

@ -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), \
}

View File

@ -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)

View File

@ -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)

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)

View File

@ -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) |

View File

@ -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)